language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #define BUFSIZ2 156 int main( ) { FILE *pfile = NULL; char*filename = "exercise_11.txt"; fpos_t position; pfile = fopen (filename, "a"); if(pfile==NULL) printf("Failed to open %s.\n",filename); char str[60] = "\ntest of ftell()"; ...
C
#include<stdio.h> #include<string.h> #include<stdlib.h> /* Lowercases all letters in str */ void toLower(char* str) { int i, length; length = strlen(str); for (i = 0; i < length; ++i) if (str[i] >= 'A' && str[i] <= 'Z') str[i] += 'a' - 'A'; } /* Returns allocated string */ char* remov...
C
//Fail - Partial Solution #include "ft_list.h" int ft_list_size(t_list *begin_list){ int counter = 1; while(begin_list->next != 0){ counter++; begin_list = begin_list->next; } return(counter); } //*Testing Only
C
#include <stdio.h> #define YAMIDI_IMPLEMENTATION #include "yamidi.h" void printMsg(struct midiMsg_s msg) { switch(msg.status) { case midiStatusNoteOff: printf("Note Off, chan=%d, key=%d, vel=%d\n", msg.params.midiParamNoteOff.chan, msg.params.midiParamNo...
C
// 13 -wap to create array 10 elements accept 10 no. from the user and store it in an array // then accept a no. from the user to search in an array.(linear search) #include<stdio.h> int main(){ int num[10]={1,2,3,4,5,6,7,8,9,10}; int cnt; int usernumber; printf("Enter number to be serched in an arra...
C
#include <stdio.h> union A { short c; char buf[4]; }x; int main() { union A x; //x.buf={'0x02','0x01','0x03','0x04'}; x.buf[0] = 0x02; x.buf[1] = 0x01; x.buf[2] = 0x03; x.buf[3] = 0x04; printf("%p\n",x.c); return 0; }
C
/* b = A*x * A: lower triangular of matrix A * irow: row index * pcol: col pointer * val: matrix val * diag: diag value of A */ #include <stdlib.h> #include <stdio.h> #include <math.h> void smv(int *irow, int *pcol, double *val, double *x, double *b, int n){ int i, j; double sum; ...
C
#include "sim.h" #include <stdlib.h> struct device * new_device(struct sim_state *s) { struct device_list *d = calloc(1, sizeof *d); d->next = NULL; struct device_list ***p = &s->machine.last_device; **p = d; *p = &d->next; return &d->device; } static int devices_does_match(const int32_t *add...
C
#include <stdio.h> #include "priority_queue.h" int main() { priority_queue idade; int opcao = 1, valor; T item; inicializar(&idade); while(opcao){ printf("Escolha uma das opcoes para manipular a Heap:\n"); printf("1 - Inserir Elemento\n"); printf("2 - Remover elemento\n"); printf("3 - Elemento com m...
C
#include <stdio.h> #include <stdlib.h> /* * Author: Guilherme Henrique Loureno * ltima Modificao: 29/08/2014 * Language: C */ int negativos(int n, float* vet); void main(int argc, char *argv[]){ int tamanho,i; float *vetor; printf("Digite o tamanho do vetor: "); scanf("%d",&tamanho); vetor = (float *)mal...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* cases.c :+: :+: :+: ...
C
// name: Luke Heary // file: main.h // date: 11/14/17 #include <stdbool.h> typedef struct { int robotNumber; int num; int initialR; int initialC; int currentR; int currentC; int numberOfMoves; int rows; int columns; int *cellsAround; int **grid; int targetR; int targetC; bool atTarget...
C
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward d...
C
#include<stdio.h> #include<stdlib.h> void main(){ int i; int *m,*c; m= (int*)malloc(5*sizeof(int)); c= (int*)calloc(5,sizeof(int)); for(i=0;i<5;i++){ printf("%d %d",m[i],c[i]); } }
C
#include <stdio.h> int main(int argc, char* argv[]) { int x = 2, y = 3, z = 5; int* x_ptr = &x; int* y_ptr = &y; int* z_ptr = &z; printf("x == %d, y == %d, z == %d\n", x, y, z); printf("x_ptr == %p\n", x_ptr); printf("y_ptr == %p\n", y_ptr); printf("z_ptr == %p\n", z_ptr); printf...
C
/* CONVERT (A+B)*C/D TO ITS POSTFIX EXPRESSION i.e. AB+C*D/ and TO ITS PREFIX EXPRESSION i.e. *+AB/CD */ #include <stdio.h> void main() { int c,l; char infix[30],infix1[30]; printf("\n\n\tENTER THE EXPRESS...
C
#include <stdio.h> #include <sys/types.h> #include <dirent.h> #include <sys/stat.h> #include <string.h> #include <stdbool.h> enum {INIT_STATE, COMMENT_STATE1, ONE_LINE_COMMENT_STATE, MULTI_LINE_COMMENT_BEGIN_STATE, MULTI_LINE_COMMENT_WAIT_END_STATE}; int handle_file(const char* path) { FILE* fp = fopen(path, "r")...
C
#include <stdio.h> #include <assert.h> #include <string.h> #include <stdlib.h> #include <stdio.h> #include <sys/stat.h> #include <unistd.h> #include "clickhouse-client.h" #define driver "/home/vagrant/percona/clickhouse-odbc/driver/libclickhouseodbc.so" int select() { int r; int deptno; const char *dname; const...
C
#include <stdio.h> void hanoi(char dep, char dest, char temp, int n) { if(n==1) { printf ("deplacez %c vers %c\n",dep,dest); } else { hanoi( dep, temp, dest, n-1); hanoi( dep, dest, temp, 1); hanoi(temp, dest, dep, n-1); } } void main() { int n; printf("Dans ce jeux il y a 3 tours qu'on va appel...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* board.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <string.h> #include <Windows.h> //#include "codecs.h" //#include "format.h" #include "colours.h" int main() { bool IncTrue = 0; bool FinTrue = 0; bool SecTrue = false; int menuOpcion = 0; int menuOpcionH = 0; int menuOpcionAv = 0; int menuOp...
C
//------------------------------------------------------------------------------------------------- /** * @file gpioSample.c * * Sample app making use of the helper lib (gpio_iot) to drive CF3-GPIO on IoT0 card for mangOH Green/Red * Scenario : * GPIO_2 and GPIO_4 drive 2 LEDs to blink alternatively * GPIO_1 is...
C
/** * code stolen from ocfs2-tools/libocfs2/openfs.c * * gcc ocfs2-dump-super.c -o ocfs2-dump-super * ./ocfs2-dump-super /dev/sda * * */ #include <stdio.h> #include <stdlib.h> #include <inttypes.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #define BLOCK_SIZE 4096 stati...
C
#include <stdio.h> int main(void) { int score1, score2, score3; scanf("%d %d %d", &score1, &score2, &score3); printf("%.1f\n", ((float)(score1 + score2 + score3) / 3)); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <math.h> double kaiseki(double *a, double *b); int main(int argc, char **argv) { double a = strtod(argv[1], NULL); double b = strtod(argv[2], NULL); double a1; a1 = kaiseki(&a, &b); printf("%.8lf\n", a1); return 0; } double kaiseki(double *a, double *b) ...
C
/* printfʽ Ƚ putcharַ ܸǿ*/ /* ʽΪ printf("ʽ",ֵ) */ /* %d %f %cַ */ #include <stdio.h> void main() { int a=88, b=89; /* abΪͻa88 b89 */ printf("%d,%d\n", a, b); printf("%f,%f\n", a, b); printf("%c,%c\n", a, b); printf("a=%d,b=%d", a, b);/* ""ڳ%d֮ⶼҪӡ */ /* %d%f%c */ }
C
#include <stdio.h> int main() { for(int x = 1; x < 10; x++){ for(int y = 1; y<10; y++){ int a = x * y; printf("%d ",a); } printf("\n"); } return 0; }
C
#include<stdio.h> #include<stdlib.h> #define INT_MAX ((unsigned int)(1 << 31) - 1) int reverse(int x) { long long res = 0, sign = 1, num = x; if (num < 0) {sign = -1; num = -num;} while (num) { res *= 10; if (res > INT_MAX) return 0; res += (num % 10); num /= 10; } return r...
C
class Solution { public: vector<vector<int>> threeSum(vector<int>& nums) { vector<vector<int>> result; int size = nums.size(); sort(nums.begin(), nums.end()); for(int i = 0; i < size; i++) { int target = 0 - nums[i]; int left = i+1; ...
C
#include <stdio.h> #include <stdlib.h> int main () { char t; int a = 0; char nome[40]; char nome2[40]; int id, hp, mana, atk; int id2, hp2, mana2, atk2; FILE *pick; FILE *pick2; FILE *pick3; FILE *pick4; FILE *pickaux; pick2 = fopen("picks2.txt","rt"); ...
C
/* ** EPITECH PROJECT, 2020 ** mylinkedlist ** File description: ** Source code */ #ifndef MY_LINKED_LIST_H #define MY_LINKED_LIST_H typedef struct linked_list { struct linked_list *next; } linked_list_t; #define HEAD(node) \ ((void **)&node) int my_count_nodes(void **head); void *my_find_previous_...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { FILE *fa, *fb; int ca, cb; char prep[]={"#include","#define"}; char buff[100]; fa = fopen("in.c", "r"); fb = fopen("out.c", "w"); if (fa == NULL || fb==NULL){ printf("Cannot open file \n"); exit(0); } ca = getc(fa); while (ca != EOF) ...
C
/*File Name:assignment10.c Author:K.S.Krishna Chandran Description:To calculate x to the power of y, where y can be either negative or positive. Date:13|11|14*/ #include<stdio.h> void power(int,int); int main() { system("clear"); int x,y,i; printf("Input the value of X and Y\n"); scanf("%d%d",&x,&y); power(x,y);...
C
#include "unity.h" #include "disassembler.h" #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include "Exception.h" #include "CException.h" #include "CExceptionConfig.h" #include <stdarg.h> #include <string.h> void setUp(void) { } void tearDown(void) { } void test_mulwf(void) { CEXCEP...
C
/* *@FileName:Example_16_12.c *@Author: Liu Yang *@Date: 2020/6/8 10:17 *@Email:liuyang__work@163.com *@Last Modified time: 2020/6/8 10:17 */ //ԤԤʶ #include "stdio.h" void why_me(void); int main(void) { printf("The file is %s.\n",__FILE__); printf("The date is %s.\n",__DATE__); printf("The time is %s.\n",...
C
#include <criterion/criterion.h> // No borrar esto! #include "lista.h" // Modificar con el nombre de la api que se le entrega al alumno! Test(misc, test_k_1) { int data[6] = {1,5,10,3,6,8}; lista_t* lista = lista_crear(); for (int i=5; i>=0; i--) { lista_insertar_primero(lista, (void*) &data[i]);...
C
#include <stdio.h> #include "common.h" // 结构体 struct MyStruct{ int a; int b; int c; }; // 用指针来遍历数组 void traverseArr(int arr[], int n){ int *p = arr; for(int i = 0; i < n; i++){ // (*p)++; printf("%d\n", *p); p++; } } int main(){ int arr[10]; int len = sizeof(arr)/sizeof(int); // getArr(arr, len)...
C
/* * ===================================================================================== * * Filename: main.c * * Description: TCP Server Demo * * Version: 1.0 * Created: 01/25/2012 10:09:52 PM * Revision: none * Compiler: gcc * * Author: D.N. Amerasinghe ...
C
#ifdef __cplusplus extern "C" { #endif /************************************************************************ * * MDV_HANDLE.H * * MDV handle struct header file * * May 1997 *************************************************************************/ # ifndef MDV_HANDLE_H # def...
C
#include "abb.h" #include "testing.h" #include <stddef.h> #include <stdlib.h> #include <stdio.h> /* ****************************************************************** * PRUEBAS UNITARIAS ALUMNO * *****************************************************************/ int cmp(const char* c1, const char*...
C
#include <stdio.h> #include <math.h> #define num_input_first_line 3 float Find_Hypotenuse(int a, float b ); void Do_Matches_Fit(int n, float hyp ); int main() { int i, num_lines_of_input, width; float length, hypotenuse; //get how many consecutive lines of input there will be //get dimensions of container sca...
C
#pragma once struct Vector2; struct Vector4; struct Vector3 { static Vector3 Forward; static Vector3 Up; static Vector3 Right; static Vector3 Zero; static Vector3 One; static Vector3 Epsilon; static Vector3 cMin; static Vector3 cMax; union { struct { ...
C
#include <stdio.h> #include <unistd.h> #include "sense.h" #include <stdbool.h> bool checkmate(char *position, int player, bool EP, int EPL){ char dummy[]="----------------------------------------------------------------"; for(int i=0; i<64; i++){ dummy[i]=position[i]; } //printf("%s\n",dummy); ...
C
#include <stdio.h> int main() { int a = ~(1 << 31); for (int b = 0; b < 10; b += a) printf("a\n"); }
C
/* ** manage_system_memory.c ** ** Made by oleszkiewicz Jonathan ** Email <JonathanOlesz@gmail.com> ** ** Started on Sun Feb 16 22:02:09 2014 oleszkiewicz ** Last update Sun Feb 16 22:19:33 2014 oleszkiewicz */ #include "malloc.h" /** * Si la zone mémoire contenue entre list.pnt_end_list et list.pnt...
C
#include <stdio.h> #define datatype int typedef struct loopnode { datatype data; struct loopnode *next; } loopnode; typedef struct loopnode * looplist_t; int is_empty_looplist(looplist_t h) { return h->next == h ? 1:0; } int insert_head_looplist(looplist_t h, datatype x) { looplist_...
C
#include "sort.h" #include "unity.h" #include "unity_fixture.h" #include <stdlib.h> #include <string.h> TEST_GROUP(sort); TEST_SETUP(sort){ } TEST_TEAR_DOWN(sort){ } TEST(sort, TestSort1){ int v[] = {5,6,7,10,3,4,5,1,6,9,8}; int size = 11; qsort(v, size, sizeof(int), comp_int); //printf("\n"...
C
/* ** my_list_swap.c for libmy in /home/raphy/Developement/Libraries/libmy/list ** ** Made by raphael defreitas ** Login <defrei_r@epitech.net> ** ** Started on Mon Jan 28 11:36:56 2013 raphael defreitas ** Last update Mon Jan 28 11:55:46 2013 raphael defreitas */ #include <stdlib.h> #include "my.h" int my_list...
C
#ifndef _TREE_C #define _TREE_C #include "tree.h" #include <stdlib.h> #include <string.h> #include <assert.h> #include <stdio.h> //does smth for each node in subtree struct Visitor{ struct Node* node; FILE* file; }; //FIRST FUNC(LEFT) FUNC(RIGHT) THEN FUNC(NODE) int VisitorLRN(struct Node* node, int (*func)(struc...
C
void reverseArray(int *a, int size) { int arr[size]; int i = 0, j = size - 1; while(i < size && j >= 0) { arr[i] = a[j]; i++; j--; } for(i = 0; i < size; i++) a[i] = arr[i]; }
C
#include <stdio.h> #include <stdlib.h> int main() { int m=0, n, i=0, j=0, a=0, b=0, number, q; scanf("%d", &n); for (m=0;m<n;m++){ scanf("%d", &number); q=number%2; if (q==0){ i=i+1; a=a+number;} else{ j=j+1; b=b+number; ...
C
int check_palindrome_recursive(char *start, char *end); int _strlen_recursion(char *s); /** * is_palindrome - checks if string is palindrome * * @s: string to check * * Return: 1 if palindrome, 0 otherwise */ int is_palindrome(char *s) { char *end; int sLength; if (!*s) /* empty string */ return (1); sLength = _...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_width.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <sys/wait.h> #include <stdarg.h> #include <signal.h> ssize_t yh_printf(const char *format, ...) { va_list vl; va_start(vl, format); char buf[4096] = { 0 }; vsnprintf(buf, sizeof(buf), format, vl); buf[strlen(buf...
C
// Write a function with prototype // int arr_norm(int *arr, int len) // which returns the norm of the array arr defined as the sum of the // square of each of the elements of the array arr, which has length len. #include <stdio.h> // begin question int arr_norm(int* arr, int len) { int ret = 0; for (int i =...
C
/*-----------------------------+ プログラミング及び演習II 第2回 問題 B-1 キーボード入力された1~255までの数値 (unsigned int型の10進数)を16進数 で表示するプログラムを作れ +-----------------------------*/ #include <stdio.h> #define RADIX 16 void print16(int n); int main(int argc, const char* argv[]) { unsigned int n; // 入力値を格納する変数 printf("1~255の整数値を入力してください: ");...
C
#pragma once #include<Windows.h> #include<stdio.h> /* ʂ̃NA␔A̓͂Ȃǂ̔ėp̂VXe */ //̓͂܂ int GetKeyInput() { int key; while (1) { key = getchar(); //͂ꂽL[s̏ꍇAs if (key == '\n')printf("Illegal Input(Enter)\n"); //sȊȌꍇAȉ̏ else { //ɓǂݍ񂾕sȂA if (getchar() == '\n') { //printf("Success\n"); break; } ...
C
#include <stdio.h> int main() { int f = 16; f = sqrt(f); // please square root f's value printf("%d \n", f); return 0; } qrt(f); // please square root f's value
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <stdbool.h> bool IsPrime(int num); int main(void){ int r1, r0, r_1, f1, f0, f_1, g1, g0, g_1, d, e, L, i, q, tmp, counter; int lcm = 0; //bool primeFlag1, primeFlag2; tmp= 0; counter = 1; printf("異なる整数を二つ入力してください\n"); ...
C
/* Задача 7. Заделяне на памет с calloc Заделете динамична памет за масив от елементи, като извикате функция, която нулира заделената памет. Преписал съм си кода от първа задача, защото ползвах calloc там, вместо malloc. */ #include <stdio.h> #include <stdlib.h> int EnterElements(int *p, int MaxElem); int main(){ ...
C
//第2次课堂作业 //启动线程计算2*N #include<stdio.h> #include<pthread.h> void*calculate(void*ptr_n) { printf("%d\n",2*(*(int*)ptr_n)); return NULL; } int main() { int n; pthread_t th; while(scanf("%d",&n)!=EOF){ if(pthread_create(&th,NULL,calculate,&n)!=0){ printf("pthread error\n"); ...
C
/* Fig. 12.13: fig12_13.c Operating and maintaining a queue */ #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include "encrypt.h" /* self-referential structure */ struct Node { char data[50]; /* define data as a char */ char pass[50]; struct Node *nextPtr; /* Node pointer */ }; /* end str...
C
#include<stdio.h> void total(int mins[], int secs[], int n, int *sum_m, int *sum_s){ for (int i = 0; i < n; i++) { printf("Enter mins: "); scanf("%d", &mins[i]); printf("Enter secs:"); scanf("%d", &secs[i]); *sum_m += mins[i]; *sum_s += secs[i]; while ...
C
void imprimeMatriz(char **m, int nL, int nC) { int i, j; for (i = 0; i < nL; i++) { for (j = 0; j < nC; j++) { printf(" %c", m[i][j]); } printf("\n"); } }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #define KERNEL 0 #define STEP 10 #define WIDTH 10.0 #define GAUSSIAN 0 #define SQUARED 1 char *kernels[] = { "gaussian", "squared" }; #define ROWS 250000 #define COLS 31 #define max(a,b) (((a) > (b)) ? (a) : (b)) #define min(a,b) (((a) < (b)...
C
#include <stdio.h> #include <stdlib.h> void ArrayItemDel(int arr[], int index, int size) { if(index >= size) { printf("Please enter the correct index number"); } else { for(int i = index; i < size + 1; i++) { arr[i]=arr[i+1]; } prin...
C
#include <stdio.h> int main (){ double A, B, C, MEDIA, wa, wb, wc; scanf("%lf%lf%lf", &A, &B, &C); wa = 2.0/10; wb = 3.0/10; wc = 5.0/10; MEDIA = (A*wa + B*wb + C*wc); printf("MEDIA = %.1lf\n", MEDIA); return 0; }
C
#include <stdio.h> #include <cs50.h> #define DIM_MIN 3 #define DIM_MAX 9 #define TRUE 1 #define FALSE 0 int board[DIM_MAX][DIM_MAX]; void draw(int d) { for(int i = 0; i < d; i++){ for(int j = 0; j < d; j++){ printf("%i\t", board[i][j]); } printf("\n")...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> char **load_array(char *input_string){ char **array_mem = malloc(3*(sizeof(char *))); for(int x=0;x<3;x++){ array_mem[x] = malloc(sizeof(char *)); printf("Allocation at %p\n",array_mem[x]); strcpy(array_mem[x],input_string); }; return array_mem; }; ...
C
#include <string.h> #include <stdio.h> #include "dictionary.h" static unsigned long hash_function(const char * str) { unsigned long hash = 0; #if 0 #define MULTIPLIER 97 for (unsigned const char * us = (unsigned const char *) str; *us; us++) { hash = hash * MULTIPLIER + *us; } #else // sdbm unsigned char c;...
C
#include<stdio.h> #include<stdlib.h> int main(){ float valor, desconto; printf("Valor do produto: "); scanf("%f",&valor); desconto=valor - valor*0.12; printf("Valor com desconto: %.2f",desconto); return 0; }
C
#ifndef COMPARISION_H #define COMPARISION_H #endif // COMPARISION_H #include<stdlib.h> #include<stdio.h> /* * TLS parsing * author: Samsuddin Sikder * email: sadiksikder@gmail.com * www.zafaco.de * site documentation: http://blog.fourthbit.com/2014/12/23/traffic-analysis-of-an-ssl-slash-tls-session * */ // du...
C
#include <time.h> #define CONSUMER_A_SLEEP_TIME 2000000 #define CONSUMER_B_SLEEP_TIME 3000000 #define PRODUCER_A_SLEEP_TIME 8000000 #define PRODUCER_B_SLEEP_TIME 7800000 #define producerA 10 #define producerB 20 #define consumerA 30 #define consumerB 40 void producer(sharedData* data, int type); void consumer(sha...
C
strchr(查找字符串中第一个出现的指定字符) 相关函数 index,memchr,rinex,strbrk,strsep,strspn,strstr,strtok strpbrk #include<string.h> char * strchr (const char *s,int c); ----strchr()用来找出参数s字符串中第一个出现的参数c地址,然后将该字符出现的地址返回。 返回值: 如果找到指定的字符则返回该字符所在地址,否则返回0。 #include<string.h> int main() { char *s="0123456789012345678901234567890"; c...
C
///Name:Priyanka P.Khandagale ///Write a program which accept number from user and return summation of all its non factors. ///Input : 12 ///Output : 50 ///Input : 10 ///Output : 37 //////////////////////////////////////////////////////////////////// #include<stdio.h> int NonFactorsummation(int iNo) { int i,sum=0; ...
C
#include "out_funcs.h" static void ft_offset_int(t_list **integer, t_list **decimal) { t_list *decimal_end; uint8_t symbs_amount; uint8_t first_int_symb; if (count_symbs(ft_lstlast(*integer)->value, 10) == 1) return ; decimal_end = ft_lstlast(*decimal); symbs_amount = count_symbs(decimal_end->value, 10); ft_...
C
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #define MAX_SIZE 100 int field[MAX_SIZE][MAX_SIZE]; int N; int count = 0; int MazePath(int x, int y, int dist) { if (x < 0 || y < 0 || x >= N || y >= N || field[x][y] != 0) return 0; else if (x == N - 1 && y == N - 1) { re...
C
/* date.c -- date utility operations */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <utime.h> #include <sys/time.h> #include "constants.h" char *get_month(); char *get_day(); char *get_year(); char *get_date(); /**************************** DATE MODULES *****************...
C
#include <stdio.h> //int main() { printf("\a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\v\w\y\z"); } int main() { printf("\a\bcd\e\fghijklm\nopq\rs\t\vwyz"); } //int main() { printf("A:\DATA\ZORK1.DAT\n"); } // No null terminator //void main1() { // //char v1[] = {'S','t','r','i','n','g','\0'}; // Correct line // char ...
C
/* splitline.c - command reading and parsing functions for smsh * * char * next_cmd(char *prompt,FILE *fp) - get next command * char ** splitline(char *str); - parse a string */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "smsh.h" /* * purpose: read next command line from fp * * return...
C
#include<bits/stdc++.h> using namespace std; int n,m,cot=0; void dfs(int x,int y) { int i,j; if(x+1==y) { cot++; return; } int mc=0; for(i=x+1;i<y;i++) { dfs(x,i-1); dfs(i+1,y); } return mc; } int main() { int i,j,k,T,fk; ...
C
#include <stdio.h> int main() { int bt[20],wt[20],p[20],tat[20],priority[20]; float avwt=0,avtat=0; int i,j,n,temp,key; printf("\nEnter the number of the processes: "); scanf("%d",&n); for(i=0;i<n;i++) { printf("\nEnter the burst time and priorit...
C
#ifndef DYNET_C_GRAPH_H_ #define DYNET_C_GRAPH_H_ #include <dynet_c/define.h> #include <dynet_c/tensor.h> typedef struct dynetExpression dynetExpression_t; /** * Opaque type of ComputationGraph. */ typedef struct dynetComputationGraph dynetComputationGraph_t; /** * Creates a new ComputationGraph object. * @para...
C
#include <string.h> #include <stdlib.h> #include <stdio.h> #include <errno.h> int main(int argc, char const *argv[]) { char s[80]; int i; sscanf("I still miss","%4s",s); printf("%s\n", strerror(errno)); for(i=0;i<80 && s[i]!='\0';i++) printf("%c\n", s[i]); return 0; }
C
# include <stdio.h> # include <stdlib.h> int main (int argc, char **argv) { if (argc != 3) { printf("Usage: removevocal <sourcefile> <destfile>"); exit (1); } FILE *openFile = NULL; FILE *newFile = NULL; if ( NULL == (openFile = fopen(argv[1], "rb"))) { perror ("Cannot open source file")...
C
#include <stdio.h> #include <string.h> int my_strlen(char* str); int main () { int len = strlen("hello, world"); printf("Length of \"hello, world\" is %d \n", len); len = my_strlen("hello, world"); printf("Length of \"hello, world\" is %d \n", len); } int my_strlen(char* str) { char* ptr = str; ...
C
#include <stdbool.h> char *ft_strlowcase(char *str) { int i; char tmp; i = 0; while (true) { tmp = str[i]; if (str[i] == '\0') { break ; } if (str[i] >= 'A' && str[i] <= 'Z') { str[i] = tmp + 32; } i++; } return (str); }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* screenshot.c :+: :+: :+: ...
C
#include <stdio.h> #include <time.h> #include <ctype.h> #include <stdlib.h> #define BELL '\a' #define DEALER 0 #define PLAYER 1 #define ACELOW 0 #define ACEHIGH 1 int askedForName = 0 /* False initially */ /* Prototypes */ void dispTitle(void); void initCardsScreen(int cards[52], int playerPoints[2], int dealerPoints[...
C
#include <inttypes.h> #include <stdio.h> #include <string.h> #include "../utils.h" void show_single_char(const char* s) { for (size_t i = 0; i < strlen(s); i++) { printf("%2c ", s[i]); } printf(" (%ldb)\n", strlen(s)); } void show_int(int x) { printf("As Integer:\t"); show_bytes((bp)&x, sizeof(int)); }...
C
// Example of type-unsafe I/O in C // Produces a compiler warning, but still compiles #include <stdio.h> typedef struct { int age; char* first_name; char* last_name; } person_t; main() { person_t p; p.age = 99; p.first_name = "Bob"; p.last_name = "Caygeon"; printf("%s\n", p); printf("%s\n", p.ag...
C
/* ** basic_functions.c for basic_functions.c in /home/frostiz/CPE_2016_BSQ ** ** Made by thibaut trouve ** Login <frostiz@epitech.net> ** ** Started on Wed Dec 14 19:28:35 2016 thibaut trouve ** Last update Wed Dec 14 20:20:04 2016 thibaut trouve */ #include "my.h" void my_putchar(char c) { write(1, &c, 1); }...
C
/*һ֪ȣдһҵмڵλ*/ /*һʵٶһͬʱ ·̵е㡣Ծԭд*/ typedef struct node { int data; struct node *next; }*Node_t; Node_t find_mid_of_list(Node_t head) { if(head == NULL || head->next == NULL) return NULL; Node_t p_fast = head->next; Node_t p_slow = head->next; while(p_fast->next != NU...
C
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /* * File: afnd.c * Author: Sergio Castellano y Francisco Andreu * * Created on 29 de septiembre de 2016, 18:20 */ #include ...
C
#include <stdlib.h> #include <math.h> #include <stdio.h> typedef struct { double phase; int t; } state_t; void msg(void *instance, int sig) { } int run(void *instance, double **param, int ix) { double *out = param[0] + ix; double amp = *(param[2]); state_t *state = (state_t *)instance; double t = state-...
C
// /bin/dev/_unbundle.c // A command to unbundle bundle files. similar to tar, but bundle files // can be unbundled on unix by "sh"ing the file. // By Valodin #include <std.h> inherit DAEMON; void unpack(string path) { string *lines; string current_file, tmp; int i, lsz; lines = read_database(path)...
C
#include "scelib.h" double sce_dot ( const int N, const double * X, const int INCX, const double * Y, const int INCY ) { double dot = 0,x,y; int i; for (i=0;i<N;i++){ x=(*X); y=(*Y); dot += x*y; X+=INCX; ...
C
# FilaDeque Implementando Fila em C #include <stdio.h> #include <stdlib.h> #include "FilaDeque.h" /* run this program using the console pauser or add your own getch, system("pause") or input loop */ void inicializa_fila (Fila *p, int c){ //Recebe ponteiro de fila e a capacidade da fila p->dados=malloc(sizeof(int)*c...
C
#include <stdio.h> #include <string.h> int main(void){ { char str1[] = "123456789"; char str2[] = "def"; /* str2Ƹstr1 strcpy޷str2ָĴСǷĺstr1 str2ַָô޷ԤˣΪstrcpyһֱƵһַΪֹ ᳬԽstr1ָı߽ */ strcpy(str1,str2); printf("strcpy÷%s\n",str1); printf("=========================\n"); } { /* strlen...
C
/* https://issues.dlang.org/show_bug.cgi?id=22972 */ int printf(const char *, ...); void exit(int); void assert(int b, int line) { if (!b) { printf("failed test %d\n", line); exit(1); } } struct op { char text[4]; }; struct op ops[] = { { "123" }, { "456" } }; char *y =...