language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include <string.h> #define MAX_LEN 200 unsigned an1[MAX_LEN+10]; unsigned an2[MAX_LEN+10]; unsigned aResult[MAX_LEN * 2 + 10]; char szLine1[MAX_LEN+10]; char szLine2[MAX_LEN+10]; int main() { gets( szLine1);//The gets function reads a line gets( szLine2); int i, j; int nLen1 = str...
C
/* led.c - LED control * * Copyright (c) 2019 Laird Connectivity * * SPDX-License-Identifier: Apache-2.0 */ #include <logging/log.h> #define LOG_LEVEL LOG_LEVEL_INF LOG_MODULE_REGISTER(oob_led); #include <gpio.h> #include "led.h" #define LED_LOG_ERR(...) LOG_ERR(__VA_ARGS__) static struct device *led1_dev; st...
C
/* # goto One of the most basic loops: tranlates to an unconditional `jmp` in x86. */ #include "common.h" int goto_func(int i) { /*goto goto_func_after;*/ in_func_label: return 1; } int main() { /* However, avoid using this as it may generate unreadable code. Opinions vary, but possible...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #define MAX_SIZE 110 char matrix[MAX_SIZE][MAX_SIZE]; int move[4][2] = { {0, 1}, {0, -1}, {1, 0}, {-1, 0}}; int Constrain(int x, int y, int n, int m) { if (x >= 0 && x < n && y >= 0 && y < m) { return 1; } else { retu...
C
#ifndef __CPIO_FILEIO_H__ #define __CPIO_FILEIO_H__ struct cpio_filehandle { int fd; char *filename; int openat_fd; size_t block_size; size_t buffer_size; struct { char *buf; int len; int offset; } read_buffer; struct { char *buf; int len; int offset; } write_buffer; }; /* * Initialise the filei...
C
#include <stdlib.h> #include <string.h> #include "scope.h" #include "ast.h" #include "error/error.h" Scope *make_scope(Scope *s, enum scopetype ty) { Scope *n = malloc(sizeof(Scope)); n->parent = s; n->vars = new_vector(); n->userdef_type = new_vector(); if(ty == FUNCSCOPE) n->fscope_vars = new_vector(...
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
/******************** (C) ******************** * :STM32λ󶨺궨 *Դ *ļʽ޸Ϊ.Hļ ********************************************************************************/ /********************************λ************************************** * λ,ʵ51ƵGPIOƹ * ʵ˼,ο<<CM3Ȩָ>>(87ҳ~92ҳ). * IOڲ궨 ****************************************...
C
/* IV.h */ #ifndef _IV_H_ #define _IV_H_ #include "cfiles.h" /*--------------------------------------------------------------------*/ /* --------------------------------------------------------- IV -- integer vector object size -- size of the vector maxsize -- maximum size of the vector owned ...
C
/* * STM32F1038ʱ,Tim1Tim8ΪAdvanced Timer, * Tim2~Tim5ΪGeneral Timer, Tim6Tim7ΪBasic Timer. * * TIMERҪ: * 1. ʱԪ * 2. 벶 * 3. Ƚ * ģʽƹ:ģʽƺģʽ * * ӰӼĴ(Shadow Register),ָϴĴһdzԱԷʵļĴ,ΪԤװ * Ĵ(Preload Register);һdzԱɼ,ڲõļĴΪshadow register * * ʱʱԴ4: * 1. ڲʱ(CK_INT),ʱʱӲֱAPB1APB2,ΪAPB1APB2һƵ * 2. ⲿ(external input pin) ...
C
#include <stdio.h> #include <stdlib.h> #include <stdint.h> typedef int* Signature; #define DeclareFns(Type,Name) \ Type Name##AllocateFn(); \ void Name##InsertFn(Type,int8_t*); \ int Name##MembershipFn(Type,int8_t*); DeclareFns(Signature,SimpleSignature32) DeclareFns(Signature,SimpleSignature64) Declar...
C
#include <stdio.h> #include <stdlib.h> int top = -1, size; void push(int Arr[]){ int a; printf("Enter: "); scanf("%d",&a); if (top!=size-1) { Arr[++top] = a; /* code */ } } int pop(int Arr[]){ int a; a = Arr[top--]; return a; } void display_elements(int Arr[]){ for (int i = 0; i <= top; ++i) ...
C
/* Write a program to add two fractions, and display the resultant fraction. Use a structure to store the numerator and denominator. Write a function that takes in two Fraction variables, and return the sum in another Fraction. */ #include <stdio.h> typedef struct{ // Numerator, denominator int num; int den; }F...
C
/* * mm.c * * NOTE TO STUDENTS: Replace this header comment with your own header * comment that gives a high level description of your solution. */ #include <assert.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <stdbool.h> #include <stdint.h> #include "mm.h" #include "...
C
#include<stdio.h> int main() { long long n,i,r,fact_n=1,fact_k=1,fact_r=1; scanf("%lld",&n); int k=n-r; for(i=1;i<=n;i++) { fact_n=fact_n*i; } printf("%lld\n",fact_n); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <semaphore.h> #include <pthread.h> #define BUFFER_SIZE 100 //variabili condivise int buffer[BUFFER_SIZE]; int freeSpots = BUFFER_SIZE; int availableItems = 0; int prod_waiting = 0; int cons_waiting = 0; int specCons_waiting = 0; int priority = 0; //p...
C
//program to fnd sum of digits untill it reduces to 1 digit #include <stdio.h> int Sum(int num); int main() { int n; scanf("%d",&n); printf("%d\n",Sum(n)); return 0; } int Sum(int num) { int sum = 0; while(num > 0 || sum > 9) { if(num == 0) { num = sum; ...
C
#include<stdio.h> #include<sys/types.h> #include<sys/stat.h> #include<fcntl.h> struct ovdc_data { int pid; int giffs; }; int ovd_entry_function(int wfd) { struct ovdc_data data; int pid = 2266; char fname[128]; char buff[2048]; int fd = 0, retval; while(1) { printf("-->pid :%d\n", pid...
C
#include "Queue.h" // 创建队列函数 bool InitQueue(P_Queue p_Queue) { p_Queue->front=0; p_Queue->rear=0; return TRUE; } // 判断队列是否为空函数 bool IsEmptyQueue(P_Queue p_Queue) { if(p_Queue->rear==p_Queue->front) return TRUE; else return FALSE; } //判断队列是否满 bool IsFullQueue(P_Queue p_Queue) { if(((p_Queue->rear+...
C
#include <stdio.h> //changes in Tom Repo for Brabch //changes in Tom Repo For Conflict //changes in Jerry Repo for Patch //changes for jerry Repo --size_t my_strlen(char *s) //Added code here for String length function //hange in //hange in erry file For the purpose of Resolve conflct +size_t w_strlen(const w...
C
#include "headers.h" typedef struct Aiger Aiger; struct Aiger { Circuit *circuit; Reader *reader; Symbols *symbols; unsigned max_index; unsigned num_inputs; unsigned num_ands; unsigned *inputs; Gate **gates; }; static Aiger * new_aiger (Circuit * c, Reader * r, Symbols * t, unsigned M, unsigned I...
C
/****************************************************************************** ** (C) Chris Wood 1995. ** ** CALLMENU.C - Show and handle the call type menu. ** ******************************************************************************* */ #include <nwcalls.h> #include <nwgfx.h> #include "helpids.h" /**** Globa...
C
#include <stdio.h> //#include <algorithm> #include <stdlib.h> //using namespace std; // 2021.02.03 23:41 // qsort ߰ compare Լ . // ü, // ͼ պ ķε Ǯ typedef struct Meeting{ int Start; int End; }Meeting; Meeting Schedule[100001]; int compare(const void *a, const void *b) { Meeting *ptA = (Meeting *)a; Meeti...
C
#include <stdio.h> #include <conio.h> long int toBin (int); int main() { long int bin; int deci; printf("Enter the decimal number\n"); scanf("%d",&deci); bin=toBin(deci); printf("The binary number is : %ld\n", bin); return 0; } long int toBin(int deci) { long int bin=0,remainder,i=1; ...
C
/* * ADC_temp.c * * Created: 14.01.2017 11:02:56 * Author: Denis Vadan */ #include <avr/io.h> #include "../GeneralDefines.h" #include "ADC_temp.h" /*F****************************************************************************************** ** NAME: ADC_temp_init ** ** PARAMETERS: NONE ** ** DESCRI...
C
#include "search_algos.h" /** * binary_search2 - binary search algorithm * @array: List * @l: left size of array * @r: right size of array * @value: value to search * Return: index of coincidence or -1 */ int binary_search2(int *array, size_t l, size_t r, int value) { size_t left = l; size_t right = r - 1; in...
C
//Program: Student Number Adder //Author: Idil Bilgic (19206730) #include <stdio.h> #define MAX_SIZE 7 //limits the size of the array int number[MAX_SIZE]; int i; int sum=0; //the sum value is initialised int main(void) { for (i=0; i<8; i++) { //makes sure the user needs to type exactly eight digits for the ...
C
/** * @file hi_sem.h * * Copyright (c) Hisilicon Technologies Co., Ltd. 2019-2019. All rights reserved. \n * Description: Semaphore APIs.CNcomment:ӿڡCNend * * @li Wait semaphore. In the interrupt function, disable interrupt context, and lock task context, this API must not be * called. Otherwise, uncontrollable ex...
C
/***************************** * COEN 146 Lab 4 Name: Jennifer Luo Lab section: Friday FTv2 UDP RDT 3.0 Client *****************************/ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <stdio.h> #include <unistd.h> #include <errno.h> #include <string....
C
#include <stdio.h> #include <stdlib.h> typedef struct node{ int value; struct node * next; } node_x; int addNode(node_x*,int); node_x* newList(int); int getNode(node_x*,int); int printNodes(node_x*);
C
#include <driver/vga.h> int main() { set_cursor_pos(0, 0); clearwin(COLOR_BLK, COLOR_YEL); const char *first = "\n\n\n\nWe can now handle some special characters."; putstr(first, COLOR_BLK, COLOR_YEL); const char *second = "\nLike tab \t and newline."; putstr(second, COLOR_BLK, COLOR_YEL);...
C
#include "libftasm.h" void ft_puts_test() { ft_puts(""); ft_puts(NULL); ft_puts("test string"); } void ft_putchar_test() { char *str = "putchar test\n"; for (int i = 0; str[i]; i++) ft_putchar(str[i]); } void ft_putnbr_test() { ft_putnbr(-2147483648); ft_putnbr(-1); ft_putnbr(0); ft_putnbr(1); ft_putnbr(...
C
#ifndef INC_01_VECTOR_VECTOR_H #define INC_01_VECTOR_VECTOR_H typedef struct vector { int size; int capacity; int* data; } vector_t; void init_vector(vector_t* to_init, int init_capacity); void push_back(vector_t* to_push, int new_int); void insert_at(vector_t* to_insert, int at, int new_int); int element...
C
/*第一行有號10進位 第二行無號10進位 第三行帶有0x標記,印出n的16進制 第四行8進制輸出n*/ #include <stdio.h> int main(){ int n; scanf("%d", &n); printf("%+d\n",n); printf("%d\n",n); printf("0x%X\n",n); printf("0x%x\n",n); printf("%o\n",n); return 0; }
C
// Tree #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> typedef struct Node { short int leftThread; Node* leftChild; char data; Node* rightChild; short int rightThread; } Node; Node* insucc(Node* tree); void tinorder(Node* tree); int main() { Node n1 = { 0, NULL, 'G', NULL, 0 }; Node ...
C
#include<stdio.h> main(){ int n; printf("Digite a quantidade de itens do vetor 1 e 2: "); scanf("%i", &n); int v1[n], v2[n], v3[2*n], valor, tam = 2 * n; for(int i = 0; i < n; i++){ printf("Digite o % item do vetor 1: ", i+1); scanf("%i", &valor); v1[i] = valor; v3...
C
/* Thread synchronization and mutual exclusion using mutex. Application to demonstrate: Reader-Writer problem with reader priority.*/ #include<pthread.h> #include<semaphore.h> #include<stdio.h> #include<stdlib.h> #include<unistd.h> pthread_mutex_t x,wsem; pthread_t tid,t1; int readcount=0; //int data=5; void * reade...
C
#include "stdio.h" char *strcpy(char *,char *); void main(void) { char a[20], b[60]="there is a boat on the lake."; printf("%s\n",strcpy(a,b)); } char *strcpy(char *s,char *t) { char *origin = s; //保留起始位置 while(*s++=*t++) ; return (origin); //返回起始位置 }
C
#include <GL/glut.h> // Cabeçalho das Funções (Prótotipo das funções / Assinatura das Funções). void Desenha(void); void Inicializa(void); void AlteraTamanhoJanela(GLsizei, GLsizei); // Função Principal. int main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutIni...
C
#include "cl_progressbar.h" #define SGETTER(t, p) \ t progressbar_layer_get_ ## p(ProgressBarLayer *layer) { \ return layer-> p; \ } \ void progressbar_layer_set_ ## p(ProgressBarLayer *layer, t value) { \ layer-> p = value; \ layer_mark_dirty(layer->layer); \ } SGETTER(int, progress); SGETTER(int...
C
//This program read two different txt files with two columns of data and generates stacked histogram //NRHF-DUNE Muon Neutrino Flux Comparision //Open with reveal.C to display stacked histogram //Open with show.C to display histogram on divided canvas { TFile *f = new TFile("stackedHist.root", "RECREATE"); //ROOT Fil...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_mouse_wheel.c :+: :+: :+: ...
C
/* matrizDestino.byteDestino[0] = matrizOrigem'[7]; matrizDestino.byteDestino[1] = matrizOrigem'[6]; ... matrizDestino.byteDestino[6] = matrizOrigem'[1]; matrizDestino.byteDestino[7] = matrizOrigem'[0]; Exemplo: Origem: 0b00000001 // 0x01 0b00000011 // 0x03 ...
C
#ifndef __M2_X_2_H__ #define __M2_X_2_H__ struct m2x2 { unsigned long a11, a12, a21, a22; }; void mul(struct m2x2 *m1, struct m2x2 *m2) { unsigned long a11 = (*m1).a11*(*m2).a11 + (*m1).a12*(*m2).a21; unsigned long a12 = (*m1).a11*(*m2).a12 + (*m1).a12*(*m2).a22; unsigned long a21 = (*m1).a21*(*m2).a11 + (*m1).a2...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include "structures.h" double normalize(float* dir); extern int intersect_triangle(float orig[3], float dir[3], float vert0[3], float vert1[3], float vert2[3], double *t, double *u, double *v); extern void createCubeTriangles(double* center, double sideLen, fac...
C
#include <msp430.h> #include "onewire.h" // http://www.smallbulb.net/2012/238-1-wire-and-msp430 , https://github.com/dsiroky/OneWire #include "delay.h" #define CONTROL BIT0 /* Global Variables */ volatile char i = 0; volatile float temp; volatile onewire_t ow; volatile uint8_t scratchpad[9]; int main() { WDTCTL...
C
#include<stdio.h> #include "functions.c" int main(){ int matrix [3][4] = { {1,2,3,4},{5,6,7,8},{9,10,11,12} }; int matrix2 [3][4]= { {20,21,22,23 },{30,31,32,33},{40,41,42,43}}; printf("Sum of Column\n"); sumOfColumns(matrix); printf("Matrix Subtract:\n"); matrixSubtract(matrix,matri...
C
#include <stdio.h> #include <unistd.h> #include <errno.h> #include <stdlib.h> #include <sys/wait.h> #include <string.h> #include <dirent.h> #include <fcntl.h> #include <signal.h> #include <ctype.h> #define MAX_LINE 80 /* 80 chars per line, per command, should be enough. */ #define MAX_PATH 500 // 500 char...
C
typedef struct{ int num_voo, maxPassag[50]; float hora_part, hora_cheg, data_partida, data_chegada; //char hora_part[6], hora_cheg[6], data_partida[10], data_chegada[10], char cidOrigem[50], cidDestino[50], companhia[100]; float valePassagem; }tipoVoo; int testaVooHD(int numPesquisa){ FILE *ar...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_itoa.c :+: :+: :+: ...
C
/*7. Escreva um algoritmo em linguagem C que: a) leia um vetor A de 12 n�meros reais; b) construa e imprima um vetor B formado da seguinte maneira: - os elementos de �ndice par s�o os correspondentes de A divididos por 2; - os elementos de �ndice �mpar s�o os correspondentes de A multiplicados por 3. */ #inc...
C
void matrixRotate90(int target[SIZE][SIZE], int source[SIZE][SIZE], int size) { for ( int row = 0, rotate = size - 1; row < size; row++, rotate-- ) { for ( int column = 0; column < size; column++ ) { target[rotate][column] = source[column][row]; } } }
C
#include "sample_guix_home_automation.h" #define MIN_DEGREE 40 #define MAX_DEGREE 120 /* Define thermostat controller information structure. */ typedef struct THERMOSTAT_INFO_STRUCT{ THERMOSTAT_BASE_CONTROL_BLOCK *controller; /* Pointer to thermostat controller. */ GX_CHAR *cold_heat_text; /* Temperature des...
C
//~ trimleme =>arada ki fazla boşluğu yok et ve ilk harfleri buyut #include <stdio.h> #include <ctype.h> void titlecase(char s[]) { int i,c; for(i=0,c=1;s[i]!='\0';i++) { if(c==1 && s[i]!='\0') { s[i]=toupper(s[i]); c=0;} else if(s[i]==' ' && s[i+1]!=' ') { c=1;} } } void bosluk_sil(char s[]) { ...
C
/******************************************************************************* * File: main.c * Author: Will Flores waflores@ncsu.edu * * Usage: Implemented using a host of API in the headers * Description: This file contains the main function template * Environment: Windows 7, x64 build * Built...
C
/** * @file * Controller module interface. * * @author Piotr Krzywicki <krzywicki.ptr@gmail.com> * @date 12.06.2018 */ #ifndef _CONTROLLER_H__ #define _CONTROLLER_H__ #include "../view/view.h" /** * @brief Structure representing current controller state. */ struct Controller; /** * @brief Initialize @ref ...
C
// // main.c // ExampleC // // Created by Matthew Lu on 6/06/2014. // Copyright (c) 2014 Matthew Lu. All rights reserved. // #include <stdio.h> #include <ctype.h> #define MAXHIST 15 //max length of histogram #define MAXCHAR 128 //max different characters,最多128个字符 //print horizontal histogram freq. of diff...
C
//Anemometer Technical Variables //The following variables correspond to the anemometer sold by Adafruit, but could be modified to fit other anemometers. const int sensorPin = A0; //Defines the pin that the anemometer output is connected to float voltageConversionConstant = .004882814; //This constant maps the value ...
C
#include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> #include "Practical.h" static const int MAXPENDING = 5; int SetupTCPServerSocket(const char *service){ struct addrinfo addrCriteria; memset(&addrCriteria, 0 ,sizeof(addrCriteria)); addrCriteria.ai_family = AF_...
C
#include <stdio.h> unsigned int setbits(unsigned int x, unsigned int startPos, unsigned int noOfBits, unsigned int y); int main() { unsigned int x; unsigned int y; unsigned int result = 0; unsigned int startPos = 0; unsigned int noOfBits = 0; printf("\nEnter the number x\n"); scanf("%x", &x); printf("\nThe n...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_print_int.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include "camping_main.h" #include "main_menu.h" #include "string.h" #define CAMPING_MAX_OCCUPANCY 100 #define CAMPING_HOUSES_AMOUNT 10 void listAll(House houses[]) { int i; for (i = 0; i < CAMPING_HOUSES_AMOUNT; ++i) { printf("Name: %s", houses[i].name); ...
C
#include "dataStore.h" //#include "dataStore.c" #include <stdio.h> //int addCar(char* make, char* model, short year, long price, int uniqueID);TODO DONE //struct Car* getAllCarsInMemory();//todo //int setMaxMemory(size_t bytes);TODO DONE //struct Car* getCarById(int id);TODO DONE //int getNumberOfCarsInMemory();//todo...
C
/*************************************************** * compute - Computes Perfect Numbers * Hugh McDonald * 12.6.13 ***************************************************/ #define _POSIX_C_SOURCE 200809L #define _BSD_SOURCE //IP ADDRESS OF SERVER #define IP "128.193.37.168" #define PORT 7070 #define MAXLINE 4096 #in...
C
#include <stdio.h> #include <string.h> #include <buffcontainer.h> char *rplcstr (const char *search, const char *find, const char *replace) { const char *sptr = search; int newstrlen = strlen (search) + 1; int rplclen = strlen (replace) + 1; int findlen = strlen (find); int strdiffs = (rplclen -...
C
/* * a C program with a recursive function itoa, which converts integer into a string. * * @Author - Yuvraj Takey */ #include <stdio.h> #include <string.h> #define MAXCHAR 80 #define ASCII_NUM 48 /*********************************************************************************** Function : str_rev() Des...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <time.h> #define MIN_HASH_COUNT 100//Min hash algoritmasında kullanılacak hash sayısı #define HASH_MAP_SIZE 10000//Hash map boyutu #define SHINGLE_SIZE 1000//shingle sayısı typedef struct ShingleList ShingleList;//shingle ların tut...
C
/*mcd.c*/ #include <stdlib.h>/*abs()*/ #include <stdio.h> static int mcd(int n,int d) { int N,D,R; N=abs(n);D=abs(d); while((R=D%N)!=0){ #ifdef PRELIMINAR printf("%d = %d(%d)+%d\n",D,D/N,N,R); #endif /*PRELIMINAR*/ D=N; N=R; } #ifdef PRELIMINAR printf("%d = %d(%d)+%d\n",D,D/N,N,R); #endif /*PRELIMI...
C
/* * prog11_8.c * Chapter11 * * Created by Sam Krishna on 4/21/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #include <stdio.h> #include <string.h> void reverse(char *string); int main (int argc, const char * argv[]) { char string[] = "reversible"; printf("The reversed str...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <poll.h> #include <unistd.h> #include <netinet/in.h> #include <uv.h> #include "../neat.h" #include "../neat_internal.h" /* Simple neat client */ static uint32_t config_rcv_buffer_size = 256; static uint32_t config_snd_buffer_size = 128; static ui...
C
#include <stdint.h> #include <stdio.h> #include <msp430.h> // How many fractional bits to use in the fixed-point format #define N_FRAC_BITS 8 // How to perform multiplication on two fixed-point numbers? #define MUL(a,b) (int32_t)(((int64_t)(a) * (int64_t)(b)) >> N_FRAC_BITS) // Size of the matrices that we are play...
C
#include <stdio.h> #include <string.h> void removeespacos(char frase[100]); int main() { char frase[100]; printf("Digite uma frase: "); fgets(frase,100,stdin); removeespacos(frase); return 0; } void removeespacos(char frase[100]) { int i,j,cont=0; int len=strlen(frase); for(i=0,j=0;i<len;i++,j++) { if...
C
#ifndef CATEGORY_H #define CATEGORY_H typedef struct category { int id; char *name; } Category; int add_category(Category *c); int del_category(Category *c); int update_category(Category *old_category, Category *new_category); int get_categories_count(); int get_all_categories(Category *list[]); int get_category_by...
C
/******************************** * File name: ws5.c * * Develoer: Inbal Elmalech * * Reviewer: * * Review date: May, 2020 * ********************************/ /********************** PREPROCESSOR DIRECTIVES **************************/ #include <stddef.h> /* size_t */ #include <stdio.h> /* printf, puts*/...
C
#ifdef _WIN32 #undef _WIN32_WINNT #else #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #define MAX_MESSAGE_LEN 80 #define PORT 8080 #define IP_PROTOCOL 0 #define HOST "192.168.0.103" #endif // Function designed ...
C
#include "main.h" void Quick_Sort(int *array, int left, int right) { if (left >= right) return; int mid = Partion(array, left, right); Quick_Sort(array, left, mid-1); Quick_Sort(array, mid+1,right); } int Partion(int *array,int left,int right) { int pivot_index = left;//㷨ֵøĽĵطץȡһ int i = left, j = right; ...
C
#include <stdlib.h> #include <stdint.h> #include <Pipes.h> #include <stdio.h> #include "prog.h" float fpincr(float x) { return(x + 1.0); } #ifdef SW float fpmul(float x, float y) { return(x*y); } float fpadd(float x, float y) { return(x+y); } float fpsub(float x, float y) { return(x-y); } #endif float dotPro...
C
// Single linked list // *khai bao cau truc struct // *make node: toa 1 node // *display node: in ra danh sach // *insert: cac ham dung de chen vao dau, cuoi day, truoc current, sau current // *remove: xoa phan tu dau tien, xoa cac phan tu khac // *free list: free list #include <stdio.h> #include <string.h> #include <...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* gnl.c :+: :+: :+: ...
C
#include<stdio.h> void main() { int num,p,n=0; printf("ij˾òϸ\n"); for(num=1;num<=4;num++) { for(p=1;p<=9;p++,n++) { if (n%9==0) printf("\n"); printf("%2d\t",num*p); } } printf("\t\t\t\t\t\t\t 20074...
C
#include<stdio.h> #include<stdlib.h> #include<limits.h> #define MAX INT_MAX typedef enum { false, true } bool; typedef struct Node { int vertexNum; int distance; } Node; typedef struct Edge { struct Edge *next; int oppositeVertexNum; int weight; } Edge; typedef struct Vertex { int vertexNum; int d; Edge *in...
C
/* * Standard Library Includes */ #include <inttypes.h> #include <stdint.h> #include <assert.h> #include <stdbool.h> #include <stdio.h> /* * Generic Library Includes */ #include "ringbuf.h" #include "memorypool.h" #define SM_PRIVATE_ACCESS #include "statemachine.h" #include "statemachinemanager.h" /* * Defi...
C
// // AppController.h // CP2_WEEK6 // // Created by stu2017s10 on 2017. 4. 11.. // Copyright © 2017년 stu2017s10. All rights reserved. // #ifndef AppController_h #define AppController_h #include <stdio.h> #include "AppIO.h" #include "Ban.h" #define MAX_NUMBER_OF_STUDENTS 100 typedef struct _AppController AppCont...
C
#if 0 /* Currently broken */ #define SG_BUILD_LIBRARY #include <siege/util/file/json.h> #include <siege/util/string.h> #include <stdlib.h> #include <string.h> #include <stdio.h> #include <ctype.h> static SGint SG_CALL _sgJSONSetCmp(const SGJSONSetItem* a, const SGJSONSetItem* b) { return strcmp(a->key, b->key); ...
C
#pragma once #include <GL/freeglut.h> struct LightSource { int lightNo; float dif_color[4]; float spec_color[4]; bool status; void init(float attenuate = 0.0f) { glLightfv(lightNo, GL_DIFFUSE, dif_color); // Light Source Color glLightfv(lightNo, GL_SPECULAR, spec_color); glLightfv(lightNo, GL_EMI...
C
#ifndef com_example_Integer2_H #define com_example_Integer2_H #define com_example_Integer2_MAX 0x7fffffff #define com_example_Integer2_MIN (-0x7fffffff - 1) struct com_example_Integer2; typedef int com_example_Integer2_t; struct com_example_Integer2 { com_example_Integer2_t value; }; struct com_example_Integer...
C
#include "MiscFunctions.H" using namespace std; //Pre-calculated square-root constants to speed up distance calculations. - from tankbattle5 const real8 MiscFunctions::preCalc[101] = { 1.00, 1.00, 1.00, 1.001, 1.001, 1.001, 1.002, 1.003, 1.004, 1.004, 1.005, 1.006, 1.008, 1.009, 1.01, 1.012, 1.013, 1.015, 1.017, 1.01...
C
/* * vim: set ft=wadc: * * Jon's WadC mapjam room, first attempt */ #"decoration.h" jon_boring { -- literally a box. boring! box(get("floor"), add(get("floor"), 190), 160, 512, 512) -- exit door will be in the top-most wall -- position the cursor on that edge. No need to rotate. movestep(512,0...
C
#include <stdio.h> #include <stdlib.h> unsigned int lcm(unsigned int a, unsigned int b); int main(int argc, char **argv) { unsigned int a; unsigned int b; unsigned int r; if (argc == 3 && atoi(argv[1]) >= 0 && atoi(argv[2]) >= 0) { a = atoi(argv[1]); b = atoi(argv[2]); ...
C
#include<stdlib.h> #include<stdio.h> /** * 依次输出从键盘输入元素的最后K个元素,并假设k<=元素个数 * 要求:Ctrl+z 结束输入 * 不能使用数组。 * */ typedef struct node { int data; struct node *link; }Node,*Linklist; int main(int argc, char const *argv[]) { Linklist list=NULL,p,r; int n=0,k=0; printf("input k:\n"); scanf("%d",&...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #define TRUE 1 #define FALSE 0 int main(int argc,char **argv) { int *Num,limit,i,j,prime=0; limit=atoi(argv[1]); Num=(int*)malloc(limit*sizeof(int)); Num[0]=Num[1]=FALSE; for(i=2;i<limit;i++) { Num[i]=TRUE; } for(i=2;i<=sqrt(limit);i++) { if(Num[i]=...
C
/* Copyright 2017 Sathyanesh Krishnan Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
C
//binary search tree #include<stdio.h> #include<stdlib.h> //globals int valueFoundFlag; int NodeCount; int leafCount; int fullNodeCount; int ancestorCount; int descendantCount; int isFoundForDescendants; typedef struct Tree { struct Tree *LC,*RC; int data; }BST; void insertTree(BST **R,int v) { if((*R)==NUL...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include "paul.h" struct cell_lite{ double prim[NUM_Q]; double cons[NUM_Q]; double RKcons[NUM_Q]; double riph; double RKriph; double wiph; }; void generate_mpi_cell( MPI_Datatype * cell_mpi ){ struct cell_lite test; int count = 6; i...
C
#include <string.h> #include "number.h" // only support 36 base static const char *pBaseStr = "0123456789abcdefghijklmnopqrstuvwxyz"; static void _str_reverse(char *szStr, int iLeftIndex, int iRightIndex) { if (iLeftIndex < iRightIndex) { char ch = szStr[iLeftIndex]; szStr[iLeftIndex] = szStr[...
C
#include <assert.h> #include <stdio.h> unsigned long long _off; #define MAX_SEQ_LEN 4096 int _getc(FILE *f) { int c = fgetc(f); if (c == EOF) return EOF; _off++; return c; } int readSeqHdr(FILE *fbin) { int c, len; if ((c = _getc(fbin)) == EOF) return EOF; // Sequence if (c != 0x30) ...
C
#include "common.h" #ifndef VDD33 #define VDD33 33 #endif void wait_for_wifi_connection() { uint8_t status = sdk_wifi_station_get_connect_status(); while (status != STATION_GOT_IP) { delay(1000); status = sdk_wifi_station_get_connect_status(); switch (status) { ca...
C
#include <graphics.h> #include <string.h> extern struct textsettingstype textsettingstype; int textwidth(char *textstring) { if(textsettingstype.font == DEFAULT_FONT) return ((textsettingstype.charsize << 3) * strlen(textstring)); else return 0; }
C
// 程序有bug, 一个客户端主动关闭后,服务端终端不再有输出 #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <arpa/inet.h> #include <signal.h> #include <sys/wait.h> #include <errno.h> void callback(int num); int childWork(int cfd); int main(int argc, char const *argv[]) { int lfd = socket(AF_INET, S...
C
#include "i2clcd8574.h" #include <string.h> #include <time.h> uint8_t pinTranslation[8] = {}; int file; uint8_t bus = 1; char *devpath = "/dev/i2c-%d", dev[20]; uint8_t address = 0x27; uint8_t topo = 4; int main(int argc, char **argv) { char buf[10] = {0}; char customChars[2][8] = { { 0b...