language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> int main (int argc, char *argv[]) { int adia, ames, anofinal, ano=2016, dias=0, mesatual, mes131, mes132, mes133, aux, contador=1; scanf("%d/%d %d", &adia, &ames, &anofinal); //Cálculo do número de sextas-feiras 13 nos anos entre o inicial (2016) e o final fornecido. for(; ano<=anofinal; ano++...
C
int ack(int, int); void main() { int m1, m2, n1, n2; int c, d; m1 = 1; m2 = 4; n1 = 2; n2 = 0; c = ack(m1, n1); d = ack(m2, n2); print c; print d; } int ack(int m, int n) { if (m == 0) { return n+1; } else if (m > 0 && n == 0) { return ack(m-1,1); } else { return ack(m-1, ack(m, n-1)); } }
C
#include "function.h" typedef struct{ char peer_id[21]; char port[8]; char ip[36]; }list_of_peer; list_of_peer list_peer[20]; int amount_peer = 0; //get all peer contain info_hash of metainfo file int get_peer(char * info_hash){ char temp[32], str[1000]; char *p, c; FILE *ptr; int j, i = 0; p...
C
#include "qtum.h" #include <stdio.h> static int screen_putc(int c, FILE *stream) { outb(QTUM_OUT_PUTC, (char)c); // put character on the screen return 1; } static int keyboard_getc(FILE *stream) { return inb(QTUM_IN_GETC); // read and return a character from keyboard } static void screen_pre_out...
C
#include "../headers/father.h" // dichiaro alcune funzioni statiche static inline int first_free(char *a, int dim); int main(int argc, char **argv) { /*! * \brief struttura da passare a getopt() per l'alias delle opzioni * */ static struct option long_opt[] = { {"matrixA", requ...
C
/*Напишете функцията int linSearch(int a[], int l, int d), която получава като първи аргумент началото на масив а, втория аргумент е дължината на масива, а третия аргумент е числото, което търсим. Претърсете масива елемент по елемент и ако някой елемент съвпада с търсеното число върнете позицията на която се намира тоз...
C
// Used to print out strings. int PrintString (char *str); // Used to print out integers. int PrintInt (int i); // Used to print out character. int PrintChar (char c); // Prints bools as an integer // value. Used solely for type // matching. int PrintBool (bool b); // Prints out a newline int PrintNewline ();
C
#include <stdio.h> #include <stdlib.h> int main() { //Declare Variables double total = 0; int product, quantity; //User input printf("Enter Product numbers and Quantities.\n (Type -1 to quit.)"); scanf("%d", &product); //Execute until user types -1 while(product != -1) ...
C
#include "holberton.h" /** * read_textfile - function that reads a text file and prints it * to the POSIX standard output. * @filename: is pointing to a string of 0 and 1 chars * @letters: is the number of letters it should read and print * Return: returns the actual number of letters it could read and pri...
C
#include "frame_recorder.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include "../common.h" handle_t frame_recorder_new(int target_frames) { frame_recorder_context_t* ctx = malloc(sizeof(frame_recorder_context_t)); memset(ctx, 0, sizeof(frame_recorder_context_t)); ctx->targe...
C
/*-------------------------------------------------------------------------* *--- ---* *--- stringLangServer.c Chadwick Rivera-Crum ---* *--- ---* *--- This file defines a C program that gets file-sys commands ---* *--- from client via a socket, executes those commands in their own ---* *-...
C
#include "io_tools.h" void gpchar(void) { int c; // version one /* c = getchar(); while (c != EOF) { putchar(c); c = getchar(); } */ // printf("getchar() != EOF %d", (getchar() != EOF)); // value 1 // printf("EOF %d", EOF); // value -1 // version two while ((c = getchar()) !...
C
#include <stdio.h> #include "average.h" int main(){ int n; printf("Please enter the limit of the array: "); scanf("%d", &n); int vec[n]; printf("Please enter the values of the array: "); for(int i = 0; i < n; i++){ scanf("%d", &vec[i]); } int r = 0; r = average_array(vec, n); printf("Aver...
C
/** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */ bool isPalindrome(struct ListNode* head) { struct ListNode* node = head; int count=0, i=0, max=0; int *arr; int even=false; if ((head == NULL)||(head->next == NULL)) re...
C
#include "physics.h" #include "map.h" #include <stdlib.h> #include <zconf.h> double getNewX(const Map *map, double pos, Direction dir) { int w = map->width; if (dir == DIR_NONE || dir == DIR_UP || dir == DIR_DOWN) return pos; if (dir == DIR_RIGHT) return pos + 1 <= w - 1 ? pos + 1...
C
#include <stdio.h> #include <stdint.h> #include "addition.h" int main(int argc, char const *argv[]) { uint32_t sum = addition(1, 2); printf("Adding 1 + 2 = %d\n", sum); return 0; }
C
#ifndef _HYBRID_TRIE_ #define _HYBRID_TRIE_ #include <stdbool.h> #include <math.h> #include "../include/word_list.h" #include "../include/my_functions.h" #define MAX(x, y) x > y ? x : y /* Hybrid trie structure */ typedef struct hybridTrie { char key; bool isKey; struct hybridTrie* inf; struct hybridTrie* ...
C
#include <stdint.h> uint32_t Rand32 (void) /**************************************************************************** * * A 32 bit random number generator. An implementation in C of the * algorithm given by Knuth, the art of computer programming, vol. 2, * pp. 26-27. We use e=32, so we have to evaluate y(...
C
/** * math sample * 2020-07-01 K.OHWADA */ // fmax: // returns the larger of two floating point arguments, // https://en.cppreference.com/w/c/numeric/math/fmax #include <stdio.h> #include <stdlib.h> #include <math.h> /* * main */ int main(void) { for(int i=0; i<11; i++) { double a = (double)i / 10; ...
C
#include "list.h" #include "struct.h" #include <stdlib.h> #include <string.h> #include <stdio.h> #include "util.h" #include "genlist.h" //Initialiser la liste de voisins à inonder struct ngb_entry *init_ngb_entry(struct neighbor *peer,int times_sent){ struct ngb_entry *res=malloc(sizeof(struct ngb_entry));...
C
#include <math.h> #include "point.h" void draw_point(SDL_Renderer *r, point p) { SDL_RenderDrawPoint(r, p.x, p.y); } point prompt_point(void) { point ret; scanf("%d %d", &ret.x, &ret.y); return ret; } int point_distance(point p1, point p2) { // a^2 + b^2 = c^2 int x1 = p1.x > p2.x ? p1.x : ...
C
/* Author: Isaac Asante * HackerRank URL for this exercise: https://www.hackerrank.com/challenges/get-the-value-of-the-node-at-a-specific-position-from-the-tail/problem * Original video explanation: https://www.youtube.com/watch?v=WTu_za4VPCY * Last verified on: March 28, 2021 */ /* IMPORTANT: * This code is mean...
C
#include<stdio.h> int arr[1000], max, min; void MM(int i,int j) { int max1,min1; if(i==j) { max=min=arr[i]; } else if(j==i+1) { if(arr[i]<arr[j]) { min=arr[i]; max=arr[j]; } else { min=arr[j]; max=arr[i]; } } else { int m; m=(i+j)/2; MM(i,m); max1=...
C
#include "main.h" int main() { int n = 0; char continuar = 'y'; while(continuar == 'y') { puts("n es primo?"); puts("-----------\n"); printf("Ingresar valor de n: "); scanf("%d", &n); fflush(stdin); if(n<=1) { puts...
C
/* El bucle for: Sintaxis: for(inicializacion; condicion; incremento){ Instrucciones; ...} //Mostrar los 10 primeros numeros-ascendente es aquel numero que es divisible por la unidad y por si mismo*/ #include<stdio.h> int main(){ int i,num,cont=0; printf("\nSumador de los 10 primeros numeros pares...
C
#include "private/ff_common.h" #include "private/arch/ff_arch_tcp.h" #include "ff_linux_net_addr.h" #include "ff_linux_net.h" #include "ff_linux_error_check.h" #include <sys/types.h> #include <sys/socket.h> #include <unistd.h> #include <fcntl.h> struct ff_arch_tcp { int sd_rd; int sd_wr; }; static struct ff_arch_...
C
#include <stdio.h> #include <stdlib.h> #include <log.h> #include <queue.h> SqQueue *CreateEmptyQueue()//创建队列 { SqQueue *sq = (SqQueue*)malloc(sizeof(SqQueue)); if(sq==NULL) { printf("CreateEmptyQueue Error\n"); return NULL; } sq->front=0; sq->rear=0; return sq; } int DestroyQueue(SqQueue *Q)//销毁队列 { if(Q==...
C
#include "stdint.h" #include "fs_api.h" #include "bitmap.h" #include "schedule.h" #include "dir.h" #include "hd.h" #include "fs.h" #include "debug.h" void print_entrys(){ uint32_t num = inode_table[0].i_size / sizeof(struct dir_entry); struct dir_entry *entry = dir_buffer; while(num--){ printk("i-...
C
#include <stdio.h> int main(void){ float g1, g2, g3, mo, d1,d2; //mo for average and d1,d2 for difference printf("1st Grader: "); scanf("%f",&g1); printf("2nd Grader: "); scanf("%f",&g2); if ((g1-g2)>2 || (g2-g1)>2){ printf("3rd Grader: "); scanf("%f",&g3); d1=g3-g1; if(d1<0) d1=-d1; d2=g...
C
#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> void f(int, int, int); void t(int, int, int); int a[10]; int main(){ int n; scanf("%d", &n); f(n, 0, 0); return 0; } void f(int n, int d, int kase) { if (n >> 1 > 0) f(n >> 1, d + 1, n >> 1 & 1 ? kase + 1 : kase); if (n & 1) { /*printf("2"); if (d != 1) p...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strsplit.c :+: :+: :+: ...
C
#include "common.h" struct config_line { char *key, *val; }; static struct config_line cfgdata[MAX_CONFIG_LINES]; static int cfglines; static int cfg_loaded = 0; static int config_line_cmp(const void *a, const void *b) { const struct config_line *pa = a, *pb = b; return stricmp(pa->key, pb->...
C
// C laboratory -- ass2.c – TO COMPLETE // dynamic memory assignation: average of the elements of a vector. #include <stdio.h> #include <stdlib.h> void generate_vec (int *A, int size) { int i; for (i=0; i<size; i++) A[i] = rand () % 100; } int main () { int i, size, addition; int *A; printf ("\n ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* sh_update_command_line.c :+: :+: :+: ...
C
#include<stdio.h> #define TRUE 1 #define FALSE 0 #define PI 3.14 typedef int BOOL; int fun42(int,int); int fun43(int); int fun44(int); void fun45(int); void fun46(char); int fun47(int); void fun48(int,int); int fun49(int,int,float); float fun50(float); void main() { printf("Accept Two Numbers From Us...
C
#include <stdio.h> int main(){ int p,d1,d2,n=0,r=0; scanf("%d %d %d",&p,&d1,&d2); if(d1>=0 && d1<=5 && d2>=0 && d2<=5){ if((d1+d2)%2==0){ if(p==0){ printf("0\n"); }else{ printf("1\n"); } }else{ if(p==0){ printf("1\n"); } else { printf("0\n"); } } }else{ printf("numero invalido")...
C
#include "cesar_func.h" #include "cesar_breaker.h" int main ( ) { char * msg; char * encrypt; char * decrypt; int key = 4; FILE *in; //in file in = fopen("test/test1.txt", "r"); //open file in lecture mode only (frem where te exe is "../") if (in == NULL) { printf("Cannot open the file...\n"); exit(0); }...
C
#include "ft_printf.h" int get_flags(string format, string *flgs) { int i = 0; while (format[i] && !contains(FORMATS, format[i])) *flgs = join_char(*flgs, format[i++], TRUE); if (format[i]) *flgs = join_char(*flgs, format[i++], TRUE); return (i); } int handle_astrisk(int i...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #pragma warning(disable: 4996) //添加的定义排除警告 /* *************************************************** 输入数据首先包含一个整数N,表示测试实例的个数, 然后是N行数据,每行包含一个整数M(1<=M<=40),表示楼梯的级数。 请输出不同走法的数量 *************************************************** */ int main() { in...
C
#include<stdio.h> #include<stdlib.h> struct process { int pid; int arrival; int priority; int share; int burst; int start; int finish; int tat; int rt; int wt; }*p; int main(){ int n,i,tt=0,*a,curr=0,j,count=0,index=-1,min; int ttat=0,trt=0,twt=0; float atat,art,awt; FILE *fp; fp = fopen("process.dat","...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* libft.h :+: :+: :+: ...
C
#include <stdio.h> int main (){ int num[10], i; for (i=0; i<10; i++){ printf("Digite um numero: "); scanf ("%d", &num[i]); } for(i=9; i>=0; i--){ if (num[i]<0){ printf("NEGATIVO\n"); }else{ printf ("%d\n", num[i]); } } return 0;...
C
#include<stdio.h> #include <sys/types.h> #include <unistd.h> int main() { pid_t id; id =fork(); if(id==0) { printf("child process pid and ppid is %d %d\n",getpid(),getppid()); } else { printf("parent process pid and ppid is %d %d\n",getpid(),getppid()); } return 0; }
C
#include<stdio.h> #include<math.h> int main() { double d,n; int note,coin,d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12; scanf("%lf",&n); note=n; coin=(n-note)*100; if((coin*1000)%10==9) coin++; printf("NOTAS:\n"); d1=note/100; note=note%100; printf("%d nota(s) de R$ 100.00\n",...
C
#include <stdio.h> int main() { int n, carry = 1; printf("Enter the number of bits: "); scanf("%d", &n); char binary[n+1]; char ones[n+1]; char twos[n+1]; printf("Enter the binary number: "); scanf("%s", binary); printf("1's complement of the number is: \n"); for (int i...
C
#include <stdio.h> int main() { printf("Bonjour\n");/* \n signifie "passage à la ligne" */ return(0); }
C
// main.c // testing loggerexp #include <stdio.h> #include "../loggerexp.h" #include "../debug_features.h" void test_function(void) { log_trace_enter("args: void"); log_condtrace_enter(CALLTRACE, "args: void"); printf("Inside test function\n"); log_condtrace_exit(CALLTRACE, "result: void"); log...
C
#include <stdio.h> #define N 10 int main () { int mat[N][N]; int riemp; long int somma; int i,j; do { printf("Inserisci la dimensione della matrice quadrata: "); scanf("%d", &riemp); }while(riemp < 1 || riemp > N); for(i = 0; i < riemp; i = i + 1) ...
C
#include <stdlib.h> #include <stdio.h> void detab(int tabPos) { int n; int curPos = 0; int numSpec; while ((n = getchar()) != EOF) { if (n == '\n') { curPos = 0; putchar('\n'); } else if (n == '\t') { numSpec = curPos % tabPos; if (numSpec == 0) { numSpec = tabPos; ...
C
//strtok //str -- 要被分解成一组小字符串的字符串。 //sep -- 包含分隔符的 C 字符串。 //char strtok(char* str,char* sep) //#include <stdio.h> //#include <stdlib.h> //#include <string.h> //int main() //{ // // /*char arr[]="zqf@bitdu.tech";*/ // char arr[]="192.168.19.110"; // char* p="."; // char* ret=0; // char buf[1024]={0}; // ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main_darray.c :+: :+: :+: ...
C
#include "zcas_part.h" #include "zcas_paragraph.h" #include "zcas_sentence.h" #include "zcas_common.h" /*功能:对文章进行分割,方式:单主题、多主题 *参数: *返回值:0-正确,其他-错误 */ int zcas_getPart(zcas_config *config,zcas_doc *doc) { DEBUG_PRINT("[ZCAS_PART]enter zcas_getPart\n"); if(NULL == config || NULL == doc){ printf("zcas_getPar...
C
#include<stdio.h> #include<conio.h> #include<stdlib.h> int main(){ int array[10][10], count=0, countzero=0, n, max=0; printf("N="); scanf("%d", &n); for (int i=0; i<n; i++){ for (int j=0; j<n; j++){ scanf("%d", &array[i][j]); } } for (int i=0; i<n; i++){ count...
C
#include<stdio.h> int main() { float c,f; printf("Enter temp in farenheight:"); scanf("%f",&f); c=(f-32)/1.8; printf("tempareture in a celcsius:%f",c); return 0; }
C
#ifndef AUX_H #define AUX_H #define _POSIX_C_SOURCE 200809L #include "abb.h" #include "pila.h" #include "nodo/nodo_abb.h" #include <stdio.h> #include <stdbool.h> #include <stdlib.h> #include <string.h> /* ***************************************************************** * ESTRUCTURAS ...
C
#include "blake2s.h" #include "blake2s_kat.h" #include <stdio.h> #include <string.h> #include <time.h> void print_hex(const uint8_t* hash, char* string, int len) { size_t i; i = 0; printf("%s : ", string); while (i++ < len){ printf("%02x ", *hash++); } printf("\n"); } int main(int argc, char const* ...
C
#include<stdio.h> #define size 10 int arr[size]; void insert(int x); void search(int x); void display(); void main() { int ch,c=1,key; for(int i=0;i<size;i++) arr[i]=0; while(c!=0) { printf("\n1.Insert\n2.Search\n3.Display\n"); scanf("%d",&ch); switch(ch) { case 1:printf("Enter value:")...
C
#include <signal.h> #include <stdio.h> #include <sys/types.h> #include <unistd.h> #include <stdlib.h> #include <sys/prctl.h> #define BITSIZEofCHAR 8 #define firstbitMASK 0b10000000 char bit = 0; void child(int sig){ exit(0); } void receiver(int sig){ if (sig == SIGUSR1){ bit = 1; } else bit = 0; }...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_memchr.c :+: :+: :+: ...
C
#include <stdint.h> #include <stdio.h> #define SCALING 2147483647 #define MASK 0xFFFF typedef struct { uint64_t factor; uint64_t state; } Generator; void advance(Generator* g) { g->state = (g->factor * g->state) % SCALING; } int eval(uint64_t a, uint64_t b) { int16_t ma = MASK & a; int16_t mb = MASK & b; ...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> #include <math.h> #define MAX_LINE_LENGTH 256 /* Assuming max line length in assembly code is 256 */ #define MAX_LABEL_LENGTH 31 /* Max label length is 31 */ #define MAX_CODE_LENGTH 400 /* Assume max code cells ammount is 400, adjust when ne...
C
/* * * Simulation_Run of A Single Server Queueing System * * Copyright (C) 2014 Terence D. Todd Hamilton, Ontario, CANADA, * todd@mcmaster.ca * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software F...
C
/* Program takes in two command-line parameters: n and error command: jacobi 5 0.0001 command: jacobi 10 0.000001 */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <time.h> #include <math.h> #define N 100 #define MAX_ITER 10000 int jacobi(); void init(); int convergence(); void srand()...
C
#include <stdio.h> #include <stdint.h> #include <stdlib.h> #define CBWCDBLENGTH 16 #define CBWSIGNATURE (0x43425355) #define CSWSIGNATURE (0x53425355) /* Command Block Wrapper */ struct umass_bbb_cbw_t { __u32 dCBWSignature; __u32 dCBWTag; __u32 dCBWDataTransferLength; __u8 bCBWF...
C
#include <pthread.h> #include <stdio.h> #include <fcntl.h> #include <stdlib.h> #include <unistd.h> #include <time.h> #include <sys/time.h> #include <locale.h> unsigned int numThreads; int arraySize; int *inpArr; struct timeval start, end; long mtime, secs, usecs, finalv, tmps; typedef struct{ int ...
C
#include <mpi.h> #include <stdio.h> #include <math.h> #include <stdlib.h> void check_res(int status_result, int rank) { if(status_result != MPI_SUCCESS) { printf("Error is in %d \n", rank); MPI_Abort(MPI_COMM_WORLD, 1); } } int max(int a, int b) { if (a > b) { return a; } return b; } void main_func(...
C
#include <stdio.h> int main(){ int i;float toplam=0.0,sayilar; for(i=0;i<5;i++){ printf("Sayi giriniz: "); scanf("%f",&sayilar); toplam=toplam+sayilar; } /*for(i=0;i<5;i++){ toplam=toplam+sayilar; }*/ printf("%f",toplam/5); }
C
//output is not unique #include<stdio.h> #include<unistd.h> #include<stdlib.h> #include<string.h> #include<sys/socket.h> #include<signal.h> #include<netinet/in.h> #include<fcntl.h> #define BUF_SIZE 30 void error_handling(char *message); void urg_handler(int sig); int acpt_sock; int recv_sock; int main(int argc,char * a...
C
/****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl, C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog. Code, Compile, Run and Debu...
C
/** * @file movement.c * @brief This defines all functionality related to the servi. * * @author Team Drop Tables * * @date April 26, 2017 */ #include "servo.h" #include "timer.h" #include "lcd.h" #include "button.h" #include "serial_wifi.h" #include "math.h" #include "driverlib/interrupt.h" /// Time ser...
C
#include <errno.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include "forest.h" forest_t* forest_create(double pDistance) { // Allocate memory for the forest. forest_t* lNewForest = (forest_t*) malloc(sizeof(forest_t)); // Set a default value for e...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* myenv.c :+: :+: :+: ...
C
#include <stdio.h> /* tab[] : adresse du tableau * *tab[] : 1er element du tableau * *(tab[] + x) : element d indice 'x' // egal a tab[x] */ int *creer_tab(void) { static int tab[5]; // STATIC permet de ne pas avoir une variable locale int i; // mais bien une variable statique...
C
#include <stdio.h> #include <stdlib.h> #include <windows.h> // funcao SetConsole #include <conio.h> // funcao getch() e kbhit() #include <time.h> // funcao rand() // variavel global int c[300][2], pontos=1, cx=2, cy=2, comida[2], velo=150; //FUNCOES void gotoxy(int x, int y){ SetConsoleCursorPo...
C
#include <stdio.h> #include <string.h> #define MAX_STRING_LENGTH 256 void escape(char*, char*); void unescape(char*, char*); int main() { char inStr[MAX_STRING_LENGTH], outStr[MAX_STRING_LENGTH * 2 - 1], choice = ' '; int i; while (choice != 'q') { printf("1) Escape string\n"); printf("2) Une...
C
_exc_struct_t *_exc_global_t; void _exc_push(jmp_buf *environ, int ret_value) { register _exc_struct_t *new_tos; if (environ && ret_value) { new_tos = (_exc_struct_t *) emalloc(sizeof(_exc_struct_t)); new_tos.environ = environ; new_tos.set_ret = ret_value; new_tos.level = exc_t...
C
#ifndef TREE_H #define TREE_H #include "position.h" #include <inttypes.h> struct SearchTreeNode; typedef struct Child { move_type move; // move from parent to this child double score; // MC estimate Q(s,a) int nsims; // MC count struct SearchTreeNode *child; // pointer to child node or NUL...
C
/* arpack-ng\UTIL\dvout.f -- translated by f2c (version 20100827). */ #include "arpack_internal.h" /** * \Name: DVOUT * Real vector output routine. * * N - Length of array SX. (Input) * SX - Real array to be printed. (Input) * IFMT - Format to be used in printing array SX. (Inpu...
C
#include<stdio.h> #include<stdlib.h> #include<tmsort.h> //we can use the sorting algoriths like this. you just need to provide a comparator function. //In comparator function set a return type based on data type you are comparing for. //In this example we are sorting integers. Therefore, we are setting int as a ...
C
/** * \file computeDet.c (implementation file) * * \brief Computation of the determinant of a square matrix through the application of the Gaussian elimination method. * * It reads the number of matrices whose determinant is to be computed and their order from a binary file. The * coefficients of each matrix ...
C
// fft.c // Fast fourier transform. (Radix-2 DIT) complex *gen_fW (int N) { // Generate W array. complex *W = malloc(sizeof(complex) * N / 2); for (int n = 0; n < N / 2; n++) { W[n] = c_eul(-2 * M_PI * n / N); } return W; } int bitReverse (int N, int val) { // Bit reversal. N must be e...
C
/* APL Compiler utilities used in code generation */ /* The APL Compiler is Public Domain It may be freely redistributed as long as this notice of authorship is retained with the sources. Tim Budd Oregon State University Department of Computer Science Corvallis, Oregon 97331 USA No guarantees are give...
C
/* Interprocess Communication using Semaphores */ #include <stdio.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/sem.h> #include <unistd.h> #include <wait.h> #include <stdlib.h> /*------ Function Prototypes -----*/ int handlesem (key_t); void P(int); void V(int); int initsem (key_t); int main(int argc...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> int main() { int n[10000],i,j; scanf("%d",&n[0]); for(i = 1; i < 10000 ; i++) { scanf("%d",&n[i]); if(n[i-1] == 42) break; } for(j = 0 ; j < (i-1) ; j++) { printf("%d\n",n[j]); ...
C
#include <stdio.h> #include <stdlib.h> #include "lists.h" /** * check_cycle - checks if there is a cycle in a single linked list * @listin_t: the list to check in * Return: 0 if there is no cycle, 1 if there is */ int check_cycle(listint_t *list) { listint_t *ptr1, *ptr2; if (list == NULL) return (0); ptr1 =...
C
#include <stdio.h> #include <stdlib.h> /* needed for fgets() function */ int main() { char stringvar[100]; char *name=stringvar; printf("I am HAL, What is your name---> "); fgets(name, 100, stdin); printf("I can't open the pod bay doors, %s \n", name); return 0; }
C
#include <stdio.h> #include <dlfcn.h> void HelloWorld() { void* Handle; void (*HelloWorld)(void); Handle = dlopen ("libHello.so", RTLD_LAZY); HelloWorld = dlsym (Handle, "HelloWorld"); HelloWorld(); dlclose (Handle); } void Sum(int A, int B) { void* Handle; int (*Sum)(int,int); Handle = dlopen ("libHello.so", ...
C
#include <stdio.h> #include <string.h> #include "cpu.h" #include "memory.h" #include "registers.h" #include "rom.h" int main(int argc, char **argv) { char *filename = NULL; printf("CHIP-8 Simple Disassembler - A1\n"); if (argc != 2) { printf("Wrong arguments.\nUsage: %s <path-to-rom>\n", argv[0]); ret...
C
#include<stdio.h> #include<string.h> struct dados{ char nome[101]; int idade[1]; float altura[1]; int peso[1]; char origem[51]; }; int main(){ struct dados info[3]; int i,comp; char procura[]="Minas Gerais"; printf("\n Os nomes dos est...
C
/* detab */ #include <stdio.h> #define MAXLINE 1000 char s[1000]; void detab(void); main() { detab(); } void detab(void) { int c, i=0; extern char s[1000]; l1: for (;(c=getchar())!=EOF ;i++){ if(c!='\t'){ s[i]=c; } if (c=='\t'){ s[i]=' '; i++; while(1){ c=getchar(); ...
C
#include <stdbool.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <errno.h> #include <signal.h> #include <stdlib.h> #include <pthread.h> #include "tcpserver.h" #include "lista.h" #define CLIENT_BASE_KEY 100 void initClientData(clientData *cli, int connfd); void handleSigint(); void print_client_...
C
#include <fractol.h> #include <control.h> void my_mlx_pixel_put(t_data *data, int x, int y, int color) { char *dst; dst = data->addr + (y * data->line_length + x * (data->bits_per_pixel / 8)); *(unsigned int*)dst = color; } void info(t_vars *vars) { mlx_string_put(vars->mlx_ptr, vars->win_ptr, 0, 20, 0xFFFFFF, "...
C
/* parser.c - Parser and Parser helper function */ #include <parser.h> #include <utils.h> #include <ui.h> #include <syscall.h> #include <track.h> #include <train_control.h> #include <ioserver.h> /* Parser Helper */ int readNum(char** input); int isWhiteSpace(char c); /* Parser */ int skipWhiteSpace(char** input); in...
C
#include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <errno.h> #include <string.h> #define MAXSIZE (541) void PrintGraphNew(int *g, int gsize) { int i, j; char file_name[100]; sprintf(file_name, "../../file/client/new_graph"); FILE* fd = fopen(file_name, "w"); fprintf(fd,"%d---------...
C
#include <stdio.h> #include <stdlib.h> #include <dirent.h> #include <sys/types.h> #include <fcntl.h> #include <unistd.h> #include <sys/stat.h> #include <string.h> #include <sys/wait.h> // pwd command ---------------------------------------------------------------------------------- int pwd(){ char current_d[1024]; ...
C
#ifndef ROGUE_H #define ROGUE_H #include <ncurses.h> #include <stdlib.h> #include <time.h> /* Player position struct */ typedef struct { int y; int x; } Position; /* Map tile struct */ typedef struct { char ch; bool walkable; } Tile; /* Room struct for generated map */ typedef struct { int height; int ...
C
// usedll.c 2019-01-05 17:56:46 #include <stdio.h> #include <stdlib.h> #include <dlfcn.h> int main(void) { /* code */ int val; int (* add_d)(int, int); int (* func_d)(int); void * handle; char * err; handle = dlopen("libdemo.so", RTLD_LAZY); if(handle == (void *)0) { fputs...
C
/** @file @brief my solution on SGU OJ problem 174 @date 2013-06-27 @version 1.0 @author ck <chengkechengke@gmail.com> @section Description # put the linked walls in the same set. when comming a new wall : if its two ends are in the same set, return this wall; if they are not in any ...
C
/** * 用Edclidal算法求正整数a和b的最大公约数 * get the GCD(Greatest Common Divisor), use Edclidal gorithm; * * a, b are integer, a > 0; b >0 * if a % b == 0, the GCD of a and b is b * if a % b != 0, the GCD of a and b is equals of the GCD of b and (a % b) */ #include<stdio.h> int get_GCD(int a, int b) { if (a % b == 0) {...
C
// // Created by atr on 05.07.17. // #include <stdio.h> #include <GL/freeglut.h> static void drawTriangle() { glClearColor(0.4, 0.4, 0.4, 0.4); glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0, 1.0, 1.0); glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0); glBegin(GL_TRIANGLES); glVertex3f(-0.7, 0.7, 0); ...