language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include <stdlib.h> #include <pthread.h> #include <string.h> #include <time.h> #include <unistd.h> pthread_mutex_t lock= PTHREAD_MUTEX_INITIALIZER; FILE *fp; void *Thread1(); void *Thread2(); struct timespec startTime,stopTime; float secsElapsed1; float secsElapsed2; clock_t t1,t2; int main() {...
C
include <stdio.h> void swapByPointer(int *A, int *B); int main(){ int a,b,*n,*m; scanf("%d",&a); scanf("%d",&b); n = &a; m=&b; swapByPointer(n,m); return 0; } void swapByPointer(int *A, int *B){ int t; t=*A; *A=*B; *B=t; printf("%d %d",*A,*B); }
C
#include <stdio.h> #include <stdlib.h> #define MAXLINE 2 /* maksymalny rozmiar wiersza */ #include "getline.h" int main() { char line[MAXLINE]; while (my_getline(line,MAXLINE) > 0) { printf("[%s]\n",line); } }
C
/* * i2c.c * * Created: 20-Jan-20 3:55:19 PM * Author: LENOVO */ /*- INCLUDES ----------------------------------------------*/ #include "i2c.h" #include "../../micro_config.h" #include "../../micro_registers.h" #include "../../common/macros.h" #include <math.h> /*- LOCAL MACROS ---------------------------------...
C
#include<stdio.h> #define TRUE 1 #define FALSE 0 typedef int BOOL; BOOL CheckBit(int iNo) { int iMask=0X00000010; int iMask1=0X00020000; int iResult=0; int iResult1=0; iResult=iMask&iNo; iResult1=iMask1&iNo; if((iResult==iMask)&&(iResult1==iMask1)) { return TRUE; } else { ...
C
#include <stdint.h> #include <string.h> #include <stdio.h> #define min(X, Y) (((X) < (Y)) ? (X) : (Y)) #define SIGIL_START "{{" #define SIGIL_END "}}" struct buffer { char *data; unsigned int size; }; struct buffer lookup(struct buffer stream) { struct buffer result; static char *url = "https://www.groov...
C
#include "lista_spesa.h" /** * Funzione che provvede a scrivere su file(il nome e' specificato dal parametro in ingresso) il nome dell'alimento che passiamo alla funzione. * * Dopo aver eseguito i vari controlli sulla modalit di apertura del file della spesa(esso pu riferirsi a quello personale o a quello glob...
C
#ifndef _ERR_H_DEF #define _ERR_H_DEF // For handling the format attribute #ifndef __GNUC__ # define __attribute__(x) // Nothing #endif /** * Gets the error number from a function that failed. * * A value of 0 means no error, otherwise its an error. * * \note There are currently no specific codes, just zero and ...
C
#include<stdio.h> int main() { int a,b,sum,d,e,u,digit,j,w=0,l[10]={0}; digit=1; scanf("%d%d",&a,&b); sum=a+b; if(sum<0) { sum=-sum; printf("-"); } d=sum; while(d>0) { d=d/10; digit=digit+1; } digit=digit-1; if(sum==0) digit=digit+1; for(j=0;j<digit;j++) { e=sum%10; l[digit-j]=e; sum=sum/...
C
#include <unistd.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int readln(int fildes,char *buf,int nbyte); // 1. /* int main(){ char c; while (read(0,&c,1)) write(1,&c,1); return 0; } */ /* // 2 int main(int argc, char *argv[]){ int file; int i; if (argc<2){ prin...
C
/** * \mainpage * The Sorter is an application to sort data files using various algorithms * * * @file main.c * @brief Main source file for the Sorter program * @date 2009-10-28 File creation * @author Cláudio Esperança <2070030@student.estg.ipleiria.pt>, Diogo Serra <2081008@student.estg.ipleiria.pt> */ #include <s...
C
#include <stdio.h> #include <stdbool.h> #include <stdlib.h> #define MaxSize 1000 int main( int argc, const char *argv[]){ int Stack[MaxSize]; int Top = -1; int M, N, K; int Tmp; int Current;/* 当前栈顶元素 */ bool flag; /* 判断该序列是否合法*/ scanf( "%d %d %d\n", &M, &N, &K ); for( int i = 0 ; i < K...
C
/* 习题10-4 递归求简单交错幂级数的部分和 (15 分) 本题要求实现一个函数,计算下列简单交错幂级数的部分和: f(x,n)=x-x^2+x^3-x^4+...+(-1)^(n-1)*x^n x 00 函数接口定义: double fn( double x, int n ); 其中题目保证传入的n是正整数,并且输入输出都在双精度范围内。 函数fn应返回上述级数的部分和。建议尝试用递归实现。 裁判测试程序样例: 输入样例: 0.5 12 输出样例: 0.33 */ #include <stdio.h> double fn(double x, int n); int main() { double x; ...
C
////ƳвԴļеСдĸȫתΪдĿļctype.h,ıģʽ ////argv[1]Ŀļargv[2]Դļ //#include<stdio.h> //#include<stdlib.h>//exit() //#include<ctype.h>//toupper() //#include<string.h>//strcmp() //#define BUFSIZE 1024 // //void file_copy(FILE * dest,FILE * source); // //int main(int argc,char * argv[]) //{ // FILE * fa,* fs; // //жǷȷ /...
C
int range (int sensorval) { if (sensorval > 250) { return 0; } else if (sensorval > 150) { return 1; } else if (sensorval > 70) { return 2; } else if (sensorval > 45) { return 3; } else if (sensorval > 30) { return 4; } else { ...
C
// Standard Khalang Prompt System #include <stdio.h> #include <stdlib.h> #include <stdbool.h> static char input[2048]; int main (int argc, char** argv) { puts("Khalang"); puts("#blessup"); while (true) { fputs("lion:>>> ", stdout); fgets(input, 2048, stdin); printf("#blessed %s\n", input); } retur...
C
// Waldomiro Barbosa Romão 2018005655 #include <stdio.h> void troca(int *x, int *y) { int aux = *x; *x = *y; *y = aux; } void bubbleSort(int vetor[], int tam) { int aux; for (int i = 0; i < tam-1; i++) for (int j = 0; j < tam-i-1; j++) if (vetor[j] > vetor[j+1])...
C
#include <string.h> #include <stdlib.h> #include <stdio.h> #include <assert.h> #include <unistd.h> char *Read_file(char *filename) // Reads the content of a file { FILE *f = fopen(filename, "rt"); assert(f); fseek(f, 0, SEEK_END); long length = ftell(f); fseek(f, 0, SEEK_SET); char *buffer = (...
C
#include <stdio.h> #include <assert.h> int fits_bits(int x, int n) { unsigned val = (unsigned) x; unsigned w = sizeof(int) << 3; unsigned mask = ~0; return val <= (mask >> (w - n)); } int main(int argc, char* argv[]) { assert(!fits_bits(8, 3)); assert(fits_bits(8, 4)); assert(fits_bits(8, ...
C
#include <stdlib.h> #include "holberton.h" /** * create_array - creates an array of chars, and initializes it with a specific * char *@size: size of the array *@c: the specific character * Return: pointer to a string */ char *create_array(unsigned int size, char c) { unsigned int i; char *p; if (size == 0) { return (0)...
C
#include <stdio.h> int main(){ // int num=0, divi =2,espar,primos=0,cantLeidos=-1,esc=-1; // // while( num != esc){ // divi = 2; // printf("introduzca numero para ver si es primo: "); // scanf("%d",&num); // // espar= num%divi; // while( espar!=0 && divi<num ){ // di...
C
#include "stdio.h" #include "stdlib.h" #include "dynamic_stack.h" #include "locale.h" /* [Estrutura de Dados - Exerccio] Ndio Dib - 201918579 Engenharia de Software */ /* Escreva uma funo que receba um vetor com vrios elementos e um ponteiro para uma pilha. Preencha a pilha passada como parmetro com os element...
C
#include <stdlib.h> #include <string.h> #include <stdio.h> #include "asset_current_location.h" asset_current_location_t *asset_current_location_create( double latitude, char *location, double longitude, double speedMilesPerHour, long timeMs ) { asset_current_location_t *asset_current_locatio...
C
#include <stdio.h> float taxi_fare(int weekday, int start_time, int duration, int distance) { int fare = 3400; // keep as integer. We will divide by 1000 when returning double speed = (double)distance/duration; int curr_day = weekday; // When boarding if (start_time < 6*60) { // befo...
C
#include <stdlib.h> #include <stdio.h> #include <locale.h> /* 6. Crie um programa que contenha um vetor de inteiros contendo 7 elementos. Utilizando apenas aritmética de ponteiros (ou seja, navegar o vetor utilizando a propriedade de ponteiros), leia esse vetor do teclado e imprima a soma dos elementos que estão em ...
C
//interactive dialog with serial device //http://en.wikibooks.org/wiki/Serial_Programming/Serial_Linux#termios #include <string.h> #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <termios.h> int main(int argc,char** argv) { struct termios tio; struct termios std...
C
#include "timer.h" /** Ecrit le résultat du calcul dans un fichier de sortie * @param noInstance le numéro d'instance utilisé lors du calcul * @param valeurSolution la fonction objectif de la meilleure solution trouvée pour cette instance * @param temps le temps de calcul pris par l'algorithme de résolution */ voi...
C
/* ヘッダファイルのインクルード */ #include <stdio.h> /* 標準入出力 */ #include <libxml/xmlreader.h> /* xmlreader */ /* main関数 */ int main(void){ /* 変数の宣言 */ xmlTextReaderPtr reader; /* XMLリーダreader */ /* XMLファイルを読み込み, XMLリーダを作成. */ reader = xmlNewTextReaderFilename("test.xml"); /* xmlNewTextReaderFilenameでtest.xmlを読み込み. */ ...
C
// 连快速幂取模都用不到的暴力就可以解决。。 #include <stdio.h> #include <string.h> #define MOD 10000000000 int main() { long long ans=0; for(long long i=1,fac;i<=1000;++i) { fac=1; for(int j=1;j<=i;++j) { fac*=i; fac%=MOD; } ans+=fac; ans%=MOD; } printf("%lld\n",ans); return 0; }
C
#include <stdio.h> #include <string.h> #include <sys/socket.h> #include <netdb.h> int udp_sock; struct sockaddr_in dst; int main(int argc, char **argv) { udp_sock = socket(PF_INET,SOCK_DGRAM,0); dst.sin_family = PF_INET; dst.sin_port = htons(18093); dst.sin_addr.s_addr = INADDR_ANY; sendto(udp_sock, "Hello\n",...
C
#ifndef _NODE_H_ #define _NODE_H_ #include "typedef.h" R_Geode getBox_Geode_R() { R_Geode boxGeode = new osg::Geode; R_ShapeDrawable boxShape = new osg::ShapeDrawable; boxShape->setShape(new osg::Box(osg::Vec3(0.0f, 0.0f, 0.0f), 1.0f, 1.0f, 1.0f)); boxGeode->addDrawable(boxShape); return boxGeode...
C
#include <stdio.h> int add(int a, int b) { return a * b; } int main() { int length, i, sum = 0, tmp; printf("Enter number of integers: "); scanf("%d", &length); for (i = 0; i < length; i++) { printf("Enter number %d: ", i + 1); scanf("%d", &tmp); printf("Number %d: %d\n", i...
C
#include <stdlib.h> #include <stdio.h> #include <SDL2/SDL.h> #include <SDL2/SDL_timer.h> #include <SDL2/SDL_image.h> #include <sys/types.h> #include <unistd.h> #include "testing.h" #define WINDOW_WIDTH (640) #define WINDOW_HEIGHT (480) #define BUTTON_WIDTH (175) #define BUTTON_HEIGHT (40) int makeGameWindow() { //mak...
C
int ft_strlen(); #include <stdio.h> int main() { char a[] = "12345"; printf("\n%d\n", ft_strlen(a)); }
C
#include <stdio.h> #include <stdlib.h> int main(void) { float amount; char currency; printf("Enter amount in CHF and currency [W] won, [$] dollar, [Y] yen, [L] pound : "); scanf("%f %c", &amount, &currency); switch (currency) { case 'W' : printf("%.2f in CHF is %.2f in KRW...
C
#include<stdio.h> #include<string.h> #include<sys/types.h> #include<sys/stat.h> #include<unistd.h> #include<fcntl.h> #include<stdlib.h> int main() { int fd = open("myfile1",O_RDONLY);//以只读的方式打开文件 if(fd < 0)//文件打开失败 { perror("open error"); exit(1); } char buf[1024]; const char* msg = "hello world\n"; while(1...
C
#include <unistd.h> #include <stdio.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/sem.h> #include <sys/shm.h> #include <errno.h> #define BUFFSZ 4096 #define MSGSZ sizeof(struct chmsg) // use as massage from child to parent proccess struct chmsg{ int count; char letter; }; int procn = 26; // numb...
C
#include <stdio.h> /* printf, fgets */ #include <stdlib.h> /* atoi */ #include <string.h> /* strlen */ const int LETTERS_NUM = 26; const char BASE_LETTER = 'a'; int main(int argc, char const *argv[]) { int characters[LETTERS_NUM] = {0}; const char *text = argv[1]; int i = 0; if(argc < 2...
C
#include <stdio.h> void swapEntero(int *a, int *b); void swapFlotante(float *a, float *b); int main(int argc, char const *argv[]) { int a = 1,b = 2; float p,q; printf("a: %d\nb: %d\n",a,b); swapEntero(&a,&b); printf("a: %d\nb: %d\n",a,b); return 0; } void swapEntero(int *a, int *b){ int aux; aux = *a; *a ...
C
/* pnmrotate.c - read a portable anymap and rotate it by some angle ** ** Copyright (C) 1989, 1991 by Jef Poskanzer. ** ** Permission to use, copy, modify, and distribute this software and its ** documentation for any purpose and without fee is hereby granted, provided ** that the above copyright notice appear in all c...
C
/* Custom effect that looks like popcorn. The 'popcorn' is color[0] and the background color is color[1]. If color[0] is the same as color[1], the 'popcorn' will be a random color. Keith Lord - 2018 LICENSE The MIT License (MIT) Copyright (c) 2018 Keith Lord Permission is hereby granted, free o...
C
#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> #include<stdlib.h> //жϴС //С˴洢ֽдڵ͵ַ ˴洢෴ //int Storage_method() //{ // int a = 1; // return *(char*)&a; //} //int main() //{ // int ret = Storage_method(); // if (1 == ret) // printf("С˴洢\n"); // else // printf("˴洢\n"); // return 0; //} //int Storage_method() //{ //...
C
#include <system/system.h> #include <system/timer.h> #include <system/task.h> #include <stddef.h> #include <stdio.h> void test() { printf("Timer 1 wake up at -> %d tick\n", system_get_tick_count()); } void test_2() { printf("Timer 2 wake up at -> %d tick\n", system_get_tick_count()); } void test_3() { pri...
C
#ifndef _PROFILE_ #define _PROFILE_ #include "Def.h" #include "myLib.h" #include "Prf.h" struct Profile; typedef double(Profile::*fFunction)(); typedef List(Profile::*vFunction)(); // struct to store all the calculated values for a profile. struct ProfRep { vector<double> x; // Values for all PDI's (in the order of...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* add_edge.c :+: :+: :+: ...
C
#include <string.h> #include <stdio.h> #include <stdlib.h> #include <time.h> #include "windows.h" void main(int argc,char *argv[]) { HANDLE hFile; DCB MyDcb; DCB GottenDcb; char *MyPort = "COM1"; if (argc > 1) { MyPort = argv[1]; } printf("Using port %s\n",...
C
/* ============================================================================ Name : for_demo.c Author : J. Kaldeway ============================================================================ */ #include <stdio.h> int main(void) { for(int i = 11; i < 21; i++) { printf("%d ", i * i); ...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> typedef struct{ int registro; // fixo 10 char cod_empregado[10]; char competencia[8]; char cod_evento[4]; int tipo_processo; char valor[9]; char cod_empresa[10]; }Lancamento; typedef struct{ int registro; //fixo 11 ...
C
#ifndef MJ808_BUTTON_C_ #define MJ808_BUTTON_C_ #include "mj808\mj808.h" #include "button\button_types_actual.c" // various __*button_t types - for convenience in one place for all LED devices extern void _debounce(__individual_button_t *in_button, event_handler_t * const in_event); // wrapper function for t...
C
#include<stdio.h> #include<stdlib.h> #include"handlers.h" /*1. Declaration of global variable*/ char audioname[100]; /*5. A funtion to take care of showing an audiofile or saving an audiofile*/ void handleMenuEvent(int choice) { /*6. To take the input from user*/ printf("enter the audio filename "); scanf("%s...
C
/* name.c */ #include <ctype.h> /* isalpha */ #define NAME_SIZE_MAX 20 static char** name_list; static unsigned int name_count; static char* name_new(const char* name) { char* newName = malloc(sizeof (char) * NAME_SIZE_MAX +1); assert(newName); memset(newName, '\0', NAME_SIZE_MAX +1); memcpy(newName, name, NAME...
C
#include "stdio.h" #include "string.h" /* all calls are assumed to be written to the same file, unless the name changes */ static char gPreviousfile[2048]=""; static FILE *gFp = NULL; FILE *inventor_openfile(char *filename) { if (!gFp || strncmp(gPreviousfile, filename, 2048)) { strncpy(gPreviousfile, filen...
C
/** * 查找 */ #include <stdio.h> #include <stdlib.h> // 有哨兵顺序查找 int Sequential_Search(int *a, int n, int key) { int i; a[0] = key; // 哨兵 i = n; // 循环从尾部开始 while(a[i] != key) i--; return i; // 返回0,没找到 } // 二分查找 int Binary_Search(int *a, int n, int key) { int low, high, mid; low = 1; // 定...
C
/*--- CCITTOTF.C ------------------------- Listing 10-4 ------- * Compute CCITT-CRC on-the-fly. * Usage: ccittotf filename * * Based on a similar program by Nigel Cort in C Gazette 5.1 * (Autumn 1990). *------------------------------------------------------------*/ #include <stdio.h> #include <stdlib...
C
#include <sys/types.h> #include <sys/ipc.h> #include <sys/sem.h> #include <stdio.h> //int a=10; //int b=20; main() { int a=10; int b=20; int semid,pid,i; struct sembuf sop; semid=semget(0x20,1,IPC_CREAT|0666); pid=fork(); if(pid==0) { sleep(5); printf("child before semop\n"); sop.sem_num=0...
C
#include <stdio.h> #include <sys/syscall.h> #include <unistd.h> #include <sys/mman.h> #include <fcntl.h> #include <stdlib.h> #include <string.h> /** * munmap 卸载通过 mmap 映射的内容 * @tags 系统调用函数 */ int munmap(void *addr, unsigned long len) { return syscall(SYS_munmap, addr, len); } int main(int argc, const char* argv[]...
C
#include <stdio.h> #include <ctype.h> #include <string.h> #include "fcgios.h" #define HGH_DBG(fmt, args...) printf("\033[40;33m HGH_DBG(%s %s %d):\t\033[0m"fmt, __FILE__, __func__, __LINE__, ## args) const char *unixPath = "/tmp/fcgi.sock"; int main(int argc, char const *argv[]) { int listenFd; char buf[102...
C
#include <stdio.h> #include <stdlib.h> #include "tree_function.h" #include "lifegame.h" #include "kadai2_ext.h" void init_cells(FILE *fp) { int w, h; char tmp[WIDTH+10]; if (fp == NULL) { for (w = 0; w < WIDTH; w++) { for (h = 0; h < HEIGHT; h++) { cells[h][w] = rand() % 2; } } } el...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_cd_check.c :+: :+: :+: ...
C
/** ****************************************************************************** * @file led.c * @author LGG * @version V1.0.0 * @date 15-July-2019 * @brief This file is LED related functions. ****************************************************************************** */ /* Includes --...
C
#include <stdio.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/msg.h> #include <stdlib.h> #include <string.h> #include "../include/types.h" #define MSGKEY 90 /* chiave per la coda */ //#define MSGTYPE 1 /* tipo per il messaggio da inviare */ int main(int argc, char *argv[]) { /* puntatore alla...
C
#include <stdio.h> void one(void); void two(void); void main(void) { one( ); two( ); } void one() { int a=5,b=7; printf("A = %d, B = %d\n",a,b); } void two() { float p=4.5,q=3.5; printf("P = %6.2f, Q = %6.2f\n",p,q); }
C
#include <stdio.h> #include <stdlib.h> #include <math.h> typedef struct Node { int row; int col; int level; // } TreeNode ; int main(){ //TRYING TO INPUT FILE* fin; fin= fopen("prefSum.txt", "r"); char buff[255]; int n; fscanf(fin, "%s", buff); n = atoi(buff); int t; int rows = (i...
C
#include<stdio.h> #include<unistd.h> #include<stdlib.h> #include <sys/types.h> #include <sys/wait.h> int main(void) { pid_t pid; if ((pid = fork()) < 0) { printf("fork error"); } else if (pid == 0) { /*WAIT_PARENT(); parent goes first */ int gid=setsid(); if(gid==getpid()) ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_vecpush.c :+: :+: :+: ...
C
/* * Use the power of pointer arithmetic to mend a broken heart. * This function will skip the first six characters of the text message. */ #include <stdio.h> #include <stdlib.h> int main() { char *msg_from_amy = "Don't call me"; skip(msg_from_amy); return 0; } int skip(char *msg) { puts(msg + 6); ...
C
#include<stdio.h> #include<conio.h> #include<math.h> #include<string.h> char * get_the_string(char * x){ return x; } int main(){ char Str[] = "Hello!"; char *a = get_the_string(Str); printf("%s" , a); getch(); return 0; }
C
#include "ft_printf.h" void treat_dec(va_list args, int *counter) { int num; char* str_num; int is_minus; is_minus = 0; size_t i; size_t len; i = 0; num = va_arg(args,int); if(num < 0) { is_minus = 1; num *= -1; } str_num = ft_ull_base(num,10); if(is_...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #define DEFAULT_PORT 8000 #define MAXLINE 4096 int main(int argc, char** argv) { int sockHandle, conn; int port = -1; struct sockaddr_in servaddr; char s...
C
#include <stdio.h> #define _XOPEN_SOURCE #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <fcntl.h> //#include <Linux/limits.h> #include <time.h> #include <pty.h> // for openpty() & forkpty() #include <utmp.h> // for login_pty int main(int argc, char *argv[]) { int rtnVal = ...
C
/* ** EPITECH PROJECT, 2020 ** my_compute_power_rec ** File description: ** Computes power recursively */ #include <my.h> static int may_overflow_if_multiplied(int number, int digit) { return (number > 2147483647 - (number * (digit - 1))); } int my_pow(int nb, int p) { if (p < 0) return (0); if (p...
C
#include <stdio.h> #include <stdlib.h> /** \brief esta funcion toma que funcion voy a realizar del menu * * \param mensaje "ingresar opcion" * \param mensaje de error de opcion. * \return retorno 0 * */ int tomarDato(char mensaje[], char mensajeError[], int* valor) { printf(mensaje); scanf("%d", valor); ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_reload_timers.c :+: :+: :+: ...
C
#ifndef CLM_LISTE_H #define CLM_LISTE_H typedef struct cell { char *word; int occurrences; struct cell *next; struct cell *previous; } Cell, *List; void displayWordsOfList(List list); Cell *getWord(List list, char *word); /** * Ajouter un mot à une liste. * Si le mot est déjà présent, son nombre d...
C
#include <stdio.h> int main() { const int a=20; int tab[a]; int i,n,S=0; printf("Saisie la taille du tableau"); scanf("%d",&n); for (i=0;i<n;i++) { printf("Saisie T[%d]",i); scanf("%d",&tab[i]); S=S+tab[i]; } printf("La moyenne des entiers de tableau= %d",S/n); return 0; }
C
#include<stdio.h> #include<string.h> #include<time.h> #include<stdlib.h> #include<errno.h> #include <sys/stat.h> #include <sys/types.h> #define PATH_SIZE 1024 void date_command_normal(); void date_command_utc(); void date_command_modified(char path[512]); void red() { printf("\033[1;31m"); // red color } void no...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/ioctl.h> #include <ctype.h> #include <sys/ipc.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include "eightled.h" #define LED_ON 1 #define LED_OFF 0 #define MAX_LED_NO 8 void eightledWrite(int led...
C
#include <stdio.h> #include <stdlib.h> struct node { char name[20]; int roll_no; float per; struct node *link; }; struct node *root = NULL; void append(void); void display(void); void main() { int ch; while (1) { printf("Enter element in the list:1\nExit:2\nDsplay:3"); scan...
C
#include "ConsolaKernel.h" void recibir_comandos() { while(morir == 0) { //0-> new, 1->ready, 2->execute, 3-> blocked, 4-> suspended, 9-> killed, char* entrada = leerCaracteresEntrantes(); if (*entrada!=NULL){ char** comando = string_split(entrada, " "); if(!strcmp(comando[0], "cola")) { if(comand...
C
/*.............Name:P Venkata Yashwanth Kumar............ ................Roll No:05AE1013........................ ................Program name:a5.c..................... ................PC No:17......................*/ #include<stdio.h> struct variable { int val; int op1,op2; char op; }; void readinput(struct va...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> void Usage() { char buff[64]; sprintf(buff,"Usage: prog_* num\n"); write(1,buff,strlen(buff)); exit(1); } int main( int argc, char *argv[] ) { int i, num; char buf[80]; if (argc != 2) Usage(); num = atoi( argv[1] ); for (i = 0; i < num; i++) { spr...
C
#ifndef RAYCAST #define RAYCAST #include "ib_3dmath.h" #define RUN_SUCCESS 0 #define RUN_FAIL 1 #define MIN_ARGS 5 #define TRUE 1 #define FALSE 0 #define CAMERA 0 #define SPHERE 1 #define PLANE 2 #define LIGHT 3 #define CENTER_XY 0.0 #define SHINE_DEFAULT 20.0 #define MAX_RECURSION 7 // Type definitions typedef i...
C
#include "holberton.h" /** * _isdigit - function that checks for a digit through (0 -9) *@c: character to evaluate in ASCII code * * Return: 1 if c is a digit or 0 otherwise * */ int _isdigit(int c) { if ((c >= '0') && (c <= '9')) { return (1); } return (0); }
C
#include <idc.idc> static print_all_method(filename) { auto file = fopen(filename, "w"); if (file != 0) { auto addr = 0; for (addr = NextFunction(addr); addr != BADADDR; addr = NextFunction(addr)) { auto name = GetFunctionName(addr); auto end = GetFunctionAttr(addr, FUNCATTR_END); M...
C
#include<stdio.h> #include<stdlib.h> int main() { FILE *ptr; int a,b,c; ptr=fopen("28.txt","r"); fscanf(ptr,"%d%d%d",&a,&b,&c); printf("the values of a,b and c is %d,%d,%d",a,b,c); return 0; }
C
/** ****************************************************************************** * * @file : strconv.c * @brief : 字符串和数字间格式转换 * ****************************************************************************** */ #include "strconv.h" const uint8_t err_message_IA[] = "INVALID ADDR!\n...
C
#include<stdio.h> #include<unistd.h> #include<netinet/in.h> #include<string.h> #include<sys/socket.h> #include<sys/types.h> #define SERV_PORT 5576 main(int argc,char **argv) { int i,j; ssize_t n; FILE *fp; char s[80],f[80],command[50]; //strcpy(s,"file.txt"); struct sockaddr_in servaddr,cliaddr; int listen...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #define u8 unsigned char int main(int argc, char *argv[]){ u8* mask; mask= (u8 *)malloc(sizeof(u8)*32); if(mask==NULL){ fprintf(stderr,"Allocate memory failed\n"); return 1; } memset(mask,0,32*sizeof(u8)); //mask[7]=~0;...
C
/* sell.c by -Acme- */ inherit F_CLEAN_UP; private void create() { seteuid(getuid()); } int sell_item(object item) { int value; string name; if( item->query("money_id") ) return notify_fail("AnuvS\n"); if( item->query("no_sell") ) return notify_fail("o˪F褣C\n"); if( (value = item->...
C
#include <stdbool.h> #include "networking.h" #include "generalMethods.h" #include <stdlib.h> #include <stdio.h> #include <errno.h> #include <string.h> #include <stdbool.h> #include "tmdl.h" #include <unistd.h> #include <pwd.h> #include "customParser.h" #include "experimental.h" #include <sys/types.h> #include <dirent.h...
C
#ifndef ROTATE_H_INCLUDED #define ROTATE_H_INCLUDED #include <stdlib.h> #ifndef ROTATEPIXEL_T_DEFINED #define ROTATEPIXEL_T_DEFINED #include <stdint.h> #if ROTATEPIXEL_T_BITS==8 typedef char RotatePixel_t; // Pixel type for rotation library //#define ROTATEPIXEL_T_BITS (8) #elif ROTATEPIXEL_T_BITS==16 typedef uint16_...
C
#include <stdlib.h> #include <stdio.h> #include <stdbool.h> #include <string.h> // This program has errors. Check again bool valid(char number[]) { bool result = false; int length = strlen(number); int counter = 0; int s1 = 0; int s2 = 0; for(int i = length - 1; i >= 0; i--) { counter++; int...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* print_error.c :+: :+: :+: ...
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
/* Copyright (C) 2019-2020 JingWeiZhangHuai <jingweizhanghuai@163.com> Licensed under the Apache License, Version 2.0; you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in wri...
C
// Program: Ls.c -- Used to show the files inside a directory #include <dirent.h> #include <stdio.h> #include <stdlib.h> int main(int argc, char **argv) { DIR *dir; // Returned by opendir struct dirent *direntry; // Returned by readdir char thisDir[201]; char *dirName; // If there is no...
C
// // Created by cuixin on 2019-12-22. // // // Created by cuixin on 2019-12-22. // #include <stdio.h> #include <string.h> //通过排序的最大文本行数 #define MAXLINES 5000 char *lineptr[MAXLINES]; //指向文本行的指针数组 int readlines(char *lineptr[], int nlines); int readlines_v2(char *lineptr[], int maxlines, char *storeArr, int fullLen...
C
# include <stdio.h> int main () { // Arreglo de enteros int integers[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; // Iterar arreglo int size = sizeof(integers)/sizeof(int); for (int i = 0; i < size; i++) { printf("%i\n", integers[i]); } return 0; }
C
#include "ls.h" int main(int ac, char **av) { if (ac != 3) return (1); char *path; size_t len; len = ft_strlen(av[1]) + 1 + ft_strlen(av[2]); path = ft_strnew(len); ft_strncpy(path, av[1], ft_strlen(av[1])); ft_strncpy(&path[ft_strlen(av[1])], "/", 1); ...
C
//SUBSTITUTION #include <stdio.h> #include <cs50.h> #include <string.h> #include <ctype.h> bool check_string (string s) { int len = strlen(s); if (len != 26) { return true; } int f[26] = { 0 }; for (int i = 0; i < len; i++) { if (isdigit(s[i])) { return t...