language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /* -------------------------
* ESTR 3106 - Assignment 1
* Name : Huzeyfe KIRAN
* Student ID : 1155104019
* Email : 1155104019@link.cuhk.edu.hk
*
* Success
* -----------------------*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <curses.h>
#include "message.h"
#include "sim... |
C | #include <stdlib.h>
#include <libgen.h>
#include "oufs_lib.h"
#include "oufs.h"
#define debug 0
#define MAX_BUFFER 1024
/**
* Compares a string directory_entry_a with the second string directory_entry_b. It is used as the function for qsort when outputting the directory entries in sorted order
*
* @param directo... |
C | /* A program to copy its input to its output, replacing each tab by \t , each
backspace by \b , and each backslash by \\ . This makes tabs and backspaces visible in an
unambiguous way */
#include<stdio.h>
#include<string.h>
#define SIZE 100
int main(void)
{
char ip[SIZE], op[SIZE], c;
/* Loop Variables */
int i ... |
C | #include <stdio.h>
int main()
{
int t0 = 0, t1 = 10;
while (t0 != t1)
{
t0 = t0 + 1;
}
t0 = t1 << 2;
printf("%d \n", t0);
return 0;
} |
C | #include <stdlib.h>
#include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <string.h>
#include "../include/radia_comm.h"
//ƶַcַstrеĸ
int get_nums_char(char *str, char c)
{
int i, num = 0;
for(i = 0; i < strlen(str); i++)
if(str[i] == c)
num++;
return num;
}
//ַָcַstrеnumγֵλãʧ-1
int get... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#define MAX_SIZE 101
#define SWAP(x, y, t) ((t) = (x), (x) = (y), (y) = (t))
void sort(int[], int); //seclect function
int main(int argc, char const* argv[])
{
int i, j, num;
int list[MAX_SIZE];
srand((unsigned int)time(NULL)); ... |
C | #include <assert.h>
#include <stdlib.h>
#include <ucontext.h>
#include "thread.h"
#include "interrupt.h"
#define READY 0
#define RUNNING 1
#define EXITED 2
#define BLOCKED 3
#define DEAD 4
/* This is the wait queue structure */
struct wait_queue
{
/* ... Fill this in Lab 3 ... */
};
/* This is the thread control... |
C | #include "test_helper.h"
Word32_t build_instr(const int type, const int op, const int rs, const int rt, const int rd, \
const int shamt, const int funct, const int imm, const int addr) {
Word32_t instr = (op << OPCODE_SHAMT);
if (R_TYPE == type) {
instr |= (rs << RS_SHAMT);
instr |= (rt << RT_SHAMT);
instr |... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include "moja.h"
//funkcja dodająca węzły
void insert_node(nodes *ptr, char i[])
{
nodes nowy;
if(*ptr != NULL)
{
if(node_by_id(*ptr,i)!=NULL)
{
printf("Węzeł o podanym id już istnieje!\n");
return;
}
}
if((nowy=(nodes)m... |
C | typedef struct
{
float freq; // Relative to Fmax.
float voltage; // Absolute value of voltage.
}
Freq_and_voltage;
// Functions.
void input_sort_print_freq_and_voltage(); // Calls all the other functions related to initialising data.
void input_freq_and_voltage(); // Inputs the data related to frequency and vo... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
char buf[40602] = { 0 };
void Calc(int n)
{
int i, j, k = 0, len = strlen(buf);
char **Arr = (char **)malloc(sizeof(char *) * ( len / n ));
for (i = 0; i < len / n; i++)
Arr[i] = (char *)malloc(sizeof(char) * n);
for (i... |
C | # Main function file for PhotoLab, modified template
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "DIPs.h"
#include "Advanced.h"
#include "FileIO.h"
#include "Constants.h"
#include "Test.h"
#include "Image.h"
/*** function declarations ***/
/* print a menu */
void PrintMenu();... |
C | #include "UART.h"
volatile uint8_t rx_buf[RX_BUF_SIZE] = {0};
volatile uint8_t rx_start;
volatile uint8_t rx_end;
volatile uint8_t rx_overflow;
void Configure_UART(){
rx_start = 0;
rx_end = 0;
DISABLE_USCIA1;
SET_UCA1_RX_TX;
SET_UCA1_UART_MODE;
SET_UCA1_PARITY_NONE;
SET_UCA1_ENDIAN;
... |
C | #include <stdio.h>
int main (){
int total,n100=0,r100=0,n50=0,r50=0,n20=0,r20=0,n10=0,r10=0,n5=0,r5=0,n2=0,r2=0,n1=0,r1=0;
scanf("%d",&total);
n100=total/100; /*503*/
r100=total%100; /*3*/
n50=r100/50; /*0*/
r50=r100%50; /*3*/
n20=r50/20; /*0*/
r20=r50%20; /*3*/
n10=r20/10; /*0*/
r10=r20%10; /*3*/
n... |
C | #include <stdio.h>
#include <stype.h>
int getch(void);
void ungetch(int);
int getint(int *pn)
{
int c,sign;
while (isspace(c=getch()));
if (!isdigit(c) && c!=EOF && c!='+' && c!='-')
{
ungetch(c);
return 0;
}
sign = (c=='-')?-1:1;
if (c=='+' || c=='-')
{
c = g... |
C | #include<stdio.h>
#include<stdlib.h>
#include"product.h"
Product* new_product(char* n, int counter, double up){
Product* pr = (Product*)calloc(1,sizeof(Product));
Pack* p = (Pack*)calloc(1,sizeof(Pack));
pr->name = n;
pr->pt = PACK;
p->counter = counter;
p->up = up;
return p;
}
d... |
C | #include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int a[5],i;
printf("\n enter 5 elements in array : \n");
for(i=0;i<5;i++)
scanf("%d",&a[i]);
printf("\n entered elements are : \n");
for(i=0;i<5;i++)
printf("\n\t%d",a[i]);
getch();
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* stockage_nouvelle_piece.c :+: :+: :+: ... |
C | /* ģ崦
Writen by Li Yunming in 2000/05/30
*/
#ifndef UTPLTDEF0001
#define UTPLTDEF0001 1
#include <stdarg.h>
#define UTPLT_NOEXISTVAR_SPACES 0
#define UTPLT_NOEXISTVAR_PRNVAR 1
#define UTPLT_NOEXISTVAR_EXIT 2
#define UTPLT_MAXVARLEN 32
#define UTPLT_ALLOCSTEP 4096 /* ÿη... |
C | #include<xinu.h>
#define MAXINT 2147483647
pid32 currentpid;
uint32 Total_ticks;
void proportionalshare(void){
uint32 t;
int32 pi;
uint32 T;
pid32 pid;
struct procent *ptold;
/*pid=currpid;*/
ptold= &proctab[currpid];
kprintf("\n I'm entering into PS Scheduler with pid=%d with priority value =%5d \n", currp... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#define MAXDATASIZE 128
#define PORT 3000
#define BACKLOG 5
int main(int argc, char** argv)
{
int sockfd, new_fd,nbytes, sin_size;
char buf[MAXDATASIZE];
struct sockaddr_in srvaddr, clientaddr;
//1.创建网络端点
... |
C |
#include <stdio.h>
#include <math.h>
int main (void){
double a, V, n;
printf ("Сколько раз производить вычисление объема правильного тетрэдра?\n");
scanf("%lf",&n);
for (int i = 0; i < n; i++){
printf ("Ребро тетраэдра a :");
scanf("%lf", &a);
V = (pow(a, 3) * sqrt(2)) / 12;
... |
C | #include<stdio.h>
int main(){
int a[3][4] = { {0,1,2,3},{4,5,6,7},{8,9,10,11}};
int(*p)[4] = a;
for(int i=0;i<4;i++)
{
printf("%d\n", *((*p+i)));
}
printf("%d\n", sizeof(*(p+1)));
return 0;
}
|
C | #include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <ctype.h>
#include <unistd.h>
#include <assert.h>
#include <math.h>
#include "lightcurves.h"
#include "util.h"
int read_instvers (char *filename, struct instvers **instverslist_r, int *ninstvers_r,
ch... |
C | #include <stdio.h>
int main(int argc, char const *argv[])
{
union u_example
{
float decval;
int pnum;
double my_value;
}U1, U2;
// U2 = 3.14f;
union u_example U3;
U3 = 3.14;
U1.my_value = 125.5;
U1.pnum = 10;
U1.decval = 100.5f;
printf("decval = %f pnum = %d my_value = %lf\n", U1.decval... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<assert.h>
#include "object.h"
/**
* int Object_int(void *self);
* void Object_destroy(void *self);
* void Object_describe(void *self);
* void *Object_move(void *self, Direction direction);
* int Object_attack(void *self, int damage);
* void *Objec... |
C | #include "Arb.h"
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[])
{
Arb a;
int limit;
if (argc != 2)
{
printf("Please input a number\n");
return 1;
}
limit = atoi(argv[1]);
if (limit < 0)
{
printf("Please input a non-negative number\n");
... |
C | #include <stdio.h>
int main()
{
int input;
long long fact = 1;
int i;
printf("Please enter the required number : ");
scanf("%d",&input);
/* Loop to calcuate the factorial for example (5! = 5 * 4 * 3 * 2 * 1) */
for(i=1;i<=input;i++)
{
fact = fact * i;
}
printf("\nfactoria... |
C | /* QuadCubo */
#include <stdio.h>
int main (void) {
int n,i;
i = 1;
scanf("%d", &n);
while (n--) {
printf("%d %d %d\n", i,i*i,i*i*i);
i++;
}
return 0;
}
|
C | /*
PROGRAM COLOR
written by dan moore in June 1995
*/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <graph.h>
#include <string.h>
#define RGB( rd, g, b) (0x3F3F3FL & ( (long) (b) << 16 | (g) << 8 | (rd) ) )
int huge pix[580][406]; /* screen pixels */
FILE *fopen(); ... |
C | #include <stdio.h>
#include <stdlib.h>
#define SIZE 4
struct student_type
{
char name[10];
int num;
int age;
char addr[15];
}stud[SIZE]; /*定义结构*/
void save( ){
FILE *fp;
int i;
if ((fp=fopen("stu-list","wb"))==NULL){
printf("cannot open file\n");
return;}
for(i=0; i<SIZE; i++)/*二进制写*/
if(fwrite(&stud[i]... |
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>
int main()
{
int primero, segundo, tercero, cuarto, quinto, temporal;
int bandera = 0;
printf("Ingresar 5 nmeros enteros positivos.\n");
printf("Ingresar primer entero positivo:\t");
scanf("%d", &primero);
printf("Ingresar segundo entero positivo:\t");
scanf("%d", &segund... |
C | #include "utils.h"
#include "affichage_graphique.h"
#include "affichageconsole.h"
#include "case.h"
#include "deplacement.h"
#include "initialisation.h"
#include "simulation.h"
// Fonctions pour demander le nombre de tour à faire/ajouter et le type d' affichage
int add_simulation();
/*fonction demandant à l' utilisate... |
C | /*File : halo.c*/
/*Penulis : Andi Irham (andi.irhamm@gmail.com)*/
/*Program menuliskan "Halo Dunia!" dan "end-of-line" (ganti baris)*/
#include<stdio.h>
int main(void){
/*badan program*/
printf("Hello World!\n");
printf("Hello World!\n");
printf("Hello World!\n\n");
printf("Saya menuliskan progra... |
C | /* trackTable.c was originally generated by the autoSql program, which also
* generated trackTable.h and trackTable.sql. This module links the database and
* the RAM representation of objects. */
/* Copyright (C) 2014 The Regents of the University of California
* See README in this or parent directory for licens... |
C | /***********************************************************
Copyright (C), 2005, Chen Chao
File name: netop.c
Author: Chen Chao Version: 1.0 Date: 2005.10
Description: bcsnifferʵļ
Others:
History:
1. Date:06-02-13
Author:cc
Modification:
(1)analAboveProtoʡprotocol->p_proto(int),ΪΪûЭı;
ʡprot... |
C | // 16426 福澤大地
#include <math.h>
#include <GL/glut.h>
#include <GL/glpng.h>
#include "ball.h"
#include "vector.h"
// 角度を変換
#define radian(deg) (rad * M_PI / 180.0)
#define degree(rad) (rad * 180.0 / M_PI)
// ball構造体を初期化
void initBall(struct ball *ball, int num, struct vector p, double r) {
ball->num = num;
... |
C | #include <stdio.h>
int main(){
int i;
printf("%8s %8s %8s\n", "^1", "^2", "^3");
for (i=1; i<6; i++)
printf("%8d %8d %8d\n", i, i*i, i*i*i);
return 0;
}
|
C | #ifndef ARVORE_BIN_H_INCLUDED
#define ARVORE_BIN_H_INCLUDED
/*
* Cria a estrutura de dado no
*/
typedef struct node{
char frequecia;
char caracter;
//struct node *p;
struct node *left,*right;
}node;
/*
* Inicializa e cria um nó, considerando os parâmetros da estrutura.
* Retorna:
*... |
C | /* Contando en la arena */
#include <stdio.h>
int main() {
long numero;
while(1) {
scanf("%ld\n", &numero);
if(numero == 0) {
break;
}
for( ; numero > 0; numero--) {
printf("1");
}
printf("\n");
}
return 0;
} |
C | // 6. Crie um programa que calcule e imprima o valor do fatorial de um
// número informado pelo usuário, usando recursividade
//REALIZADO POR GABRIEL PINHEIRO CAMPOS , UNINOVE SANTO AMARO, 03/A NOTURNO: RA 2220102380.
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
int recursiveFactor(int);
int main()
{
... |
C | #ifndef MONEY_H
#define MONEY_H
#define MONEY_FILE "/system/money"
/* coin types */
#define ORB 1
#define GOLD_HUNDRED 2
#define GOLD_CROWN 3
#define SILVER_TREE 4
#define SILVER_ROYAL 5
#define BRONZE_COPPER 6
#define COPPER_HALF 7
#define COPPER_BIT 8
#define COIN_NAMES \
({ ... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "get_name.h"
#include "print_str.h"
int main(){
char hello[90] = "Hello, ";
char* result;
result = get_name();
print_str(strncat(hello, result, 80));
free(result);
return 0;
}
|
C | #include <vcc.h>
#ifndef VERIFY
#include <stdio.h>
#endif
#define is_bounded(A, N) \
(\forall unsigned _j; _j < (N) ==> (A)[_j] < (N))
#define is_inverse(A, inverse, N) \
(\forall unsigned _j; _j < (N) ==> (A)[(inverse)[_j]] == _j)
#define is_injective(A, N) \
(\forall unsigned _j1, _j2; _j1 < (N) && _j2 < (N)... |
C | #include "raceui.h"
#include "statemachine.h"
TextLayer *dashboardClock = NULL;
static ResHandle dashboardFontHandle;
GFont dashboardFont;
static char dashClockBuffer[10] = "??:??";
void make_dashboard_clock(Window *window) {
if(dashboardClock == NULL) {
dashboardFontHandle = resource_get_handle(RESOURCE... |
C | #include <stdlib.h>
#include <math.h>
#include "PriorityQueue.h"
struct priority_queue_t {
// Stores the entries.
const void** heap;
// Stores the priorities associated to the elements in heap.
double* priorities;
// Current number of entries.
size_t length;
// Maximum size. Defined by ... |
C | // 2013013017 윤신웅
// cachesim.c
#include <sys/time.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#define MAX 100
#define SIZE 67108864 //64MB
// memory, cache
int* memory;
int** cache;
int L1_size, L1_line_size, set; // cache setting value
double clock_rate, cycle_sec; /... |
C | #include<stdio.h>
#define cube(x) x*x*x
#error i luv u
void main()
{
int n;
scanf("%d",&n);
printf("Cube=%d",cube(n));
#undef cube
#ifdef cube
printf("\n cube is defined");
#else
printf("\n cube is not defined");
#define cube(x) x*x*x
#endif
printf("Cube=%d",cube(n));
#undef cube
#ifnde... |
C | #include <stdio.h>
#include <stdbool.h>
void implication(bool a, bool b) {
printf("%s\n", !(a && !b) ? "true" : "false");
}
int main(int argc, char * argv[]) {
bool x;
bool y;
x = true;
y = true;
implication(x, y);
x = true;
y = false;
implication(x, y);
x = false;
y = true... |
C | #include "pokedex.h"
#include <stdio.h>
#include <string.h>
#include "testing.c"
#define EXITO 0
#define ERROR -1
#define CAPTURADISIMO 'S'
#define AVISTAR_FORMAT "%i;%[^;];%[^;];%[^;];%i;%c\r\n"
#define EVOLUCIONAR_FORMAT "%i;%[^;];%i;%[^;];%[^\n]\r\n"
/*Funciones creadas por mi*/
int imprimir_especie(especie_pokem... |
C | // 4. Napisz funkcję, która po wczytaniu liczby całkowitej wypisze jej cyfry
// zaczynając od ostatniej i kończąc na pierwszej.
// Na przykład po wczytaniu liczby '1410' funkcja powinna wypisać '0141'.
#include <stdio.h>
#include <stdlib.h>
int main (){
}
|
C | #include<stdio.h>
int main (void)
{
char name [40];
printf("Enter a name: ");
scanf("%s",name);
printf(" %s %s\n",name, " Srivastava");
return 0;
} |
C | #include<stdio.h>
int main()
{
//按位于
int a = 3;
int b = 5;
int c = a^b;
printf("%d\n",c);
//按位或
return 0;
} |
C | #include <stdio.h>
#include <string.h>
int main(void)
{
char str[100];
int i,len;
char ch;
len=strlen(len);
for(i=0;i<len;i++)
str[i]=str[len-1-i];
str[i]='\0';
printf("%s\n",str);
return 0;
}
|
C | #include <stdio.h>
#include <stdbool.h>
#include <pthread.h>
int main(){
//C counts for equal values, D counts for not equal values.
int b,c,d,q = 0;
//test value to go through array right and left;
int right[]={1,2,3,4,5};
int left[]={1,2,2,4,5};
//storage arrays to keep the element seperate
//test Bool fo... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <string.h>
union semun {
int val;
struct seid_ds *buf;
unsigned short *array;
struct seminfo *__buf;
};
int main(int argc, char *argv[]) {
int semid;
int key = ftok("makefile", 22);
int sc;
... |
C | #include"comm.h"
int main()
{
printf("test_sem\n");
int semid = creatSem(1);
if(semid < 0)
{
return -1;
}
int ret = initSem(semid,0);
if(ret < 0)
{
return -2;
}
P(semid,0);
sleep(15);
printf("nihao \n");
exit(1);
printf("DEBUG:exit\n");
V(semid,0);
sleep(5);
destorySem(semid);
return 0;
}
... |
C |
#include <stdio.h>
#include <stdlib.h>
#define STACK_MAX_SIZE 5
#define STACK_OVERFLOW -100
#define ERROR_STACK_OVERFLOW printf("Error. Stack overflow\n");
#define STACK_UNDERFLOW -101
#define ERROR_STACK_UNDERFLOW printf("Error. Stack underflow\n");
#define OUT_OF_MEMORY -102
#define STACK_WAS_CLEARED printf("St... |
C |
#include <stdio.h>
int main ()
{
/* ֲ */
int a = 100;
int b = 200;
/* 鲼 */
if( a == 100 )
{
/* Ϊ棬 */
if( b == 200 )
{
/* Ϊ棬 */
printf("a ֵ 100 b ֵ 200\n" );
}
}
printf("a ȷֵ %d\n", a );
printf("b ȷֵ %d\n", b );
return 0;
}
|
C | /*
* 7. Here’s a partial program using a variadic function:
*
* #include <stdio.h>
* #include <stdlib.h>
* #include <stdarg.h>
* void show_array(const double ar[], int n);
* double * new_d_array(int n, ...);
*
* int main()
* {
* double * p1;
* double * p2;
*
* p1 = new_... |
C | #include<stdio.h>
main()
{
unsigned long long int n;
printf("Enter no:\t");
scanf("%d",&n);
digit(n);
//printf("%d",n);
}
digit(int n)
{
int i,j,s;
if(n<10)
return word(n);
else
{
//printf("%d",n%10);
digit(n/10);
return word(n%10);
}
}
word(int n)
{
switch(n)
{
case... |
C | #include "stdio.h"
#include "stdlib.h"
int main(){
FILE *fptr;
int x = 20; char c = '&';
char cstr[] = "Hello friend";
float flt = 2.75;
fptr = fopen("output.dat", "w");
if(fptr == NULL){
printf("File error.\n");
exit(1);
}
fprintf(fptr, "x = %d\tc = %c\n", x, c);
... |
C | #include <stdio.h>
int f_add(int a, int b);
int double_n(int n);
int result;
int main() {
int x, y[20], i;
x = f_add(4,2);
y[10] = x;
result = double_n(x);
for (i=0; i < 6; i+=1) {
x = i;
}
result += y[x+5];
return result;
}
int f_add(int a, int b) {
return a+b;
}
int double_n(int n) {
return n*n;
} |
C | #include <stdio.h>
#include <string.h>
int main()
{
char str[50] = "Mr John Smith ";
printf("before => %s\n", str);
replace(str);
printf("after => %s\n", str);
return 0;
}
int replace(char * str)
{
int size1 = strlen(str);
int extra = 0 , i = 0;
while(i < size1){
if( str[i++] == ' ' ){
extra += 2;
... |
C | #include <stdlib.h>
#include <assert.h>
#include "arraylist.h"
ArrayList *arraylist_create() {
/* Allocate Memory */
ArrayList *list = malloc(sizeof(ArrayList));
assert(list != NULL);
list->size = 0;
list->data = calloc(2, sizeof(void *));
assert(list->data != NULL);
list->data[0] = NULL;
... |
C | for (int i = 0; i < N; i++) {
x[i] += dt * vx[i];
if (x[i] >= 1.0f || x[i] <= -1.0f) vx[i] *= -1.0f;
}
for (int i = 0; i < N; i++) {
y[i] += dt * vy[i];
if (y[i] >= 1.0f || y[i] <= -1.0f) vy[i] *= -1.0f;
}
for (int i = 0; i < N; i++) {
z[i] += dt * vz[i];
if (z[i] >= 1.0f || z[i] <= -1.0f) vz[i] *= -1.0f;... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <getopt.h>
#include <unistd.h>
#include <stdbool.h>
#include <libgen.h>
#include "type_definitions.h"
#include "read_write_csv.h"
#include "calculations.h"
#include "fitting_functions.h"
#include "fit_assessment.h"
#include "printer.... |
C | #include <stdio.h>
int main()
{
int n;
do
{
scanf("%d",&n);
if(n==42)
break;
else
printf("%d\n",n);
}while(1);
return 0;
}
|
C | #include <dos.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#define SWINT 0x60
#define CR 0x0D
#define LF 0x0A
#define MAX_PACK 100
#define MAX_BUF 50
/**
PACKET format
0 ****next hop_mac(6)**** |6 *****source_mac(6)****** |12 **type(2)** |14 ***dest_ip(2)*** |16 *... |
C | #include <stdio.h>
main()
{
int i, num;
printf ("bang cuu chuong: ");
scanf ("%d", &num);
for (i = 1; i <= num+1; i++ )
printf ("%d x %d = %d\n", num , i, num*i);
}
|
C | #include <stdlib.h>
#include <strings.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <netinet/in.h>
#include <netdb.h>
#include <unistd.h>
#include <signal.h>
#define MAX_BUF 1024
int bb=1;
int aa=1;
int sockfd;
int a, b, c, d, e;
vo... |
C | #include "holberton.h"
/**
* case97 - prints the Error 97
*/
void case97(void)
{
dprintf(STDERR_FILENO, "Usage: cp file_from file_to\n");
exit(97);
}
/**
* case98 - prints the Error 98
*@file: takes the first argument
*/
void case98(char *file)
{
dprintf(STDERR_FILENO, "Error: Can't read from file %s\n", file);
exi... |
C | //
// OS Windows
// 2019.10.01
//
// [Algorithm Problem Solving]
//
// BAEKJOON #1436 ȭ
//
#include <stdio.h>
int sep(int n)
{
register int cnt = 0;
while (n)
{
if (n % 10 == 6) cnt++;
else cnt = 0;
if (cnt == 3) return 1;
n /= 10;
}
return 0;
}
int simul(int t)
{
register int cnt = 1, i = 666;
while (... |
C |
#ifndef _CITY_h
#define _CITY_h
#include "env.h"
#include "Stack.h"
typedef struct City* pCity;
typedef struct Branch* pBranch;
struct Branch{
pCity city; /* Pointeur sur City */
float dist; /* Distance */
pBranch next; /* Next */
} Branch;
struct City{
char* name;
float lat; // Localisation en ... |
C | #include "SPI.h";
#define SPI_SS 10
#define SPI_MOSI 11
#define SPI_MISO 12
#define SPI_SCK 13
void setup()
{
Serial.begin(9600);
setupSPI();}
/*
* Command bytes:
* a - Reset RF
* b - delay, delayTime (ms)
* c - select chip (SS)
* d - deselect chip (SS)
* e - wait MISO low
* f - SPI transfer, transferBy... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* solution.c :+: :+: :+: ... |
C | /*
* Adapted from http://content.gpwiki.org/SDL:Tutorial:Using_SDL_net
*
* Alexandre Lopes
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "SDL_net.h"
int main(int argc, char **argv)
{
IPaddress ip; /* Server address */
TCPsocket sd; /* Socket descriptor */
int ... |
C | // Ex 3 - Quermesse
#include <stdio.h>
int sorteia(int posicao, int numIngresso){
if (posicao == numIngresso){
return numIngresso;
}
else{
return 0;
}
}
void main(){
int repeticoes, ganhador = 0, numIngresso, teste = 0, i;
while(1){
// Garante que o número de pessoas não passe 200.
do{
scanf("%d", ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "db_module.h"
#include <errno.h>
char buffer[128];
char buffer2[128];
int compare(void *left, void *right) {
return(strcmp((const char *) left, (const char *) right));
}
comparator cmp = &compare;
void print_welcome(){
puts("Welcome to");
puts... |
C | #include<stdio.h>
#include<stdlib.h>
#include<time.h>
struct node{
struct tm date;
int priority;
char task[100];
struct node *next;
int status; // 1 if completed, 0 if not
};
void insert(struct node**);
void task_completed(struct node**);
void display(struct node*);
void delete_task(struct node**)... |
C | #ifndef __FIBER_H__
#define __FIBER_H__
#if defined (__cplusplus)
extern "C" {
#endif
#include <ucontext.h>
#define STACK_SIZE (128 * 1024)
typedef enum {
NEW,
SUSPENDED,
RUNNING,
TERMINATED
} fiber_state;
typedef void (*fiber_func)(void *arg);
typedef struct fiber fiber;
typedef struct scheduler ... |
C | #include "headers.h"
int signalFlag1 = 0;
void signalHandler1(int sig)
{
signalFlag1 = 1;
return;
}
void shell_clock(char** command)
{
int i,j = 1;
int tflag = 0; // for interval
int nflag = 0; // for duration
signalFlag1 = 0;
// flag == 1 -> argument for number of seconds... |
C | #include "binary_trees.h"
/**
* binary_tree_rotate_right - rotate to the right
* @tree: is a pointer to the root node of the tree to traverse
* Return: void
*/
binary_tree_t *binary_tree_rotate_right(binary_tree_t *tree)
{
binary_tree_t *new;
if (tree == NULL)
return (NULL);
new = tree;
tree = tree->left;
if (tree->ri... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int p, i, j, k;
scanf("%d", &p);
for (i=1; i<=p-2; i++)
for (j=1; j<=p-i-1; j++)
{
k = p-i-j;
if (i+j > k && i+k > j && j+k >i)
printf("%d %d %d\n", i, j, k);
}
return 0;
... |
C | #include<stdio.h>
/*
Recursion is the process which comes into existence when a function calls a copy of itself
to work on a smaller problem. Any function which calls itself is called recursive function,
and such function calls are called recursive calls. Recursion involves several numbers of recursive calls.
However... |
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 | // Copyright 2021 Dumistracel Eduard-Costin
#include "all.h"
void print_shw(dll *list_planet, char *index) {
if (list_planet->size == 0) {
printf("Planet out of bounds!\n");
return;
}
unsigned count = atoi(index);
if (count > list_planet->size - 1) {
printf("Planet out of bounds... |
C | #define ANIO_ACTUAL 2018
typedef struct
{
int dia;
int mes;
int anio;
}eFecha;
/** \brief Solicita una fecha al usuario y la devuelve.
*
* \param void
* \return eFecha
*
*/
eFecha pedir_eFecha(void);
/** \brief Muestra la fecha.
*
* \param fecha eFecha Es la fecha a mostrar.
* \return void
*
*/... |
C | #include<stdio.h>
int main()
{
int A[1000000000];
int i,N,last_digit;
scanf("%d",&N);
for(i=0;i<N;i++)
{
scanf("\n%d",&A[i]);
}
last_digit=A[N-1]%10;
if(last_digit==0)
printf("\nYES");
else
printf("\nNo");
return 0;
}
|
C | /*
* Wrapper functions for our own library functions.
* Most are included in the source file for the function itself.
*/
#include "unp.h"
#include <math.h>
const char* Inet_ntop(int family, const void *addrptr, char *strptr, size_t len)
{
const char *ptr;
if (strptr == NULL) /* check for old code */
{
err_q... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "sys/wait.h"
int main(int argc, char* argv[]) {
pid_t child;
child = fork(); //create A and B, B is child of A
if (child == -1) {
perror("Error");
exit(1);
}
else if (child == 0) { //inside B process
pid_t ... |
C | // sum3str.c: sum 3 hardcoded strings
#include <stdio.h>
#include <stdlib.h>
int main() {
char *r = "1";
char *s = "23";
char *t = "456";
int i, j, k;
if ((sscanf(r, "%d", &i) == 1) &&
(sscanf(s, "%d", &j) == 1) &&
(sscanf(t, "%d", &k) == 1)) {
printf("%d\n", i+j+k);
}
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>
struct TreeNode {
int val;
struct TreeNode *left;
struct TreeNode *right;
};
long lastVal = LONG_MIN;
bool isValidBST(struct TreeNode * root) {
if (!root) return true;
if (!isValidBST(root->left)) return false;
i... |
C | #include <stdio.h>
void main()
{
int a,n,d,sn;
scanf("%d%d%d",&n,&a,&d);
sn=(n*(2*a+(n-1)*d))/2;
printf("sum is %d",sn);
getch();
}
|
C | /*
** my_strlen.c for 42sh in /home/arrazo_p/semestre2/SystemeUnix/PSU_2014_minishell2/sources
**
** Made by arrazolaleon pedroantonio
** Login <arrazo_p@epitech.net>
**
** Started on Thu Feb 12 18:39:37 2015 arrazolaleon pedroantonio
** Last update Sun May 24 14:53:18 2015 Vatinelle Maxime
*/
#include "../42sh.h... |
C | /* FILE DESCROPTION
*
* FILE NAME : d3tcol.c
* ROUTINE : o
* REVISION :
* REMARKS : 88.01.09 s.aizawa
*/
#include <stdio.h>
#include "la_ws/include/d3libc.h"
extern struct dsm *d3gcmp();
static char sccsid[]="@(#)d3tcol.c 1.3 88/06/12 14:56:47";
/* FUNCTION DESCRIPTION
*
* FUNC.N... |
C | /**
* @file threadPoolHandler.h
* @brief Contiene funzioni per creare o distruggere thread e per definire la struttura del pool
*
\author Michele Morisco 505252
Si dichiara che il contenuto di questo file e' in ogni sua parte opera
originale dell'autore
*/
#ifndef THREADPOOLHANDLER_H_
#... |
C | #include<linux/kernel.h>
#include<linux/version.h>
#include<linux/module.h>
#include<linux/fs.h>
#include<linux/cdev.h>
#define DEVICE "alloc_naresh"
static dev_t dev_alloc;
static struct cdev* cdev_naresh;
static int major=0;
static int count=1;
static int inuse=0;
// ssize_t read (struct file * file, char __use... |
C | #include<stdio.h>
int main()
{
int a[10][10],transpose[10][10],r,c,i,j;
printf("Enter rows and columns of the matrix:");
scanf("%d %d",&r,&c);
printf("\n Enter elements of the matrix:\n");
for(i=0;i<r;i++)
for(j=0;j<c;j++)
{
scanf("%d",&a[i][j]);
}
for(i=0;i<r;i++)
for(j=0;j<c;j++)
{
transpose[j][i]=a[i][j];
}
printf... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.