language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include "holberton.h" void print_nonzero(unsigned long int); /** * print_binary - Prints the binary representation of a number * if the number is equal to 0, otherwise call print_nonzero * * @n: number to print binary representation */ void print_binary(unsigned long int n) { if (n == 0) { _putchar('0'); re...
C
#include<stdlib.h> #include<math.h> #include<time.h> #include<unistd.h> #include<memory.h> #include<stdint.h> #include<stdio.h> #include"linkedlist.h" #define pause() clear(); getchar() struct Student { uint8_t grade; uint8_t age; struct Student * next; }; void clear(void) { char buffer[100]; ...
C
#include "RingBuffer.h" #include <stdbool.h> #include <stddef.h> #include <stdlib.h> #include <assert.h> #include <stdio.h> #include <memory.h> typedef struct Node { Data item; Node *next; } Node; typedef struct RingBuffer { Node *first; Node *last; int n; } RingBuffer; char *Data_toString(Data d...
C
#include "bib.h" #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> void insereFila(fila **pont, int chave, char *nome){ assert(pont); printf("%s\n", nome); if(*pont == NULL){ *pont = (fila *) malloc(sizeof(fila)); if(*pont != NULL){ (*pont)->chave = chave; strcpy((*pont)->no...
C
#ifndef __MATH_IRP_H__ #define __MATH_IRP_H__ /* NOTE: some of this code is unnecessary and going to be removed later */ #include <stdint.h> #include <sys/cdefs.h> #if defined(TEST_DIV) || defined(TEST_IRP) #include <stdio.h> #endif #define MALT_IRP_GUESS_CONST (48.0 / 17.0) #define MALT_IRP_GUESS_FACTOR (32 / ...
C
#include <stdio.h> #include "shapeobj.h" int main() { int i; double area; OBJECT *arrShapes[3]; // Base *ptr[3]; arrShapes[0] = newCircle(4,5,1); arrShapes[1] = newRectangle(14,35,16,7); // arrShapes[1] = newRect(5,6,4,3,); for (i = 0; i < 2; ++i) { send_message(arrShapes[i], COMPUT...
C
#ifndef DBCONNECTION_H #define DBCONNECTION_H #include <QSqlDatabase> #include <QSqlQuery> #include <QtGui/QApplication> #include <QMessageBox> #include <QSqlDatabase> #include <QSqlError> #include <QFile> #include <QDir> #include <QDebug> #include "settings.h" // Crea la conexion a la BD static bool createConnection...
C
//ֶ֮ //A[low, high)ҳA[X1]A[X2] //ԪرȽϴ //T(n) = 2 * T(n/2) + 2 <= 5n / 3 - 2 #include <stdio.h> void max2(int A[], int low, int high, int* x1, int* x2) { if (low + 1 == high) { *x1 = (A[low] > A[high]) ? low : high; *x2 = (*x1 == low) ? high : low; return; } if (low + 2 == high...
C
#include "queue.h" #include <stdio.h> #include <stdlib.h> static void out_of_memory() { printf("Out of memory.\n"); exit(EXIT_FAILURE); } static int const_one(){ return 1; } static int mult_one(Data d){ return *(int*)d * 2; } int main(){ Data a_data,b_data,c_data; QNode** qu...
C
/* Copyright (c) 1990 UNIX System Laboratories, Inc. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */ /* UNIX System Laboratories, Inc. */ /* The copyright notice above does not evidence any */...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <assert.h> #include <sys/time.h> #define iteraciones 1000000 double tiempoFuncion, tiempoVacia, tiempoSyscall; //tiempos de la función de los syscalls struct timeval tiempoF, tiempoS,tiempoV, tiempoX; long obtener_nanosegundos(struct timeval t){ ...
C
#include "./../../include/sm/enc_dec.h" /* Increase the given sequence number with one. */ void addOneSeqNb(uint32_t *seqNb) { *seqNb = (*seqNb == 0xFFFFFFFF ? 1 : *seqNb + 1); } /* Add the given number and sequence number together. */ uint32_t addMultSeqNb(uint32_t seqNb, uint32_t nb) { uint32_t res; res = seqNb...
C
#include "curl_code.h" #include <unistd.h> #define KNRM "\x1B[0m" #define KRED "\x1B[31m" #define KGRN "\x1B[32m" #define KYEL "\x1B[33m" #define KBLU "\x1B[34m" #define KMAG "\x1B[35m" #define KCYN "\x1B[36m" #define KWHT "\x1B[37m" #define RESET "\033[0m" // Verifica se a palavra encontra-se na pagina bool i...
C
#include "sem.h" #define N 10 #define noOfPorts 10 typedef struct msgPortPair msgPortPair; typedef struct port Port; struct msgPortPair{ int content[10]; int client; }; struct port{ msgPortPair messages[N]; semaphore_t *empty, *full, *mutex; int in; int out; }; Port port[noOfPorts]; void cr...
C
/* -------------------------------------------------------------------------- */ /* --- DEPENDANCIES --------------------------------------------------------- */ /* fix an issue between POSIX and C99 */ #if __STDC_VERSION__ >= 199901L #define _XOPEN_SOURCE 600 #else #define _XOPEN_SOURCE 500 #endif #include <...
C
#include"Operand.h" #include<stdlib.h> /* Initialise the operand -- called from Database.c while initilising all the available commands */ struct Oprnd* init_operand(short int brs, short int ev, short int ov) { struct Oprnd* toRet = (struct Oprnd*)malloc(sizeof(struct Oprnd)); if(toRet == NULL) { p...
C
// // MapHelpers.h // H_A_R_P_S // // Created by David Haylock on 11/11/2015. // // #ifndef MapHelpers_h #define MapHelpers_h #include <stdio.h> #include "ofMain.h" struct MapDetails { string Difficulty; int numberOfLevels; }; struct Map { string difficulty; int level; int timeNeededToSolveMa...
C
#define _GNU_SOURCE #include <unistd.h> #include<stdio.h> #include <sys/wait.h> #include <fnmatch.h> #include <fcntl.h> #include<sys/types.h> #include<dirent.h> #include<err.h> #include<errno.h> #include<sys/stat.h> #include<stdlib.h> #include"myfind.h" int printd(char *n , char *nl) { printf("%s%s" , n , nl); ...
C
Status getMidNOde(LinkList L,ElemType *e) { LinkList search,mid; search = mid = L; while(search->next != NULL) { //searchƶٶmid if(search->next->next != NULL) { search = search->next->next; mid = mid->next; } else { search = search->next; } } *e = mid->data; return OK; }
C
#include<stdio.h> int a[200],isp[200][200],ansl,ansr ; int check(int l,int r) { for(int i=l;i<=r;i++) if(a[i]!=a[l+r-i]) return 0 ; return 1 ; } int check2(int l,int r) { for(int i=l;i<r;i++) if(isp[l][i] && isp[i+1][r]) return 1 ; return 0 ; } main() { int n=0 ; while(scanf("%d",&a[n++])!=EOF) ...
C
#include "r_aux.h" int Segno(int x) { if (x > 0) return 1; else if (x < 0) return -1; else return 0; } // interna bool Uguale(double x, double y) { if (x == R_PosInf) { if (y == R_PosInf) return true; else return false; } else if (x == R_NegInf) { if (y == R_NegInf) return true; else ...
C
#include <lrcu/lrcu.h> /* Simple API usage example */ #define INVALID_C_BEFORE ((u64)-1ULL) #define INVALID_C_AFTER ((u64)-2ULL) struct shared_ptr{ void *ptr; int reader_timer, writer_timer; int flag; }; struct shared_data{ u64 c; struct shared_ptr *shptr; }; struct shared_data *shared_dat...
C
#include "printf.h" int ft_printf(const char *restrict format, ...) { va_list ap; va_start(ap,format); while (*format) { while (*format != '%' && *format) { ft_putchar(*format); format++; } format++; ft_recog(ap, *format); format++; } va_end(ap); }
C
/* File : opnd.c * By : Kylie Lin * Login: link6 * team : Two Teams * date : 12/8/17 * members: Minyoung Kim, Michael Lieu */ /* * opnd.2 is for driver2 *this is opnd.c for calc */ #include<stdio.h> #include"chrutil.h" #include"exponent.h" #include"display.h" #include"tfdef.h" #define DISPLAY int get_opn...
C
#include <limits.h> #include <stdint.h> #include <s8-helpers.h> #define HALF_MAX_BIT (sizeof(uint32_t) * 4) static int highest_bit(uint32_t n) { int bit = -1; for(int k = HALF_MAX_BIT; k > 0; k>>=1) { if(n >> k) { bit += k; n >>= k; ...
C
#include "device_stm32.h" // On teste juste le device ici #include <assert.h> #include <string.h> #include <stdio.h> unsigned char BYTES[] = "Hello World!"; int main() { char buffer[100]; int nbRead; proto_Device_t device = devstm32_create(); device->open(device, ""); nbRead = device->read(devi...
C
/* Contador de palavras * * Este programa recebera uma serie de caracteres representando palavras em sua * entrada. Ao receber um caractere fim de linha ('\n'), deve imprimir na tela o * numero de palavras separadas que recebeu e, apos, encerrar. * * Nome: Thomás Portugal * RA: 187646 */ #include <stdio.h> i...
C
#ifndef LINKED_LIST_LINKED_LIST_H #define LINKED_LIST_LINKED_LIST_H typedef struct node{ int data; struct node* next; } node_t; void init(node_t** current_node, int size); node_t* write(node_t* current_node, int data); int is_below_threshold(node_t* current_node, int threshold); int add_node(node_t* current_n...
C
#include "sfp.h" #include <stdlib.h> #include <string.h> #include <stdio.h> #define TMin (int)-2147483648 #define TMax (int)2147483647 typedef union{ unsigned u; sfp s; struct{ unsigned frac : 16; unsigned exp : 7; unsigned sign : 1; // unsigned dummy : 8; }raw; }mysfp;...
C
#include <stdio.h> #include <cs50.h> #include <string.h> int main (int argc, string argv[]) { int keylen = strlen(argv[1]); printf("%i\n",keylen); char argkey[keylen]; for (int z=0; z<keylen; z++) { argkey[z]=argv[1][z]; } int ucase[26]; char uacase[26]; ...
C
#include<stdio.h> int main() { float a,area,volume;//surface area printf("\nEnter the any size of a cube:\n"); scanf("%f",&a); area=6*(a*a); volume=a*a*a; printf("\nSurface area of cube is:%0.3f",area); printf("\nVolume of a cube is :%0.3f ",volume); return 0; }
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> #define BUFFER 1024 typedef enum {FALSE=0, TRUE} bool_t; bool_t isName(char* arr); bool_t isAge(char* arr); int main(int argc, char* argv[]) { if( argc != 3 ) { printf("Invalid number of arguments"); return 0; } if ( isName(ar...
C
/* print-if.c * * See overview comments in * * src/runtime/c-libs/lib7-socket/print-if.h * * This routine is not really socket-specific, so it * probably belongs in some more general directory, * but initially at least I'm using it to debug * socket stuff, so this location will do for now. -- 2010-02-21 Cr...
C
/* * Bibliothque de fonctions pour l'utilisation de l'cran LCD DOG EA 163 * 3 x 16 caractres en mode SPI - Ncessite la bibliothque spi.h * A inclure dans les projets * #include "spi.h" * #include "lcd.h" */ #include "spi.h" /* Ecran LCD */ #define RS_LCD PORTAbits.RA0 // out // LCD /* * Initialisation de...
C
# include<stdio.h> int aaa=10; int bbb=20; void SWITCH(void); int main() { printf("aaa=%d bbb=%d\n",aaa,bbb); SWITCH(); printf(" after calling SWITCH procedure, aaa=%d bbb =%d\n",aaa,bbb); return 0; } void SWITCH (void) { int temp; temp=aaa; aaa=bbb; bbb=temp; return; }
C
/* * An example showing how a sentry can be used for more advanced * security model. In CHERIv8 every function is actually a sentry. * However sentries can allow for additional security when used with * a level of indirection. In this example an assembly trampoline is * used to load additional data, that isn't ava...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.c :+: :+: :+: ...
C
/********************** Faa um programa que mostre as tabuadas dos nmeros de 1 a 10. **********************/ #include <stdio.h> int main() { int i, a, multip; printf("Tabuada de 1 a 10.\n"); for(a = 1; a < 11; a++) { i=0; while(i<11) { multip = a*i; p...
C
/* 编写一个程序吧一个单词读入一个字符数组中,然后倒叙打印这个单词。提示:strlen() */ #include<stdio.h> #include<string.h> int main() { char n[20]; int n_len; printf("input a word\n"); gets(n); n_len = strlen(n); for (int j = n_len;j>0;j--){ printf("%c",n[j-1] ); } return 0; }
C
/* * This is sample code generated by rpcgen. * These are only templates and you can use them * as a guideline for developing your own functions. */ #include "add.h" #include <time.h> // function to get server time and adding appropriate delay void add_prog_1(char *host) { struct timespec begin, end; // start ...
C
#include <stdio.h> #include <stdlib.h> /* Escreva uma funo que recebe um inteiro positivo m e devolve 1 se m primo, 0 em caso contrrio. (b) Escreva um programa que leia um inteiro no-negativo n e imprima a soma dos n primeiros nmeros primos. 2. (a) Escreva uma funo que recebe um nmero inteiro n>0 e devolve o n...
C
#include "mm256_unsigned_extend_epi8_to_epi32.h" #if __x86_64__ #if defined(HAVE_AVX_INSTRUCTIONS) && defined(HAVE_AVX2_INSTRUCTIONS) static _Alignas(64) __m256i shuffle_epi8_m256[2]; static _Alignas(64) __m256i permutevar8x32_epi32_m256[1]; /* Description Unsigned extend packed 8bit integers from a to packed...
C
#include <stdio.h> int main(void) { int dividend = 0; int divisor = 0; printf("Введите a и b \n"); scanf("%d %d", &dividend, &divisor); int result = 0; while (dividend > divisor) { dividend -= divisor; result++; } printf("Неполное частное равно %d", result); r...
C
#include <stdio.h> /* header file */ int main (int argc, char const *argv[]) { int a,b,c; printf("\nPlease Enter A Number: "); scanf("%d", &a); printf(" Please Enter A Second Number: "); scanf("%d", &b); c=a+b; printf("%d + %d = %d \n", a,b,c); return 0; //function returns 0 (ok) }
C
/* Bark: * * The game consists of a deck of cards and a board (a rectangular grid with * spaces to place cards). The deck consists of cards each having a number * between 1 and 9 (inclusive) and a suit (represented by a capital letter). * * A new game will end immediately if there are not at least 11 cards in the...
C
// // main.m // 01排序算法 // // Created by peng on 15/10/10. // Copyright © 2015年 test. All rights reserved. // #include <stdio.h> /** * 排序算法简介 * 排序算法分为内排序和外排序。 * 内排序:被排序的数据都在内存里面,排序的过程中不会访问外存设备(如:硬盘) * 外排序:被排序的数据比较大,不能一次性都放到内存当中,排序的过程中需要访问外部设备(如:硬盘) * * * 内排序分为:插入排序、选择排序、交换排序、归并排序、基数排序。 * * 插入排序:直接插入排序...
C
/* exectestprogram1.c * exectest "Exec's" this executable into a new process to test the Exec system call. */ #include "syscall.h" void main() { int i; PrintOut("Running test1\n", 14); for (i = 0; i < 8; ++i) PrintOut("This will be printed 8 times\n", 29); PrintOut("test1 complete\n", 15); Exit...
C
#include <errno.h> #include <stdio.h> #include <stdlib.h> int posix_memalign(void **memptr, size_t alignment, size_t size) { fprintf(stderr, "FIXME: posix_memalign implemented without alignment\n"); *memptr = malloc(size); return *memptr ? 0 : ENOMEM; }
C
#include <stdio.h> #include <stdlib.h> void c_convolve(const int nsources, /*scalar - number of sources*/ const int noutlets, /*scalar - length of subset*/ const int subset_length, /*scalar - length of subset*/ const int x_size, ...
C
/* blah_util.h Defines some useful functions */ #ifndef _BLAH_UTIL #define _BLAH_UTIL #include "blah_types.h" /* Function Prototypes */ #ifdef __cplusplus extern "C" { #endif //__cplusplus int blah_util_randRangeInt(int min, int max); //returns a random integer in the range of min..max void blah_util_byteSwa...
C
#include "common.h" char PS1[MAX_COMMAND_LENGTH] = "\033[32m[\\u \\p]$\033[0m "; char PS1Buf[MAX_DIR_CONCAT_LENGTH]; //char now_dir[1024]; // 打印提示符 int putPS1() { static char * x[1] = {PS1Buf}; int retc; size_t pos = 0; size_t len = strlen(PS1); while(pos < len) { if(PS1[pos] == '\\' && p...
C
/** * Parallel Make Lab * CS 241 - Spring 2019 */ #include "format.h" #include "graph.h" #include "parmake.h" #include "parser.h" #include "set.h" #include "queue.h" #include <stdio.h> #include <pthread.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <time.h> graph *g = NULL; set *visit...
C
#include "drivers\hitechnic-gyro.h"; #include "drivers\hitechnic-irseeker-v2.h" /* Made by Team 6299 QuadX - Jacob Greenway - Joshua Johnson - Linnea May */ float heading = 0; float valInRange(float val, float threshold = 1.0) { return (abs(val) <= threshold) ? 0 : val; } bool isInRange(float heading, float ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "dynamic-array.h" // #define DELETE_TEST #ifdef DELETE_TEST #define SIZE 10 #endif int main(void) { int ret = 0; size_t nr_case = 0; #ifndef DELETE_TEST size_t i = 0; #endif struct dynamic_array *array = NULL; #ifndef...
C
#include <stdio.h> #include <conio.h> #include <stdlib.h> #include <locale.h> #include <math.h> #include <string.h> #include <time.h> float media_sal(float sal[], int n){ float media =0; int i; for(i=0; i<n; i++){ media = media + sal[i]; } media = media / n; return media; } int maior_sa...
C
/* $NetBSD: psym_switch_expr.c,v 1.4 2022/04/24 09:04:12 rillig Exp $ */ /* * Tests for the parser symbol psym_switch_expr, which represents the keyword * 'switch' followed by the controlling expression, now waiting for a * statement (usually a block) containing the 'case' labels. */ //indent input // TODO: add i...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* checker_parse_tab.c :+: :+: :+: ...
C
#include <stdlib.h> #include <math.h> #include "dbg.h" #include "randnum.h" #include "vector.h" dreal vect_Dotprod_dreal(const vect_dreal *vect_a, const vect_dreal *vect_b) { int ndim_a, ndim_b, idim; dreal prod; check_mem(vect_a, "vect_a"); check_mem(vect_b, "vect_b"); ndim_a = vect_a->ndim; ndim_b =...
C
/*编写如下set_idx函数, 接收元素类型为int型、元素个数为n的数组 ,并为所有元素赋上和下标相同的值。 */ #include <stdio.h> void set_idx(int *v, int n) { int i; for (i = 0; i < n; i++) { *(v + i) = i; } } int main() { int i, n; printf("请输入一个整数:\n"); scanf("%d", &n); int a[n]; set_idx(a, n); ...
C
/**This is a program implementing Linkbed List and all basic operations like insertion, deletion etc. * This program is implemented for problems available on Geeks for Geeks. */ /**This method will intialize the linked list. * The header node will be assigned. This method is automatically called before * creation...
C
/* Tests.h Functions for testing and debugging. Adrian Clinansmith April 20, 2019 */ #ifndef TESTS_H #define TESTS_H #include <stdio.h> #include <stdbool.h> #include <string.h> #include <tgmath.h> /****************************/ /*** return value testing ***/ /****************************/ /* Macro that exchanges a...
C
/* Create C arrays from jpeg images using this online tool: http://tomeko.net/online_tools/file_to_hex.php?lang=en If needed, first resize and crop to an appropriate width and height to suit your display with an image editing program such as IrfanView. You can also change the image "quality" to re...
C
#include<stdio.h> #include<math.h> int main() { int urut[8],angka[4]; int dari,tampung=0,nomer=0; int basis,a,b,sisa,hasil; scanf("%d %d",&dari,&basis); int i; for(i = 3; i >=0; i--) { scanf("%d", &angka[i]); //angka[3]=1 angka[2]=0 angka[1]=1 angka[0]=0 } for(i = 0; i ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* find_data.c :+: :+: :+: ...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include "hex.h" #include <assert.h> /*The block cipher*/ char cipher(unsigned char block, char key) { //this is an affine cipher where "a" is fixed at 11 and b=key return (key+11*block)%256; } /*The inverse of the block cipher*/ char inv_cipher(unsigne...
C
#include "ListInterface.h" void Initialize (List *L) { int i=0; //Loop initializes each student in list for (i=0; i<MAXLISTSIZE; i++) { strcpy(L->items[i].name, ""); L->items[i].grade = 0; } L->count = 0; } void Insert (Item X, int position, List *L) { #ifdef DEBUG ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* motion_reader.c :+: :+: :+: ...
C
#include<stdio.h> #include<stdlib.h> int main(int argc, char *argv[]){ //Check if user inputted an arguement if(argc != 2){ printf("error\n"); return 0; } //determine if number is even or odd char *result = (atoi(argv[1]) % 2 == 0) ? "even\n" : "odd\n"; printf("%s", result...
C
#include <math.h> #include <stdio.h> int main(){ double x; double y; if (sin(x) - cos(y) < 0.0000000001) { printf("Solved 02"); } return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> struct Casilla{ char tipo; int estado; int minas; char etiqueta; }; typedef struct Casilla tipoCasilla; tipoCasilla** crearTablero(int filas,int columnas); void inicializarJuego(int filas,int columnas,tipoCasilla** nmatrix); char asig...
C
#include "config.h" #include <stdio.h> #include <string.h> #include <ctype.h> #include <stdlib.h> int parse_line( const char* line, char** key, char** val ) { const char* cursor = line; char key_buf[1024]; char val_buf[1024]; int i = 0; /* parse \s*(\w*)\s*=\s*(\w*) */ while( *cursor && isspace(*cursor) ) cur...
C
#include <stdio.h> #include <stdint.h> #include <stdlib.h> int visited[1000] = {0}; struct Node { int vertex; struct Node* next; }; struct Graph { int numVertices; struct Node** adjList; }; typedef struct Node Node; typedef struct Graph Graph; Node* createNode(int v) { Node* node = (Node*)mall...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include "llist_queue.h" // Queues are FIFO data structures // I will implement init, push, pop, peek, clear, and isEmpty methods. // I will use a doubly-linked list, and keep track of both ends. int test(void){ Queue* queue = initQueue(); if(isEmpty...
C
#include <stdio.h> int main() { int ara1[] = {3, 1, 5, 2, 4, 6, 8, 7}; int ara2[10]; int i, n = 8, minimum, index_2, minimum_index; printf("Original value: "); for (i = 0; i < n; i++) { printf("%d ", ara1[i]); } for (index_2 = 0; index_2 < n; index_2++) { minimum = 10000;...
C
//------------------------------------------------------------------- // // ubNwb_[ (block.h) // Author:Itsuki Takaiwa // //------------------------------------------------------------------- #ifndef _BLOCK_H_ #define _BLOCK_H_ #include "main.h" //-----------------------------------------------------------...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include <mysql.h> typedef struct { char name[32]; int type; char language[30]; char expansion[255]; } Acronym; MYSQL *conn; char *output_filename = "acronyms.tex"; char *languages_priority[] = {"Portuguese", "English", NULL}; char ...
C
#include<stdio.h> int main(){ char ara[100]; int i; printf("Enter your string: "); gets(ara); for(i=0;i<strlen(ara);i++){ if(ara[i]>='a' && ara[i]<='z') ara[i]-=32; ...
C
// // Created by maciek on 20.08.16. // #include <stdlib.h> #include <stdio.h> #include <string.h> #include "structure.h" #include "messages.h" DiseaseList* initialiseDiseaseList(){ DiseaseList* list = malloc(sizeof(DiseaseList)); list->first = malloc(sizeof(Disease)); list->first->prev = NULL; list-...
C
/************************************************** * * Davi Ferreira Santo * Trabalho 2 * Professor: Diego Rubert * */ #include <stdio.h> #include <stdlib.h> #include <time.h> #define MAX 10 typedef struct { int vezes; int faces; int mod; } dados; typedef struct { char nome[MAX+1]; char ra...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* draw.c :+: :+: :+: ...
C
#include <time.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/time.h> #define TEST1 777777777 #define TEST2 2222222222 #define PTEST 250000000 //#define PTEST 125000000 //#define PTEST 62500000 //#define PTEST 31250000 //#define PTEST 8 int arr[PTEST] = ...
C
#include "cesl_mpsc_llfifo.h" #include <cesl_compiler/cesl_atomic.h> #include <string.h> #include<stdint.h> // ----------------------------- // PRIVATE: Helper functions --- // ----------------------------- size_t cesl_mpsc_llfifo_inc_index (cesl_mpsc_llfifo_t* self, size_t index) { // NOTE: For modulo of power of...
C
#include "BinsonObject.h" #include "BinsonArray.h" BYTE* cBSONInteger_to_bytes(int64_t value,IntValueType type,size_t* size); BYTE* cBSONField_to_bytes(BinsonField* pObj,size_t* size); BinsonField* cBSON_parse_field(BYTE* rawData,size_t startIdx,size_t* pEndIdx,size_t byteSize,bool skipFielname); //function to ...
C
#define Array(TYPE) struct { TYPE* data; int size; int used; } #define initArray(A, TYPE, I) A.data = malloc(I * sizeof(TYPE)); A.used = 0; A.size = I #define initArrayP(A, TYPE, I) A.data = malloc(I * sizeof(TYPE)); A.used = 0; A.size = I; for(int i = 0; i < A.size; i++){TYPE arr = {NULL,0,0};A.data[i]=arr;} #define i...
C
// main.c // author: Christophe VG <contact@christophe.vg> // based on basic-in-atmega168.c from tutorial on Sparkfun #include <stdio.h> #include <avr/io.h> #include <string.h> #include "../moose/avr.h" #include "../moose/bool.h" #include "../moose/serial.h" #define MAX_CMD_SIZE 64 #define STATUS_PORT PORTC #defin...
C
// The merge-sort involves breaking the given array into two sub-arrays of equal-arrays // And then comparing the elements at every step and finally merging them into an array // INcluding standard C library # include "stdio.h" // Function declaration void mergeSort(int, int, int []); void merge(int, int, int, int []...
C
#include <stdio.h> #include <stdlib.h> #include <fftw3.h> #include "./../commons/commons.h" #define EVEN 0 #define ODD 1 fftw_complex *double_to_fftw_complex(double *signal, int N) { int i; fftw_complex *signalFftw = (fftw_complex *)fftw_malloc(N * sizeof(fftw_complex)); for (i = 0; i < N; i++) { ...
C
#include<stdio.h> int main(void) { unsigned int k,Map[8],Power[8],N_Bits,Test,Value,N_Table,j,m; FILE *out; printf("Enter Number of Bits = ? "); scanf("%d",&N_Bits); for(k=0,m=1;k < 8;k++,m=2*m) Power[k] = m; N_Table = 1; k = N_Bits; while(k > 0){ N_Table = 2 * N_Table; k--; } printf("\n\n\n"); for(k=0;k < N_Bits;k++){...
C
/* * TabelaHash.c * * Created on: 12 de nov de 2018 * Author: n226804875 */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <stddef.h> #include "TabelaHash.h" #include "ArvoreRedBlack.h" void criaHash(HASH hash) { int i; for (i = 0; i < TAM_TABELA; i++) strcpy(ha...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #define MAXLINES 5000 // 待排序的最大行数 #define MAXLEN 1000 char *lineptr[MAXLINES]; // 指向文本行的指针 int readlines(char *[], int); void writelines(char *[], int); int getline(char [], int); void my_qsort(void *[], int, int, int, int (*comp)(void *, void *)); int ...
C
#include "private/malloc_private.h" void free_zone(t_malloc_zone **zone_list, t_malloc_zone *zone) { size_t zone_size = 0; if (zone == NULL) return; if (zone->prev) zone->prev->next = zone->next; if (zone->next) zone->next->prev = zone->prev; if ((*zone_list) == zone) (*zone_list) = (*zone_list)->next; ...
C
#include <stdio.h> int main(void) { char str[8] = {'a', 'b', 'c', '\0'}; char str1[8] = "abc"; char *s = "abc"; str[1] = 'A'; printf("%s\n", str); s[1] = 'A'; printf("%s\n", s); return 0; }
C
#include <stdio.h> /*Leia 2 nmeros inteiros, calcule e escreva o quociente e o resto da diviso do 1o pelo 2o. */ int main(){ int x, y; float quociente, resto; printf("Escreva o Pimeiro numero: "); scanf("%i", &x); printf("Escreva o Segundo numero: "); scanf("%i", &y); quociente = x / y; ...
C
// // problem_16-19.c // week1-cont // // Created by Sean Reed on 6/10/14. // Copyright (c) 2014 seanreed.test. All rights reserved. // #include <stdio.h> #include <math.h> int main(int argc, char *argv[]){ //calculate 3^2 int power = pow(3,2); //16. Calculate the nth power of an integer e.g. 32...
C
#include <stdio.h> int main(){ float num[10], somaNeg=0, somaTotal=0; int i, quantPos=0, quantNeg=0, quantNul=0; printf("Digite 10 numeros quaisquer: "); for(i=0; i<10; i++){ scanf("%f", &num[i]); if(num[i]>0){ quantPos++; } else if(num[i]<0){ quantNeg++; somaNeg += num[i]; } else{ quantNul+...
C
#include<stdio.h> int G[1005][1005]; int len[1005]; int vis[1005]; int end_node = 0; void dfs(int node) { int i; vis[node]=1; for(i=0;i<len[node];i++) { if(vis[G[node][i]]==0) { dfs(G[node][i]); } } } int main() { /* Node Indexing starts from 0 */ int i,n,m,u,v,check=1; printf("Enter no. of nod...
C
/* Problem: <Problem here> For example: Test | Result ------------------------------------------------ | | | ------------------------------------------------ | | | ------------------------------------------------ | | | */ #include <stdio.h> #include <math.h> ...
C
/* ** EPITECH PROJECT, 2020 ** tetris ** File description: ** count the spaces */ #include "tetris.h" int get_space(char *str) { int space = 0; for (int i = 0; str[i] != '\0'; i++) if (str[i] == ' ') space++; return (space); }
C
#include <stdlib.h> #include <stdio.h> #include <assert.h> #include <limits.h> // This template is only a guide // You need to include additional fields, data structures and functions // data type for heap nodes typedef struct HeapNode { // each node stores the priority (key), name, execution time, // release time...
C
// // Created by Kevin Arévalo on 20-05-19. // #include "cpu.h" #include "../Auxiliar/binary_ops.h" #include "register.h" #include "instr_mem.h" #include "ram.h" #include "../Auxiliar/custom_string_ops.h" #include <stdlib.h> #include <string.h> /** * Inicia un procesador con PC en 0 y memoria de instrucciones y ram ...