language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include "function_pointers.h" /** * int_index - Print the int index * @array: Print the index of the array * @size: Store the size of array * @cmp: Function pointer compare * Return: Integer index */ int int_index(int *array, int size, int (*cmp)(int)) { int i, index; if (array != NULL &&...
C
/* * Mode_ColorBlending.c * * Created on: 04.06.2013 * Author: Jean-Martin George */ #include "Mode_ColorBlending.h" #include "Modes.h" #define LEFT_RIGHT 0 #define RIGHT_LEFT 1 static RGB_Color_t currentColor = {0, 0, 0}; static RGB_Color_t startColor = {0, 0, 0}; static RGB_Color_t endC...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include "../def.h" #include "../var.h" #define SOURCE 0 #define RESULTS 1 int is_in_image(int height,int width,int i,int j,int y,int x){ return y+i >= 0 && y+i < width && x+j >= 0 && x+j < height; } void eight_expansion(imgdata idata,int y,int x){ } void...
C
#pragma GCC optimize "-O3" #include<stdio.h> #include<stdlib.h> #include<string.h> #include<math.h> #include<assert.h> #include<stdbool.h> #include<limits.h> typedef double dbl; int main(){ int n; dbl v, x, f, t; while(scanf("%d %lf %lf %lf %lf", &n, &v, &x, &f, &t) == 5){ int m = ceil(v/x); dbl a = v / m; db...
C
#include<stdio.h> #include<math.h> int main() { int n,temp,sum=0; float mean,var,sd; printf("Enter a no : "); scanf("%d",&n); int a[n]; for(int i=0;i<n;i++) scanf("%d",&a[i]); for(int i=1;i<n-1;i++) { for(int j=0;j<n-i;j++) { if(a[j]>a[j+1]) { temp=a[j]; a[j]=a[...
C
//given an array of size n+2, with elements in the range 1 to n //find the two repeating elements //using count array //O(n) time //O(n) space #include<stdio.h> void findRepeat(int a[], int n) { int count[n-2]; int i; for(i=0;i<n-2;i++) //an auxillary to keep track of count count[i]=0; for(i=0;i<n;i++) { ...
C
#include <unistd.h> #include <stdio.h> #include <string.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <sys/stat.h> #include <fcntl.h> #include <stdlib.h> #include "head.h" int archivo_accion(char *buffer, int cliente, char *ip){ int archivo, opcion; c...
C
// implemention a memory allocate and free demo #define Allocatesize 1000 static char allocbuf[Allocatesize]; static char *allocp=allocbuf; char *alloc(int n){ if(allocbuf+Allocatesize-allocp>=n){ //fit the space limitation allocp+=n; return allocp-n; //old pointer } else return 0; } void afree(char *p){//...
C
#include <stdio.h> #include <ctype.h> int main() { int va1 = 'h'; int va2 = '2'; if (isdigit(va1)) { printf("va1 = |%c| һ\n", va1); } else { printf("va1 = |%c| һ\n", va1); } if (isdigit(va2)) { printf("va2 = |%c| һ\n", va2); } else { p...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_putullnbr.c :+: :+: :+: ...
C
#include <stdio.h> #include <string.h> int ft_strncmp(char *s1, char *s2, unsigned int n); int main(void) { printf("1 la repond : %d\n", strncmp("dsfwer", "sdfdsf", 3)); printf("1 la repond : %d\n", ft_strncmp("dsfwer", "sdfdsf", 3)); printf("2 la repond : %d\n", strncmp("dsfwer", "sdfdsf", 1)); printf("2 la re...
C
#include <ctype.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "error.h" char *FILENAME = "file.txt"; #define pprintf(format, ...) \ printf ("[PID %d] " format, getpid (), ##__VA_ARGS__) int tube[2]; enum { R, W }; void...
C
#include <string.h> #include <stdlib.h> #include <sys/stat.h> #include <stdio.h> #include <time.h> #include <stdbool.h> #define SEP '/' int count_levels(const char * path){ int i = 0, levels = 0; bool escaped = false; while(path[i] != '\0'){ if (escaped) { escaped = false; continue; } if (path[i] ==...
C
#include <stdio.h> //Compiler version gcc 6.3.0 int main() { int x, y, i, p; scanf("%d", &x); for(i = 1, p = 1; i <= x; i *= 10, p *= 2) y += p*((x/i)%10); printf("%d", y); return 0; }
C
/* Nombre Fichero: include/pila.h */ #include <stdio.h> #include <stdlib.h> #include <string.h> #define TAM_MATRICULA 10 typedef struct Aux Coche_t; struct Aux { char matricula[TAM_MATRICULA]; Coche_t *sig; }; /*Añade un nuevo nodo al principio de la lista y rellena el nodo con la clave pasada como paramet...
C
#include<stdio.h> #include<stdlib.h> #include<unistd.h> #define PATH_MAX 1024 int main(void){ char *pathname; if(chdir("/home/choiseungseo") < 0){ fprintf(stderr, "chdir error\n"); exit(1); } pathname = malloc(PATH_MAX); if(getcwd(pathname, PATH_MAX) == NULL){ fprintf(st...
C
//BinaryGap int solution (int n) { int count =0,temp = 0; int flag = 0; while(n/2 != 0) { if (n%2 == 1 && flag == 0) { flag = 1; } else if (n%2 == 1 && flag == 1 ) { if ( count > temp) temp = count; count = 0; } ...
C
/* Nome:Aula 7 - While Copyright: ESAMC - Francisco Author: Elton Date: 13/04/2020 - 20:10 Description: Exerccio 6 - Nmeros em crescente para dar 1220400 */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <conio.h> int main () { int n; //pega apenas uma va...
C
/* Example code for Exercises in C. Copyright 2019 Allen Downey License: Creative Commons Attribution-ShareAlike 3.0 */ #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct { int num, den; } Rational; /* Make a rational. */ Rational *make_rational(int num, int den) { Rational *rational...
C
#include<stdio.h> #include<stdlib.h> #include<math.h> #include "utils.h" double distToLineSegment(double px, double py, double x1, double y1, double x2, double y2) { double diffx, diffy, v1x, v1y, v2x, v2y; diffx = x2 - x1; diffy = y2 - y1; v1x = px - x1; v1y = py - y1; v2x = px - x2; v2y...
C
//#include <stdio.h> //#pragma warning(disable:4996) // //#define MAX 100 // //typedef struct node { // int data; // struct node *left; // struct node *right; // struct node *parent; //}NODE; // //int N = 0, data[MAX] = { 0 }, end = 0, print = 0; // end , print Ʈ // //NODE *queue[MAX]; //NODE *head = NULL; // //void ...
C
#define _CRT_SECURE_NO_DEPRECATE 1 #include <stdio.h> //int main() //{ // unsigned int i; // for (i = 9; i >= 0; i--) // { // printf("%u\n", i); // } // return 0; //} unsigned int i = 0; int main() { int count = 0; for (i = 0; i <= 255; i++) { printf("hello world\n"); count++; } printf("count=%d\n", count)...
C
#include <stdio.h> void mad_add(const int a[4][3], const int b[4][3], int c[2][4][3]); void mat_printf(const int m[2][4][3]); int main(void) { int tensu1[4][3] = { {91, 63, 78}, {67, 72, 46}, {89, 34, 53}, {32, 54, 34} }; int tensu2[4][3] = { {9, 6, 7}, {6, 7, 4}, {8, 3, 5}, {3, 5, 3} }; int sum[2][4][3]; mad_a...
C
#include "x_syscalls.h" #include <stdio.h> #include <errno.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/sem.h> #include <sys/shm.h> #include <sys/wait.h> // declaration void x_error(const char*); void *x_malloc(size_t); void x_chdir(const char*); pid_t x_for...
C
/* ** sort_tab.c for sort_tab in /home/leandre/TEST_FOLDER ** ** Made by Léandre Blanchard ** Login <leandre.blanchard@epitech.eu> ** ** Started on Sat Sep 16 15:36:40 2017 Léandre Blanchard ** Last update Sun Jan 7 11:07:19 2018 Léandre Blanchard */ #include <string.h> static int test_order(char **tab) { if (!t...
C
//when a function is called inside #include<stdio.h> #include<stdlib.h> struct Node{ int data; struct Node *next,*prev; }; void push(struct Node **head,int data){ struct Node *newnode=(struct Node*)malloc(sizeof(struct Node)); newnode->data=data; newnode->next=(*head); newnode->prev=NULL; if...
C
#include <stdio.h> #include <stdlib.h> int N; int temp[50]; int head=0; void findDependencies(int row, int matrix[N][N]){ for(int col = 0; col < N; col++){ if(matrix[row][col] == 1){ // printf("%d ", col); temp[head] = col; head++; matrix[row][col] = 0; findDependencies(col, matrix); } } return; }...
C
//ray.c #include <stdlib.h> #include <stdio.h> #include <math.h> #include "light.h" void makeppm(char *file, unsigned char *ppm, int wd, int ht){ /*file pointer set to the output file to write (,"w")*/ FILE *fp; fp = fopen("test1.ppm", "w"); /*print the ppm file header*/ fprintf(fp, "P6 %d %d %d\n",...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* bloc.c :+: :+: :+: ...
C
//// //// Created by macbook air on 2020-03-27. //// // //#include <stdio.h> // //typedef struct _empInfo{ // int empNum; // int age; //}EmpInfo; // //int main(void){ // // EmpInfo empInfoArr[1000]; // EmpInfo ei; // int eNum; // // printf("사번과 나이 입력 : "); // scanf("%d %d",&(ei.empNum),&(ei.age)); ...
C
#include <stdio.h> #include <stdlib.h> int isJolly(int num[], int size){ int* exist = (int*) calloc(size, sizeof(int)); int i = 1; for(; i < size; i++){ int index = abs(num[i] - num[i-1]); if(index > size-1 || exist[index]){ free(exist); return 0; } exist[index] = 1; } free(exist); r...
C
/** @file: 03-divisao.c * @author: Guilherme N. Ramos (gnramos@unb.br) * @disciplina: Algoritmos e Programação de Computadores * * Exemplos de utilização do operador de divisão. Em C, só é possível dividir * valores numéricos. */ #include <stdio.h> int main () { printf("Divisão:\n"); /* Escreva...
C
/* calculator.c * CALCULADORA POLACA * Equipo 06 * 22/07/2017 */ #include <stdio.h> #include "scanner.h" #include "stackOfDoublesModule.h" int main(void){ double op2; Token dato; Token *t; t = &dato; while ((GetNextToken(t)) != EOF) { switch (t->type) { case Number: push...
C
#include<stdio.h> main(){ int vetorX[100]; //100 primeiros naturais multiplos de 5 int vetorA[100]; //100 primeiros naturais ímpares int vetorC[30] = { 5,15,20,30,45,55,60,65,80,95,100,105,110,120,130,145,155,160,165,170,175,190,195,200,230,235,240,245,250,255}; int vetorCA[130]; int auxA = 0, aux; ...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <time.h> #include <ctype.h> #include "List.h" #include "Hashtable.h" #include "Graph.h" /*/ #define HASZNALOM_A_MALLOC_FREE_POINTERET true #include "debugmalloc/debugmalloc.h" //*/ int main() { Graph *graph = g_create(); char inp[NODE_LENG...
C
#include <stddef.h> float finduniq(const float *nums, size_t n) { if(nums[0] == nums[1] && nums[2] != nums[0]) { return nums[2]; } else if(nums[0] != nums[1] && nums[0] != nums[2]) { return nums[0]; } else if(nums[0] != nums[1] && nums[0] == nums[2]) { return nums[1]; } for(size_t i = 3;...
C
#include <stdio.h> int main(void) { int a; int b; int c; printf("Quelle est la valeur de a ?\n"); // on demande la valeur de a scanf("%i", &a); // recopie la saisie de l'utilisateur printf("Quelle est la valeur de b ?\n"); // on demande la valeur de b scanf("%i", &b); // recopie la sa...
C
// testIfAPointIsOnTheTriangle.c // Julian Saknussemm // ?/?/? // Class Name // The objective of the program is to determine whether or not a point // lies within a triangle. // This is determined by satisfying the following rule: // A point P(x,y) is inside triangle A(x0,y0), B(x1,y1), C(x2,y2) // iff // P is on the s...
C
/*- * See the file LICENSE for redistribution information. * * Copyright (c) 1996, 2013 Oracle and/or its affiliates. All rights reserved. */ #include <sys/types.h> #include <ctype.h> #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> typedef struct { char *name; ...
C
#include<stdio.h> int main() { int a,b,c,s=0; for(a=1;a<5;a++) { for(b=1;b<5;b++) if(a!=b) for(c=1;c<5;c++) if(a!=c&&b!=c) printf("%d\n",a*100+b*10+c); } }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* print.c :+: :+: :+: ...
C
#include <stdio.h> int main(){ int a,b; int i; int ans=0; scanf("%d %d",&a,&b); for(i=1;i<b-a;i++){ ans+=i; } ans-=a; printf("%d",ans); return 0; } ./Main.c: In function main: ./Main.c:8:2: warning: ignoring return value of scanf, declared with attribute warn_unused_result [-Wunu...
C
#include<stdio.h> void f_binary(int n); int main() { int n; printf("Է : "); scanf_s("%d", &n); f_binary(n); return 0; } void f_binary(int n) { if (n==0||n==1) { printf("%d", n); } else { f_binary(n / 2); printf("%d", n % 2); } }
C
#include <stdio.h> #include <sys/types.h> #include <unistd.h> void main() x { int pid=fork(); if(pid<0) printf("Process creation failed"); else if(pid==0) printf("\nChild process executing\n PID: %d\nParent PID: %d\n",getpid(),getppid()); else printf("\nParent process exe...
C
/** * Practice using #define macros to customize C language */ #include <stdio.h> #define run() main() #define print printf int run() { print("Hello World!\n"); return 0; }
C
//Common Function #include <stdio.h> #include <string.h> #include <stdlib.h> #include "../../include/common.h" #define BLUE "\x1B[34m" #define GREEN "\x1B[42m" #define RED "\x1B[41m" #define RESET "\x1B[0m" #define ZONES 4 void show_msg(int type, const char *msg) { if(type == 0) printf(RED "%s" RESET, msg)...
C
#define _CRT_SECURE_NO_WARNINGS #include "server.h" int ExceptionFilter( DWORD Code, EXCEPTION_POINTERS *ExceptionPointers ) { printf("[EXCEPTION] ExceptionCode=0x%x, EIP=0x%x, ESP=0x%x\n", Code, ExceptionPointers->ContextRecord->Eip, ExceptionPointers->ContextRecord->Esp); Log("[EXCEPTION] Except...
C
#include "holberton.h" /** * infinite_add - prints an integer as if it were a string * @n1: integer to print * @n2: char * @r: buffer * @size_r: size * Return: void */ char *infinite_add(char *n1, char *n2, char *r, int size_r) { int a, b, n = 0, k = 0; for (a = 0; n1[a] != '\0'; a++) ; for (b = 0; n2[b] !=...
C
#include <stdio.h> #include <locale.h> int main() { setlocale(LC_ALL,""); int X, Y, x, y, z, i; float A, B, C, total, Total; printf("Temos 3 tipos de produto:\nTipo A---R$10.00---Cdigo 1---desconto de 20%\nTipo B---R$20.00---Cdigo 2---desconto de 10%\nTipo C---R$30.00---Cdigo 3---sem desconto"); printf("Qual...
C
/* * ===================================================================================== * * Filename: list.c * * Description: list * * Version: 1.0 * Created: Thursday 04 July 2013 04:29:19 CST * Revision: none * Compiler: gcc * * Author: Zhang Dongsheng...
C
#include "Mapping.h" int equidistribute( const realArray & w, realArray & r ); // define F(x) 1.+(x) #define F(x) 1.+(x)+(x)*(x) int main() { Range R(0,10); realArray w(R),r(R); real h=1./(R.getBound()-R.getBase()); for( int i=R.getBase(); i<=R.getBound(); i++ ) { w(i)=F((i-R.getBase())*h); } w.d...
C
#include <stdio.h> int main_prob04_4(void) { int num; printf(" Էϼ : "); scanf("%d", &num); num = ~num + 1; printf(" : %d\n\n", num); int num2; num2 = 3 << 3; // 3Ʈ ̵, 2^3=8 num2 = num2 >> 2; // 2Ʈ ̵, 2^2=4 printf("3 * 8 / 4 = %d\n\n", num2); return 0; }
C
// { dg-do run } // Shows that problem of initializing one object's secondary base from // another object via a user defined copy constructor for that base, // the pointer for the secondary vtable is not set after implicit // copying of the outer class, but rather has the pointer to the main // vtable for the secondar...
C
/* Code to compute a Number Theoretic Transform for multiplication in the ring F_q[x] / <x^n+1>. n = 1024, q = 59393 */ #include "FFT_1024_59393.h" #ifdef TESTFFT #include <stdio.h> #include <sys/time.h> #endif /*Set n and q*/ static const FFTSHORT n = 1024; static const FFTSHORT q = 59393; #include "FFT_102...
C
/** @file task1.c * Demonstrates semaphores to contol the synchronization of threads. * * This program starts a number of processes that are synchronized with * semaphores to control the text output. * * @author Robert van Engelen * Modified 3/1/21 with permission by CAC **/ #include <stdlib.h> #include <stdio.h> #in...
C
/* * Escreva um programa que calcule a resistência equivalente(Re) de um circuito elétrico * composto de três resistores R1, R2, R3, ligados em paralelo. Os valores dos resistores * deverão ser lidos pelo programa. */ #include <stdio.h> #include <math.h> #include <stdlib.h> int main(){ double re, r1, r2, r3; ...
C
#include<stdio.h> #include<stdlib.h> void main(int argc, char *argv[]) { int arg; for(arg=0;arg<argc;arg++) { if(argv[arg][0]=='-') { printf("option:%s\n",argv[arg]+1); } else printf("argument %d: %s\n",arg,argv[arg]); } exit (0); }
C
#include <stdio.h> #include <stdlib.h> #include "Queue.h" // Static queues void SinitQueue (SQueue q){ q->front=0; q->lenght=0; int SisEmptyQ (SQueue q){ if ((q->length)==0) return 1; return 0; } int Senqueue (SQueue q, int x){ if ((q->length)==MAX) return 1; pos=(q->front)+(q->length)%Max; //? n perc...
C
//* A program that inputs for a string of characters //* and outputs every character +2 //* (Exmp: 123 -> 345; 567 -> 789; 163 -> 385; abc -> cde etc.) #include <cs50.h> #include <stdio.h> #include <string.h> #include <ctype.h> int main(void) { string s = get_string(""); for (int i = 0, n = strlen(s); i < n; i...
C
#include <stdio.h> #include <stdlib.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ void main(){ int i,j,temp,arr_num[5] = { 23, 90, 9, 25, 16}; for (i=3; i>=0;i--) for (j=4; j>=4-i;j--) { if(arr_num[j] < arr_num[j-1]) { temp=arr_num[j]; arr_num[...
C
#include <stdio.h> struct instruct { int data1; int data2; }; struct outstruct { struct instruct a; struct instruct b; }; struct outstruct make_outstruct(int a1, int a2, int b1, int b2) { struct outstruct res; res.a.data1 = a1; res.a.data2 = a2; res.b.data1 = b1; res.b.data2 = b2;...
C
#include <stdlib.h> #include <stdio.h> #include <assert.h> #include "util.h" void test_min() { int test_util_numbers[5] = {43, 2, 76, 954, 7}; int min_index = min(test_util_numbers, 5); assert(min_index == 1); } void test_max() { int test_util_numbers[5] = {43, 2, 76, 954, 7}; int max_index = ma...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <stdbool.h> #include <windows.h> #include "Menu.h" #include "Play.h" #include "Prepare_game.h" #include "Results.h" #include "Settings.h" #include "Wheel.h" #include "Release_memory.h" //stany //TURN_OFF, PREPARE_GAME, SETTINGS, RESULTS, GUESS_LET...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> int main() { int i; srand(time(NULL)); for(i=0; i<1000000; i++) { printf("%d\n", rand()); } return 0; }
C
//#include <dirent.h> #include "dirent2.h" #include <stdio.h> #include <string.h> #include <stdlib.h> #define MAX_LEN 65535 int main(void) { DIR *dir; struct dirent *file; int found = 0; char buf[MAX_LEN] = ""; dir = opendir("E:\\Workstation"); //这里改成需要显示文件目录的文件位置 if (dir) { while ((file...
C
#include "cg.h" #include "pv.h" inline double dis_pp(Point a, Point b) { return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y)); } inline double dis_pl(Point p, Point a, Point b) { Vector v1 = b - a, v2 = p - a; return fabs(cross(v1, v2)) / length(v1); } inline double dis_ps(Point p, Point a, Poin...
C
/* ** trace_func1.c for corewar in /u/a1/august_e/corewar/vm/execute ** ** Made by eric augustin ** Login <august_e@epita.fr> ** ** Started on Sun Dec 22 15:51:03 2002 eric augustin ** Last update Sun Dec 22 15:51:11 2002 eric augustin */ #include <stdlib.h> #include <unistd.h> #include "trace.h" #include "../common...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <poemic_defs.h> PaStream* openStream() { PaError err; PaDeviceIndex devout,ndev; const PaDeviceInfo *info; PaStreamParameters param; PaStream *handle; int i; err = Pa_Initialize(); ndev = Pa_GetDeviceCount(); printf("List of availab...
C
#include "hash.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> struct node{ struct node *next; name x; number p; } struct hash{ node *a, *b, *c, *d, *e, *f, *g, *h, *i, *j, *k, *l, *m, *n, *o, *p, *q, *r, *s, *t, *u, *v, *w, *x, *y, *z, *current; } hash *newHash() { ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char *argv[]) { char a[101], b[101],hantei; int kup = 0,aketa = 0,bketa = 0,kdiff,kaisu,i,cketa,sum, c[101],khantei = 0,daisho; fgets(a,101,stdin); //引数の間違いを訂正 fgets(b,101,stdin); while(1) { hantei =...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* expansion.c :+: :+: :+: ...
C
#include<stdio.h> #include<string.h> char *str_tok(char* str,const char* token); int main(){ char str[] = "s s s s"; char *current = strtok(str," "); while(current != NULL){ printf("%s\n",current); str_tok(NULL," "); return 0;} char *str_tok(char* str,const char* token){ char *tmp; int...
C
#include<stdio.h> int main(){ double a[100],n; int i; scanf("%lf",&n); a[0]=n; for(i=0;i<100;i++){ a[i+1]=a[i]/2.0; printf("N[%d] = %.4lf\n",i,a[i]); } return 0; }
C
/* Tests the SMV memory domain system. Adapted from the original * SMV userland testcases. * *@author Marcela S. Melara */ #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <smv_lib.h> #include <memdom_lib.h> #define MAIN_THREAD 0 static int test_memdom_create() { printf("-- Test: main thre...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_ls_option_t.c :+: :+: :+: ...
C
#include "lists.h" /** * add_node_end - this function add a node to the tail of the linked list * @head: this is the parameter pointing to the head of the linked list * @str: this is the text to set in the node * * Return: returns a copy of the node; */ list_t *add_node_end(list_t **head, const char *str) { li...
C
/* ** EPITECH PROJECT, 2021 ** my_env ** File description: ** my_env */ #include "my.h" #include "42sh.h" #include <stddef.h> #include <stdlib.h> int check_env_error(char **av, int i) { if (av[1] == NULL) return (0); for (i = 0; av[i] != NULL; i++); if (i > 3) { my_puterror("setenv: Too ma...
C
#include<stdio.h> #include<stdlib.h> #include <stdio.h> #define n 4096 // block size in bytes int prevBlock; int flag; int file_size; //-------------------------------------------------------------disk storage level implementation-------------------------------------------------------- int writeB...
C
/* * Project: Gauss-Jordan elimination method by columns (KJI-form) * Implemented with MPI * File: main.c * Author: Chris Aslanoglou */ #include <stdio.h> #include <stdlib.h> #include <mpi.h> #include <time.h> #include <unistd.h> #include "gauss_jordan.h" gauss_jordan gj; int main(int argc, char** ...
C
#include <stdio.h> int main() { int NUM,arr[100],t,i,j,brr[100],prr[100],temp=0,count=0,swap; scanf("%d %d",&NUM,&t); for(i=0;i<NUM;i++) { scanf("%d",&arr[i]); } for(i=0;i<t;i++) { scanf("%d",&brr[i]); } for(i=0;i<NUM;i++) { count=0; for(j=0...
C
#include <stdio.h> void board(int, int); int checkWin(); char square[3][3] = {{'\40', '\40', '\40'}, {'\40', '\40', '\40'}, {'\40', '\40', '\40'}}; // 40 is octal for 32, which is the ASCII value for blank spaces int main(){ int turn = 1, row, col; int winCheck = checkWin(); while(winCheck == ...
C
/** * Keil project template * * Before you start, select your target, on the right of the "Load" button * * @author Tilen Majerle * @email tilen@majerle.eu * @website http://stm32f4-discovery.com * @ide Keil uVision 5 * @conf PLL parameters are set in "Options for Target" -> "C/C++" -> "Defines" * @packs ...
C
#include "timer3.h" #include <stdint.h> #include <avr/io.h> #include <avr/interrupt.h> void (*timer3_overflow_callback)(void); void (*timer3_compa_callback)(void); ISR(TIMER3_OVF_vect) { if (timer3_overflow_callback) timer3_overflow_callback(); } ISR(TIMER3_COMPA_vect) { if (timer3_compa_callback) timer...
C
#include <gtk/gtk.h> #include "cairo_util.h" // Draw a rounded rectangle starting at x,y with size Sx, Sy. // The round factor gives the radius of the rounded rectangle by radius = min(Sx, Sy)*RoundFactor void CairoRoundedRectangle(cairo_t *cr, double x, double y, double Sx, double Sy, double RoundFactor, int Filled...
C
#include <stdio.h> #include <stdlib.h> #include <c_interface.h> /* * We'd like to be able to override the node's function table to * point to our own functions. * * First we need to add a few functions to the node function table. * - start * - longpoll * - shortpoll * - query */ /* * Optional. * Th...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> int main(int argc, char *argv[]) { char buf[20] = { 0 }; memset(buf, 'A', sizeof(buf)); sprintf(buf, "hello"); printf("%s\n", buf); for (int i = 0; i < sizeof(buf); i++) { printf("%c", buf[i] == 0 ? '@' : ...
C
/**********************************************************/ //公司名称: //创建时间:2012-10-16 //作者:ke //文件名:mytimer.c //功能描述:该文件提供了单位为ms的标准定时和延时函数,需要timer.c的支持 /**********************************************************/ #include <stdio.h> #include "stm32f1xx_hal.h" #include "mytimer.h" //u32 gmy_sys_tick; /*系统全局计时器*/...
C
// // linkedListStringVer.c // // Created by Kazuhiro Tobita on 11/12/2019. // #include <stdio.h> #define string txt1 = "airpods" #define string txt2 = "is a kind of eyerphones" struct node_struct { char character; struct node * next; struct node * prev; }; struct mystring_struct { struct node * h...
C
/* Maximum Bipartite Matching */ # include <stdio.h> # include <math.h> # define s(a) ((a)*(a)) # define SIZE 200 # define Q SIZE+1 typedef struct{ double x,y; }Point; int t,match[SIZE]; int d[SIZE][SIZE]; double dist(Point a,Point b) { return sqrt(s(a.x-b.x)+s(a.y-b.y)); } void MaximumBipartiteMatching(void)...
C
#include <unistd.h> #include <stdlib.h> #include <stdio.h> #define PRINT_ERR_EXIT(_msg) {perror(_msg); exit(1);} int main(void) { int cnt; cnt = unlink("linux.txt"); if (cnt == -1) PRINT_ERR_EXIT("Unlink linux.txt") printf("Unlink linux.txt success!!!\n"); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <readline/readline.h> #include <readline/history.h> #include <string.h> #include <unistd.h> #include <ctype.h> #include <fcntl.h> #include <sys/types.h> #include <sys/wait.h> #include <assert.h> #define MAXARGS 100 #define PIPE_READ 0 #define PIPE_WRITE 1 ...
C
/* Md. Imran Hosen Id: 2619150011 www.github.com/MdImranHosen */ #include<stdio.h> #include<conio.h> void main(){ char s[5]; system("cls"); printf("\n Enter any operator:"); gets(s); switch(s[0]) { case'>': if(s[1]=='=') printf("\n Greater than or equal"); else printf("\n Greater than"...
C
#include<header.h> int size_of_file(const char *file) { struct stat buf; if(stat(file,&buf) != 0) { perror("error:"); return 0; } else return buf.st_size; }
C
#include<stdio.h> #include<stdlib.h> struct Node{ int data; struct Node *next; }; void print(struct Node *ptr){ while(ptr!=NULL){ printf("%d ",ptr->data); ptr=ptr->next; } printf("\n"); } struct Node *insertBeg(struct Node *head,int data){ if(head==NULL) { head=(struct Node *)malloc(sizeof(...
C
// Está com os problemas na parte da biblioteca ainda Orlando. Como mudamos de liguagem ficou um pouco mais corrido entao estamos postando essa para realizar alterações //posteriormente #include <stdio.h> #include <errno.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> ...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> char* numbertostring(char* str, int i); char numberString0To19[20][10] = {"", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine",\ "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen",\...
C
#ifndef VEC_H #define VEC_H #include <math.h> typedef struct vec3_t { double x, y, z; } Vec3; Vec3 vec_create(double x, double y, double z); Vec3 vec_cross(Vec3 v1, Vec3 v2); double vec_dot(Vec3 v1, Vec3 v2); double vec_length(Vec3 v); #endif /* end of include guard: VEC_H */
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> //#include <wiringPi.h> #define ledPin 21 #define dit 100; #define dah 300; #pragma warning(disable:4996) static const char* space[2] = { "*", "*******" }; static const char* alpha[30] = { ".-", //A "-...", //B "-.-.", //C "-..", ...
C
#include "server.h" int main(void) { volatile int ser_sock = 0; volatile struct sockaddr cli_addr = {0}; volatile char r_buff[] = "\0"; const char w_buff[] = "hello client"; const socklen_t cli_len = sizeof(struct sockaddr); while(1) { recvfrom(ser_sock, r_buff, sizeof(r_buff), 0, &cli_addr, &cli_len)...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<ctype.h> int main() { char a; scanf("%c",&a); if(isdigit(a)){ printf("hello"); } }