language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
//*---------------------------------------------------------------------------- //* ATMEL Microcontroller Software Support - ROUSSET - //*---------------------------------------------------------------------------- //* The software is delivered "AS IS" without warranty or condition of any //* kind, eithe...
C
#include "math.h" #include "common.h" const char * USAGE = "Write an atof function that handles scientific notation"; struct significand_num { int length; int digits[256]; }; typedef struct scinot scinot_t; struct scinot { int significand_sign; // -1 or 1 int exponent_sign; // -1 or 1 long significand; // nums...
C
#include<stdio.h> main() { int arr[5]={1,2,3,4,5},i; for(i=0;i<5;i++) { printf("1st elemnt addr %p %d\n",&arr[i],arr[i]); } printf("i am printing one by one"); printf("%p %p %p %p %p %p\n",&arr,&arr+0,&arr+1,&arr+2,&arr+3,&arr+4); }
C
#include <stdio.h> int main(void) { enum numeri_int {A = 1, B = 2, C = 3}; enum numeri_int x; enum numeri_int y; printf("inserisci A B C : "); scanf("%[A,B,C]", &x); scanf("%*[^\n]"); scanf("%[A,B,C]", &y); scanf("%*c"); printf("%f", (float)x/y); }
C
#include <stdio.h> #include <stdlib.h> #include "string.h" char* getInputString(int size){ char *array = (char*) malloc(size + 1); printf("Enter string:"); gets(array); return array; free(array); } int countWords(char* stringArray){ const char *SEPARATORS = {"|!?.,;/*-+{}[]\'@#$%^&()=~12345678...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* sh_builtin_type_search.c :+: :+: :+: ...
C
//Copyright 2016 Fyf and Xjw. All Rights Reserved. #include "custom.h" #include <stdio.h> #include <stdlib.h> #include <time.h> void PrintArray(Number *array, BitNum n, int flag)//Fyf { for (BitNum i = 0; i < n; i++) { if(flag == 0) printf("%d\n", array[i]); else printf("array[%d]=%d\n", i, array[i]); } } Num...
C
/* * yase - Yet Another Sieve of Eratosthenes * seed.c: sieves the "seed primes" needed to sieve the entire interval * * Copyright (c) 2015 Matthew Ingwersen * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"),...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "src/utils.h" #include "src/tables.h" const char* TMP_FILE = "tmp_grading.txt"; const int BUF_SIZE = 1024; /**************************************** * Helper functions ****************************************/ int check_lines_equal(char **arr, ...
C
/* The VDRIVER - A Classic Video Game Engine By Jake Stine and Divine Entertainment (1997-2000) Support: If you find problems with this code, send mail to: air@divent.org For additional information and updates, see our website: http://www.divent.org Disclaimer: I could put things here that would m...
C
#include<stdio.h> #include<stdlib.h> #define MAX 100005 int n,ans[MAX],visit[MAX]; int main(int argc, char *argv[]) { int i,j; scanf("%d",&n); if(n%1) { printf("-1\n"); return 0; } memset(visit,0,sizeof(int)*(n+1)); ans[n]=0; for(i=n;i>0;i--) { visit[ans[i]]=1...
C
/* This file is part of the examples given in the slide. * For educational use as part of the Intro to ARM course at http://www.opensecuritytraining.info/IntroARM.html . */ #include <stdio.h> int main(void) { int a, b; int *x; a = 8; b = 9; x = &a; b = *x + 2; printf("The address of a is 0x%x\n",x); ...
C
/* * Two versions of gcd implementation using subtract, and modulo operation then measure how many times each one * took for executions. * * Clearly gcd() took 8 times while gcdNotEfficient() took 260 times. */ #include <stdio.h> int gcdNotEfficient(int u, int v) { int t, count=0; while (u > 0) { if (u < v...
C
#include <unistd.h> #include <stdlib.h> #include <dirent.h> #include <sys/stat.h> int is_a_file(char* current_file) { struct stat path_stat; stat(current_file, &path_stat); return S_ISREG(path_stat.st_mode); } int get_file_count() { struct dirent* direc_entry; DIR *cwd = opendir("."); int directory_count = 0;...
C
#include <stdlib.h> #include <stdio.h> int ft_atoi(char *str) { int i; int ret; int neg; ret = 0; neg = 1; i = 0; while (((str[i] >= 9 && str[i] <= 13) || str[i] == 32) && str[i]) ++i; if (str[i] && str[i] == 45) { neg = -neg; ++i; } else if (str[i] && str[i] == 43) ++i; while (str[i] <= 57 &&...
C
#include <stdlib.h> #include <string.h> #include <play.h> #include <stdio.h> static inline unsigned long to_bytes(stream_state *s, unsigned long x) { return x * s->channels * sizeof(SAMPLE); } // S1 is modified to be the mix of S1 and S2. // If S2 was longer, then the reminder is enqueued after S1. // Assumes that...
C
#include "sequential-version.h" #include <stdio.h> #include <stdlib.h> #include <string.h> struct SOE sequential_sieve_of_eratosthenes(long int n) { long int p, count = 0, index; char prime[n+1]; struct SOE soe; memset(prime, '*', sizeof(prime)); for (p = 2; p * p <= n; p ++) { if ...
C
#include <stdio.h> #include <stdarg.h> #include <string.h> #include <stdlib.h> #include "hash_tables.h" /** **hash_table_get - Retrieves a value associated with a key. *@ht: a variable *@key: a variable *Return: 0 **/ char *hash_table_get(const hash_table_t *ht, const char *key) { unsigned long int index; hash_...
C
/*2.编写一个程序读取输入,读到#字符停止。程序要打印每个输入的字 * 符以及对应的ASCII码(十进制)。一行打印8个字符。建议:使用字符计数 * 和求模运算符(%)在每8个循环周期时打印一个换行符。 */ #include <stdio.h> int main(void) { char ch; int i = 1; while ((ch = getchar()) != '#') { if (i % 9 == 0) printf("\n"); else printf("%3c %3d ", ch, ch); i++; } printf("\n"); return 0; }
C
/* PARALELISMO EN BLOQUES */ #include <pthread.h> #include <stdlib.h> #include <stdio.h> #include <sys/types.h> #include <unistd.h> /* Modulos propios */ #include "defs.h" #include "procesamiento.h" #include "hilos.h" #include "helper.h" #include "archivos.h" float *rxx, *x; int main(){ /* Register le indica al ...
C
#include<stdio.h> void main() { int a; printf("enter the number"); scanf("%d",&a); if(a<0) printf("the given number is negative"); elseif(a>0) printf(" the given number is positive"); else printf("the given number is zero"); getch(); }
C
/* * sadstrings.c */ #include <assert.h> #include <stdio.h> #include <stdlib.h> #include <string.h> void get_strings(char const *in) { char *cmd; int len = strlen("strings ") + strlen(in) + 1; cmd = malloc(len * sizeof(char)); snprintf(cmd, len, "strings %s", in); printf("%s\n", cmd); free(cmd); } int main(i...
C
#ifndef STACK_H #define STACK_H #define SElemType int #define MAXSIZE 20 #define bool int #include <stdio.h> #include <stdlib.h> typedef enum Status{ OK, ERROR }Status; typedef struct Stack{ SElemType elem[MAXSIZE]; int top; }Stack, *Ptr; typedef Ptr StackPtr; Status InitStack( StackPtr S ); bool Stac...
C
#include "homework1.h" int num_threads; int resolution; void *threadFunction(void *var) { threadFunctionParams params = *(threadFunctionParams *)var; image *im = params.im; int threadID = params.threadID; int intervalSize = ceil((float)resolution / num_threads); int low = threadID * intervalSize; ...
C
/* * Description: <write a brief description of your lab> * * Author: <your name> * * Date: <todacommand.h.gchy's date> * * Notes: * 1. <add notes we should consider when grading> */ /*-------------------------Preprocessor Directives---------------------------*/ #define _GNU_SOURCE #include <ctype.h> #include <stdio....
C
#include <stdio.h> #include <stdlib.h> void merge(int* nums, int left, int middle, int right) { int i, j, k; int sizeLeft = middle - left + 1; int sizeRight = right - middle; int* LEFT = (int*)malloc(sizeof(int) * sizeLeft); int* RIGHT = (int*)malloc(sizeof(int) * sizeRight); for (i = 0; i < sizeLeft; i++) LE...
C
#include <stdio.h> int main() { char s[] = {"abcd"}; printf("%c\n",s[0]); s[0] = 'E'; printf("%s %c\n",s,s[0]); return 0; }
C
#include "holberton.h" /** * puts_half - finds and prints midpoint on * * @str: pointer to numbers * * Return: none */ void puts_half(char *str) { int j, mid; int i = 0; while (str[i] != '\0') /* gets size */ { i++; } i = i + 1; if (!(i % 2)) mid = (i - 1) / 2; /* odd size start */ else mid = i...
C
/* * kernel_alloc.c * Brandon Azad */ #include "kernel_alloc.h" #include <assert.h> #include <fcntl.h> #include <pthread.h> #include <stdbool.h> #include <stdlib.h> #include <unistd.h> #include "log.h" // This is the size of entries in the ipc_kmsg zone. See zinit(256, ..., "ipc kmsgs"). static const size_t ipc_...
C
#pragma once #include <stdio.h> #include <stdbool.h> #include <stdlib.h> #include <time.h> #include "util.h" #define NUM_ROW 12 #define NUM_COL 25 #define NUM_ROTATE 4 #define NUM_TILE 4 #define BOARD_X 1 #define BOARD_Y 1 typedef char Board[NUM_COL][NUM_ROW]; typedef struct { Pos pos; int blockNum; int rota...
C
#ifndef SUNIT_INT_H #define SUNIT_INT_H /* ========================================================================= * PRIVATE HEADERS * ========================================================================= */ typedef int (*AssertFuncPtr)(); void raise_test_fail(const char* test_n...
C
//INDEX //001.语句 自动换行输出 //002.函数 int bitcount(unsigned x)统计变量中1的个数 //003.函数 getbits(x, p, n)它返回 x 中从右边数第 p 位开始向右数 n 位的字段。 //004.规则 优先级 //005.函数 int binsearch(int x, int v[], int n) //006.规则 巧用逗号运算符 /**********************************************************************/ //001 /*打印一个数组的n个元素,每行打印10个元素,每列之间用一个空格隔开, 每行用一...
C
/******************************************************************************* This file is part of the up2p. Copyright wilddog.com All right reserved. File: protocol_uart.c No description TIME LIST: CREATE skyli **************************************************...
C
typedef int DIR; struct dirent { char d_name[50]; }; typedef struct dirent dirent; DIR mock_state = -1; dirent cur_ent; DIR* opendir(const char* path) { if (strcmp(path, "illegal") == 0) { return NULL; } if (strcmp(path, "cant/close") == 0) { /* Iteration will work but close will fail. */ mock_s...
C
/* example-8.3 */ #include <stdio.h> #include <string.h> #include <ctype.h> int main(void) { char st[100]; int i,n; printf ("文字列を入れてください "); gets(st); n=strlen(st); for(i=0;i<n;i++) st[i]=toupper(st[i]); printf ("すべて大文字で表示:%s\n",st); for(i=0;i<n;i++) st[i]=tolower(st[i]); printf ("すべて小文字で表...
C
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> int p[3]; int f[2]; int min(int a, int b) { return a < b ? a : b; } int main(void) { double minp = 0; double minf = 0; scanf("%d", &p[0]); scanf("%d", &p[1]); scanf("%d", &p[2]); scanf("%d", &f[0]); scanf("%d", &f[1]); minp = min(min(p[0], p[1]), p[2]); ...
C
#define _CRT_SECURE_NO_WARNINGS #include "Header.h"; char base64[] = { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghigklmnopqrstuvwxyz0123456789+/" }; int FindNumber(char symbol) { int i = 0; for (i; i < 64; i++) { if (symbol == base64[i]) break; } return i; } void Encode(FILE *f1,FILE*f2) { char c; ...
C
#include "base.h" /** * y = sin(x^3/2) + x * x = 1 */ double CALL(task)(double x, double eps, bool *divergent) { return x_sin(pow(x, 3) / 2, eps, divergent) + x; } double CALL(base)(double x, double _) { return sin(pow(x, 3) / 2) + x; } double CALL(initiate_x)() { return 1; }
C
///4. Write a function in C to print all prime numbers inside a given range [a,b]. You need to pass a and b as parameters to the function. #include<stdio.h> int primeInRange(int a, int b) { int f; for (int j=a; j<=b; j++) { f=1; for(int i=2; i<j; i++) { if(j%i==0) ...
C
// snake.h #ifndef SNAKE_H #define SNAKE_H #endif typedef struct body { int x; int y; struct body *next; struct body *prev; } body; typedef struct snake { int len; body *head; body *tail; } snake;
C
#include <stdio.h> int main() { int a,b,c; printf("Enter number\n"); scanf("%d",&a); printf("Enter number you want to take power of it\n"); scanf("%d",&b); for(c=1;c<=b;c++){ a=a*a; } printf("%d",&a); }
C
//#include <conio.h> #include <stdio.h> #include <stdlib.h> #include <locale.h> int main (){ setlocale(LC_ALL, "Portuguese"); float celsius, fah; printf("Digite a temperatura em graus Celsius: "); scanf("%f", &celsius); fah = (celsius*1.8)+32; printf("A temperatura equivale a %2.f em Fahrenh...
C
#include "pokemonGo.h" struct PokemonGo_s { Map pokedex; Map evolutions; Map world; Map trainers; Store store; }; static void pokemonDestroyForMain(MapDataElement pokemon); static void evolutionDestroyForMain(MapDataElement evolution); static void locationDestroyForMain(MapDataElement location); static void trai...
C
struct elemento { int inf; struct elemento *pun; }; struct elemento *creaLista2(); void visualizzaLista(struct elemento *); void contaPari(struct elemento *, int *, int *); int contaPari2(struct elemento *, int *); int main() { int pari, dispari; struct elemento *puntLista; puntLista = creaL...
C
#include<stdio.h> int max( int k[]); int main( void){ int i,k[100],m,x; printf("Enter the number of elements:"); scanf("%d",&x); printf("Enter the elemets:"); for(i=0;i<5;i++) { scanf("%d",&k[i]); } m=max(k); printf(" The largest element is:%d\n",m); return 0; } int max ( int k[]) { int n,i; n=k...
C
/*************************************************************************** * solve.c * * This file pertains solvers for linear systems of the form AX = F. * A number of different solvers will be provided in the future. * * solve_1: dit is een zeer twijfelachtig geheel... * Gauss equation solver for systems of ...
C
/* average.c: ָ */ #include <stdio.h> #define ARR_LEN 20 void printFloatArray( const float* array, int length ) { int i; for (i = 0; i < length; ++i) { printf( "%10.8f\t", array[i] ); if ((i + 1) % 5 == 0) printf( "\n" ); } } /* average()Ԫصƽֵ * Ա顢鳤 * ֵԪصƽֵdouble */ double averag...
C
#include <stdio.h> #include <stdlib.h> #include "timing.c" #define N 1000 //Nhan ma tran kich thuoc lon int main(){ double** A = NULL; double** B = NULL; double** C = NULL; A = (double **)malloc(sizeof * A * N); B = (double **)malloc(sizeof * B * N); C = (double **)malloc(sizeof * C * N); #...
C
#include "../likely.h" #include "../rangecheck.h" #include "../safemult.h" /* does an array of "elements" members of size "membersize" starting at * "arraystart" lie inside buf1[0..len-1]? */ int range_arrayinbuf(const void* buf1, size_t len, const void* arraystart, size_t elements, size_t membersize) { size_t alen...
C
static char help[] = "Create a Plex sphere from quads and create a P1 section\n\n"; #include <petscdmplex.h> typedef struct { PetscInt dim; /* Topological problem dimension */ PetscBool simplex; /* Mesh with simplices */ } AppCtx; static PetscErrorCode ProcessOptions(MPI_Comm comm, AppCtx *options) { Pets...
C
// Chapter 5 Question 2 #include <unistd.h> #include <fcntl.h> #include <sys/wait.h> int main(void) { int fd; fd = open("output.txt", O_CREAT|O_TRUNC|O_WRONLY, 0666); // open a file for writing // Create a new process by fork if(!fork()) { // child write(fd, "Child is writing\n",...
C
/* ** char_function.c for my_irc in /home/noel_h/rendu/PSU_2014_myirc/src_server ** ** Made by Pierre NOEL ** Login <noel_h@epitech.net> ** ** Started on Fri Apr 10 16:31:41 2015 Pierre NOEL ** Last update Tue Apr 14 15:28:29 2015 Pierre NOEL */ #include <math.h> #include "server.h" static void function_usua...
C
#include <stdio.h> #include <stdlib.h> #include <arpa/inet.h> void error_handling(char * message); int main(int argc, char *argv[]) { struct sockaddr_in addr_inet; if( argc !=2){ printf("Usage: %s <IP> \n", argv[0]); exit(1); } if(!inet_aton(argv[1],&addr_inet.sin_addr)) error_h...
C
#include<stdio.h> void main(){ int i=1, num, result=0; printf("Digite 10 números: \n \n"); while(i<=10){ printf("Número %d: ", i); scanf("%d", &num); result += num; i++; } printf("Resultado: %d", result); }
C
extern double f1(double); extern double f2(double); extern double f3(double); #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include "function.h" #define e1 1e-4 #define e2 1e-4 #define start_a -2 #define start_b 2 typedef double (*func) (double x); static int num; static double nothi...
C
#include <stdio.h> #include <unistd.h> #include <sys/time.h> #include <sys/select.h> #define BUF_SIZE 30 int main(int argc, char *argv[]) { fd_set reads, temps; int result, str_len; char buf[BUF_SIZE]; struct timeval timeout; FD_ZERO(&reads); FD_SET(0, &reads); // 0 is standard input(console) ...
C
/** @file @brief This file is used so that implementations of the storage functions exist for Consumers and Providers. Since storage is not used by the libraries in these instances, functionality does not matter. Not using the actual implementation saves significant size because the storage library is...
C
/* This is the Parker benchmark as presented in Figure 1 of the paper MAHA: a program for datapath synthesis Alice C. Parker, Jorge T. Pizarro, Mitch Mlinar, Design Automation Conference, 1986 However, the version used here is from parker1986.hc of the HLSynth91 benchmark suite - the modification i...
C
#ifndef VARIADICFUNCTIONS_H #define VARIADICFUNCTIONS_H #include <stdarg.h> #include <stdio.h> #include <stdlib.h> int _putchar(char c); int sum_them_all(const unsigned int n, ...); void print_numbers(const char *separator, const unsigned int n, ...); void print_strings(const char *separator, const unsigned int n, ......
C
#include<stdio.h> int main(void) { int ch = 'A'; for (int n = 0; n < 6; n++) { for (int m = 0; m < n + 1; m++) printf("%c", ch++); printf("\n"); } return 0; }
C
/** * \file philosopher.c * \brief blabla * \author Adrien Forest * \version 0.1 * \date 26 mai 2010 */ #ifndef __PHILOSOPHER_H #define __PHILOSOPHER_H /** * Process used as a master for the philosoophers to manange the communications and the forks * \param argc nombre d'arguments * \param argv arguments *...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/types.h> int main(int argc, char **argv) { int read_fd = 0, write_fd = 0; int i = 0; char buf[] = {'a', '\0'}; if(argc != 3) { fprintf(stderr, "Incorrect number of arguments passed to ping\n"); exit(EXIT_FAILURE); }...
C
#include <stdio.h> #include <malloc.h> struct Queue { int val; struct Queue *next; }; typedef struct Queue N; N *front = NULL, *rear = NULL, *ptr; void Insert() { ptr = (N *)malloc(sizeof(N)); printf("Enter value : "); scanf("%d",&ptr->val); ptr->next = NULL; if(front == NUL...
C
/*find number of words in a sentence*/ #include <stdio.h> #include <string.h> int main() { char s[200]; int count = 0, i,flag= 1; scanf("%[^\n]*c",s); for (i = 0;s[i] != '\0';i++) { if (s[i] == ' ') { if (flag==0) { count++; fla...
C
/* * jsonb_delete.c * Test jsonb delete operator functions for 9.4+ * * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * Author: Glyn Astill <glyn@8kb.co.uk> * */ #include "postgres.h" #include "fmgr.h" #include...
C
#include <stdio.h> void print_array_double(const double * ar, int n); void print_array_double_2D(const double ar[][5], int n); void array_multiply_2_double(double ar[][5], int n); int main(void) { double array[3][5] = { { 1.3, 3.4, 8.9, 2.9, 2.9 }, { 2.9, 2.9, 1.9, 3.8, 9.9 }, { 2.9, 8.7, 2.9, 9.6, 2.7 } }; print_a...
C
#include "flags.h" #include <stdio.h> #include <stdlib.h> #include <netdb.h> #include <string.h> #include <unistd.h> #include <errno.h> #include "shared.h" #include "types.h" #include "debugging.h" #include "operation.h" #include "reduce_ops.h" #include "impi.h" // NOTE: this is the underlying MPI #include "mpi.h" ...
C
#include<stdio.h> int main(){ int a, b, c, i; scanf("%d%d%d", &a,&b,&c); for(i=10;i<=100;i++){ if((i%3==a)&&(i%5==b)&&(i%7==c)) { printf("%d",i); return 0 ; } } printf("No answer"); return 0; }
C
#include "lists.h" /** * add_nodeint - Adds an element to the list * @head: A double pointer to the list * @n: The elements that will take the nodes * Return: Always 0. */ listint_t *add_nodeint(listint_t **head, const int n) { listint_t *add; add = malloc(sizeof(listint_t)); if (add == NULL) return (NULL);...
C
#include <string.h> #include <pthread.h> #include <stdlib.h> #include <sys/shm.h> #include <sys/stat.h> #include <sys/mman.h> #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <unistd.h> #include <sys/ipc.h> #include <sys/shm.h> #include <fcntl.h> //Dynamic array for storing the tokens after pars...
C
/* ** plv.c for in /home/weinha_l/Semestre_4/mouillette_zappy/src/server/ ** ** Made by Loïc Weinhard ** Login <weinha_l@epitech.eu> ** ** Started on Sun Jun 26 13:12:30 2016 Loïc Weinhard ** Last update Sun Jun 26 13:19:47 2016 Loïc Weinhard */ #include "graphic_client.h" #include "utils.h" #include "xfct.h" sta...
C
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <time.h> #include <stdlib.h> struct elementi{ int num; struct elementi *next; }*stelement; int zauzimanjeMemorije(int); void formiranjeNiza(int*, int); void formiranjePP(int* , int); void prikaziListu(); void pretrazivanjeNiza(int*, int); void pretrazivanje...
C
#include "lists.h" /** * insert_node - insert a node with the number value * @head: pointer to the list * @number: value of the new position * Return: a list with the new node inside */ listint_t *insert_node(listint_t **head, int number) { listint_t *temp, *aux; if (head == NULL) return (NULL); temp = mallo...
C
#include <stdio.h> #include <stdlib.h> #include "header.h" Node* insert(Node* root, Node *newNode) { Node *node = search(root, newNode->key); Node *x = root; if (node != NULL) return root; while (x != NULL) { node = x; if (newNode->key < x->key) { x = x->...
C
#include "Factorial.h" int factorial(int x){ int ans=x; x--; for(;x>1;x--) ans = x * ans; if(x < 1) return 1; else return ans; }
C
// RUN: %sea smt %s --step=small -o %t.sm.smt2 // RUN: %z3 %t.sm.smt2 fp.spacer.order_children=2 2>&1 | OutputCheck %s // // RUN: %sea smt %s --step=small --inline -o %t.sm.inline.smt2 // RUN: %z3 %t.sm.inline.smt2 fp.spacer.order_children=2 2>&1 | OutputCheck %s // // RUN: %sea smt %s --step=large -o %t.lg.smt2 ...
C
#include "boolean.h" Bool String_To_Bool( char *s ) { Return_Val_If_Fail( s, FALSE ); if( String_To_True( s ) ) { return TRUE; } return FALSE; } Bool String_To_True( char *s ) { Return_Val_If_Fail( s, FALSE ); if( ( strcmp( s, "true" ) == 0 ) || ( strcmp( s, "True" ) == 0 ) || ...
C
/********************************************************************/ /* Class: Computer Programming, Fall 2018 */ /* Author: ffE */ /* ID: 107820016 */ /* Date: 2018.12.5 */ /* Purpose: qeܫŪT{O_PϦVۦP */ /* Change History: log the change history of the program */ /******************************************************...
C
#include <stdio.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/socket.h> #include <sys/types.h> #include <netinet/in.h> #include <arpa/inet.h> int main(int argc,char* argv[]) { if(argc!=3) { printf("Usage:%s:ip port\n",argv[0]); exit(1); } ...
C
#ifndef __LAB6_WORKER_H__ #define __LAB6_WORKER_H__ #include <mpi.h> #include "utils.h" int worker_proc(int rank) { // Get chunk size size_t chunk_size; MPI_Recv(&chunk_size, 1, MPI_UINT64_T, RANK_MASTER, MPI_ANY_TAG, MPI_COMM_WORLD, NULL); printf("<%d>: chunk size: %zu\n", rank, chunk_size); //...
C
#ifndef UTILS_STRING_H #define UTILS_STRING_H #include <include/cdefs.h> #include <stddef.h> #include <stdint.h> void itoa(long long i, unsigned base, char *buf); void itoa_s(long long i, unsigned base, char *buf); char *strcpy(char *s1, const char *s2); size_t strlen(const char *str); int strcmp(const char *str1, c...
C
#include<stdio.h> void main() { char line[80]; int vowels=0,consonants=0,digits=0,whitespaces=0,other=0; printf("enter a line of text"); scanf("%s",line); line_scanner(line,vowels,consonants,digits,whitespaces,other); } void line_scanner(char line[],int *pv, int *pc, int *pd, int *pw, i...
C
#include <stdio.h> /* * Count how many ';' in given file. */ int main(int argc, char const *argv[]) { if(argc < 2){ printf("Empty Input!\n"); return 0; } FILE * fp = fopen(argv[1],"r"); int total = 0; char c; if(fp == NULL){ printf("Can not found %s\n",argv[1]); return 0; } while(feof(...
C
/* SPDX-License-Identifier: MIT */ /* * Author: Andreas Werner <kernel@andy89.org> * Date: 2016 */ #ifndef PWM_H_ #define PWM_H_ #include <FreeRTOS.h> #include <stdint.h> #include <stdbool.h> #include <system.h> #include <hal.h> /** * \defgroup PWM PWM Subsystem * \ingroup HAL * \code * #include <pwm.h> * \end...
C
#include<stdio.h> int main(){ int n1; printf("Operao ternario\n"); printf("Digite um numero:"); scanf("%i",&n1); printf("%s", n1>=0 ? "positivo" : "negativo"); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> /* ӼһЩַ͵ȥֱûһ# Ϊֹ */ int main() { char c,filename[20]; FILE *fp; printf("Please enter the file name:\n"); scanf("%s",filename); //ע⣺ܰifδwhileѭУᵼÿһַһļ if((fp=fopen(filename,"w"))==NULL)//һֻдļʹfpָļ { printf("cannot open the file!\n"); exit(0); } ...
C
/* ** options_errors.c for tetris in /home/detroy_j/Documents/delivery/tetris ** ** Made by detroy_j ** Login <jean-baptiste.detroyes@epitech.eu@epitech.net> ** ** Started on Mon Feb 20 18:12:59 2017 detroy_j ** Last update Thu Mar 9 15:52:00 2017 detroy_j */ #include <stdlib.h> #include "options.h" #include "my...
C
#include<stdio.h> #include<stdlib.h> #define maxsize 5 typedef struct stack{ int arr[maxsize],top; } stk; void push(stk *,int); void pop(stk *); int isfull(stk *); int isempty(stk *); int display(stk *); main() { int item,ch; stk s,*sp; sp=&s; sp->top=-1; while(1) { printf("\n1.Push\n2.Pop\n3.Display\n0.Exit...
C
#include "timerDriver.h" #include <eZ8.h> // Counter for timer 0 short timer0Counter = 0; /* Interrupt function for timer 0 */ #pragma interrupt void isr_timer0() { timer0Counter++; } /* Get the counter for timer 0 */ short getTimer0() { return timer0Counter; } /* Reset timer 0, so it can recount */ void rese...
C
#include "parser.h" void error_directory_diff(char *dir) { DIR *flow; ft_putstr_fd("minishell: ", 2); ft_putstr_fd(dir, 2); ft_putstr_fd(": No such file or directory\n", 2); if ((flow = opendir(dir)) != NULL) { g_error = 126; closedir(flow); } else g_error = 127; } void error_command_diff(char *cmd)...
C
/** @file @brief UDP utility functions */ /* * Copyright (c) 2017 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_INCLUDE_NET_UDP_H_ #define ZEPHYR_INCLUDE_NET_UDP_H_ #include <zephyr/types.h> #include <zephyr/net/net_core.h> #include <zephyr/net/net_ip.h> #include <zephyr/net/net_...
C
#include <stdio.h> #include <stdlib.h> char *substr(char *a,size_t l,char *b,size_t strt,size_t end) { size_t i,of = strt; for(i = strt - of;i < end - of;i++) b[i] = a[i]; b[i] = '\0'; return b; } int main() { size_t SZ = 10; char *a = (char *)malloc(sizeof(char) * (SZ + 1)); a[0] = 'a'; a[1] = 'b'; a[2] =...
C
/* ** EPITECH PROJECT, 2019 ** my_str_isupper.c ** File description: ** is a string compose with uppercase letters */ int my_str_isupper(char const *str) { int res = 1; for (int i = 0; str[i] != '\0'; ++i) { if (str[i] >= 65 && str[i] <= 90) res = 1; else return (0); ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_doubleflag3.c :+: :+: :+: ...
C
/* * Copyright (C) 2013 Felix Fietkau <nbd@openwrt.org> * Copyright (C) 2013 John Crispin <blogic@openwrt.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 2.1 * as published by the Free Software Foundation * * Thi...
C
#include <stdio.h> int main() { int n1; int n2; int n3; scanf ("%d", &n1); for (n1; n1 > 0; n1--) { scanf ("%d %d", &n2, &n3); printf("%d\n", n2 + n3); } return (0); }
C
// Handcrafted examples I used when designing the domain int main(void) { example1(); example2(); example3(); example4(); example5(); example6(); example7(); example8(); example9(); example10(); example11(); example12(); example13(); example14(); example15(); example16(); } // Simple ex...
C
#include <stdio.h> #include "jpeglib.h" #include "encode.h" #include "img.h" uint8_t jpeg[64*1024] = {0}; uint8_t buf[2048]= {0}; JFILE input = { .buffer = gImage_rgb565, .index = 0 }; JFILE output = { .buffer = jpeg, .index = 0 }; int main() { printf("hello world\n\r"); jpeg_encode(&input, ...
C
#include <sys/queue.h> #include <stdio.h> #include <stdlib.h> #include <string.h> struct event { TAILQ_ENTRY (event) ev_next; int ev_fd; }; TAILQ_HEAD (event_list, event); struct event_list eventqueue; static void event_set(struct event *ev, int fd) { ev->ev_fd = fd; printf("ev(%p)\n", ev); pri...
C
#include <bits/stdc++.h> using namespace std; int diff(pair<int,int> a,pair<int,int> b) { return abs(a.first-b.first)+abs(a.second-b.second); } int main() { map < int, pair<int,int> > A; int T,N=0,x; cin>>T; while(T--) { cin>>N; for(int i=0;i<N;i++) { for(int j=0;j<N;j++) { cin>>x; A[x]=make_pair(i...