language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> int main() { int input = 0, x = 0; int sum = 0; printf("Input a positive number less than 500: "); scanf("%i", &x); input = x; while ( x != 0 ) { sum += x % 10; x /= 10; } printf("Sum of the digit %i is: %i\n", input, sum); return 0; }
C
#include <stdio.h> #include <sys/time.h> #include "cycle.h" int main(void){ struct timeval t1,t2; double elapsedTime; unsigned int N=10; //while(N<10000){ LinkedList *l=createList(N); printf("Total heap space=%u\n", spaceAllocated); l=createCycle(l); //gettimeofday(&t1, NULL); printf("%s\n",testCyclic(l))...
C
#define F_CPU 16000000UL //freq 16 MHz #include <avr/io.h> #include <avr/pgmspace.h> #include <avr/interrupt.h> #include <util/delay.h> #include "SPI_routines.h" #include "SD_routines.h" #include "UART_routines.h" #include "i2c_routines.h" #include "ADC_routines.h" #include "FAT32.h" #define INTERVAL 1000 //interval...
C
/* ** 2001 September 15 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** *******************...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_ls.c :+: :+: :+: ...
C
/* NAME: Pi_mc: PI Monte Carlo Purpose: This program uses a Monte Carlo algorithm to compute PI as an example of how random number generators are used to solve problems. Note that if your goal is to find digits of pi, there are much better algorithms you could use. Usage: To keep the ...
C
/********************************************************************** * parcoursEnLargeur.c * * (Djebien Tarik) <tarik.djebien@etudiant.univ-lille1.fr> * * PROCEDURE en_largeur(G,s) * Parcours en largeur d'abord de la composante connexe s, * sans tenir compte des orientations. * DEBUT * colorier en...
C
#include <stdio.h> int minWire(int, int, int*); int main() { int t, n, c, i, j, Arr[100000], dummy[100000], wire = 0, check = 0; scanf("%d", &t); while(t--) { scanf("%d", &n); c = getchar(); i = 0; while((c = getchar()) != '\n') { if(c == '0') ...
C
#include <signal.h> #include <stdlib.h> #include <unistd.h> int main(int argc, char **argv) { if (argc == 1) { system("echo $HOME"); //if (fork() == 0) system("./Terminar 100 &"); //if (fork() == 0) system("./Terminar 5 &"); } sleep(argc > 1 ? atoi(argv[1]) : 200); kill(0, SI...
C
/******************************************************************************* * File : 1947.c * Author : tainzhi * Mail : qfq61@qq.com * Created : 2017-04-17 13:23:51 * Modified : 2017-04-17 13:26:54 *******************************************************************************/ #include <stdio.h> #incl...
C
#include "holberton.h" #include <stdio.h> /** * main - Entry point * * Return: Always 0 (Success) */ int main(void) { long num = 612852475143; int i = 2; int max = 0; while (num != 1) { while (num % i == 0) { if (i > max) max = i; num = num / i; } i++; } printf("%d\n", max); return (0); }
C
#include <stdio.h> #include <string.h> void main (void) { char *(*puntero[10])(char&,char (*)(char),char,char *); char info[]="Esto es una prueba"; printf ("%d",sizeof(char)*(strlen(info)-2)); }
C
#include <time.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <omp.h> #include "util.h" int main(int argc, char const *argv[]) { if (argc != 3) { printf("usage: [exec] [point num] [thread num]\n"); return -1; } int pnt_nums, thread_nums; sscanf(argv[1], "%d", &...
C
#include<stdio.h> void f(); void b(); int qunju = 5; int main() { f(); f(); b(); return 0; } void f() { static int a = 1;//static声明后a为全局变量 但是针对函数内是初始化 1 次,再次调用时结束值 //其他函数 不可以调用此值 //概括就是 全局变量是 全局的生存期 本地的作用域 //全局变量呢 地址都是放在一起的 一次排列 而 对于局部变量他存放的地址 和 全局变量的地址有很大的差别 printf("%d\...
C
#include <stdio.h> #include <string.h> int main() { printf("Vvedite n\n"); int n; scanf("%d", &n); int k = 1; for(int i = n - 1; i >= 0; i--){ for(int j = 0; j < i; j++) printf(" "); for(int j = 0; j < k; j++) printf("*"); for(int j = 0; j < i; j++) ...
C
#include <stdio.h> #define MAXN 40 int n; int a[MAXN][MAXN]; int main() { int i, j; scanf("%d", &n); a[0][0] = 1; for (i = 0; i < n; ++i) { a[i][0] = a[i][i] = 1; for (j = 1; j < i; ++j) a[i][j] = a[i-1][j-1] + a[i-1][j]; } for (i = 0; i < n; ++i) { fo...
C
#include<stdio.h> void main() { clrscr(); int n; printf("\nEnter a no"); scanf(%d,&n); if(n==0) { printf("no is zero:); } else if(n%2==0) { printf("even no"); } else { printf("odd no"); } }
C
/*************************************************************************** server.c Version: 2.25 Wed Aug 31 10:33:22 2011 Copyright 2011 Karolina, Patricia, Pedro Email: {karol.milano, lvlayumi, ptersnow}@gmail.com *************************************************************************...
C
/* Copyright (c) 2019-2020, Adrien BLASSIAU and Corentin JUVIGNY Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE A...
C
#define N 6 extern char gameboard[N][N]; extern int ROWS, COLS; extern int turn; extern int fW, fE, fN, fS, fNW, fNE, fSW, fSE; void flip_condition() { int i, k, l; //for if(turn==0) { // if(ROWS<N-2&&gameboard[ROWS+1][COLS]=='X'){ // for(k=1;k<N-1;k++) { if(gameboard[ROWS+k][COLS]=='X'&&game...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<netdb.h> #include<netinet/in.h> #include<sys/types.h> #include<sys/socket.h> #include<fcntl.h> #include<unistd.h> //#define PORT_NUM 8887 #define MESSAGE_MAX_LEN 99999 #define PAYLOAD_MAX_LEN 9999 #define PATH_MAX_LEN 9999 char PORT_NUM[4] = "8887"; cha...
C
#include "cbase.h" void buffer_assign_data_fast(Buffer *buffer, const char *bytes, size_t len) { array_assign_fast(&buffer->array, bytes, len); } bool buffer_assign_data(Buffer *buffer, const char *bytes, size_t len, Status *status) { return array_ass...
C
#include <stdio.h> #include <stdlib.h> #include <sys/shm.h> #include <sys/sem.h> int main(){ int *soma, x=3, y=3; int idMem; /* identificador da memória comum */ int sem; struct sembuf P, V; P.sem_num=0;P.sem_op= -1; P.sem_flg=0; V.sem_num=0; V.sem_op=1; V.sem_flg=0; if ((sem = semget(IPC_PRIVATE, 1, ...
C
#include<cs50.h> #include<stdio.h> #include<string.h> int main(void) { FILE* file = fopen("phonebook.csv", "a"); char* name = get_string("Name: "); char* number = get_string("Number: "); fprintf(file, "%s,%s\n", name, number); fclose(file); }
C
#include "client.h" char *client_name,*connect_type,*socket_path,*port_no; int serv; int main(int argc, char** argv){ if(argc!=4){perror("Error: wrong ammount of args");exit(-1);} if (strlen(argv[1]) != M_NAME_LENGTH) {perror("Error: wrong client name");exit(EXIT_FAILURE);} if (!streq(argv[2], "network") && !st...
C
#include <stdlib.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include "lsmcolors.h" #include "ansicodes.h" #include "lsmount.h" void initcolors(void) { colors[0] = ANSI_ESC_RED; colors[1] = ANSI_ESC_GREEN; colors[2] = ANSI_ESC_BLUE; colors[3] = ANSI_ESC_YELLOW; colors[4] = ANSI_ESC_WHITE; color...
C
#include <stdlib.h> #include "index_vec.h" struct index_vec { size_t *arr; size_t cap; size_t len; }; struct index_vec *index_vec_new(void) { size_t cap = 1; size_t *arr = malloc(cap * sizeof *arr); struct index_vec *vec = malloc(sizeof *vec); vec->arr = arr; vec->cap = cap; vec->...
C
#include <stdio.h> #include <omp.h> #include <stdint.h> #include <math.h> #include "io-util.h" #include "rand.h" #define PI 3.14159265358979323846 int main(){ //prompt for input uint64_t tosses; { StreamIterator iter = allocStreamIter(stdin); printf("Enter Tosses: \n"); tosses = r...
C
#include "sparse_matrices.h" /** * HELPER FUNCTIONS */ void fill_nnz_int(struct Matrix *, struct sparse_csr *); void fill_nnz_double(struct Matrix *, struct sparse_csr *); void fill_IA_JA(struct Matrix *matrix, struct sparse_csr *matrix_csr); // CONVERT MATRIX INTO SPARSE CSR FROMAT void matrix_to_csr(struct Matrix...
C
/* * File: main.c * Author: carlostovar * * Created on 30 de noviembre de 2016, 7:19 */ #include <stdio.h> #include <stdlib.h> #include <time.h> /* * */ int main(int argc, char** argv) { int patron[2][2]; int matriz[10][10]; int i,j; int ok; ok=0; printf("\n\nLa matriz aleatoria es:\n\n"); ...
C
#include <stdio.h> #include <string.h> int main() { /* unformatted char input | unformatted char output int gfetc(FILE *fp) / getc(FILE *fp) | int fputc(int c, FILE *fp) / putc(int c, FILE*fp) returns the input char from stream | returns EOF on error else positive number returns ...
C
#include <stdio.h> int platform1D(int ar[], int size); int main() { int i,b[50],size; printf("Enter array size: \n"); scanf("%d", &size); printf("Enter %d data: \n", size); for (i=0; i<size; i++) scanf("%d",&b[i]); printf("platform1D(): %d\n", platform1D(b,size)); return 0; } int platform1D(int ar[], int size) ...
C
/* en un archivo contiene las notas de los alumnos en cada materia. el archivo esta ordenado por legajo. estructura del archivo: typedef struct Notas { int legajo; char materia[20]; int nota; } Notas ; se pide: 1- crear programa para cargar archivo. 2- crear programa para leer archivo de notas y: 2.1- ...
C
// Implements a dictionary's functionality #include <stdbool.h> #include "dictionary.h" #include <string.h> #include <strings.h> #include <ctype.h> #include <stdlib.h> #include <stdio.h> // Represents a node in a hash table typedef struct node { char word[LENGTH + 1]; struct node *next; } node; // Number of...
C
#include <stdio.h> #include <omp.h> main() { int i,j ,k,n; FILE *fp; i =2; k = 2; j = 0; n = 0; double t_start,t_end,t_sp0,t_sp1,t_sp2,t_sp3,t_sp4,t_sp5,t_sp6,t_sp7,t_sp8; double speedup1,speedup2,speedup3,speedup4,speedup5,speedup6,speedup7,speedup8; fp = fopen("data0.txt","w"); t_start = omp_get_wtime(); for ( i...
C
/* ** EPITECH PROJECT, 2019 ** test_my_put_nbr.c ** File description: ** test nbr */ int my_put_nbr(int nb); int main() { my_put_nbr(1000); my_put_nbr(0); my_put_nbr(-0); my_put_nbr(-2147483647); my_put_nbr(2147483647); my_put_nbr(-42); my_put_nbr(-2147483648); return (0); }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "hash.h" #include "dict.h" //* function name: ReadDictionary //* Description: This function reads a dictionary line by line from the standard input //* Parameters: None //* return value: a Pointer to the dictionery pHash ReadDictionary() { pHash dict...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> struct ListNode { int val; struct ListNode *next; }; struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; }; typedef struct ListNode ListNode; typedef struct TreeNode TreeNode; TreeNode *findCommon(TreeNode *node, T...
C
#include "xc.h" #include "tempSensor_Library.h" void i2c_init(void) { TRISBbits.TRISB0 = 1; // Digital Output (make it input only when reading data) TRISBbits.TRISB1 = 1; // Digital Output TRISBbits.TRISB4=0; //Testing LED output I2C1CON=0x0000; //clear control bits I2C1STAT=0x0000; /...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* helpers2.c :+: :+: :+: ...
C
#include<stdio.h> #define MAX 6 int main(void){ for (int i = 0; i < MAX; i ++){ for (int y = 0; y < MAX; y++){ if (y < i){ printf(" "); }else{ printf("*"); } } printf("\n"); } }
C
/*һṹ,ڱǵڼ,ע*/ #include <stdio.h> int main() { struct time { int year; int month; int day; }; int i,day=0; int month[12]={31,28,31,30,31,30,31,31,30,31,30,31}; struct time Time; printf("Ҫ(ʽ--,,)\n"); scanf("%d,%d,%d",&Time.year,&Time.month,&Time.day); if(Time.year%4==0) { month[1]=29; } for(i=1;i<Time...
C
#include "Rummikub.h" carta * criabaralho(){ carta *Baralho = (carta *) calloc(106, sizeof(carta)); int v; printf("Voce deseja jogar com:\n"); printf("1 - Baralho aleatorio\n"); printf("2 - Baralho pre-definido(Arquivo)\n"); scanf("%d",&v); if(v==1){ srand(time(NULL)); char valores[14] =...
C
// Copyright (c) 2003-2013, LogMeIn, Inc. All rights reserved. // This is part of Xively C library, it is under the BSD 3-Clause license. /** * \file xi_helpers.h * \author Olgierd Humenczuk * \brief General helpers used by the library */ #ifndef __XI_HELPERS_H__ #define __XI_HELPERS_H__ #include <stdlib.h...
C
#include <stdio.h> #include <stdlib.h> void main() { int N = 0, J = 0; int sum = 0; scanf("%d %d", &J, &N); //사탕의 개수 J, 상자의 개수 N개(모두 크기 다름) int* r = malloc(N * sizeof(int)); int* c = malloc(N * sizeof(int)); int* box = malloc(N * sizeof(int)); for (int i = 0; i < N; i++) { scanf("%d %d", &r[i], &c[i]); ...
C
/* Psi-, weight- and psi-prime functions for M-estimators Copyright (C) 2020-21 Tobias Schoch (e-mail: tobias.schoch@gmail.com) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; ei...
C
/**************************************************************************** * Returns the total cpu time used in seconds. * Emulates the Cray fortran library function of the same name. ****************************************************************************/ #ifdef LINUX /* LINUX *...
C
#include <stdio.h> #include <string.h> int main() { int t; scanf("%d",&t); while(t--) { char s[10000]; scanf("%s",s); printf("%.2lf\n",strlen(s)*.01); } return 0; }
C
/* * TASK 7 * By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. * What is the 10 001st prime number? * * Result: 104743 */ #include "euler.h" long task7() { /* * We'll use the sieve of Eratosthenes * A modified version will be used; here, we onl...
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <ctype.h> #include <cwctype> #include <wchar.h> #include <locale.h> #include <string.h> #include <stdio.h> #include <execinfo.h> #include <signal.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <unist...
C
#include <assert.h> #include "int_stack.h" int intstack_new(IntStack *this_, size_t alloc_size) { assert(this_); assert(alloc_size > 0); int *data = (int *)calloc(alloc_size, sizeof(*data)); if (!data) { return ZCPU_ERR_MEM_ALLOC; } this_->index = 0; this_->alloc_size = alloc_s...
C
#include "libmx.h" void mx_pop_back(t_list **head) { if (head == NULL || *head == NULL) return NULL; t_list *delL = NULL; if ((*head)->next == NULL) { free(*head); *head = NULL; } else { while (delL->next->next) { delL = delL->next; } free(delL->...
C
// Вывести строчку написаную после двоеточия или то что написано между двумя двоеточиями #include "Header.h" #include "Functionlist6.2.c" int main() { char x; // Для повтора char *RawLine; // Строчка ввода char *Line; // Форматированая строчка int Length = 0; ...
C
#include <stdio.h> #define N 8 // power of 2 int a[N]; void mark(int x, int y) { int i; for(i = 0; i < y; i++) a[x]++; } rule(int l, int r, int h) { int i, j, t; for (t = 1, j = 1; t <= h; j += j, t++) for (i = 0; l+j+i <= r; i+= j+j) mark(l+j+i, t); } int main(void) { int l = 0, r...
C
#include "system.h" void fifo32_init(FIFO32_STRUCT *fifo, t_U32 size, t_S32 *buf) { fifo->size = size; fifo->buf = buf; fifo->free = size; fifo->flags = 0; fifo->write_entry = 0; fifo->read_entry = 0; } t_S8 fifo32_put(FIFO32_STRUCT *fifo, t_S32 data) { if(fifo->free == 0) { fi...
C
#include "math.h" #include "stdlib.h" #include "string.h" #include "array.h" int** array_chunk(int *array, int arraySize, int chunkSize) { //function to chunk the array with the given chunk size fegew /* *array - pointer to array to be chunked arraySize - number of elements in the array chunkSize - number of e...
C
//DIÞARDAN GÝREN SAYININ RAKAMLARINI TOPLAYAN PROGRAM #include<stdio.h> #include<conio.h> int main() { int sayi,toplam=0,k,ilksayi; printf("sayi gir :"); scanf("%d",&sayi); ilksayi = sayi; while (sayi>0) { k = sayi % 10; sayi = sayi / 10; toplam = toplam + k; } printf("%d",toplam); ge...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <time.h> #include "FunCpIOLA.h" /**************************************************************************************** *********************** SOLICITAR INT, FLOAT, CHAR Y VALIDAMOS ************************* ********************...
C
#include <ipconf.h> #include "net_sas.h" void errno_task(TOOL_VP_INT exinf); /* MODULE_HDR +----------------------------------------------------------+ ** ** <W[> SAS_ERRNO_01 ** ** <> SAS_ERRNO_01( void ) ** ** Ȃ ** ** <^[l> sXe[^X (BOOL) TEST_PASS I ** ...
C
#include <stdio.h> #include <stdlib.h> void quickSort(int *vetor, int inicio, int fim){ int i, j, meio, aux; i = inicio; j = fim; meio = vetor[(inicio + fim) / 2]; do{ while(vetor[i] < meio) i++; while(vetor[j] > meio) j--; if(i <= j){ aux = vetor[i]; ...
C
#include<stdio.h> int main() { //1 Passo: Declaracao das Variaveis float codigo, unidades, preco, desconto, precof; //2 Passo:Entrada de Dados printf("Digite o Codigo do produto comprado: "); scanf("%f", &codigo); printf("Digite a quantidade de produtos: "); scanf("%f", ...
C
/* ** EPITECH PROJECT, 2018 ** zappy ** File description: ** broadcast command */ #include "server.h" /*! * @brief prints the message on file descriptor of receiver * @param receive_fd file descriptor of receiver * @param sender_fd file descriptor of sender * @param name name of team of sender * @param mess message t...
C
//\=========================================================================================== //\ File: gba_input.h //\ Author: Morgan James //\ Date Created: 13/11/2017 //\ Brief: Outlines the registers for GBA Key Input and provides functionality for handling key presses. //\=========================================...
C
#include <string.h> #include "./List.h" #define NAME_LENGTH 20 #define TWITTER_TEXT_LENGTH 140 typedef struct s_userInfo { int tweetCount; int mentionCount; int retweetCount; int likeCount; } UserInfo; UserInfo UserInfo_New(int tweetCount, int mentionCount, int retweetCount, int likeCount); typedef struct s_Use...
C
#include "monty.h" /** * pop - release memory * * @stack: stack * @line_number: number of line * * Return: nothing */ void pop(stack_t **stack, unsigned int line_number) { stack_t *vector; vector = *stack; if (vector == NULL) { free(release.temp); free(release.containerFile); free_h(stack); fclose(re...
C
#include "../../includes/ft_lib_push_swap.h" void ft_checking_pos(t_env *vn, int pos) { int rank; rank = val_to_rank(vn, vn->a->tab[in(vn->a->bot + pos)]); ft_checking(vn, rank); } int ft_calc_head(t_env *vn, int rank) { int pos; int bot; int count; int tmp; count = 1; bot = vn->a->bot; tmp = ra...
C
#include <pebble.h> static Window *s_window; static TextLayer *s_text_layer; static PreferredContentSize s_content_size; static void prv_window_load(Window *window) { Layer *window_layer = window_get_root_layer(s_window); GRect bounds = layer_get_bounds(window_layer); s_text_layer = text_layer_create((GRect) {...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ps_step_3.c :+: :+: :+: ...
C
#include <stdlib.h> #include <mpi.h> int IncOrder(const void *e1, const void *e2) { return (*((int *) e1) - *((int *) e2)); } /* This is the CompareSplit function */ void CompareSplit(int nlocal, int *elements, int *relements, int *wspace, int keepsmall) { int i, j, k; for (i = 0; i < nlocal; i++) { ...
C
/* $Id$ */ #include <ptable-utils.h> PTBL_Production PTBL_LookUpProduction(PTBL_ParseTable pt, int label) { PTBL_Labels labels = PTBL_getParseTableLabels(pt); ATermInt num = ATmakeInt(label); PTBL_Label head; for (; !PTBL_isLabelsEmpty(labels); labels = PTBL_getLabelsTail(labels)) { head = PTBL_getLabels...
C
/************************************************* 文件名:zuoye2.c 功 能:统计文件中英文字母个数并输出出现最多的字母 版本号:0.0.1 *************************************************/ #include <fcntl.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <stdlib.h> int main() { int i,j,fd1=0,rd_data=0,letter[26]={0},max; char ...
C
#include <string.h> char* strrchr(const char source[static 1], int character) { unsigned char c = character; if (!c) return (char*)(source + strlen(source)); char* found = 0; char* candidate; while ((candidate = strchr(source, character))) { found = candidate; source = ca...
C
/************************************************************** 5079번 jongtae0509 C 정확한 풀이코드 길이:289 byte(s) 수행 시간:0 ms 메모리 :1120 kb ****************************************************************/ #include<stdio.h> int main(){ int v,i,a=0,b=0; char s[20]={}; scanf("%d",&v); scanf("%s",s); for(i=0;i<v;i++){ if...
C
#include <stdarg.h> #include <stdlib.h> #include <stdio.h> #include <sys/time.h> FILE *log_file; double dwalltime() { double sec; struct timeval tv; gettimeofday(&tv, NULL); sec = tv.tv_sec + tv.tv_usec / 1000000.0; return sec; } void print_log(const char *s, ...) { va_list args; va_start(args, s); ...
C
#ifndef PRODUCT #define PRODUCT struct Product{ int item; // which kind of product, not the id; int category; // optional now; double weight; // int max_number[3]; // the maximum item number for small, public: Product(){ item = -1; category = -1; double weight = 0; max_number[0] = 0; max_num...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> void insert(char*, int); void delete(); void list(); void save_data (char*); void read_data (char*); typedef struct node { char table_name[20]; int table_size; struct node *next; } INFO_NODE; INFO_NODE *heads[4]; INFO_NODE *tails[4]; int main (int argc, ...
C
int32_t intcmp(const void *a, const void *b,size_t x UNUSED) { if ((*(const int *) a) < (*(const int *) b)) { return -1; } else if ((*(const int *) a) > (*(const int *) b)) { return 1; } else { return 0; } } void print_int(const void *a) { printf("%d ", (*(const int *) a)); } void * ckalloc(size...
C
// // main.c // SumReductionOpenCL // // Created by Ruben Vasconcelos on 4/5/17. // #include <stdio.h> #include <stdlib.h> #include <sys/time.h> #include <unistd.h> #ifdef __APPLE__ #include <OpenCL/opencl.h> #else #include <CL/cl.h> #endif const char *ProgramSource = "kernel void add(global int* input,\n"\ " ...
C
#include "param.h" #include "coeur.h" #include <arduino.h> void lancement(){ if (analogRead(0) >= SENSIBILITE) { /* SENSIBILITE CONSEILLEE >950 afin de supprimer les interférences de la carte ...
C
/*memcpy将字符串2中的n个字符拷贝到字符串1中,并返回字符串2*/ void *memcpy(void *dest, const void *src, int count) { assert((dest != NULL) && (src != NULL)); void *address = dest; while(count--) { *(char *)dest = *(char *)src; dest = (char *)dest + 1; src = (char *)src + 1; } return addr...
C
#include "queue.h" #include <string.h> #include <stdio.h> #include <stdlib.h> void push(char data[MSG_SIZE], Block **head, Block **tail) { /* push a block into the top of queue * data: the messange of the block, max size depends on MSG_SIZE * head: pointer, points to the head of queue * tail: pointer, poin...
C
#include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <string.h> #include <unistd.h> #include <ctype.h> #include <errno.h> //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CONSTANTS DECLARATIONS //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #define TRUE 1 #define FALSE 0 #define SHOWL...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* wall.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ void main() { int v[5],i; for(i=0;i<5;i++){ printf("introduzca valor\n"); scanf("%d",&v[i]); }; printf("La cadena es:"); for(i=0;i<5;i++){ printf("%d ",v[i]); }; }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <windows.h> int pangkat(int a, int b){ if(b == 1) { return a; } else { return a*pangkat(a,(b-1)); } } int main() { int a,b; int i=0; int hasil=1; printf("===...Hallo...=== \n\n"); printf("\n"); Sleep(2000); printf("\n"); ...
C
#include <stdio.h> #include <stdlib.h> int occ[26]; void clear_occ() { for(int i = 0; i < 26; i++) { occ[i] = 0; } } int main() { size_t size=32; char* line = (char*)malloc(size*sizeof(char)); int t = 0; while(!feof(stdin)) { int len = getline(&line,&size,stdin); /* printf("%d\n",len); */ for(int i = 0;...
C
#include <stdio.h> #include <stdlib.h> #define PRECHECK 0xAEAEAEAEAEAEAEAEL #define POSTCHECK 0xEAEAEAEAEAEAEAEAL // +------------------------------------------+ // + Pointer to next memory block + // +------------------------------------------+ // + Size of User Data, in bytes + // ...
C
#ifndef __lc_util_h__ #define __lc_util_h__ #include <glib.h> #include <lc/lc.h> #ifdef __cplusplus extern "C" { #endif /** * lc_singleton_get: * * Retrieves a singleton instance of lc_t. The instance will already be * initialized to defaults and attached to the glib event loop. If the * instance could not b...
C
/* Ryan Lebeau 22/01/2018 AssignOnePartTwo.c COMP 3300 */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <fcntl.h> #include <unistd.h> #include <time.h> #include <sys/wait.h> int* bubbleSort(int[],int); int persistance(int, int); int* largest(int[]); int* smallest(int[]); int main(int argc, char...
C
/* * 中断头文件 * * 中断相关,类型定义,函数声明 * * author:// 绝大部分代码来自 《操作系统真相还原》 */ #ifndef __INTERRUPT_H #define __INTERRUPT_H #include "std_type_define.h" #define PIC_M_CTRL 0x20 //这里用的可编程中断控制器是8259A,主片的控制端口是0x20 #define PIC_M_DATA 0x21 //主片的数据端口是0x21 #define PIC_S_CTRL 0xa0 //从片的控制端口是0xa0 #define PIC_S_...
C
#include <stdio.h> #include <stdlib.h> struct context { char *namelist[10]; int val; }; int main(void) { struct context *ctx = calloc(1, sizeof(*ctx)); int i; for (i = 0; i < 10; i++) { printf("%d: %p\n", i, ctx->namelist[i]); } printf("val %d\n", ctx->val); return 0; }
C
#include "libtexproma_private.h" void tpm_repeat(tpm_mono_buf dst, tpm_mono_buf src, unsigned nx, unsigned ny) { for (int y = 0; y < TP_HEIGHT; y++) for (int x = 0; x < TP_WIDTH; x++) tpm_put_pixel(dst, x, y, tpm_get_pixel(src, x * nx, y * ny)); } void tpm_flip(tpm_mono_buf dst, tpm_mono_buf src) { for ...
C
#include "cutting.h" void print_token(char *token, int ptr_debut, int ptr_fin) { //printf("\n<ptrs = %d, ptrf = %d>\n", ptr_debut, ptr_fin); while(ptr_debut <= ptr_fin) printf("%c", token[ptr_debut++]); } void fileToTempon() { pascalTabS = NULL; char *m = (char*)malloc(MAX_LINE*sizeof(char)); int...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* libft.c :+: :+: :+: ...
C
#include <stdio.h> #include "dllist.h" void dl_init_node(LPDL_NODE node) { node->dl_next = NULL; node->dl_pre = NULL; } void dl_insert_node(LPDL_NODE node, LPDL_NODE insert, LPDL_ROOT root) { if (insert) { //update head node->dl_next = insert->dl_next; insert->dl_next = node; node->dl_pre = insert; if (nod...
C
// Your Name // CS136, Winter 2015 // Assignment 8, Problem 2 #include <stdlib.h> #include <assert.h> #include <stdio.h> #include <stdbool.h> int main(void) { struct dyn_array { int *data; int len ; int max ; }; struct dyn_array da = {NULL, 0, 0}; int ch; while (1){ int retur...
C
//File: ServerC.c // prj02 : This file contains the 'main' function. Program execution begins and ends there. // Author: CHIKE OKONTA // CLASS: CSCI 312 // PROJECT 03: Implementation file (ServerC.c) // Date: 10/19/2020 /* * PURPOSE * Play rock Paper and Scissors using client server connectio...
C
/* * bunker.h * * Created on: Sep 22, 2016 * Author: superman */ #ifndef BUNKER_H_ #define BUNKER_H_ #include <stdint.h> #define BUNKER_NUM_BUNKERS 4 //Number of bunkers #define BUNKER_NUM_TILES 10 //Number of bunker tiles #define BUNKER_EROSION_STATE_0 0 //Erosion state 0 whole #de...
C
#include<stdio.h> #include<limits.h> int main() { int n, m; int arr[100001] = { 0, }; scanf("%d %d", &n, &m); for (int i = 0; i < n; i++) scanf("%d", &arr[i]); int l = 0, r = 0; int num = 0; int sum = 0; int ans = INT_MAX; while (l <= r&&r<=n) { if (sum >= m) { //printf("len: %d\n", r - l); i...
C
#include <stdlib.h> #include <string.h> #include "graph.h" #include "list.h" #define MIN(X, Y) (((X) < (Y)) ? (X) : (Y)) #define MAX(X, Y) (((X) > (Y)) ? (X) : (Y)) struct _graph{ node **list; int vertices; }; graph *graph_create(int vertices) { graph *g = calloc(1, sizeof(graph)); ...