language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/********** Including Necessary Header Files **********/ #include <unistd.h> #include <stdio.h> #include <sys/types.h> #include <sys/wait.h> #include <stdlib.h> #include <string.h> #include <readline/readline.h> #include <readline/history.h> #include <errno.h> #include <fcntl.h> #include <signal.h> /*...
C
void Division (int Numb [], int Size, int Left, int Right) { int OldLeft = Left, OldRight = Right; int MiddlePos = (Right + Left) / 2; int Middle = Numb [MiddlePos]; //$e printf ("\n<< Division (Numb, Size = %d, Left = %d, Right = %d): OldLeft = %d, OldRight = %d, MiddlePos = %d, Middle = %d \n",...
C
#include "eventhandler.h" #include "reactor.h" #include "diagnosticserver.h" #include <malloc.h> #include "tcpserver.h" struct DiagnosticsServer { EventHandler eventHandler; Handle listeningSocket; }; static Handle getServerSocket(void * instance) { const DiagnosticsServerPtr server = instance...
C
#include "OLED_I2C.h" #include "delay.h" #include "font.h" #include "picture.h" void I2C_Configuration(void) { I2C_InitTypeDef I2C_InitStructure; GPIO_InitTypeDef GPIO_InitStructure; RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C3,ENABLE); RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOC,ENABLE); ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #define ROZMIAR 30 #define ROZMIAR_OWADY 17 int main() { char kwiaty[ROZMIAR]; char owady[ROZMIAR_OWADY]; char *dodatek="smierdza jak stare buty"; int wolne; puts("jakie kwiaty lubisz najbardziej?"); gets(kwiaty); if((strlen(kwiaty)...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* move.c :+: :+: :+: ...
C
#include "cub3d.h" void load_textures(t_mlx *mlx) { load_texture(mlx, mlx->n_texture, mlx->game_info->n_image); load_texture(mlx, mlx->w_texture, mlx->game_info->w_image); load_texture(mlx, mlx->s_texture, mlx->game_info->s_image); load_texture(mlx, mlx->e_texture, mlx->game_info->e_image); } int load_texture...
C
/* * @lc app=leetcode id=740 lang=c * * [740] Delete and Earn */ // @lc code=start int deleteAndEarn(int *nums, int numsSize) { int *sums = calloc(10001, sizeof(int)); for (int i = 0; i < numsSize; i++) sums[nums[i]] += nums[i]; for (int i = 2; i <= 10000; i++) sums[i] = fmax(sums[i - 1...
C
#include <stdio.h> #include <string.h> struct Books { char title [50]; char author [50]; char subject [100]; int book_id; }; int main() { struct Books Book1; /*Declare Book1 of type Book*/ struct Books Book2; /*Declare book2 of type book*/ /*book 1 specs */ strcpy(Book1.title, "C programming"); strcpy(B...
C
#include <stdio.h> #include <string.h> #include <stdbool.h> #define LOG 18 #define MAX 100010 #define min(a,b) ((a)<(b) ? (a):(b)) #define clr(ar) memset(ar, 0, sizeof(ar)) #define read() freopen("lol.txt", "r", stdin) int n, q, lg[MAX], ar[MAX], dp[LOG][MAX]; int query(int i, int j){ int k = lg[j - i]; int ...
C
// gcc -m32 level4.c -o level4 #include <stdio.h> #include <fcntl.h> #include <unistd.h> #include <stdlib.h> #define BUF_LEN 64 int denyFlag = 0; int hidden() { puts("Wow, you got it!"); system("cat ./flag.txt"); } int main(int argc, char** argv) { char buffer[BUF_LEN]; setvbuf(stdin, 0, 2, 0); ...
C
#include <stdio.h> //дij int main() { //int n, int n2, int n3; int n, n2, n3; n = 5; n2 = n * n; n3 = n2 * n2; printf("n = %d, n squared = %d, n cubed = %d\n",n, n2, n3); return 0; }
C
#include "main.h" char idle = 0; int main(int argc, char **argv) { printf("\n----------------------------------------\n"); printf("\nStarting CNC Controller\n"); printf("\nSetting Up WiringPi\n"); wiringPiSetup(); init_control_gpio(); reset_motor_state(); reset_area_state(); ...
C
#include<stdio.h> int main(void) { char str[100], ch; int i; FILE* fp; fp = fopen("E:/arnol/Documents/VisualStudio/C/ClassEG/20191122/a1.txt", "w+"); ch = getchar(); while (ch != '#') { fputc(ch, fp); ch = getchar(); } rewind(fp); fgets(str, 5, fp); puts(str); fclose(fp); return 0; }
C
/* * ISA - DHCP server * @author Marian Durco (xdurco00) */ #include "dserver.h" int parseOptions(dhcp_msg, optList*); uint32_t BROADCAST; uint32_t SERVER_IP,NET_MASK; IpPool *CLEAN_POOL = NULL; /* @function - main */ int main(int argc, char **argv) { int socket; signal(SIGINT,signalHandler); arguments progr...
C
int main( void ) { /* Testing all the basic I/O functions individually would result in lots of duplicated code, so I took the liberty of lumping it all together here. */ /* The following functions delegate their tests to here: fgetc fflush rewind fputc ungetc fseek flushbuffer s...
C
// vd sap xep diem cua sv ss12 #include<stdio.h> int main() { int n; int num[100]; int l; int desnum[100], k; int i, j, temp; printf("Enter the total number of marks to be entered: "); scanf("%d", &n); system("cls"); for(l = 0; l < n; l++) { printf("\nEnter the marks of student %d: ", ...
C
// to find out sqrt // https://github.com/w3cp #include <stdio.h> double mysqrt(double num); // to return the sqrt of its parameter int main() { double x; scanf("%lf", &x); printf("%0.2lf\n", mysqrt(x) ); return 0; } // end main // returns the sqrt of its parameter double mysqrt(double number) ...
C
/*Задача 7. Напишете масив от структури наречен kaytab[ ], като използвате тази, дефинирана в горното упражнение - потребителски тип key_t, която съдържа символен низ и число. Инициализирайте масива с всички ключови думи на С */ #include <stdio.h> typedef struct My { char str[16]; int number; }...
C
/*#include <stdio.h> #define SIZE 10000 typedef struct { int Xtopleft; int Ytopleft; int anchura; int altura; }Rectangle; int IntersectRectangles(Rectangle firstRectangle, Rectangle secondRectangle, Rectangle* resultRectangle) { //printf("\n%d %d %d %d", firstRectangle.Xtopleft, firstRectangle.Ytopleft, first...
C
/* Escribir un programa cunha función que teña unha cadea de caracteres como parámetro formal, que elimine espazos extra entre palabras desa cadea, e devolva o número de espazos eliminados. A frase modificada, así como o número de cambios feitos téñense que impirmir dende main(), non dentro da función que fai os cambio...
C
#include <time.h> #include <stdio.h> #include <SDL/SDL.h> #include <SDL/SDL_image.h> #include <SDL/SDL_mixer.h> #include "perso.h" #define HAUT 0 #define DROITE 1 #define BAS 2 #define GAUCHE 3 #define AUCUNE_DIRECTION 0 #define DIRECTION_HAUT 1 #define DIRECTION_DROITE 2 #define DIRECTION_BAS 4 #define DIRECTION_G...
C
#include <wiringPiI2C.h> #include <stdio.h> #include <stdbool.h> #include <wiringPi.h> int main (void) { int handle = wiringPiI2CSetup(0x5c); wiringPiI2CWrite(handle, 0x10); while (true) { int word = wiringPiI2CReadReg16(handle, 0x00); int lux = ((word & 0xff00) >> 8) | ((word & 0x00ff) << ...
C
#include <errno.h> #include <unistd.h> #include "task.h" #include "log.h" #include "event_svc.h" int tasks_alive = 0; int task_rd_new(task_t *task, size_t count) { task_rd_set(task, resource_desc_new(count)); return 0; } void task_rd_set(task_t *task, res_desc_t *desc) { ASSERT(!task->task_rd); ta...
C
// // This code was cribbed from "The ZeroMQ Guide - for C Developers" -- Example 2.7 Weather Update proxy // // #define _GNU_SOURCE //#include <unistd.h> // #include <stdlib.h> #include <signal.h> #include <uuid/uuid.h> #include <string.h> #include <zmq.h> #include "common.h" void sighandler(int unused) { } int m...
C
#include <stdio.h> #include <stdlib.h> int main (void) { int i, *a; a = malloc (sizeof (int) * 5); if (a == NULL) { printf ("No s'ha pogut reservar memòria\n"); exit (1); } printf ("Comenza a zeros\n"); for (i = 100; i < 200; i++) a[i] = 0; free (a); return 0; }
C
/* * CMSC 212, Spring 2010, Project #1 * Secret test 07 (secret07.c) * * Tests shift_program()'s return value for values for start that are * invalid (too large). */ #include <stdio.h> #include "machine.h" #define EMP -1 #define SZ 128 int main() { Word mem[SZ]; int ret= 0; ret= ret || shift_program(mem...
C
#include <stdio.h> #include <gmp.h> int main() { mpz_t result; mpz_init(result); mpz_fac_ui(result, 100); char result_str[200]; mpz_get_str(result_str, 10, result); mpz_clear(result); int sum_of_digits = 0; for (int i = 0; result_str[i] != '\0'; i++) { sum_of_digits += result_str[i] - '0'; } printf("%i...
C
/** * @file * @brief * * @author Anton Kozlov * @date 26.05.2014 */ #include <kernel/panic.h> #include <kernel/sched/sched_lock.h> #include <hal/ptrace.h> #include <mem/page.h> #include <mem/phymem.h> #include <mem/sysmalloc.h> #include "fork_copy_addr_space.h" #include <kernel/task/resource/task_fork.h...
C
#include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <string.h> #define NEW_CHAR_DIR "/dev/button_driver" #define UP 0 #define DOWN 1 #define LEFT 2 #define RIGHT 3 #define PRESS 4 #define NUM_BUTTONS 5 int main(void) { int press = 0; int fd; int write_buf[NUM_BUTTONS]; printf("Pre-open\n"); fd = op...
C
/* * de volgende code laat het ledje op de gamepad rondspinnen: * 045e:028e Microsoft Corp. Xbox360 Controller */ #include <libusb-1.0/libusb.h> #include <stdio.h> #include <unistd.h> // for sleep() int main(int argc, char *argv[]) { libusb_device_handle *h; unsigned char data[] = { 1, 3, 0x0a }; unsigned ...
C
/************************************************************************* > File Name: game.c > Author: narutolby > Mail:willianlby@yahoo.cn > Created Time: 2013年03月26日 星期二 14时35分46秒 ************************************************************************/ #include<stdio.h> int main(){ int T,N,j; scanf("%d...
C
#include <stdbool.h> #include <malloc.h> #include <stdio.h> #include <seq_list.h> void init_seq_list(SeqList* sl) { sl->nElem = 0; } void reinit_seq_list(SeqList* sl) { sl->nElem = 0; } int size(SeqList* sl) { return sl->nElem; } int seq_search(SeqList* sl, Key key) { int i = 0; while(i < sl->nElem) { ...
C
#include <stdio.h> /* avg(x,y) = floor((x+y)/2) */ int avg(int x, int y) { int half_x = x>>1; int half_y = y>>1; return half_x+half_y+(x&y&1); } int main() { printf("%d\n", avg(3,4)); printf("%d\n", avg(3,3)); printf("%d\n", avg(4,4)); }
C
/*******************************************************************************************************************************************************/ /*Author: Donia Mohamed Mahmoud*/ /*Version: V1.2*/ /*NAME: GPIO DRIVER */ /******************************************************************************************...
C
#include <stdio.h> int ft_str_is_numeric(char *str); int main(void) { char *str; str = "555"; printf("%d\n", ft_str_is_numeric(str)); }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> // custom imlementation. Reads from stdin until \n or EOF reached // dynamically allocates buffer, thus we have to call free when we finish working with buffer char *read_lin...
C
#include "dog.h" #include <stdio.h> #include <stdlib.h> /** * free_dog - check the code for Holberton School students. * @d: int * Return: Always 0. */ void free_dog(dog_t *d) { if (d) { free(d->name); free(d->owner); free(d); } }
C
#include <stdio.h> #include <stdbool.h> #include <math.h> #include <ctype.h> #include <stdlib.h> #include <string.h> #define MAX_WORD_LENGTH 20 bool are_anagrams(const char *word1, const char *word2) { char alphabet[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', '...
C
#include <stdio.h> /* * ASM_ADD is a macro that uses inline assembly to perform addition. The * parameters op1 and op2 can be integer literals or integer variables. dest * must be a previously declared integer variable. */ #define ASM_ADD(op1, op2, dest) do { \ asm("movl %%eax, %%ecx;" \ "addl %%ebx, ...
C
/****************************************************************** * 文件:uart.h * 功能:实现uart相关函数 * 日期:2018-02-27 * 作者:zx * 版本: * Ver.1.0 | 最初版本 * Ver.1.1 | 添加UART2初始化函数 * * Copyright (C) 2018 zx. All rights reserved. *******************************************************************/ #include "UAR...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> enum status {DEAD, ALIVE}; int main(int argc, char* argv[]) { int n, m, i, j, iter; int *people, *mark; int current, remain, count; clock_t start_time, end_time; if (argc<3){ printf("Usage: alg n m"); return 1; ...
C
#ifndef TRAINER_H_ #define TRAINER_H_ #include "location.h" #include "store.h" #include "map.h" #include "list.h" #include "pokemon.h" #include <stdio.h> typedef struct trainer_t *Trainer; typedef enum { TRAINER_SUCCESS, TRAINER_NULL_ARG, TRAINER_DOES_NOT_EXIST, TRAINER_INVALID_ARG, TRAINER_OUT_O...
C
#include <stdio.h> #include <string.h> #include <malloc.h> struct NODE { struct NODE *arcs[26]; int IsTerminal, cnt; }; struct NODE *InitNODE() { struct NODE *elem = malloc(sizeof(struct NODE)); elem->IsTerminal = 0; elem->cnt = 0; memset(elem->arcs, NULL, sizeof(struct NODE *) * 26); retu...
C
#include <Arduino.h> #include <BluetoothSerial.h> #include "variable.h" bool newData = false; const byte numChars = 32; #define K_RPM_C 1 #define K_RPM_P 2 #define K_RPM_V1 3 #define K_RPM_D 4 #define K_RPM_I 5 #define K_RPM_L 6 #define K_RPM_S 7 #define K_RPM_D2 8 #define K_RPM_M 9 #define K_NONE 0 char receivedChars[...
C
#include "global.h" #include "string.h" #include "const.h" #include "kliba.h" #include "system_call.h" typedef char * va_list; #define get_arg_list(fmt) (va_list)((char*)(&fmt)+4) int vsprintf(char *buf,const char *fmt,va_list args); /*======================================================================* ...
C
// Solve the rod cutting problem using memory based approach. // Partha P Sarmah CSE 201902022093 CITK #include <stdio.h> int Rodcutting(int *, int); int max(int, int); int r[5] = {0, 0, 0, 0, 0}; int main() { int p[5] = {0, 4, 6, 9, 11}; int optsol = Rodcutting(p, 4); printf("the optimal solution is :%d\...
C
#include "list.h" #include <string.h> #include <stdlib.h> #include <assert.h> #include <stdio.h> typedef struct Node *Node; struct Node { void *data; Node next; }; struct List { int length; int elementSize; Node head; Node tail; }; List list_new(int elementSize) { assert(elementSize > 0); List n = m...
C
#include <stdio.h> #include <stdlib.h> #include <limits.h> #include "tools.h" List *create_list() { List *thelist = malloc(sizeof(List)); if(thelist != NULL) { thelist->size = 0; thelist->first = NULL; thelist->last = NULL; } return thelist; } Node *createN...
C
/* * intdisp.c * * Usage: intdisp [1608 data file] * where the 1608 file contains lightcurves and errors for the four * components, in the format: * * day S_A S_B S_C S_D err_A err_B err_C err_D * * * 19Apr01 CDF, A modification of delays.c * */ #include <stdio.h> #include <stdlib.h> #include <ma...
C
#ifndef JOGO_H #define JOGO_H #include "mesa.h" #include "menu.h" // "jogo.h" contém funções necessárias para administrar o jogo e seu estado atual // Menu inicial que recebe o usuario // Pré-condição: nenhuma // Pós-condição: Permite que o usuario comece um novo jogo ou carregue um jogo ja salvo void jogo(); // V...
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include "matriz.h" int main(int argc, char **argv){ float ***mat, relatorio_f; int relatorio_i; Dados tam; printf("Digite o numero de alunos, disciplinas e semestres: "); scanf("%d %d %d", &tam.l, &tam.c, &tam.d); //linha, coluna, dimensao tam.c +=1;...
C
#include <stdio.h> #include <stdlib.h> #include <stdarg.h> #include <stdint.h> #include <stdbool.h> #include <string.h> #include <assert.h> #include <utils.h> #include <btree.h> #define PAGE_SZ ((uint64_t)77) #define ENTRY_SZ 12 // Para essa implementação em particular temos que assumir que `CAPACITY` é um // númer...
C
/* * A mine sweeper using the MLV library */ #include <MLV/MLV_all.h> #include "grid.h" #include "draw.h" #include <stdio.h> /* Custom */ /* #define GRID_WIDTH 36 #define GRID_HEIGHT 24 #define NUMBER_OF_MINES 10 */ /* Beginner */ #define GRID_WIDTH 9 #define GRID_HEIGHT 9 #define NUMBER_OF_MINES 10 /* Intermedi...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* line_parser.c :+: :+: :+: ...
C
#include "AT24Cxx.h" u8 AT24Cxx_ReadOneByte(u8 addr) { u8 temp=0; I2C_Start(); //ʼź if(EE_TYPE>AT24C16) { I2C_Send_Byte(0xa0); I2C_Wait_Ack(); I2C_Send_Byte(addr>>8); } else { I2C_Send_Byte(0xa0+((addr/256)<<1));//ַ+ݵַ } I2C_Wait_Ack(); I2C_Send_Byte(addr%256); I2C_Wait_Ack(); ...
C
#include <stdio.h> int main(void) { int operand1 = 0, operand2 = 0; scanf("%d %d", &operand1, &operand2); printf("%d", operand1 * operand2); return 0; }
C
#include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/time.h> #include <netinet/in.h> #include <arpa/inet.h> #include <errno.h> #include <time.h> #include "socket.h" #include "gameplay.h" #ifndef PORT #define...
C
//Sending/ Receiving Data from/to PC to/from Microcontroller Displaying it on LCD #define F_CPU 8000000UL #include<avr/io.h> #include<util/delay.h> void usart_init() { UBRRL=51; UBRRH=0; UCSRB=0x18; UCSRC=0x8e; } void usart_send(char send) { while((UCSRA&0x20)==0); UDR=send; } void usart_string(unsigned char ...
C
#include <stdio.h> #include <stdlib.h> #include <stddef.h> #define MAX 15 struct data{ char date[MAX]; unsigned int flag; char eigentuemer[MAX]; char password[MAX]; }; int main(void) { struct data newfile = {"testfile",0,"itsme", "believe"}; printf("Vom Anfang zur Strukturvariable flag : %d Bytes\n", off...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> /* In this demo we'll make an array of structures. Like before, we'll create a structure and declare it as "player". Next up, we'll declare an array that will hold 3 "player" structure elements. */ int main (int argc, char* argv) { st...
C
#include <stdlib.h> #include <unistd.h> #include <stdio.h> #include <string.h> #include <assert.h> #include <stdint.h> #include <pthread.h> /* TODO: 1) queue of links (parsers to downloaders). Fixed size 2) queue of pages (downloaders to parsers). Unbounded 3) hash set 4) waiting until done QUEUE OF LINKS parser wait...
C
/****************************************************************************** * @file utilities.c * @author Zhangsf * @version V1.0.0 * @date 01-October-2016 * @brief is the Utilities ****************************************************************************** */ #include <stdlib.h> #...
C
#include<stdio.h> int A[100]; int sizeA = 0; void swap(int *a, int *b){ int temp = *a; *a = *b; *b = temp; } void selectionSort(int arr[], int size){ int min_indx; for(int i=0; i<size-1; i++){ min_indx = i; for(int j = i+1; j<size; j++){ if(arr[j]<arr[min...
C
/** Program to find LCM of two numbers **/ #include<stdio.h> #include<math.h> int main() { int i,num1,num2,max,lcm=1; printf("Enter first number" ); scanf("%d",&num1 ); printf("Enter Second number" ); scanf("%d",&num2 ); max=num1>num2 ?num1:num2; i=max; while (1) { if (i%num1==0 && i%nu...
C
#include "gme_funcs.h" #include "gme_helpers.h" #include "util.h" extern VALUE cEmulator; extern VALUE eGenericException; extern VALUE eInvalidFile; extern VALUE eTrackNotStarted; /* * Opens a new input file. * Returns a new instance of GME::Emulator. * Accepts options in a hash (2nd argument). */ VALUE gme_ruby_...
C
#include <stdio.h> #include <assert.h> #include <pthread.h> #include "mythreads.h" static int counter = 0; void *mythread(void *arg){ int i; for(i = 0;i < 1e7;i++) counter++; return NULL; } int main(int argc, char *argv[]){ pthread_t p1, p2; printf("main: begin\n"); Pthread_create(&p1, NULL, mythread, "A"); ...
C
/** * @file * @brief Handle and generate names and IDs */ #pragma once #include "../lickdir.h" /** * @brief determine if the given ID is valid * @param id the ID to check * @param lick the lick directory * @param install_path the drive or path to install under * @return 1 if the ID is valid; 0 if it is not v...
C
/* auther: C.H King * buildtime: 2013/4/30 */ #include <stdio.h> #define MAXN 30000 int fa[MAXN]; void init () { int i; fa[0] = 1, fa[1] = 1; for (i = 2; i < MAXN; ++ i){ fa[i] = (fa[i-1] + fa[i-2])%10000; } } int main () { int t, n; scanf ("%d", &t); init (); while (t --){ scanf ("%d", &n); n %= M...
C
#include <stdio.h> #include <stdlib.h> int main(int argc, char** argv) { long int dec, remainder, quotient; int binaryNumber[100], i = 1, j; printf("decimal = "); scanf("%lu", &dec); quotient = dec; while (quotient != 0) { binaryNumber[i++] = quotient % 2; quotient = quotient...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* collect_addr.c :+: :+: :+: ...
C
#include <mpi.h> #include <stdio.h> #include "field_match.h" #include "player_match.h" /** * Entry point of the application * @param argc [description] * @param argv [description] * @return [description] */ int main(int argc, char *argv[]) { int rank, processes; MPI_Init(&argc, &argv); MPI_Co...
C
/** * @Author: la-montagne * @Date: 2019-07-17T13:17:52+02:00 * @Last modified by: la-montagne * @Last modified time: 2019-07-17T13:57:55+02:00 */ #include <stdlib.h> void free_vars(char *a, char *b) { if (a != NULL) free(a); if (b != NULL) free(b); } void free_tabs(char **tab) { ...
C
//0 directly to 123 #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #define N_NODES 2000 #define N_TO_REACH 123 typedef struct { int label; bool visited; } Vertex; //stack variables int stack[N_NODES]; int top = -1; int counter = -1; int bestSolution = 999999; int lineCounter = 0; //graph v...
C
#include <pebble.h> #include "menu_window.h" //---pointers to the Window and TextLayer--- static Window *window; static TextLayer *text_layer; //---the click event handler for the SELECT button--- static void select_click_handler(ClickRecognizerRef recognizer, void *context) { menu_window_push(); } //---the cli...
C
#include "SyntaxTree.h" #include <stdlib.h> #include <malloc.h> #include <stdio.h> #include <crtdbg.h> extern int column; extern int row; NodeData *createNode(nodeType nType) { NodeData * newNode = (NodeData *) malloc(sizeof(NodeData)); if(newNode == NULL){ _ASSERT(!"Not Enough Memory"); fprintf(s...
C
////////////////////////////////////////////////////////////////////////////////////////// // < Է ζǹȣ ȭ Լ > ////////////////////////////////////////////////////////////////////////////////////////// #include "lotto.h" extern int cnt; // Ӽ ϴ void mynum_display(int (*mynum)[7]) { int i, j; printf("\n[ ȣ ]\...
C
#include "unity.h" #include "BinarySearch.h" void setUp(void){} void tearDown(void){} void test_binarySearch_with_4_element_for_last_element(void){ int array[] = {2,4,6,8}; int returnedIndex; returnedIndex = binarySearch(8,array,0,3); TEST_ASSERT_EQUAL(3,returnedIndex); } void test_binarySearch_with_4_element_f...
C
#include <stdio.h> int get_int_from_user(void); int main(void) { int sum = 0; int input; int result; int i; input = get_int_from_user(); printf("Computing the sum from 0 to %d...\n", input); for(i = 0, sum = 0; i < input; ++i) { sum += i; } printf("Sum[0..%d] = %d\n", input, sum); ...
C
/* Coded By: Ryan Boudreaux */ #include <stdio.h> #include <stdlib.h> /* Throw the instructions */ void instruct_error() { system("clear"); /* Clear the display screen */ printf("Operating Systems Homework Code Assignment 1\n\nUsage: ./HW1 [-s | -f] [input-file] [output-file(if using -f option)]\n\n");...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* check_array.c :+: :+: :+: ...
C
/* ** chars_tools.c for chars tools in /home/mille_j//zappy/serveur/src/networking ** ** Made by john mille ** Login <mille_j@epitech.net> ** ** Started on Wed Jun 22 16:58:13 2011 john mille ** Last update Sun Jul 10 11:17:09 2011 john mille */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include "z...
C
#include <stdio.h> #include <string.h> #include <alloca.h> #include "uci.h" /** @file */ /** * @brief &Ouml;ffnen einer UCI cfg Datei * * Diese Funktion wird aufgerufen, wenn auf einem Socket Daten gelesen werden * k&ouml;nnen. Die Funktion hat folgende Parameter: * * @param[in] Pfad Verzeichnis, in dem die UCI Datei...
C
#include <unistd.h> #include <sys/wait.h> #include <stdio.h> #include <stdlib.h> #include "guiao7.h" #define NEXT(current) (((current) + 1) % num_processes) int* pids; int num_processes; void switchProccess(int pidStop, int pidStart) { if (pidStop != -1) kill(pidStop, SIGSTOP); kill(pidStart, SIGCONT); } voi...
C
#include <linux/init.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/cred.h> // ------------ simple parameter definition static unsigned int some_param = 1; module_param(some_param, uint, 0644); MODULE_PARM_DESC(some_param, "This is some parameter"); // ------------ mo...
C
#include <pthread.h> #include <semaphore.h> #include <stdio.h> sem_t sem1,sem2; int play=0; pthread_mutex_t lock; void *procedure(void *id); void main(){ pthread_t processes[3]; int process_id[3] ={1,2,3}; pthread_mutex_init(&lock,NULL); sem_init(&sem1,0,1); sem_init(&sem2,0,0); pthread...
C
/*=====================================================================================================*/ /*=====================================================================================================*/ #include "stm32f1_system.h" #include "stm32f1_usart.h" #include "module_rs232.h" /*=========================...
C
// // Created by 吴凯 on 2018/12/11. // #include <ctype.h> #include <stdio.h> int my_htoi(char s[]); int my_ctoi(char c); /*答案解决办法*/ int htoi(char s[]); int main(){ char s[5]; s[0]='0',s[1]='x',s[2]='2',s[3]='F',s[4]='\0'; int n = my_htoi(s); printf("%s , %d \n", s, n); n = htoi(s); printf(...
C
/*=============================================================== * Copyright (C) 2020 All rights reserved. * * 文件名称:daily4_homework17.c * 创 建 者: dwl * 创建日期:2020/08/14 * 描 述: * * 更新日志: * ================================================================*/ #include <stdio.h> int main() { un...
C
/* Solution to the "Between Two Sets" challenge by zemen on HackerRank. https://www.hackerrank.com/challenges/between-two-sets/problem */ #include <stdio.h> #include <stdlib.h> int get_total_x(int *, int *, int, int); int lcm(int *, int); int gcd(int, int); int find_gcd(int *, int); int main() { in...
C
/* ** view_map.c for samurai_tek in /home/tessie_g//afs/rendu/samurai_tek ** ** Made by adrian tessier ** Login <tessie_g@epitech.net> ** ** Started on Thu Jan 26 21:18:32 2012 adrian tessier ** Last update Fri Jan 27 13:18:54 2012 adrian tessier */ #include "samurai_tek.h" void view_map(t_case ***map) { int i...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int t; struct Grafo{ int eh_ponderado; int nro_vertices; int grau_max; //numero maximo de ligações int** aresta; //as conexões int** pesos; int* grau; //quantas aresta o vertice ja possue char *operacao; }; typedef struct Grafo grafo; grafo *cria_g...
C
#ifndef _LOCUS_RANGE_H #define _LOCUS_RANGE_H /* before using this function, fasta_init(fasta_file) must be called, using the fasta_file relevant to the set of locus ranges. parse a locus range file. translates contig names to tids. merges overlapping ranges, and orders them. locus_range_file: has ...
C
#include "holberton.h" /** * _strpbrk - point to char that matches s from accept * @s: str 1 * @accept: str 2 * * Return: char or NULL */ char *_strpbrk(char *s, char *accept) { int x, y; x = 0; while (s[x] != '\0') { y = 0; while (accept[y] != '\0') { if (s[x] == accept[y]) return (s + x); y...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> typedef char* KeyType; typedef char* ValueType; typedef struct tagNode{ KeyType Key; ValueType Value; struct tagNode* Next; } Node; typedef Node* List; typedef struct tagHashTable{ int TableSize; List* Table; } HashTable; HashTable* CHT_CreateHashT...
C
/* Nama File : chance.c */ /* File Body dari header chance.h*/ #include "chance.h" char filename[30]; /** Prosedur dan Fungsi Chance **/ /* Prosedur dan Fungsi Primitif */ void CreateEmptyChance(Chance *C) /* Mendefinisikan Chance Kosong */ { int i; for (i=IdxMin;i<=IdxMax;i++) { (*C).Tab[i]=ValUndef; } (*C)....
C
#include "io.h" #include "serial_port.h" void serial_configure_baud_rate(unsigned short com, unsigned short divisor) { outb(SERIAL_LINE_COMMAND_PORT(com), SERIAL_LINE_ENABLE_DLAB); outb(SERIAL_DATA_PORT(com), (divisor >> 8) & 0x00ff); outb(SERIAL_DATA_PORT(com), divisor & 0x00ff); } void serial_configure_line(u...
C
#include <stdio.h> #include <stdlib.h> #include <limits.h> typedef struct { int data; struct Node *next; }Node; Node *first = NULL; //Iterative method for removing duplicates in amsingly linked list void RemoveDuplicates(Node *ptr) { Node *q = first->next; while(q) { if(ptr->data != q...
C
//------------------------------------------------------------ // SCU's Internet of Things Research Lab (SIOTLAB) // Santa Clara University (SCU) // Santa Clara, California //------------------------------------------------------------ // This application is based on the Cypress WICED platform //-----------...
C
#include<stdio.h> #define ops 4 float sum(float a,float b){return(a+b);} float sub(float a,float b){return(a-b);} float d(float a,float b){return(a/b);} float m(float a,float b){return(a*b);} int main() { float a,b,(*p[ops])(float,float)={sum,sub,d,m}; int c; printf("Enter your choice\n0.sum\n1.subt...