language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <sys/socket.h> //per socket(), bind() connect() #include <unistd.h> // per close() #include <arpa/inet.h> // per sockaddrin #include <string.h> #include <stdio.h> #include <stdlib.h> #define PROTOPORT 27015 #define QLEN 6 void errorhandler(char *errorMessage) { printf("%s", errorMessage); } int main(...
C
#include<stdio.h> #include<math.h> #include<stdbool.h> #include<stdlib.h> double* solve(int arr[],int n); int main() { int n,option; printf("Enter the size of array : "); scanf("%d",&n); int arr[n]; printf("Enter elements of array :\n"); for(int k=0; k<n; k++) scanf("%d"...
C
#include <stdio.h> int main(int argc, char *argv){ int i = 5; char c = (char)i; printf("'%c'\n", c); }
C
/****************************************************************************** Use IAP to program the flash A single page of 64 bytes should be sufficient Top 32 bytes of RAM needed RAM buffer with data needs to be on word boundary Uses 148 bytes of stack space Use compare function to only write changes Interr...
C
/* Este modulo kernel irá a leer el tiempo actual del sistema */ // Dependencias // Importantes #include <linux/module.h> #include <linux/init.h> #include <linux/proc_fs.h> #include <linux/sched.h> #include <linux/uaccess.h> #include <linux/fs.h> #include <linux/sysinfo.h> #include <linux/seq_file.h> #includ...
C
/************************************************************************* > File Name: code18.c > Author: SDW > Mail:264459522@qq.com > Created Time: 日 8/17 00:14:35 2014 ************************************************************************/ //18.约瑟夫问题: //N 个人围成一个圆圈,首先第一个人从 1 开始一个人一个人顺时针报数,报道第 m 个人, 令其出列。然后再...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_continue_procent.c :+: :+: :+: ...
C
#include <stdio.h> #include <string.h> int count(char* str, char c) { int count = 0; for (int i = 0; i < strlen(str); i++) { if (str[i] == c) count++; } return count; } int main() { char str[101]; char c; printf(" ڿ Է: "); gets(str); printf(" Է: "); c = getchar(); printf("%c : %d\n", c, count(str...
C
#ifndef shell #define shell // SOME AESTHETICS // inputs: none // returns: none // prints out the prompt, with cwd void print_prompt(); // RUNNING THE THING // inputs: char** args // returns: 3 if command is exit, 2 if command is cd, values returned by redirect(), ter_pipe(...
C
#include <stdio.h> #include <stdlib.h> #include "stack.h" #define MAXSIZE 32 /* ׺ʽ任ɺ׺ʽ * s:Ҫջ * b:׺ʽĻ * a:׺ʽ */ void change(Stack s,int *b,int *a) { int i = 0; int j; for(j = 0;j < sizeof(a)/sizeof(*a);j++) { if(a[j] != '\0') { if(a[j] > '0' && a[j] < '9') { ...
C
/** *Laboratorio 1: Variables y Operadores *author: Guillermo Carsolio *Matricula: A01700041 *Date:19/08/16 **/ #include <stdlib.h> //librería estanda #include <stdio.h> // Librería de E/O //Inicio del programa int main () { //Son 3 Lineas |1.Defino mi variable v1|2.Le pido al usuario el valor de la var...
C
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> int main() { double up = 0; double down = 0; double goal = 0; int day = 1; scanf("%lf %lf %lf", &up, &down, &goal); if (up >= goal) { printf("%d\n", day); } else { goal -= up - down; goal = goal / (up - down); day = (int)(goal + 0.5); printf("%d\...
C
/* * * Título: TP DE VECTORES 04 * Consigna: 4. Ingresar 25 edades, y calcular * A. (o) Edad promedio * B. () Imprimir las edades mayores a 34 años * C. () Imprimir las edades menores a 21 años * Alumno: Nicolás Esteban Olmedo * */ /* Directivas del preprocesador */ #include <stdio.h> #define ARRAY_SIZE 3 /* Macros ...
C
/**************************************************************************/ /* */ /* This example uses jfp_lib to change fuzzification functions. */ /* Usage: jfp_ex02 <jfrf> */ /* The progr...
C
#include <unistd.h> #include <sys/ioctl.h> #include <signal.h> #include <stdio.h> #include <stdarg.h> #include <termios.h> #include "termesc.h" #define alt_buf "?1049" #define curs "?25" #define term_clear "2J" #define clear_line "2K" #define high "h" #define low "l" #define jump "H" #defi...
C
/******************************************************* Statement - Display Day of the month. Programmer - Vineet Choudhary Written For - https://turboc.codeplex.com *******************************************************/ #include<stdio.h> #include<conio.h> #include<math.h> int fm(int date, int month,...
C
#include "mpi.h" #include <time.h> #include <stdio.h> #include <assert.h> #define NS_PER_SEC 1E9 #define msgsize 1024*1024 #define niter 10 #define Bytes_PER_MB 1E6 int main(int argc, char *argv[]) { int rank, num_procs, i, j; double* bufferA; double* bufferB; struct timespec start_time, end_time; ...
C
#ifndef LOG_H #define LOG_H #include<stdio.h> /**************************************** [ṹ] Log [Ա1] date[26] // [Ա2] overage_change //仯 [Ա3] char explain[500] //˵ [Ա4] next //Logָ *******************************************/ typedef struct Log { char date[26];// double overage_change;//仯 char exp...
C
#include <stdio.h> int main() { int x,y; scanf("%d%d",&x,&y); int a,b; a=(4*x-y)/2; b=(x-a); if(y%2==1 || b<0 || a<0) printf("No answer\n"); else printf("%d %d\n",a,b); return 0; }
C
/* Arquitectura cliente-servidor Programa cliente O cliente lê os números do ecrã, informa o sevidor e apresenta os resultados dos cálculos, fornecidos pelo servidor após o cálculo. */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/file.h> #inc...
C
#include<stdio.h> #include<conio.h> void main() { int a,b,i; char sym; clrscr(); printf("enter the a,b,sym:"); for(i=0;i<4;i++) { scanf("%d%c%d",&a,&sym,&b); if(sym=='/') { printf("division is %d\n",a/b); } else if(sym=='%') { printf("modulo is %d\n",a%b); } else { printf("wrong symbol\n"); } getch(); } }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "stable.h" #include "cmm.h" int st_size = 512; stable* st_table = NULL; /* * st_hash return the hash key for the given string * If the length of the input string is 0, -1 is returned */ unsigned long int st_hash(const char *str) { //str[] is 0...
C
/* Program Number: 1c Student Name: Ellanti Bharath Sai; Register Number: IMT2018022 Date:25-02-2021 Description: This program will create a fifo file using mknod and mkfifo. */ #include<stdio.h> #include<fcntl.h> #include<unistd.h> #include <sys/stat.h> int main() { int fd; fd = mkfifo("fifo...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_free.c :+: :+: :+: */ ...
C
// Pavan Kumar J 20201CCS0094 #include<stdio.h> void main() { int a,b; printf("enter the value of a\n"); scanf("%d",&a); b=--a; printf("after decrement a value is %d\n",a); printf("b value is %d\n",b); }
C
/* A basic memory-allocator, written by Logan Buckley based on the principles of the memory allocator in K&R C */ #include <stdlib.h> #include <stdio.h> #define MEMSIZE 1048576 /* * Avoid any system memory considerations by using * statically-allocated memory. The free list will start as one block * pointing to...
C
#include "header.h" float totalWholesale(Node **head){ Node *temp; float wholesale = 0.0; temp = *head; while(temp!=NULL){ wholesale += (temp->book.wholesalePrice * temp->book.wholesaleQuantity); temp = temp->next; } return wholesale; }
C
/** * @file uart.c * @brief inits uart to desired baud rate. * Functions for uart data manipulation. * @todo what if checksum error (uart_try_read_packet) * @todo if byte reading is too long -> write WARNING! */ //TODO: Implement close(uart0_filestream); #include "uart.h" #include <stdio.h> #include <unistd.h> ...
C
/* find prime number b/t two any numbers */ #include<stdio.h> void main() { int a=10,b=30,i,j; printf("%d,%d\n",a,b); for(i=a+1;i<=b-1;i++) { for(j=2;j<i;j++) { if(i%j==0) { break; } } if(i==j) { printf("%d\t",i); } } }
C
// C program to find LCM of two numbers using recursion #include <stdio.h> // header files int LCM(int n1, int n2); // function declaration int main() { int num1, num2, leastcm; // declare some variables printf("Enter any two numbers - \n "); // ask user input scanf("%d%d", &num1, &num2); // read in use...
C
#ifndef __RECHERCHE__COMMUN__ #define __RECHERCHE__COMMUN__ #include <stdio.h> #include "liste_resultats_texte.h" /* nom_fichier_par_identifiant_descripteur : cette fonction permet de connaitre le nom d'un fichier à partir de l'identifiant d'un descripteur. entrées : - identifiant : identifiant du descripteur ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* sort_stack.c :+: :+: :+: ...
C
/** * Petr Zubalik - xzubal04, 1BIT * steg-decode.c * IJC - DU 1 * preklad - gcc 5.4.0 */ #include <stdio.h> #include "error.h" #include "bit_array.h" #include "ppm.h" #include "eratosthenes.h" #include <ctype.h> #include <stdlib.h> int main(int argc, char const *argv[]) { if (argc < 2 && argc > 3) { error_msg...
C
#include <stdio.h> int iadcionar (int N1, int N2) { return(N1+N2); } int isubtrair (int N1, int N2) { return(N1-N2); } int imultiplicar (int N1, int N2) { return(N1*N2); } float idividir (int N1, int N2) { return(N1/N2); } int iresto (int N1, int N2) { return (N1%N2); } int main() { int x...
C
/* Author : E13200 * Title : Lab04-named pipe demostration * Date : 2017.08.23 * Description : This program will get the string from the pipe and capitalize that. * Then again send that string to the another pipe. Therefore, the se.c program can get * that string and print in terminal. * compilation: * fir...
C
#include <stdio.h> #include "constants.h" /* shorthand macro for mod-4 calculation */ #define MOD4(a) ((a) > 0 ? ((a) & 3) : (4 + ((a) % -4))) #define Nb 4 #define Nr 10 #define Nk 4 /* some easy to understand typedefs */ typedef unsigned char byte; typedef unsigned int word; /* key expansion function declarations...
C
#include<stdio.h> int main(void) { enum month {january=1,february,march,april,may,june,july,august, september,october,november,december}; enum month aMonth; int days; printf("enter number of month : "); scanf("%d",&aMonth); int a=8; aMonth=a-1; switch(aMonth) { case january: ...
C
#include <stdio.h> #include <string.h> /** * main - Init function (* a blank line * Description: Longer description of the function)? (* section header: Section description)* * Return: Description of the returned value */ int main(void) { printf("with proper grammar, but the outcome is a piece of art,\n"); return (...
C
/* * Rewriting cat command * * @Harsh_Garg, 1910990582 */ #include<stdio.h> #include<string.h> // Function to display the error void show_error () { printf("Wrong Syntax : use -help option to know more about the command\n"); } // Functio to show the syntax void show_Syntax () { printf("-----------...
C
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> char* reduce(char* s){ int i, check=0; int n=strlen(s); for(i=0; i< n-1; i++){ check=0; if (s[i+1]==s[i]){ check=1; break; } } if (check){ for(int j=i; j<n-1; j++) ...
C
#include <stdio.h> /** * main - prints the name of the file it was compiled from, followed by \n * Return: 0 on SUCCESS */ int main() { printf("%s\n",__FILE__); return (0); }
C
/* * stm32f407xx_USART_driver.c * * Created on: 17-Feb-2021 * Author: Sayan Rana */ #include "stm32f407xx_USART_driver.h" // Clear the IDLE flag static void USART_ClearIDLEflag(USART_RegDef_t *pUSARTx); // A static function to clear the IDLE flag static void USART_ClearIDLEflag(USART_RegDef_t *pUSAR...
C
/** * @file plat_stdlib.c * @brief ϵͳװ װ time * @details * @author ΰ * @date 2018/7/10 * @version V1.0 * @par Copyright (c): * ޹˾ * @par History: * V1.0: ΰ, 2018/7/10 , һδ\n */ #include "cos.h" #include "ctype.h" #include "stdlib.h" #include "plat_stdlib.h" /*!\brief ƽ...
C
#include <stdio.h> #include <stdlib.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int argc, char *argv[]) { long int num; while(scanf("%d",&num)==1) { if(num==1) printf("%ld\n",num); if(num==2) printf("%ld\n",num)...
C
#include <stdio.h> /*calcula a potencia de modo recursivo usando *o fato que x^y = x*x^y-1*/ int potencia (int x, int y) { if (y == 1){ return x; } else { return (x*potencia(x,y-1)); } } int main() { int x; int y; scanf("%d", &x); scanf("%d", &y); int p; p = potencia(x,y); ...
C
#include <stdio.h> int main(){ int t, n, i; unsigned long long int f[61]; scanf("%d", &t); f[0] = 0; f[1] = 1; for(i = 2; i < 61; i++){ f[i] = f[i-1] + f[i-2]; } for(i = 0; i < t; i++){ scanf("%d", &n); printf("Fib(%d) = %llu\n", n, f[n]); } return 0; }
C
/*--------------------------------------------------------------------------------------------------------*\ |* Created by ADLER THESSIN *| |* Last modified, March 20, 2018 ...
C
#include <stdio.h> int main() { int n; int sum = 0; scanf("%d", &n); for(int i = 0;i<=n/3;i++){ // i表示包含了几个3; sum += (n - i * 3) / 2 + 1; // /2 标识包含了几个2的情况 } // +1 表示当仅由1组成时,只有一种情况 printf("%d\n", sum); // 最后的sum即为总数 return 0; }
C
#include "packet.h" #include "serial.h" #include<stdio.h> /*标准输入输出定义*/ #include<stdlib.h> /*标准函数库定义*/ #include<unistd.h> /*Unix 标准函数定义*/ #include<sys/types.h> #include<sys/stat.h> #include<fcntl.h> /*文件控制定义*/ #define __USE_MISC #include<termios.h> /*PPSIX 终端控制定义*/ #include<errno.h>...
C
#include <stdio.h> int recursion(int a, int b, int max) { if (b > max) return 0; if (b % 2 == 0) return b + recursion(b, a + b, max); return recursion(b, a + b, max); } int main() { printf("%d\n", recursion(1, 1, 4e6)); return 0; }
C
/* * Translate a tasklet string into tasklet packet format (like binary format) * for motes to understand it and be able to get the tasklet parameters. * Every created tasklet should have its construct. * */ #include "element_construct.h" #include "element_map.h" #include <string.h> #include <stdlib.h> #include ...
C
#include <stdio.h> int main(int argc, char **argv) { // Zanke : // while, for, do...while int i; i = 0; while( i < 10 ) { printf( "i = %d\n", i ); i = i + 2; } /* while( pogoj ) // !!! TU NI PODPICJA !!! { stavek1; stavek2; ... stavekN; ...
C
#include <stdio.h> int main(){ int anio,mes,dia; printf("Ingrese El Dia:\n"); scanf("%d",&dia); printf("Ingrese El Mes:\n"); scanf("%d",&mes); printf("Ingrese Anio\n"); scanf("%d",&anio); printf("La Fecha Es : %d",anio*10000+(mes*100)+dia); }
C
#include<stdio.h> #include<math.h> int m; int n; int main() { int a[3][3]; printf("enter the number of column\n"); scanf("%d",&m); printf("enter the number of rows\n"); scanf("%d",&n); printf("enter the elements of matrix\n"); for(int i=0;i<m;i++) { for(int j=0;j<n;j++) { ...
C
#include <string.h> // strnstr is a BSD extension // Creative Commons. http://stackoverflow.com/questions/23999797/implementing-strnstr char *strnstr(const char *haystack, const char *needle, size_t len) { int i; size_t needle_len; /* segfault here if needle is not NULL terminated */ i...
C
#include "common.h" #include "dospush.h" #include <tcp.h> #include <dos.h> #include <fcntl.h> #include <io.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> #include <sys/types.h> #include <time.h> /* Default 4K stack is too small. */ extern unsigned _stklen = 8192; ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* utils_base.c :+: :+: :+: ...
C
#include<stdio.h> struct amar { long double ln; char ch; int a; long ln1; char ch1; //short int si; //char ch1; }; struct amar an; int main() { printf("long: %d\n",sizeof(long)); printf("int: %d\n",sizeof(int)); printf("char: %d\n",sizeof(char)); printf("short: %d\n",sizeof(short)); printf("long double: %d\n",sizeof...
C
#include<stdio.h> double makeDouble(int integral, long fraction){ double result; int count= 10; while (fraction/count !=0){ count*=10; } if (integral > 0) result = integral + (double)fraction/count; else result = integral + ((double)fraction/count)*-1; return result; } int main(){...
C
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> int coeff[10] = {0}; int max_index = 0; void calculate_coefficient(int x) { int i = 0 , cv = 0 ; for (i=1 ; i<10; i++) { cv = pow(5,i-1) + coeff[i-1]; if(cv <= x) coeff[i] = cv; else break; } max_index = i-1; } int main(int...
C
/** * @file main.c * @brief Use joystick buttons to control blinking * @version V1.0 * @date 23/01/2016 * * @note Direct access to registers * @note No library except CMSIS is used * * ******************************************************************************/ /** @mainpage 08-blink-c...
C
/* Implements stack */ typedef struct stack * Stack; // creates empty stack Stack createStack(void); // frees stack void freeStack(Stack s); // push to stack, returns pushed val int push(Stack s, int val); // pop from stack // returns popped value, or null if stack is empty int pop(Stack s); // returns top of sta...
C
#include "FileUtil.h" #include "Log.h" #include <sys/uio.h> #include <unistd.h> #include <stdlib.h> #include <fcntl.h> int g_iFileEndFlag; char cOpenType; FILE *ResultOpen(const char *czFileName, const char *czMode) { if( czFileName==NULL || czFileName[0]=='\0' ) { cOpenType=otSTDOUT; return stdout; }else if...
C
/* * debounce.c * * Created on: Apr 22, 2015 * Author: arruti */ #include "stm32f0xx_hal.h" #include <stdbool.h> #include "debounce.h" bool debounce_check_button_with_threshold(button_debounce* debounce, bool current_state, uint32_t threshold_count, uint32_t sample_period) { uint32_t current_systicks = HA...
C
#include <u.h> #include <libc.h> #include <thread.h> #include <mux.h> Mux mux; Ioproc *readProc; Ioproc *writeProc; int netfd; typedef struct Message Message; struct Message { uint tag; uint val; }; int MessageSetTag(Mux *mux, void *msg, uint tag) { return ((Message*)msg)->tag = tag; } int MessageGetTag(Mux *mux...
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
/* filename - main.c version - 1.0 description - ⺻ Լ mainԼ μ -------------------------------------------------------------------------------- first created - 2020.02.07 writer - yujin. */ #include <stdio.h> #include <stdlib.h> // Լ int main(int argc, char **argv) { if (argc <= 1) { p...
C
/* * 10-print_comb2.c * * Description: * This program prints all integers between 00 and 99. * All integers printed are double digits. If the integer * is normally a single digit, IE: 1, a zero is added to the * front. */ #include <stdio.h> #define ZERO 48 #define NINE 57 /** * main - this is the main functi...
C
#include "cell_grid.h" #include <stdio.h> #include <stdlib.h> /* * Input: * int numRows, number of rows for new CellGrid * int numCols, number of cols for new CellGrid * Output: * A CellGrid* pointing to a newly allocated CellGrid * Summary: * Allocates a new CellGrid with numRows rows and ...
C
extern void _uart_putchar(int c); int putchar(int c) { if (c == '\n') { _uart_putchar('\r'); } _uart_putchar(c); return 0; } void show_msg(char *msg) { char *p; p = msg; while (*p) { putchar(*p); p++; } }
C
/* * file for vectoradd.c */ #include <stdio.h> #include <stdlib.h> #include <math.h> int main(int argc, char *argv[]); //PIPS generated variable void p4a_launcher_main(float *a, float *b, int n); //PIPS generated variable void p4a_launcher_main_1(float *a, float *b, float *c, int n); //PIPS generated variable P4A_a...
C
#include<stdio.h> #include<stdlib.h> /* Exercicio 07 - Fazer um programa que obtenha dois numeros inteiros, x e y, mostre o quociente e o resto da divisao inteira entre eles. */ int main(){ return 0; }
C
#include<stdio.h> #include<math.h> int main() { int choice; printf("\nWhat is your choice"); printf("\n1.c to f\n2.f to c\n"); scanf("%d",&choice); if(choice==1) { int ca; printf("\nca="); scanf("%d",&ca); float far=1.8*ca/2; printf("\n c...
C
#include "led.h" /****************************************************************************************** *LED_GPIO_Config() * void * ֵvoid * ܣLEDĹܽ *********************************************************************************************/ void LED_GPIO_Config(void) { GPIO_InitTypeDef GPIO_InitStructure; R...
C
#include <math.h> void xrotate(double x[3],double y[3], double z[3], double theta) { double st = sin((double)theta); double ct = cos((double)theta); double ct1 = 1 - ct; double exp1 = x[0] * x[1] * ct1; double exp2 = x[2] * st; double exp3 = x[0] * x[2] * ct1; double exp4 = x[1] * st; double exp5 = x[1] * x[2...
C
#include <stdio.h> int main() { int a,b, i,c,d,e, n = 0,f= 0; scanf("%d %d",&a,&b); for(i =a+1;i<b;++i) { d= i; c= i; while (c!= 0) { c/= 10; ++n; } while (d!= 0) { e=d% 10; f+=pow(e, n); d/=10; } if(f== i) { printf("%d ",i); } n=0; f=0; } return 0; }
C
#include "Memory/kmalloc.h" #include "Libraries/linked_list.h" #include <stdbool.h> #include <stdint.h> typedef struct memory_header { LinkNode node; int size; bool free; uint32_t magic; } Memory_Header; LinkedList free_memory; Memory_Header *find_free_memory(uint32_t size) { Memory_Header *curre...
C
/** * main.c - EGB240 Digital Voice Recorder * * Version: 1.0 * Author: Kevin Duong * Student ID: N9934731 */ /************************************************************************/ /* INCLUDED LIBRARIES/HEADER FILES */ /*************************************...
C
/* * Checks if LibreSSL's PRNG is fork-safe. * From https://www.agwa.name/blog/post/libressls_prng_is_unsafe_on_linux * This code is in the public domain. * * Original source: https://gist.github.com/AGWA/eb84e55ca25a7da1deb0 */ #undef LIBRESSL_INTERNAL #include <openssl/rand.h> #include <stdio.h> #include <stdl...
C
#include<stdio.h> #include<conio.h> void main() { int year; clrscr(); printf("enter any year"); scanf("%d",&year); if(year%100!=0 && year%400==0 || year%4==0) printf("leap"); else printf("no no no no"); getch(); }
C
#include<stdio.h> #include<string.h> void reverse(char naw[]) { int a; for(a=strlen(naw)-1;a>=0;a--){ printf("%c",naw[a]); } } int main() { char chawna[100]; scanf("%[^\n]",chawna); reverse(chawna); }
C
// 3 kyu // Esolang Interpreters #4 - Boolfuck Interpreter char * loop(char **code, int i) { if (!i) return; while (*(*code += i) != "[]"[i > 0]) if (**code == "[]"[i < 0]) loop(code, i); } char gm(char *a, i) { return a[i / 8] >> i % 8 & 1; } void sm(char *a, i, b) { a[i / 8] = (a[i / 8] | 1 << i % 8) ^ ...
C
#include "ft_ls.h" int time_sort(t_llist *a, t_llist *b) { if (a->stat->st_mtimespec.tv_sec == b->stat->st_mtimespec.tv_sec) return (a->stat->st_mtimespec.tv_nsec > b->stat->st_mtimespec.tv_nsec); return (a->stat->st_mtimespec.tv_sec > b->stat->st_mtimespec.tv_sec); } int rev_timesort(t_llist *a, t_llist *b) ...
C
#ifndef KDTREE_H #define KDTREE_H typedef void* KDT; typedef void* KTD_Value; /* Cria uma KD-Tree*/ void* KDT_create(int (*compare)(void*, void*, int), int dimension, void (*freeFunc)(void*)); /* Insere um Valor na KD-Tree*/ void KDT_insert(KDT tree, KTD_Value value); /*Retorna o tamanho da tree*/ ...
C
#include "search_algos.h" /** * advanced_binary - doc * * @array: doc * @size: doc * @value: doc * * Return: doc */ int advanced_binary(int *array, size_t size, int value) { size_t i, aux, aux2; int tmp; if (!array) return (-1); printf("Searching in array: "); aux2 = 0; for (i = 0; i < size; i++) { if (i == ...
C
#include "hashTable.h" #include "functions.h" int main(int argc, char* argv[]) { int i; size_t command; printf("Give the bytes you want to allocate: "); scanf("%zu",&command); printf("Size will be included in class of %zu bytes.\n",myround(command)); /* test 1 */ printf("\nTest 1: Adresses of %zu bytes.\n",m...
C
#include <stdio.h> int main() { int n; char str[100]; scanf("%i%s", &n, str); for (int i = 0; i < n; ++i) printf("%s ", str); printf("\n"); }
C
#include "main.h" int main() { init(); do { loop(); } while (1); } void init() { RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE); GPIO_InitTypeDef gpio; GPIO_StructInit(&gpio); gpio.GPIO_Mode = GPIO_Mode_OUT; gpio.GPIO_Pin = LEDS; GPIO_Init(GPIOD, &gpio); GPIO_Se...
C
/*Write a program which accept string from user and check whether it contains vowels in it or not. Input : marvellous Output : TRUE Input : Demo Output : TRUE Input : xyz Output : FALSE*/ #include<stdio.h> #include<conio.h> #define TRUE 1 #define FALSE 0 typedef int BOOL; BOOL ChkVowel(char*); BO...
C
#include <stdio.h> void swap(int *a, int *b) { int temp = *a; *a = *b; *b = temp; } void heapify(int arr[], int here, int size) { int left = here * 2 + 1; int right = here * 2 + 2; int max=here; if (left < size&&arr[left]>arr[max]) max = left; if (right < size&&arr[right]>arr[m...
C
#ifndef __PARAMETER_STORAGE_SETTING_PARAM_H__ #define __PARAMETER_STORAGE_SETTING_PARAM_H__ #ifdef __cplusplus extern "C"{ #endif typedef enum _STORAGE_SWITCH { STORAGE_SWITCH_START, STORAGE_SWITCH_ON, STORAGE_SWITCH_OFF, STORAGE_SWITCH_END }STORAGE_SWITCH; /*存储策略,一直存储?事件存储?还是定时存储?*/ typedef enum _ST...
C
#include "Stream.h" #include "NodeSet.h" #include "Scope.h" #include "Lexer.h" #include <stdlib.h> #include <stdio.h> Stream *Stream_new(FILE *fp) { Stream *stream = malloc(sizeof(Stream)); stream->fp = fp; return stream; } void Stream_delete(Stream *stream) { free(stream); } int Stream_eof(Stream *stream) { re...
C
#include "Course.h" extern unsigned GetCourseRecords(); void ReadFileToCouList(const char* path, Course_list* couList) { FILE* file = fopen(path, "r"); unsigned lines = 0; Course temp = { 0 }; char str[1024] = { 0 }; unsigned index = 0; if (NULL == file) { fprintf(stderr, "Can't open file!"); error; retur...
C
/* * The ELepHant Reasoner * * Copyright (C) Baris Sertkaya (sertkaya@fb2.fra-uas.de) * * 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...
C
//Palash Mittal #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #define BUF_SIZE 100 //function to calculate the fibonacci number in the child process //val stores the value of ith fibonacci number int childFib(int i){ int val,j; int x = 1, y = 1; if(i <=...
C
#pragma once #include"Ԥ.c" #include<stdlib.h> #include<stdio.h> #include <malloc.h> stu* insert(stu*, stu); // stu* fcreateline(int); //ļ 0.ϳ 1.Ŀǰ stu* store(stu*, int); //棺0. 1.Ŀǰ stu* sort(stu* head,int n) { stu* sort00(stu * ); stu* sort10(stu * ); stu* sort20(stu * ); stu* sort30(stu * ); stu* sort40(stu ...
C
#include "bitmap.h" #include <debug.h> #include <limits.h> #include <round.h> #include <stdio.h> #include "threads/malloc.h" #include "threads/palloc.h" #ifdef FILESYS #include "filesys/file.h" #endif /* Element type. This must be an unsigned integer type at least as wide as int. Each bit represents one bit i...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_lstnew.c :+: :+: :+: ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* left_redirections.c :+: :+: :+: ...
C
/* ** EPITECH PROJECT, 2021 ** bonus ** File description: ** display_level_failed */ #include "my.h" int redirect_menu_level_failed(global_t *global, int y) { if (y == 6) { if (global->in_map_arg == 0) load_map(global, global->current); else load_map(global, global->arg_map...