language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include "client.h" int is_signal_received(int is_signal) { static int status = FALSE; if (is_signal) status = TRUE; else if (status) { status = FALSE; return (TRUE); } return (FALSE); } void send_message(pid_t server_pid, char *msg) { int i; int ret; int mask; i = 0; while (1) { mask = 0b10...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_setinfo.c :+: :+: :+: ...
C
/* ======================================================= * PCS 2056 - Linguagens e Compiladores * ======================================================= * * table_of_symbols.h - Symbol table * * Created on: 21/09/2011 * Authors: * Bruno Pezzolo dos Santos, 5948816 * Carla Guillen Gomes, 569...
C
#include<stdio.h> #include<stdlib.h> #include<fcntl.h> #include<unistd.h> #define BUFSIZE 512 int main(int argc, char *argv[]) { char buffer[BUFSIZE]; int fd; ssize_t nread; long total = 0; if((fd = open(argv[1], O_RDONLY)) == -1) perror(argv[1]); while((nread = read(fd, buffer, BUFSIZ...
C
#include <stdio.h> #define INF 100000000 #define min(x,y) ((x<y)?x:y) #define max(x,y) ((x>y)?x:y) int R, C, g[505][505], dp[505][505]; int main(){ int t, i, j, a, b; scanf("%d", &t); while(t--){ scanf("%d %d", &R, &C); for(i=0; i<R; i++) for(j=0; j<C; j++) scanf("%d", &g[i][j]); ...
C
#include "dlist.h" int insert_before(data_t g_data,data_t n_data,DLink **head,DLink **tail) { //Check if list is empty if (*head == NULL) { return LIST_EMPTY; } DLink *temp = *head; //If not empty DLink *new = malloc(sizeof(DLink)); new -> data = n_data; new -> prev = NULL; new -> nex...
C
/*============================================================================= | Title: server.c | | Author: Grace Miller | Language: C | To Compile: Run the Makefile in the server folder | | Class: CS 63 Programming Parallel Systems | Due Date: 10/15/2016 | +------------------...
C
/*In the programming language of your choice, write a program generating the first n Fibonacci numbers F(n), printing ... - ... "Buzz" when F(n) is divisible by 3. - ... "Fizz" when F(n) is divisible by 5. - ... "BuzzFizz" when F(n) is prime. - ... the value F(n) otherwise. */ /* * Author : Navjot (Joti) Singh Dhalla...
C
#include <stdarg.h> #include <stdio.h> int printf(const char *restrict s, ...) { int r; va_list ap; va_start(ap, s); r = vprintf(s, ap); va_end(ap); return r; }
C
#include "api.h" void police() { int y, x, z, color0, color1, i = -1; clearScreen(black); blink0: color0 = R; color1 = B; blink1: for (y = 0; y < (MAX_Y + ((i & 0x2)>>1))/2; y++) { for (x = 0; x < MAX_X; x++) { for (z = 0; z < MAX_Z; z++) { imag[z][y][x][color0] = 255; imag[z][y][x...
C
#include <string.h> #include "agile_chtbl.h" int agile_chtbl_init(agile_chtbl* htbl, int buckets, int(*h)(const void*), int(*match)(const void*,const void*), void(*destroy)(void*)) { int i; if ((htbl->table=(agile_list*)malloc(buckets*sizeof(agile_list)))==NULL) return -1; htbl->buckets = buckets; for (i = 0; i ...
C
// Link of the problem (language PT-BR): http://br.spoj.com/problems/MINADO12/ // (Name of the problem) MINADO12 - Campo minado #include<stdio.h> int main(void){ int N; scanf("%d", &N); int mina[N]; int minar[N]; for (int i = 0; i < N; i++){ scanf("%d", &mina[i]); minar[i] = 0; } for (int i = 0; i < N; i++...
C
/** Writes len bytes of value c (converted to an unsigned char) to the string b. **/ #include "libft.h" void *ft_memset(void *b, int c, size_t len) { unsigned char *tb; tb = (unsigned char*)b; tb[len] = '\0'; while (len--) { tb[len] = (unsigned char)c; } return (b); }
C
typedef struct no{ int moda; int quantidade; struct no * prox; }Dno; typedef struct { Dno * inicio; }Dlista; Dlista * Create_Lista(){ Dlista * novo = (Dlista*)malloc(sizeof(Dlista)); if(novo){ novo->inicio = NULL; }else puts("No Alocou\n"); return novo; } int Inseri...
C
#include<stdio.h> int main() { switch(cas()) { case 1: al(); break; case 2: apl(); break; case 3: exit(0); default : printf("Invalid Choice "); } } int cas() { int ch; printf("\n1.a"); printf("\n2.b"); printf("\n3.Exit"); pr...
C
/* * (C) Iain Fraser - GPLv3 * Sythentic generic machine instructions. */ #include <stdarg.h> #include "emitter.h" #include "machine.h" void assign( struct machine_ops* mop, struct emitter* e, struct machine* m, vreg_operand d, vreg_operand s ) { mop->move( e, m, d.value, s.value ); mop->move( e, m, d.type, s.typ...
C
#include<stdio.h> #include<string.h> #include<stdlib.h> int cmpfunc (const void * a, const void * b) { return ( *(int*)a - *(int*)b ); } int main() { int n,m,i,sum,sum1=0,temp,j; scanf("%d",&n); int a[n]; for(i=0;i<n;i++) { scanf("%d",&a[i]); sum1=sum1+a[i]; } scanf("%d",&m); int b[m]; for(i=0;i<m;i++) ...
C
#include <android/log.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> #include <sys/types.h> #include <fcntl.h> #include <unistd.h> #include <dirent.h> #include <linux/limits.h> #include <sys/sendfile.h> #include <dlfcn.h> #define MOD_PATH "/sdcard/Android/data/com.Defau...
C
/* ** EPITECH PROJECT, 2017 ** File Name : disp_env.c ** File description: ** by Arthur Teisseire */ #include <stddef.h> #include "my.h" void disp_env(char **env) { int i = 0; while (env[i] != NULL) { bufferize(env[i]); if (!is_char_in_str('=', env[i])) bufferize("="); bufferize("\n"); i++; } bufferiz...
C
// // Created by human on 29.02.2020. // #ifndef GRAPHICSTEST_FLOAT4_H #define GRAPHICSTEST_FLOAT4_H #include <math.h> #include <immintrin.h> typedef struct vec4_t { union { struct {float f0, f1, f2, f3;}; struct {unsigned u0, u1, u2, u3;}; float fdata[4]; }; }vec4_t; static inline str...
C
/******************************************************************************* * @author : Rohan Jyoti * @filename : mFileLib.h * @purpose : File Generator for Testing Purposes ******************************************************************************/ #ifndef mFileGen_h #define mFileGen_h #define _GNU_SOU...
C
/* * threadPool.c * lab05lect * * Created by AJ Bieszczad on 2/17/09. * Copyright 2009 CSUCI. All rights reserved. * */ /* * 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 Foundation; either v...
C
/* * Shedular_program.c * * Created on: 12 Mar 2020 * Author: Basma Abdelhakim */ #include "../03-LIB/STD_TYPES.h" #include "../01-MCAL/01-RCC/RCC_interface.h" #include "../01-MCAL/03-SYSTIC/SYSTIC_interface.h" #include "Schedular_interface.h" typedef struct { basic_task_info * task; u32 periodicityTi...
C
#include "holberton.h" /** * check - checks if n has a square root recursively * @n: number to check against * @x: potential square root, increments with recursion * * Return: square root of n, else -1 if no valid square root */ int check(int n, int x) { if ((float)n / (float)x == (float)x) return (x); if ((float)...
C
#ifndef VECTOR4D_D_H #define VECTOR4D_D_H #include <math.h> struct vector_4d { double x; double y; double z; double w; vector_4d (double _x = 0, double _y = 0, double _z = 0, double _w = 0) : x (_x), y (_y), z (_z), w (_w) { } static vector_4d subtract (vector_4d a, vector_4d b) { return {...
C
/* * File Name: client.c * version: 1.0 * Author: William Collins * Date: 1/30/2012 * Assignment: Lab #6 * Course: Real Time Programming * Code: CST8244 * Professor: Saif Terai * Due Date: 2/13/2012 * Submission * Type: Email Submission * Destin...
C
#include "bsp_basetime.h" BASETIME_PARA_T BaseTime_Para[BASETIME_NUM]; NVIC_InitTypeDef BaseTime_InitStruct; TIM_TimeBaseInitTypeDef TIM6_TimeBaseStruct; unsigned char BaseTime_Init(unsigned char id) { if(id > BASETIME_NUM) return BASETIME_ERROR; if(id == 0) { NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0); ...
C
#include "bsp_dataconvert.h" /* ********************************************************************************************************* * : BEBufToUint16 * ˵: 2ֽ(Big Endian򣬸ֽǰ)תΪ16λ * : _pBuf : * ֵ: 16λֵ * * (Big Endian)С(Little Endian) *******************************************************************...
C
/* * @file ADC.c * @brief ADCɼ * @author MAZY * @version v1.0 * @date 2019-04-03 */ /*Magic Don't touch !*/ /*ħ*/ #include "include.h" #include "ADC.h" #define MAXQSIZE 6 //ܴMAXQSIZE-1 = 5Ԫ //#define OK 1 #define ERROR 0 #define OVERFLOW -1 float weight[MAXQSIZE-1] = { 0.1 ,0.3 ,0.4 ...
C
#include "palette.h" Palette *Palette_New(int x,int y,int w,int sz,int idx,int numColors,...) { Palette *palette=malloc(sizeof(Palette)); if(palette) { palette->x=x; palette->y=y; palette->w=w; palette->sz=sz; palette->idx=idx; palette->numColors=numColors; palette->colors=malloc(sizeof(GLuint)*numC...
C
#include <stdio.h> #include <stdlib.h> #define DEBUG 1 //#define SHOW_ASM 1 #define NUM_REG 5 #define STACK_SIZE 1024 // ax, bx, cx, dx, ex unsigned int regs[NUM_REG + 1]; unsigned int stack[STACK_SIZE] = {0}; int pstack = 0; void push(int v) { pstack++; stack[pstack] = v; #ifdef DEBUG if(pstack == STACK_SIZE...
C
/* # Name: <Jack Stephens> # Date: <April 22, 2019> # Title: Lab3 step2 # Description: This program uses pipe() to write the file called to the output */ /*sample C program for Lab assignment 3*/ #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include <sys/wait.h> // main int main(i...
C
// https://www.hackerrank.com/challenges/flipping-bits #include<stdio.h> #include<stdlib.h> #include <stdint.h> int j,n; int main(){ int32_t i; scanf("%d",&n); for(j=0;j<n;j++){ scanf("%u", &i); printf("%u\n", ~i ); } }
C
#include <stdio.h> int main() { float altura; printf("Digite sua altura: \n"); scanf("%f",&altura); printf("Sua altura é: %.2f", altura); return 0; }
C
/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef BUFFER_H #define BUFFER_H #include "typedefs.h" #ifdef __cplusplus extern "C" { #endif typedef ssize_t(buffer_op_sys)(fd_t fd, void* buf, size_t len); typedef ssize_t(buffer_op_proto)(fd_t fd, void* buf, size_t len, void* arg); typedef...
C
#include <stdio.h> #include <stdlib.h> #include <sys/stat.h> #include <assert.h> #include <string.h> #include <ctype.h> typedef struct { char* pointer; unsigned lenght; } string; //=========================================================================================== unsigned size_of_file...
C
#include<stdio.h> #include<stdlib.h> int b[10000]; int visited[10000]; int top2 = -1; int min = 100000; int matrix[100][100]; void dfs(int matrix[100][100],int visited[],int source,int dest,int k,int n){ int m; if(source == dest){ if(top2 == k+1){ int j; int sum=0; for(j=0;j<top2;j++){ su...
C
#include <stdio.h> #include "functions.h" #define OK 0 #define ELEMENTS_ERROR -2 #define FILE_ERROR -3 #define N 5 #define M 7 int main(int argc, char **argv) { int size1, size2; int array[N][M]; int retVal; FILE *file; file = fopen(argv[argc - 1], "r"); retVal ...
C
double findMedianSortedArrays(int* nums1, int nums1Size, int* nums2, int nums2Size) { int sum = nums1Size + nums2Size; // 数组总个数 int i = 0, j = 0; // i j - 游标 double chosed = 0; // 缓存每次选中的数 double m = 0, n = 0; // 有偶数个元素时,两个中位数的下标 while (i + j < sum) { if (j == nu...
C
/************************************************************************* > File Name: diffork.c > Author: Zhanghaoran0 > Mail: chiluamnxi@gmail.com > Created Time: 2015年07月23日 星期四 19时06分39秒 ************************************************************************/ #include<stdio.h> #include<stdlib.h> #include<st...
C
/*Raul P. Pelaez 2016. vector types algebra*/ #ifndef VECTOR_OVERLOADS_H #define VECTOR_OVERLOADS_H #include <cmath> typedef unsigned short ushort; typedef unsigned int uint; typedef unsigned long long int ullint; #ifndef CUDA_ENABLED #define VECATTR inline struct float2{float x,y;}; struct float3{ float x,y,z;}; ...
C
/** * @Author: GuillaumeLandre * @Date: 2018-10-26T14:41:10+01:00 * @Last modified by: GuillaumeLandre * @Last modified time: 2018-11-07T13:18:09+00:00 */ #include <stdio.h> #include <stdlib.h> int main(int argc, char const *argv[]) { int a = "0x2A"; int b = 0; printf("valeur de a en hexa = %x\n", a...
C
#include "collection/lfcByteBuffer.h" #include "testing/lfcCriterionHelper.h" #define TEST_SUITE_NAME spec_lfcByteBuffer_write_uint32 Test( TEST_SUITE_NAME, return_0_after_start ) { lfcByteBuffer_t *tto = lfcByteBuffer_ctor(); should_be_same_int_wText(lfcByteBuffer_write_uint32(tto, 1),...
C
/*working code*/ #include<stdio.h> int main(void){ int i; unsigned long long sum; unsigned long long sumsq; sum = (100 * 101 / 2)*(100*101/2); sumsq = (100 * 101 * 201)/6; printf("sum: %lld\n",sum); printf("sumsq: %lld\n",sumsq); printf("sum - sumsq: %lld\n",(sum - sumsq)); return(0); }
C
/** @file selection.c @author Andrew Dallow - ID: 56999204, Dan Orr - ID: 53440575 @date 11 Oct 2014 @brief Maps Navswitch buttons to Rock, Paper, or Scissors symbols and displays them on the led matrix. */ #include "navswitch.h" #include "tinygl.h" #include "RPS_shapes.h" #include "...
C
#include<stdio.h> #include<string.h> int regex2(char *string){ int i,j=0,state_transition[2][3]={{0,2,2},{1,1,2}}; int size = strlen(string); for(i=0;i<size;i++){ if(string[i]=='a'){ j = state_transition[0][j]; } else if(string[i]=='b'){ j = state_transition[1][j]; } } if(j==2){ return 0; } else...
C
#include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <ctype.h> #include <stdlib.h> #include <string.h> #include <sys/wait.h> #include <sys/ipc.h> #include <sys/shm.h> #include <signal.h> #define SHMKEY 314159 #define BUFF_SZ sizeof(2) void addSeconds(long* myClock); int main(int argc, char **argv)...
C
#include "main.h" #define INTERVAL 100 // Logging intverval in milliseconds FATFS FatFs; FIL logfile; int logtime = 0; int logging = 0; int buttonready = 1; void LED_Init(void) { RCC->AHBENR |= RCC_AHBENR_GPIOAEN; RCC->AHBENR |= RCC_AHBENR_GPIOBEN; RCC->AHBENR |= RCC_AHBENR_GPIOFEN; GPIOA->MOD...
C
#include <sys/time.h> #include <stdlib.h> #include <stdio.h> /*----------------------------------------------------------*/ /* time in sec */ /*----------------------------------------------------------*/ double util_gettime(){ struct timeval tp; gettimeofday(&tp, NULL)...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <pthread.h> #define MAX_THREADS 2 #define BUF 255 #define COUNTER (10 * 1000 * 1000) /* global var: Race Condition! */ static FILE *fz; static void open_file(const char* file) { fz = fopen(file, "w+"); if (fz == NULL) { printf("Konnt...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* get_next_line.c :+: :+: :+: ...
C
#include <arpa/inet.h> #include "csapp.h" int main(int argc, char** argv) { if (argc != 2) { unix_error("Usage: ./exe <32 bit unsigned hex number>"); } struct in_addr addr; sscanf(argv[1], "%x", &addr.s_addr); const char* dotted_decimal_string = inet_ntoa(addr); printf("%s\n", dotted_...
C
#include <stdlib.h> #include <stdio.h> #include <ncurses.h> #include "board.h" #include "man.h" #include "physics.h" #define WIDTH 21 #define HEIGHT 21 #define DELAY 100 enum COLOUR_PAIRS { PLAYER_ONE=1, PLAYER_TWO, FLAMES }; void init(); void end(); WINDOW *create_window(int height, int width, int starty, int start...
C
#include<stdio.h> int A[27]; char Word[11]; char Alpha[27] = { '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'}; int T; int Max; void readCase() { int i; for (i = 0; i < 26; i++) { scanf("%d", &A[i]); } scanf(" %s", Word); } void ...
C
/*** * ***/ #include<stdio.h> int max(int x, int y) { return ((x>y)?x:y); } void ks(int cap,int wt[],int pf[],int n) { int t[n+1][cap+1], i, j; for(i=0;i<=n;++i) { for(j=0;j<=cap;++j) { if(i==0 || j==0) t[i][j]=0; else if(wt[i-1]<=j) t[i][j] = max((pf[i-1]+t[i-1][j-wt[i-1]]),t[i-1][j]); els...
C
class C { int a; int m(int b) { return this.a + b; } } int main() { class C c; int d; c = newC(); c.a = 1; d = c.m(1); return 0; }
C
/*Задача 3.Напишете функцията int linSearch(int a[], int l, int d), която получава като първи аргумент началото на масив а, втория аргумент е дължината на масива, а третия аргумент е числото, което търсим. Претърсете масива елемент по елемент и ако някой елемент съвпада с търсеното число върнете позицията на която се н...
C
#include <stdio.h> #define MAX 4000000 int main(void) { int sum = 0; int prev = 1, cur = 2, temp; while (cur < MAX) { if (cur % 2 == 0) { sum += cur; } temp = cur; cur += prev; prev = temp; } printf("Sum: %d\n", sum); return 0; }
C
/********************************************************* ESCRIPTION: Test of implementation functions of stack. Athor: Gal Dahan Reviewer:--- **********************************************************/ #include <stdio.h>/*printf*/ #include <stddef.h> /* size_t */ #include <stdlib.h> #include "../include/stack.h" ...
C
#include "LinkedListApi.h" #include <stdlib.h> #include <assert.h> #include <stdio.h> struct _ll_{ ll_node *head; unsigned int node_count; int (*comparison_fn)(void*, void*); int (*order_comparison_fn)(void*, void*); }; struct _ll_node{ void* data; struct _ll_node *next; }; ll_t* get_singly_ll(ll_t* ll){...
C
#define str_len 100 #include <stdio.h> // fprintf() // printf() // stderr // getchar() // perror() #include <unistd.h> //chdir() // fork() // exec() // pid_t #include <string.h> // for tokenising // strcmp() // strtok() #include <sys/types.h> // for mkdir #include <dirent.h> #include <stdlib.h> // malloc() // re...
C
#include "prf.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include "digest.h" #include "hex.h" #include "hmac.h" #include "md5.h" #include "sha.h" /** * P_MD5 or P_SHA, depending on the value of the new_digest function * pointer. * HMAC_hash( secret, A(1) + seed ) + HMAC_hash( secret, A(2) + see...
C
#include <stdlib.h> #include <SDL/SDL.h> #include "constantes.h" #include "jeu.h" #include "menu.h" int main(int argc, char *argv[]) { //Initialisation de la SDL SDL_Init(SDL_INIT_VIDEO); SDL_SetVideoMode(LARGEUR_FENETRE, HAUTEUR_FENETRE, 32, SDL_HWSURFACE | SDL_DOUBLEBUF); SDL_WM_SetCaption(":: Casse...
C
#pragma warning(disable:4996) #include <stdio.h> #include <string.h> #include <stdlib.h> typedef struct node { int coef; int exp; struct node *next; }NODE; typedef struct list { struct node *header; }Dlist; NODE *getnode(); void initList(Dlist *list); void appendTerm(Dlist *list, int c, int e); Dlist addPoly(Dli...
C
#ifndef _DCT_H #define _DCT_H #include <stdint.h> /** * 2-D Cosine Transform. * Naive and very slow version. */ void dct (int16_t* block, float destination[8][8]) ; /** * Inverse 2-D Cosine Transform. * Naive and very slow version. */ void idct (int16_t* block, float destination[8][8]) ; /** * Fast Cos...
C
#include "pipe.h" #include "sysfile.h" #include "spinlock.h" #include "slub.h" #include "sched.h" #include "put.h" extern struct file SysFTable[SYSOFILENUM]; extern struct spinlock SysFLock; int pipealloc(int *sfd0, int *sfd1) { struct pipe *pi; pi=NULL; if((*sfd0 = falloc()) == -1 || (*sfd1 = falloc()) =...
C
//헤더파일 #include <stdio.h> #include <string.h> typedef struct { char name[20]; //제품명 int weight; //중량 int price; //가격 int num; //별점개수 } Product; int createProduct(Product *p); // 제품을 추가하는 함수 void readProduct(Product p); // 하나의 제품 출력 함수 void listProduct(Product *p, int count); // 전체 등록된 제품 리스트 출력 int se...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* fill_cmdlist.c :+: :+: :+: ...
C
#include <stdio.h> #include <math.h> int main() { char line[100]; float num_grade; char letter_grade; char modifier; printf("Please enter your numeric grade: "); fgets(line, sizeof(line), stdin); sscanf_s(line, "%f", &num_grade); if (num_grade > 100 || num_grade < 0) { printf("Invalid grade e...
C
#include "tree.h" // Morris Traversal void in_order_iterative(struct Tnode *root) { struct Tnode *current = root; struct Tnode *pre = NULL; printf("Inorder Traversal:"); while (current != NULL) { // if there is no left node, print the current node and advance to the right. if (current->left == NULL) { printf...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ps_getinfo2.c :+: :+: :+: ...
C
/* dibuja una grafica de barras horizontales */ /* Autor: Jose Luis Quijada */ #include <stdio.h> #include "grafico.h" #define MAX_BUFFER 5 int buffer[MAX_BUFFER] = {4, 6, 7, 11, 13}; void drawBar(int value) { for (int i = 1; i <= value; i++) { printf("*"); } printf("%2d ", value); } ...
C
//reversersing the string #include<stdio.h> char * count(char *p) { int i,j; char q; for(i=0;p[i];i++); for(i=i-1,j=0;i>j;i--,j++) { q=p[i];p[i]=p[j];p[j]=q; } } main() { char s[100]; printf("enter the first string..."); scanf("%[^\n]",s); printf("before... %s \n ",s); count(s); printf("after.... %s \n ...
C
#include<stdio.h> #include<stdlib.h> #include<math.h> #include<limits.h> #define scan1(a) scanf("%d",&a) #define scan2(b,c) scanf("%d %d", &b, &c) #define scan3(d,e,f) scanf("%d %d %d", &d, &e, &f) #define pn() printf("\n"); #define print1(a) printf("%d\n", a) #define print2(a,b) printf("%d %d\n", a, b) #de...
C
int i = 0; while (i++ < 3) printf("%d ", i); for (; ; i++) { printf("%d\n",i); }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> void main() { char str[100]; FILE *fp1 = fopen("test1.txt","r"); FILE *fp2 = fopen("test2.txt","w"); if( fp1 == NULL && fp2 == NULL ) { printf("Error."); exit(0); } else { fgets(str,100,fp...
C
/* Created by tamarapple on 9/11/19 */ #include <stdio.h> #include "tests.h" void vectorCreate_test() { /* creates vector with capacity 1000 */ Vector *vector_3 = vectorCreate(1000); vectorDestroy(&vector_3); /* tries to create vector with capacity 0 */ /* Vector *vector_2 = vectorCreate(0); ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* er_wrk.c :+: :+: :+: ...
C
/* Authors: Ranger Beguelin and Vaishnavi Kulkarni Date: 2/25/19 Description: write.c of Project 1 for Principles of Embedded Software */ //Header files #include <stdio.h> #include <stdint.h> #include <stdlib.h> #include "write.h" #include "allocate.h" #include "fsl_debug_console.h" int32_t *write_pointer; uint32_t o...
C
#include <stdio.h> double mult(double a, int n) { int i; double res=0; if (n>0) { for (i=0;i<n;i++) { res=res+a; } return res; } else if (n<0) for (i=0;i>n;i--) { res=res+a; } return -res; } /* int main() { int a,b; double c; scanf("%d %d",&a,&b); c=puissance(a...
C
#include "sched.h" #include "heap.h" #include "panic.h" #include "asm.h" #include "screen.h" #include <stand.h> #include <queue.h> /* 4K stack */ #define STACK_SIZE 0x1000 typedef struct { uint32 esp, ebp, ebx, esi, edi, eflags; IrqRegs regs; uint32* stack; uint32 id; } ThreadContext; typedef struct...
C
#include "holberton.h" /** * swap_int - esta funcion intercambia el valor a y b * @a: a pues es a * @b: y b pues es b * * Return: no retorna nada como 472 */ void swap_int(int *a, int *b) { int e; e = *a; *a = *b; *b = e; }
C
#include "jaccard_weighted_aux.h" #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <assert.h> void make_lut16_chunk(double *weights, double *chunk) { /* Args: weights: 16 values of weights chunk: 2**16 values zeroed out Bits are numbered (w.r.t. weights), we keep...
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 i; float a, b, c; printf("Digite um numero inteiro entre 1 e 3: "); scanf("%d", &i); printf("Valor de A: "); scanf("%f", &a); printf("Valor de B: "); scanf("%f", &b); printf("Valor de C: "); scanf("%f", &c); if(i == 1){ printf...
C
#include <stdio.h> int ar[100]; int start, end; void option() { printf("Enter 1 for push\n"); printf("Enter 2 for pop\n"); printf("Enter 3 for top\n"); printf("Enter 4 for elements\n"); printf("Enter 0 for exit\n"); } void push(int num) { end++; ar[end] = num; return; } void pop() { ...
C
/*****************************************************************************/ /* Copyright YouDao, Inc. */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ ...
C
#include "ngg_tool.h" #include "neuralnet/neuralnet.h" #include "util/util.h" #include <stdlib.h> #include <stdio.h> #include <string.h> #include <argp.h> static int parse_opt (int key, char* arg, struct argp_state* state) { options_t* opts = state->input; switch (key) { case 'a': // action ...
C
#include "injector.h" #define MIN(a,b) (((a)<(b))?(a):(b)) #define MAX(a,b) (((a)>(b))?(a):(b)) void* GetGP() { unsigned int gp; asm( "move %0, $gp\n" : "=r"(gp) ); return gp; } uintptr_t adjustAddress(uintptr_t addr) { return addr; } void WriteMemoryRaw(uintptr_t addr, void* val...
C
#include <stdlib.h> #include <stdio.h> /** * @author Lars Erik Storbukås * @mail lst111@student.uib.no * @date 25/03 - 2015 * @course INF237 Algorithm Engineering * @task Movie - Set 5 * **/ int main() { // start here int nr_of_movies; int nr_of_request; scanf("%d%d", &nr_of_movies,...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* execute_args.c :+: :+: :+: ...
C
#include <stdio.h> #include <string.h> struct MS { char name[11]; char num[11]; int grade; }; int main() { int n = 0; int i = 0; int min = 0, max = 0; int mindex = 0; int maxdex = 0; struct MS *stu; scanf("%d", &n); stu = (struct MS *)malloc(n * sizeof(struct MS)); for (...
C
void INT00_1(){ void *fp; int x; /* ... */ if (fscanf(fp, "%ld", &x) < 1) { /* handle error */ } } void INT00_2(){ unsigned int a, b; unsigned long c; /* Initialize a and b */ a = 9999999999; b = 9999999999; c = (unsigned long)a * b; /* not guaranteed to fit */ //@violation INTEGER_UNDERFL...
C
#include <ncurses.h> #include <stdbool.h> #include <string.h> #include <unistd.h> #include "common/ctx.h" #include "ui/print_functions.h" #include "cli/cmd.h" #include "cli/operations.h" // approximate length of chiventure banner #define BANNER_WIDTH (96) #define BANNER_HEIGHT (12) /* see print_functions.h */ void p...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* matrix_rotate.c :+: :+: :+: ...
C
#include <stdlib.h> #include <stdio.h> #include "include/mul.h" #include "include/operations.h" #include <string.h> //-------------------------------------------------------- _object mulIntInt(_object o1, _object o2) { return createInt(o1->cont.num * o2->cont.num); } _object mulIntStr(_object o1, _objec...
C
#include <stdio.h> #include <pthread.h> #include <stdlib.h> #include "pithread.h" int main () { pthread_t tid[10]; // ID thread scanf("%d", &inter); // For all threads for (int i = 0; i< NUMTHR ; i++){ // create thread pthread_create (&tid[i], NULL, docalc, &i); } // For each thread ...
C
#include "abstract_syntax_tree.h" #include <unistd.h> table_element * function_tracker; //function to create a new node of type "type" and value "value" struct node * create_node (char* type, char* value, int line, int column, int to_print) { struct node *new = (struct node *)malloc(sizeof(struct node)); new->va...
C
#include<stdio.h> int main() { int i,j,n; printf("Enter a number= "); scanf("%d",&n); for(i=2;i<=n;i++) { if(n%i==0) { break; } } if(i==n) { printf("\t %d is a Prime Number.",n); } else { printf("\t %d is a Not a Prime Number.",n); } return...
C
#include <stdio.h> int main() { char *s; char s1[4]; int i; int x; int z; i = 0; s = "0123456789abcdef"; x = 852; z = x; while (z) { z = z / 16; i++; } z = i; s1[z] = '\0'; while (z) { z--; s1[z] = s[(x % 16)]; printf("%c ", s1[z]); x = x / 16; //printf("%d\n", x); } printf("\nHexad...