language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /* Capstone Disassembler Engine */
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
#include <stdio.h>
#include <capstone/platform.h>
#include <capstone/capstone.h>
struct platform {
cs_arch arch;
cs_mode mode;
unsigned char* code;
size_t size;
const char* comment;
};
static csh handle;
static void pri... |
C | /* ************************************************************************** */
/* */
/* :::::::: */
/* ft_flag_precision.c :+: :+: ... |
C | //double log10(double x) 返回log10x的值
#include<stdio.h>
#include<math.h>
int main()
{
int t;
scanf("%d",&t);
while(t--){
double sum;
int i,n;
sum=0;
scanf("%d",&n);
... |
C | #include <stdlib.h>
#include <assert.h>
#include <stdio.h>
#include "linkedlist.h"
int main(int argc, char **argv)
{
ll_t list = makeList();
assert(list.head == NULL);
int val = 7;
push(&list, &val);
assert(*(int *)list.head->data == 7);
assert(list.head->next == NULL);
assert(*(int *)pop(&list) == 7);
asse... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* syntax_utils.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
struct Array
{
// int pointer for the Array of integer type
// int *A;
int A[20];
int size;
int length;
};
void DisplayArrayElements(struct Array arr)
{
int i;
printf("\nElements are:\n");
for(i=0; i<arr.length; i++)
{
... |
C | #include "9cc.h"
// プロトタイプ宣言
Map *new_map();
void *map_get(Map *map, char *key);
// この辺はテストコード
int expect(int line, int expected, int actual){
if(expected == actual)
return 0;
fprintf(stderr, "%d: %d expected, but got %d\n", line, expected, actual);
exit(1);
}
void test_vector(){
Vector *vec = new_vector... |
C | #include <stdio.h>
/*
16. Faça uma função chamada DesenhaLinha. Ele deve desenhar uma linha na tela usando
vários símbolos de igual (Ex: ========). A função recebe por parâmetro quantos sinais
de igual serão mostrados.
*/
int DesenhaLinha(int n);
int main(){
int n;
printf("Insira N: ");
scanf("%d", &n);
Dese... |
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | #include<stdio.h>
#include<stdlib.h>
int main()
{
long signed int n,d;
scanf("%ld",&n);
scanf("%ld",&d);
long signed int arr[n];
for(long signed int i=0;i<n;i++)
{
scanf("%ld",&arr[i]);
}
while(d>0){
int temp=arr[0];
for(int i=1;i<n;i++)
{
arr[i-1]=arr[i];
}
arr[n-1]=... |
C |
/*#include <stdio.h>
int main(void)
{
int radius = 7;
float pi = 3.14;
printf("The area of circle is %f", pi*radius*radius);
int height = 10;
printf("Volume of a cyliner is %f", pi*radius*radius*height);
return 0;
}*/
#include <stdio.h>
int main()
{
int a = 52, b, c;
printf("The value of a is %d", a);
return ... |
C | #include "libft.h"
#include <stdio.h> //////////
int main()
{
int result_flg = 1;
// for (int i = -2147483648; i < -2147483627; i++)
// for (int i = 2147483638; i < 2147483647; i++)
for (int i = -10; i < 100; i++)
{
printf("%d : %s , issame:%d\n", i, ft_itoa(i), (i == atoi(ft_itoa(i))) ? 1 : 0);
if (result_... |
C | #pragma once
#include "math.h"
#include "ImageBlockLocalization\ImageParser.h"
#define M_PI 3.14159265358979323846
//return value is reported by degree.
bool CalclateRotation(FPOINT* pArrayPoints, double& dwRotation)
{
double dw_xUL = pArrayPoints[0].x;
double dw_yUL = pArrayPoints[0].y;
double dw... |
C | #include <stdio.h>
#include <stdlib.h>
struct Node {
int val;
struct Node *back;
};
struct Node *top=NULL;
void push(int val){
struct Node* newData = (struct Node*)malloc(sizeof(struct Node));
newData->val=val;
newData->back = NULL;
if(top==NULL){
top=newData;
}else{
newData->back=top;
top=new... |
C | #include<stdio.h>
#include<conio.h>
#include<math.h>
int stack[20],top=-1;
void push(int x)
{
stack[++top]=x;
}
int pop()
{
return(stack[top--]);
}
void main()
{
char s[20];
int x,i,y;
clrscr();
printf("\n evelation of post fix exp\n");
printf("\n enter a postfix expression");
gets(s);
for(i=0;i<strlen(s);i++... |
C | #include "blocodememoria.h"
#include "endereco.h"
#include <time.h>
blocoMemoria **criaMemoriaRAM(){
blocoMemoria **bloco = malloc(tamanhoRam * sizeof(blocoMemoria));
for (int i = 0; i < tamanhoRam; i++){
bloco[i] = criablocoMemoriaRAM();
bloco[i]->end = criaEndereco(i, 0);
}
r... |
C | /**
* \file login_server.c
* \fn int login(void)
* \brief Función de logueo al servidor
* \author Pose, Fernando Ezequiel. (Fernandoepose@gmail.com)
* \date 2015.05.06
* \return Retorna el socket si se conecto o errores.
* \version 1.1.1
*/
//--------------
//-- Includes --
//--------------
#include "servidor.h"
i... |
C | /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/common/byte_buf.h>
#include <aws/common/byte_order.h>
#include <aws/common/common.h>
#include <string.h>
/**
* Stub for aws_byte_buf_write.
* Has the same behaviour as the actual funct... |
C | /* -----------------------------------------------------------------------
* Demonstration of how to write unit tests for dominion-base
* Include the following lines in your makefile:
*
* testUpdateCoins: testUpdateCoins.c dominion.o rngs.o
* gcc -o testUpdateCoins -g testUpdateCoins.c dominion.o rngs.o $(CF... |
C | /*
* @lc app=leetcode.cn id=9 lang=c
*
* [9] 回文数
*/
#include <stdlib.h>
// @lc code=start
#define TURE 1
#define FALSE 0
/*
step1: 转换为字符串;
step2: 将字符从左到右倒转;
step3: 对比倒转后是否相等;
*/
bool isPalindrome(int x){
char str[64] = {0};
int i = 0;
int numOfchar = 0;
if(x < 0){
retu... |
C | #include"header.h"
int main(void)
{
char *ptr = NULL;
int choice;
int num;
int res1;
unsigned int snum;
unsigned int dnum;
int src_pos;
int des_pos;
int pos;
int no_of_bit;
if(NULL == (ptr = (char*)malloc(sizeof(char)))){
perror("buffer is full");
exit(EXIT_FAILURE);
}
while(1){
print... |
C | // Napiste prog., kt. nacita cele cislo n predstavujuce pocet vstupov. potom zo vstupu
// nacita n riadkov, kazdy obsahujuci dvojicu realnych cisiel (hodinovu mzdu a pocet hodin)
// Pre kazdu z n dvojic program vypise mzdu a nakoniec spolocnu sumu
#include <stdio.h>
double mzda (double h_mzda, double hod);
int main ... |
C | //
// Created by Niclas Ragnar on 2016-05-18.
//
#ifndef LOGIC_LOGIC_H
#define LOGIC_LOGIC_H
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
bool is_first_trick(bool played[]); // Check if it is first trick of round.
bool start_trick(char* table[], int player_pos); // Check player pos for EE on "empty"(E... |
C | #ifndef HEADER_H_ /* This is called an include guard. */
#define HEADER_H_
int h(int x); /* An int is 4 bytes! */
#endif // HEADER_H_
/*
This conditional statement will stop the compiler from processing its contents twice.
If the header is included twice, the preprocessor will skip over the content of the fi... |
C | #include<stdio.h>
int main(){
int Clave;
int Cont=0;
while(Clave!=23645){
printf("INGRESE LA CLAVE DE 5 DIGITOS\n\n");
scanf("%d", &Clave);
Cont++;
if(Clave!=23645){
printf("\t\t\t CLAVE INCORRECTA\n\n");
}else{
printf("\t\t\t CLAVE CORRECTA!!!!");
... |
C | #include<stdio.h>
void main()
{
int a;
printf("Enter the number");
scanf("%d",&a);
printf("\nNear even number::%d",a-1);
}
|
C | #include<stdio.h>
#include<conio.h>
void main()
{
int n,i;
printf("enter an integer number");
scanf("%d",&n);
for(i=1;i<n;i++)
{printf("%d\t",i);
}
}
|
C | #include<stdio.h>
main() {
int a[2][4] = {1,0,3,-1,2,1,0,2};
int b[4][3] = {4,1,0,-1,1,3,2,0,1,1,3,4};
int c[2][3] = {0};
for (int i = 0;i < 2;i++) {
for (int j = 0;j < 3;j++) {
for (int k = 0;k < 4;k++) {
c[i][j] += a[i][k] * b[k][j];
}
}
}
for (int i = 0;i < 2;i++) {
for (int j = 0;... |
C | /*#include <stdio.h>
#include <stdlib.h>
int MyDijsktra(int** TheArray,int** TheShadow,int Col,int nbline,int nbcol)
{
int Max=10000;
int i,startLine;
if(Col=nbcol)
{
}
else
{
}
return 0;
}
int main()
{
int line,col,i,j;
int** TheArray;
int** TheShadow;
while(scan... |
C | #include <stdio.h>
#include <stdlib.h>
#include "Talk.h"
MessageTalkList *createMessageTalkList() {
MessageTalkList *list = malloc(sizeof(MessageTalkList));
list->first = malloc(sizeof(MessageTalkCell));
list->last = list->first;
list->first->next = NULL;
return list;
}
Talk *createTalk(int talkI... |
C | /*
* @file datastruct.h
* @brief Definitions and struct declarations pertaining to data
* structures
* @author John F.X. Galea
*/
#ifndef DATASTRUCT_H_
#define DATASTRUCT_H_
#include <stdint.h>
#include "dr_api.h"
/**
* @var destroy_value_function_t Safely destroys a value
*/
typedef void (*ub_destroy_val... |
C | '''Leia 2 variáveis, denominadas A e B e fazer a soma dessas duas variáveis, atribuindo o resultado à variável X .
Imprima X como mostrado abaixo. Imprima a linha final após o resultado, caso contrário, você receberá " Presentation Error ".
Entrada
O arquivo de entrada conterá 2 números inteiros.
Resultado
Imprima ... |
C | //ѭððڵбȽϣ
//ȻСǰںһʽ
#include <stdio.h>
//Ҫֵǿ
void bubble_sort (int arr [], int sz)
{
int i = 0;
//ȷð
for ( i = 0; i < sz-1; i++)
{
int flag = 1;//贫Ѿ
//ÿһðĸ
int j = 0;
for ( j = 0; j <sz-1-i ; j++)
{
if (arr[j]>arr[j+1])
{
int tmp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = tmp;
fla... |
C | /*
* ch14/cr8_so_many_threads.c
***************************************************************
* This program is part of the source code released for the book
* "Hands-on System Programming with Linux"
* (c) Author: Kaiwan N Billimoria
* Publisher: Packt
*
* From: Ch 14 : Multithreading Part I - The Essen... |
C | #include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#define FILENAME "bufferedio.out"
int main(int argc, char *argv[])
{
char *buffer;
FILE *fd;
int block_size, block_count;
if (argc != 3)
{
printf("usage: %s <blocksize> <blockcount>\n", argv[0]);
exit(EX... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_split_whitespace.c :+: :+: :+: ... |
C | #include "../include/xxhash.h"
#include "../include/isaac.h"
#include "../include/ilog.h"
#include "./filters.h"
#include "./bitutils.h"
#include "stdio.h"
#include "stdlib.h"
#define RANDOM_SEED1 123456789
#define RANDOM_SEED2 987654321
static const unsigned char *ISAAC_SEED = (unsigned char*)"22333322";
/**
* G... |
C | #include <pthread.h>
#include <stdio.h>
void* run_proc(void* x_void_ptr) {
printf("Hello from thread\n");
}
int main() {
printf("Creating threads\n");
pthread_t t1;
if (pthread_create(&t1, NULL, run_proc, NULL)) {
printf("Error creating the thread\n");
return 0;
}
if (pthread_join(t1, NULL)) {
printf("E... |
C | /*
Lab Test 3 A semaphore implementation of the producer consumer problem
*/
#include <pthread.h>
#include <stdio.h>
#include <semaphore.h>
#define BUFF_SIZE 10
char buffer[BUFF_SIZE];
int nextIn = 0;
int nextOut = 0;
sem_t empty_slots;
sem_t full_slots;
sem_t mutex;
// The producer function
void P... |
C | #include<stdio.h>;
void swap(int*b1,int* b2)
{
int a;
a = *b1;
*b1 = *b2;
*b2 = a;
}
int main()
{
int a1[5] = { 1,2,3,4,5 };
int a2[5] = { 5,4,3,2,1 };
for (int i = 0; i < 5; i++)
{
swap(&a1[i], &a2[i]);
}
for (int i = 0; i < 5; i++)
{
printf("%d ", a1[i]);
}
printf("\n");
for (in... |
C | /*-
* Copyright (c) 2013-2018 Hans Petter Selasky
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the... |
C | /*
* usart0.c
*
* Created on: 09/23/18
* Author: Viarus
*/
#include <avr/io.h>
#include <avr/interrupt.h>
#include <stdlib.h>
#include "usart0.h"
#include "usart1.h"
volatile char UART0_RxBuf[UART0_RX_BUF_SIZE];
volatile uint8_t UART0_RxHead;
volatile uint8_t UART0_RxTail;
volatile char UA... |
C | #include <stdio.h>
#include <stdlib.h>
#include "jnitools.h"
jobject JObjectFromPointer(JNIEnv *jenv, char *className, void *p) {
jclass jc;
jmethodID jmid;
jobject jresult;
jlong jl;
if (p == NULL) return NULL;
jc = (*jenv)->FindClass(jenv, className);
if (jc == NULL) {
printf("ERROR. Class %s not... |
C |
#include "exercicio3.h"
void *threadCitizen(void *params) {
int result = -1, error = 0;
params_t *par = (params_t *)params;
result = par->worker();
send_sync(0, par->ch, result);
receive(1, par->ch, &error);
if (error)
printf("Thread %d finalizando\n", par->ch);
else {
printf("Thread %d ativa\n"... |
C | #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
int fCountChar(const char *filename)
{
FILE *fp = fopen (filename, "r");
//File doesn't exist or something
if (fp == NULL)
{
printf("Failed opening %s\n", filename);
exit(EXIT_FAILURE);
}
char c;
int count = 0; ... |
C | /**
*
* Infomática I
* Año: 2019
* Grupo Nº: 6
* Nombres de alumnos: Albanesi, Tomas Agustin
Gonzalez Perez, Jose
Mella, Camila
Alvarez, Gerson
Magallanes, Claudio
* TP Nº1 Guia de Trabajos Practicos 2018
* Nº de e... |
C | // Soru1:
//Girilen bir tamsayının üç katını ekrana yazdıran programı yazınız.
#include <stdio.h>
int main(){
int a;
scanf("%d", &a);
a *= 3;
printf("%d\n", a);
} |
C | /*
Even or Odd
*/
#include<stdio.h>
main()
{
int number=0;
printf("enter number\n");
scanf("%d",&number);
number%2 == 0 ? printf("even\n") : printf("odd\n");
}
|
C | #include <stdio.h>
int main(){
int i, n, j, k=0;
scanf("%d", &n);
for(i=1; i<=n; i++){
if(i==(n+1)/2+1)k--;
for(j=1;j<=n;j++){
printf("%d ", k*n+j);
}
k = i<=(n+1)/2 ? k+2:k-2;
printf("\n");
if(i==(n+1)/2 && n%2)k-=2;
}
return 0;
}
|
C | #include "message_buffer.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/ipc.h>
#include <sys/shm.h>
int shmid;
void *memory_segment=NULL;
int init_buffer(MessageBuffer **buffer) {
/*---------------------------------------*/
/* TODO 1 : init buffer */
{}
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
int daysOfMonths [12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int specialFebruary(int *y) {
if (* y % 100 == 0) {if (* y % 400 == 0) return 1; else return 0;}
else if (*y % 4 == 0) {return 1;}
else {return 0;}
}
void decrement_date(i... |
C | /*
ETAPA 5 - TRABALHO DE COMPILADORES
Gabriel Zillmer e Rodrigo dal Ri
*/
#include <stdio.h>
#include <stdlib.h>
#include "tac.h"
TAC* tacCreate(int type, Hash_Node *res, Hash_Node *op1, Hash_Node *op2)
{
TAC *n = (TAC*) calloc(1, sizeof(TAC));
n->type = type;
n->res = res;
n->op1 = op1;
n->op2 = op2;
n->pre... |
C | #include<stdio.h>
#include<string.h>
int t,n,m,ans;
/***************************************************************/
//代码8-6 解决通配符问题的穷举搜索法
//返回通配符范式w与字符串s是否对应
//多传递两个变量表示字符串长度
int match(char *w,char *s,int len_w,int len_s){
//匹配w[pos]和s[pos]
int pos=0;
while(pos<len_w && pos<len_s && (w[pos]=='?'||w[pos]==s... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* export_support.c :+: :+: :+: ... |
C | /** This coder was programmed for dot-product of two vectors. **/
#include <stdio.h>
#include <stdlib.h>
/* Define length of dot product vectors */
#define VECLEN 100
int main (int argc, char* argv[])
{
int i,len=VECLEN;
double *a, *b;
double sum;
/* Assign storage for dot product vectors */
a = (dou... |
C | /*******************************************************
判断奇偶
*******************************************************/
#include<stdio.h>
int main()
{
int a;
printf("请输入要判断的数\n");
scanf("%d",&a);
if(a%2==0)
printf("%d为偶数\n",a);
else
printf("%d为奇数\n",a);
}
|
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | /**
* Projekt: Implementace interpretu imperativního jazyka IFJ14
*/
/**
* @file memoryallocation2.c
* @author Antonin Cala(xcalaa00)
* @brief soubor obsahujici funkce pro spravu pameti
*/
#include "memoryallocation2.h"
#include "bst.h"
#include <stdlib.h>
#include <stdio.h>
#include "errors.h"
#include "globalv... |
C | #include<stdio.h>
#include<stdlib.h>
struct Diagonal
{
int A[10];
int n; //size of the array
};
void set(struct Diagonal *m,int i,int j,int k)
{
if(i==j)
{
m->A[i-1]=k;
}
}
int get(struct Diagonal m, int i, int j)
{
if(i==j)
{
return m.A[i-1];
}
else
{
return 0;
}
}
void... |
C | #include<stdio.h>
void display(char , int , int );
int main(void)
{
int ch;
int rows, cols;
printf("Enter a character and two integers\n");
while((ch = getchar()) != '\n'){
scanf("%d%d",&rows,&cols);
getchar();
display(ch,rows,cols);
printf("Enter another character and t... |
C | /* program enum04.c */
main()
{
enum coin { penny,nickel,dime=4,quarter=6,half_dollar,dollar};
enum coin money;
for ( money=penny ; money<=dollar ; money++ )
printf("%3d",money);
printf("\n");
}
|
C | #include <stdio.h>
int fclose(FILE *stream)
{
int r = 0;
if (stream->_flags & _iowrite)
r = fflush(stream);
stream->_flags &= ~(_ioread | _iowrite);
return r;
}
|
C | /*
SST_File_POSIX.c
Author: Patrick Baggett <ptb1@762studios.com>
Created: 12/23/2011
Purpose:
libsst-os file I/O for POSIX platforms
License:
This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
and/or modify it under the terms o... |
C | /* findlm.c Daniel Scharstein 6/16/99 */
/* driver for landmark program
*/
static char rcsid[] = "$Id: findlm.c 6071 2015-10-16 21:58:31Z carrick $";
#include <stdio.h>
#include <math.h>
#include "image.h"
#include "landmark.h"
static char usage[] = "\n\
usage: %s [options] img.pgm\n\
\n\
search for landmark ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
/*
* p2p聊天程序客户端
* 父进程发送数据
* 子进程接收数据
* */
#define ERROR_EXIT() {\
printf("errno:%d\n",errno);\
perror("error");\
exit(EX... |
C | #include <stdio.h>
#include <time.h>
#include <math.h>
#include <stdlib.h>
int x = 1; // El caballo inica en la casilla superior
int y = 1; // izquierda
const int TAMANO = 8; // Cambiar esta variable para resolver el problema del
// recorrido del caballo en un tablero de N * N
int contador = 1; // Est... |
C | // ganchan.c
// by Find.
inherit SKILL;
string *dodge_msg = ({
"ֻ$n˫ɶٿԱһ$Nʽȫա\n",
"$nһʽơ˲ѲӰ\n",
"$n˫һţתƮ֮߳⣬$Nʽ$n˿\n",
"ֻ$nһšߣ$Nзա\n"
});
int valid_enable(string usage)
{
return (usage == "dodge") || (usage == "move");
}
int valid_learn(object me) { return 1; }
string query_dodge_msg(string limb)
{
r... |
C | #include <stdio.h>
int gcd(int,int);
int gdc(int u, int v){
if(v==0){
printf("Reached base case. Returning.\n");
return;
}
else{
printf("calling gcd: gcd(%d,%d)\n",v,(u%v));
return gcd(v,(u%v));
}
}
int main(void){
int x=0,y=0;
scanf("%d%d",&x,&y);
printf("%d\n", gcd(x,y));
return 0;
}
|
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | #include "q.h"
int main()
{
char a,*p = "hello";
struct queue *q;
q = queue_create(20);
while(*p)
{
enqueue(q,*p);
p++;
}
while(!queue_is_empty(q))
{
dequeue(q,&a);
printf("%c ",a);
}
printf("\n");
return 0;
}
|
C | #include <unistd.h>
#include <signal.h>
#define SECOND 1
void do_nothing();
void do_int();
main ()
{
int i;
unsigned sec = 1;
signal(SIGINT, do_int);
for (i = 1; i < 8; i++) {
alarm(sec);
signal(SIGALRM, do_nothing);
printf("%d varakozik, meddig?\n", i);
pause();
}
}
void do_nothing(){ ;}
void do_int()... |
C | #include <sys/types.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <string.h>
#include <netdb.h>
#include <stdio.h>
#define B_PORT 22160
void error(const char *msg)
{
perror(msg);
exit(0);
}
int main(int argc, char *argv[])
{
int sock, length, n;
sock... |
C |
#include <stdio.h>
FILE *in_fptr,
*fopen();
char matrix[16][16]; /* matrix[0][] and matrix [][0] are not used */
/* so that the subscripts will be 1-15 (to */
/* make the code simpler) */
int data_set_count, matrix_size;
/* **************... |
C |
void f1(int n,int a[100][100])
{
int i;
for(i=0;i<=n-1;i++)
{
int x=a[i][0],j;
for(j=1;j<=n-1;j++)
if(x>a[i][j]) x=a[i][j];
if(x>0)
for(j=0;j<=n-1;j++)
a[i][j]-=x;
}
for(i=0;i<=n-1;i++)
{
int x=a[0][i],j;
for(j=1;j<=n-1;j++)
if(x>a[j][i]) x=a[j][i];
if(x>0)
for(j=0;... |
C | #include<stdio.h>
typedef unsigned long long ull;
int main()
{
int t;
ull a,b,temp1,i,j,sum,sum1,sum2;
scanf("%d",&t);
while(t--)
{
sum=0;
scanf("%llu%llu",&a,&b);
j=a;
sum1=sum2=0;
while(a<b&&a%10!=0){
j=a; sum1=0;
while(j>0)
{
temp1=j%10;
if(temp1%2==0)
sum1=sum1+2*j;
else
sum1=sum1+j;
j=j/10;
}
sum=sum+(sum1%1... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "commands.h"
#include "utils.h"
static void release_argv(int argc, char*** argv);
int main()
{
char buf[8096];
int argc;
char** argv;
while (1) {
fgets(buf, 8096, stdin);
// printf("parse start\n");
mysh_parse_command(buf, &argc, &a... |
C |
/* Inclusiones */
#include <avr/io.h>
#include <stdint.h>
#include <util/delay.h>
/* Constantes y macros */
#define DDR_SERIAL_TX DDRD
#define PORT_SERIAL_TX PORTD
#define SERIAL_TX 1
#define BIT_DURATION_US 417
/* Variables globales */
/* Declaraci�n de funciones */
void Serial_Tx_Byte(char byte);
void Serial_T... |
C | /*
* Exercise 6.4
* Write a program that calculates the average of an array of 10 floating-point
* values.
*/
#include <stdio.h>
int main ()
{
/* declare a float accumlator s, initialized to 0, and an array of 10
* floats initialized to some random float numbers */
float s = 0, arr[10] = {67.39, 47.2... |
C | #include<bits/stdc++.h>
using namespace std;
int main(){
cout << "400" << endl;
for(int i = 0;i<400;i++){
cout << i << " ";
}
cout << endl;
for(int i = 0;i<400;i++){
cout << i*i << " ";
}
cout << endl;
} |
C | #include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "item.h"
Item *NewItem(const char *path)
{
if(path == NULL)
return NULL;
Item *pitem = (Item *)malloc(sizeof(Item));
if(pitem == NULL)
{
printf("[-] NewItem Fail\n");
exit(0);
}
memset(pitem, 0, sizeof(... |
C | #include <stdio.h>
#include <stdlib.h>
struct node
{
struct node *prev;
int data;
struct node *next;
};
/*Declaring global variable start node*/
struct node *start = NULL;
/** \brief : This function creates a new double linked list as per the user's input
* for number of nodes.
* \param : integer numO... |
C | //
// Header.h
// Stack
//
// Created by MacBook on 2018/9/25.
// Copyright © 2018 MacBook. All rights reserved.
//
//
// SeqStack.hpp
// blabla
//
// Created by MacBook on 2018/9/24.
// Copyright © 2018年 MacBook. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define initSiz... |
C | #include <stdio.h>
#include <stdlib.h>
int main() {
int i = 0xefffffff;
printf("%d\n", i);
char *b = (char *)&i;
printf("%d, %d\n", *b == 0x34, *(b + 1) == 0x12);
}
|
C | #include <conio.h>
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
int main ()
{
srand(time(0));
double v[1000], num, menor, maior;
int i;
do{
printf("Digite o numero desejado, entre 1 e 1000.");
scanf ("%lf", &num);
}while (num<1||num>1000);
for (i=0; i<num; i++)
{
v[i] = rand()%10;
}
menor ... |
C | /**
* Forking a process a thrice
* Result: 8 times "Hello" would be printed
* Explanation: @TODO
*/
#include <unistd.h>
#include <string.h>
int main()
{
fork();
fork();
fork();
char str[] = "Hello\n";
write(0, str, strlen(str));
return 0;
} |
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
int NumbOfBit(int i);
int main(int argc, char* argv[])
{
assert(NumbOfBit(256) == 1);
assert(NumbOfBit(-1) == 32);
assert(NumbOfBit(254) == 7);
assert(NumbOfBit(1) == 1);
assert(NumbOfBit(255) == 8);
assert(Nu... |
C | /* ESP32 Pointer exploit Example
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#include <... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <arpa/inet.h>
#include <unistd.h> //usleep
#include <signal.h>
#include <pthread.h>
#define checkError(ret) do{if(-1==ret){printf("[%d]err:%s\n", __LINE__, strerror(errno));exit(1);}}while(0)
static void *SendMsgThread(voi... |
C | int main(void) {
int x = 1;
/* if 语句前 */
if (x > 0) {
/* 为正时的处理 */
x = 1;
} else if (x < 0) {
/* 为负时的处理 */
x = -1;
} else {
/* 为零时的处理 */
x = 0;
}
/* if 语句后 */
x *= 2;
return x;
}
|
C | #include "ftsh.h"
#include "exp_arith.h"
int init_toks_clean(t_tok *d, t_tok **c)
{
int k;
k = 0;
if (!(*c = (t_tok*)malloc(sizeof(t_tok) * (get_tok_len(d) + 1))))
clean_exit(1, MALLOC_ERR);
while (k <= get_tok_len(d))
{
(*c)[k].token = 0;
(*c)[k].value = 0;
(*c)[k].varid = -2;
(*c)[k].varname = NULL;... |
C | /*
============================================================================
Name : FileOperater.c
Author :
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
r 打开 只读文件,该文件必须存在。
r+ 打开可读写的文件,该文件必须存在。
w 打开 只写文件,若文件存在则文件长度清为0,即该文件内容会消失。若文件不存在则建立该文件。
w... |
C | #include <stdio.h>
#include <stdlib.h>
void crearmatriz (int a[11][11], int ren, int col);
// int filas = (sizeof(edades)/sizeof(edades[0]));
// int columnas = (sizeof(edades[0])/sizeof(edades[0][0]));
void imprime (int a[11][11],int ren, int col);
void transpuesta (int a[11][11], int b[11][11], int ren,... |
C | /******************************************************************************
* File:
* display.c
*
* Description:
* The library is responsible for displaying objects on LCD.
*
*****************************************************************************/
/************/
/* Includes */
/***... |
C | /*
* Author: Alina Bogdanova BS18-04
* Date: 25.09.19
* Description: a program that forks a child
* process, waits for 10 seconds and then
* sends a SIGTERM signal to the child
* Child process runs an infinite loop
* and print “I’m alive” every second
*/
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wait.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <unistd.h>
enum errors {
OK,
ERR_INCORRECT_ARGS,
ERR_SOCKET,
ERR_CONNECT
};
int init_socket(const char... |
C | #include <parse.h>
json_t *parse_single_day(json_t *root) {
if (!json_is_object(root)) {
fprintf(stderr, "error: invalid root object\n");
json_decref(root);
exit(EXIT_FAILURE);
}
json_t *data = json_object_get(root, "data");
if (!json_is_array(data)) {
fprintf(stderr, "e... |
C | #include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define IN 0
#define OUT 1
#define LOW 0
#define HIGH 1
#define LED_PIN 110
#define BUF_MAX 4
#define DIRECTIO... |
C | // Skeleton for lab 2
//
// Task 1 writes periodically RGB-images to the shared memory
//
// No guarantees provided - if bugs are detected, report them in the Issue tracker of the github repository!
#include <stdio.h>
#include "altera_avalon_performance_counter.h"
#include "includes.h"
#include "altera_avalon_pio_reg... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strtol.c :+: :+: :+: ... |
C | /*
TITLE: Evaluation of Postfix Expression
NAME:Tauseef Mushtaque Ali Shaikh
CLASS: S.Y.[CO]
ROLLNO: 18CO63
SUBJECT: DS
DATE: 19/8/19
DISCRIPTION: In this Program a Postfix Expression is Evaluated and Result is Stored in a Stack.
*/
#include<stdio.h>
#include<stdlib.h>
#define max 50
struct stack
{
int ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.