language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include <string.h> void showprompt(void); /*prototype*/ int main() { char input [64]; do { showprompt(); /*call the function*/ gets(input); puts("Someday I must implement that function.."); } while((strcasecmp)("quit" ,...
C
#include <stdio.h> #include <stdlib.h> void MatrixSearch(double **a, double*pMax, double*pMin,int n) { int i,j; *pMax=*pMin=*(*(a+0)+0); for(i=0;i<n;i++) { for(j=0;j<n;j++) { if(*(*(a+i)+j)>*pMax) *pMax=*(*(a+i)+j); if(*(*(a+i)+j)<*pMin) ...
C
/* Exercise 1-20. Write a program detab that replaces tabs in the input with the proper number of blanks to space to the next tab stop. Assume a fixed set of tab stops, say every n columns. Should n be a variable or a symbolic parameter? */ #include <stdio.h> #define MAX_LINE_LEN 1025 #define TAB_SIZE 8 int Getline(ch...
C
// // filterWords.c // Lab1 // // Created by Amanda Rosén on 2014-12-26. // Copyright (c) 2014 Amanda Rosén. All rights reserved. // #include "filterWords.h" int filterWords(char (*array_importantwords)[60],StackAddress strStack,int array_length) { int i; for (i=0; i<=array_length; i++) { if (exi...
C
inherit ROOM; #include <dirs.h> #include <std.h> #include "/wizards/shanus/defs/tara.h" void init() { ::init(); add_action("read", "read"); } void create() { ::create(); set_property("light",2); set_property("night light",2); set_property("indoors", 1); set_short("Tara's Tavern"); set("day long"...
C
/* A LAN Risk Server * ----------------- * Usage ./server PORT_NUMBER * * If no port number given, uses DEFAULT PORT * * Author: Ewan McCartney */ #include "Server.h" /* Small function to print out errors over stderr. * Program terminates once message printed */ void error(const char *msg) { ...
C
/* ** EPITECH PROJECT, 2017 ** my_fill_str ** File description: ** fill a str with '\0s' */ char *my_fill_str(char *to_fill, int len) { int index = 0; while (index < len) { to_fill[index] = '\0'; index++; } return (to_fill); }
C
#include <stdio.h> #include <stdlib.h> int BinaryConversion (int User_Input) { int Original = User_Input, Remainder, arr[10], count =0, i; while(User_Input>0){ Remainder = User_Input%2; User_Input = User_Input/2; arr[count++] = Remainder; } printf("\n Binary of number...
C
/*Faa um programa em C que leia um vetor contendo n valores no intervalo [0,9], sendo n fornecido pelo usurio. Aps obter o vetor, faa com que o seu vetor apresente a sada conforme abaixo: vetor de entrada: [9,2,3,4,5] sada esperada: 81, 18, 27, 36, 45, 18, 4, 6, 8, 10, 27, 6, 9, 12, 15, 36, 8, 12, 16, 20, 45, 10, 15...
C
#include "dependency_analysis.h" #include "inst_list.h" #include "graph.h" reg_map_t *compute_dependencies(single_list_t *list) { reg_map_t *map = newMap(xed_reg_enum_t_last()); xed_decoded_inst_t *instructions = list->array; xed_decoded_inst_t xedd; for (size_t i = 0; i < list->size; i++) { ...
C
#include<stdio.h> #include<stdlib.h> #include<unistd.h> #include<string.h> #include<time.h> #include<sys/ipc.h> #include<sys/msg.h> #include<sys/wait.h> #include<sys/errno.h> extern int errno; // error NO. #define PIDFILE "/var/run/smsd.pid" // PID file #define MSGPERM 0600 // msg queue permission #define M...
C
#include<stdio.h> int arr[10]={9,8,0,1,7,5,2,3,6}; int size=10; int print(){ int i=0; for(i=0;i<size;i++){ printf("%d | %d \n",i,arr[i]); } } int liner(int val){ int i=0; printf("%d is the value of index is:",i); for(i=0;i<size;i++){ if(arr[i]==val){ printf("%d",val); ...
C
/* *LED blink using PIN 13 (connect positive side of led), 220 ohm resistor (stops led from overloading and burning out!!!), GND. */ //Set up function of LED pin 13. //int: Integers are whole numbers in the C language. int led = 13; void setup() { pinMode(13, OUTPUT); } //Set up LED on pin 13, with loop ...
C
/* Database "epinions_1" contains tables: item review trust useracct */ #ifndef EPINIONS_1 #define EPINIONS_1 struct T_item { double item_id; char title[12]; }; struct T_review { double a_id; double user_id; // --> useracct.user_id double item_id; // --> item.item_id double rating; double rank; }; struct...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* check_map.c :+: :+: :+: ...
C
/* REFERENCE: http://preshing.com/20120305/implementing-a-recursive-mutex/ */ #if defined(ZEROMTX) && !defined(PTHREAD) #include <stdlib.h> #include <zero/asm.h> #include <zero/thr.h> #include <zero/mtx.h> zeromtxatr * zeroallocmtxatr(void) { zeromtxatr *atr = malloc(sizeof(zeromtxatr)); if (atr) { a...
C
printf("\nEnter the direct path distance between node %d and %d: ", i, j);
C
/*--------------------------------------------------------++ || Operate Left Port || ++--------------------------------------------------------*/ // HAVE TO KEEP COMPONENTS RUNNING INDEPENDENTLY (ON / OFF) // ORDER OF THIS MATTERS!! IF NOT IN THE FOLLOWING ORDER, nosepoke will NOT...
C
#include <stdio.h> #include <locale.h> #include <glib.h> #include <glib/gstdio.h> // gcc -o permutacje-par permutacje-par.c `pkg-config --libs --cflags glib-2.0` gchar* duza(const gchar* param) { gchar *name; int i,len; glong dlug; g_return_val_if_fail(param != NULL, NULL); name = g_strdup(param); /* capit...
C
/* ** EPITECH PROJECT, 2020 ** command ** File description: ** cmd */ #include "../include/my.h" int my_command(char *str) { my_putstr(str); str = get_next_line(0); if (detect_stop_car(str) == 1) return (1); return (0); } int detect_stop_car(char *str) { int i = my_strlen(str) - 1, j = 0;...
C
#include "stack.h" void SInitP (tStackP *S) /* ------ ** Inicializace zásobníku. **/ { S->top = 0; } void SPushP (tStackP *S, int a ) /* ------ ** Vloží hodnotu na vrchol zásobníku. **/ { /* Při implementaci v poli může dojít k přetečení zásobníku. */ if (S->top==90) printf("Chyba: D...
C
#include <stdio.h> int main() { double i, sum, x = 0; while (scanf("%lf", &x) == 1) { sum += x; i++; printf("Total=%f Average=%f\n", sum, sum / i); }; return 0; }
C
#include <stdio.h> #include <stdlib.h> typedef short TKey; typedef struct _Node{ TKey key; struct _Node *left, *right, *top; }Node; void insertNode(Node **root, TKey n); void removeNode(Node **root, TKey n); void listPreOrder(Node *Root); int High(Node *n); int FB(Node *n); void RSD(Node *n1, Node *n2); void RSE...
C
/* * del_test.c */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include"adflib.h" void MyVer(char *msg) { fprintf(stderr,"Verbose [%s]\n",msg); } /* * * */ int main(int argc, char *argv[]) { struct Device *hd; struct Volume *vol; struct List *list; ...
C
// fsplit.cpp : Defines the entry point for the console application. // #include <stdlib.h> #include "stdafx.h" #include <string.h> #define MAX_SPLIT 100 char *itoa(int, char *, int); int main(int argc, char* argv[]) { if ((argc < 3) || (argc > (MAX_SPLIT + 2))) { printf("File splitter by TS-Labs\n"...
C
#include<stdio.h> int main(){ int v,n,i,t; scanf("%d%d",&v,&n); for(i=0;i<n;i++){ scanf("%d",&t); if(t==v) printf("%d",i); } }
C
/******************************************************** ** Authors: Alessandro Di Stanislao, alessand.distanislao@studio.unibo.it ** Carlo Caini (project supervisor), carlo.caini@unibo.it ** ** ** Copyright (c) 2018, Alma Mater Studiorum, University of Bologna ** All rights reserved. ******...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* pf_wctoa.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> void arraySum (int A[], int n){ int s=0; for(int i=0;i<n;i++) { s=s+A[i]; } printf("%d",s); } int main() { int n,i; int a[n]; printf("Enter the number of elements\n"); scanf("%d",&n); printf("Enter the elements...
C
/* ** crack.c guesses the password (max 5 characters) when given a hash ** Dani van Enk, 11823526 */ // including the used libraries #include <stdio.h> #include <stdlib.h> #include <ctype.h> #define _XOPEN_SOURCE #include <unistd.h> #include <crypt.h> #include <string.h> // predefining the used functions char next_le...
C
#include <stdio.h> #include <stdlib.h> #include <limits.h> /** Given a sorted array of n integers where each integer is in the range from 0 to m-1 and m > n. Find the smallest number that is missing from the array. Examples Input: {0, 1, 2, 6, 9}, n = 5, m = 10 Output: 3 Input: {4, 5, 10, 11}, n = 4, m = 12 Output: ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #define max 50 #define long_alfabeto 26 #define inicio_ascii_mayusculas 65 #define inicio_ascii_minusculas 97 const char *alfMinusculas = "abcdefghijklmnopqrstuvwxyz", *alfMayusculas = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; void importar...
C
#include<stdio.h> int main() { char str[100]; countSpecialChar; int counter; countDigits=countSpecialChar; printf("Enter a string: "); scanf("%c",str); for(counter=0;str[counter]!=NULL;counter++) { if( countSpecialChar++) } printf("\nDigits: %d \nSpecial Characters: %d",countSpecialChar); return 0;
C
#include <stdio.h> void main() { char str1[100]; char str2[100]; int i = 0, m = 0; int j = 0; int count = 0; int k = 0, choice; printf("Please Enter the first string "); // scanf("%s",str); // gets(str); fgets(str1, sizeof(str1), stdin); printf("Please Enter the second string...
C
#include "hash_tables.h" /** * hash_table_create - a function that creates a hash table. * @size : side of the hash table * Return: a pointer to the newly created hash table */ hash_table_t *hash_table_create(unsigned long int size) { hash_table_t *table; table = malloc(sizeof(hash_table_t)); if (table == NULL)...
C
#include <stdio.h> main(){ int i,v[10],cont=0,conti=0; for(i=0;i<10;i++){ printf("digite os valores: "); scanf("%d",&v[i]); } for(i=0;i<10;i++) { if(v[i]>0){ cont++; } else{ cont=cont; } if(v[i]%2!=0){ conti++; } else{ conti=conti; } } printf("a quantidade de valores posi...
C
#include <stdio.h> #include <lab0.h> extern unsigned long etext, edata, end; void printsegaddress() { kprintf("void printsegaddress()\n"); kprintf("\nCurrent: etext[0x%08x]=0x%08x, edata[0x%08x]=0x%08x, ebss[0x%08x]=0x%08x", &etext, etext, &edata, edata, &end, end); kprintf("\nPreceding: etext[0x%08x]=0x%0...
C
int main() { int i; for i=0; i < 3; i++){ printf("i: %d", &i); } return 0; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* remove_backslash.c :+: :+: :+: ...
C
#include<stdio.h> void main() { char ch; printf("\n enter the character"); scanf("%c",&ch); printf(" ASCII value is %d",ch); }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* msh_parsing2.c :+: :+: :+: ...
C
/* File: mesinkata.h */ /* Definisi Mesin Kata: Model Akuisisi Versi I */ #ifndef __MESINKATA_H__ #define __MESINKATA_H__ #include "boolean.h" #include "mesinkar.h" #define NMax 50 #define BLANK ' ' typedef struct { char *TabKata; int Length; } Kata; /* State Mesin Kata */ extern boolean EndKata; extern Kata...
C
#include <stdlib.h> #include <math.h> #include "Vector3.h" Vector3 plusEquals(Vector3 *v1, Vector3 v2){ v1->x += v2.x; v1->y += v2.y; v1->z += v2.z; return *v1; } Vector3 minusEquals(Vector3 *v1, Vector3 v2){ v1->x -= v2.x; v1->y -= v2.y; v1->z -= v2.z; return *v1; } ...
C
#include <stdio.h> int main(void) { int test_case, T, i, len, dec, dec1, need, temp; char str[1002]; freopen("1_input.txt", "r", stdin); scanf(" %d", &T); for (test_case = 1; test_case <= T; ++test_case) { for (i = 0; i < 1002; i++) { str[i] = NULL; } scanf("%s", str); dec = str[0] - '0'; nee...
C
#include <stdio.h> #include <assert.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #include <time.h> int main() { int ptoc[2]; int ctop[2]; pipe(ptoc); pipe(ctop); pid_t child; int count = 0; clock_t start = clock(); if ((child = fork...
C
#include "global.h" #include "md4.h" #define MD 4 #define MD_CTX MD4_CTX #define MDInit MD4Init #define MDUpdate MD4Update #define MDFinal MD4Final static void MDPrint (digest) unsigned char digest[16]; { unsigned int i; for (i = 0; i < 16; i++) printf ("%02x", digest[i]); } static void MDString (char...
C
/******************************************************** * Author: Shawn Guo * * Date : 2013/2/15 * * Last : 2013/2/15 * * Project: LCD高精度时钟 * * 插入LCD1602, P1 | ...
C
#include "stdlib.h" #include "stdio.h" #include "string.h" int main () { char *str = "American"; char *str_temp = malloc (strlen (str) + 1); strlcpy (str_temp, str, strlen (str) + 1); char cur_char; char *temp = str_temp + (strlen (str_temp) * sizeof (char) - sizeof (char)); cur_char = *temp; while...
C
#include <stdio.h> int main() { int i,n,m,p=0,j; printf("Enter the size:"); scanf("%d",&n); int a[99][99]={0}; a[0][(n-1)/2]=1; j=(n-1)/2; for(i=2;i<=n*n;i++) { p--; j++; if(p>=0) ; else p+=n; if(j<=n-1) ; else j+=(-n); if(a[p][j]==0) a[p][j]=i; else a[++p][j]=i; } for(i=0;i<n;i...
C
/* Here are the special operators that psipp recognizes which are * not handled in parse.y. */ #include <stdio.h> #include <stdlib.h> #include "global.h" /* This returns true if the value of the two names are the same. If * one (or both) of the names is quoted, then the string with the * quotes removed is used ...
C
#include<stdio.h> void main(){ char str[10]; clrscr(); printf("Enter a string: "); scanf("%s", &str); if(str[0] == 'a'){ if(str[1] == 'b'){ printf("String is valid"); } else{ printf("String is invalid"); } } else{ printf("String is invalid"); } getch(); }
C
#include <stdio.h> #include <limits.h> struct { const char *str; const int base; const long result; } tests[] = { {" 0", 10, 0}, {"0101", 2, 5}, {"ffff", 16, 0xffff} }; int main(int argc, const char **argv) { for (int i = 0; i < (sizeof(tests) / sizeof(tests[0])); i++) { printf("...
C
#ifndef SPIMAGEDATA_H_ #define SPIMAGEDATA_H_ #include "../SPPoint.h" #include <stdbool.h> /** A type used for defining an ImageData item**/ typedef struct sp_image_data { int index; int numOfFeatures; SPPoint* featuresArray; } sp_image_data; /** A type used for defining an ImageData item as a pointer**/ typedef ...
C
#include "sort.h" /** * bubble_sort - sort an array with the bubble method * @array: <- * @size: array size * * Return: none */ void bubble_sort(int *array, size_t size) { size_t i, j; int aux, tmp; if (!array) return; else if (size <= 1) return; for (i = 0; i < size - 1; i++) { aux = array[0]; ...
C
// testing4.c #include <stdio.h> #include "gfx4.h" int main() { int wid = 600, ht = 500; char c; char *thefont = "-misc-fixed-bold-r-normal--13-120-75-75-c-70-iso8859-1"; char *mytext = "Notre Dame Fighting Irish"; int x_winctr, y_winctr; // window's center int pxl_w, pxl_h, x_txt, y_txt; ...
C
#ifndef SIMPLE_HASHTABLE_HEADER #define SIMPLE_HASHTABLE_HEADER #include <stddef.h> #include <stdint.h> typedef void * (* alloc_fn)(size_t size); typedef void (* free_fn)(void * ptr); typedef uint32_t (* hash_fn) (void * data, size_t datalen); /* simple table of linked-lists */ struct sht; struct sht * sht_create_c...
C
#include<stdio.h> #include<conio.h> main() { int a; //char one,two,three,four,five,six,seven,eight,nine,ten; clrscr(); printf("Enter the number:"); scanf("%d",&a); //if(a>=1)&&(a<=10) if(a==1) printf("\none"); else if(a==2) printf("\ntwo"); else if(a==3) printf("\nthree"); else if(a==4) printf("\nFour"); else if(a==5) ...
C
#include "holberton.h" int main(void) { char c[10] = "Holberton"; int i; for (i = 0; i < 10; i++) putchar (c[i]); putchar('\n'); return (0); }
C
/** * @file * @brief Implementation by students of usefull function for the system project. * @todo Change the SU_removeFile to use exec instead of system. */ #include "system_utils.h" /** * @brief Maximum length (in character) for a command line. **/ #define SU_MAXLINESIZE (1024*8) /********************** ...
C
/* * @file: T02_InvertSequencesRGB_White_Layered.c * @company: ITESO * @Engineer Team: D.F.R. / R.G.P. */ #include <stdio.h> #include <stdint.h> #include "MK64F12.h" #include <bits.h> // se añadió .h vClass #include <GPIO.h> // se añadió .h vClass - tiene propio .c vClass int main(void) { GPIO_clock_gati...
C
#include <stdio.h> #include "ft_printf.h" int main(void) { unsigned long a; unsigned long b; //a = 5; //b = 5; a = -42; b = -42; //a = 4294967295; //b = 4294967295; /*All with unsigned ints: 11 symbols and 1*/ printf("original: %u\n", a); ft_printf("our : %u\n\n", b); //flags printf("FLAGS...
C
double arithmetic(double a, double b, char *s) { if (s[0]=='a') return a+b; else if (s[0]=='s') return a-b; if (s[0]=='m') return a*b; else if (s[0]=='d') return a/b; }
C
/* * mm-naive.c - The fastest, least memory-efficient malloc package. * In this naive approach, a block is allocated by simply incrementing * the brk pointer. A block is pure payload. There are no headers or * footers. Blocks are never coalesced or reused. Realloc is * implemented directly using mm_malloc and mm...
C
#include <stdlib.h> #include <stdio.h> #include <time.h> #include <pthread.h> #include <sys/ioctl.h> #define X 80 #define Y 80 #define DEAD '.' #define ALIVE '0' #define mb() asm volatile("mfence":::"memory") #define true 1 #define false 0 int size_x, size_y; char MAP[X][Y]; volatile char LOCK = 0; volatile char ...
C
/* sttrampoline.c: this is an optional helper file to link into Stata plugins which provides infrastructure plugins to define subcommands. */ /* This lets a single plugin operate in multiple steps which is necessary sometimes to work around the limited Stata API, */ /* and it lets a sin...
C
#include <stdio.h> int main() { float number; printf("How much money you made last year: "); scanf("%f",&number); number = number*0.7; printf("After taxes: $%.2f\n", number); if (number < 0) { printf("invalid input\n"); } else if (number >= 0 && number <= 20000) { printf("broke\n"); } el...
C
#include <stdio.h> int main(void) { // your code goes here int s,q,num; scanf("%d %d",&s,&q); for(num=s;num<=q;num++) { if(num%2==1) printf("%d ",num); } return 0; }
C
// // // Author: T.Warburton // // Design: T.Warburton && S.Sherwin // // Date : 12/4/96 // // ...
C
/* You're going on a trip with some students and it's up to you to keep track of how much money each Student has. A student is defined like this: #define NAMELIM 0x8 struct student { char name[NAMELIM + 1]; unsigned fives; unsigned tens; unsigned twenties; }; As you can tell, each Student has some...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* helper.c :+: :+: :+: ...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> char* retirarEspacos(char frase[]){ for(int i=0; frase[i] != '\0'; i++){ if (frase[i] == 32){ frase[i] = '\a'; } } return frase; } int main(){ char frase[256]; printf("Digite uma frase:\n"); fgets(frase, 255, stdin); printf("\nFrase alterada:\...
C
#include <stdio.h> void reverse_string(char* string) { if (*string != 0) { reverse_string(string + 1); } //ȥ\0 string--; printf("%c", *string); } int main() { char arr[] = "student"; int n; reverse_string(arr); return 0; }
C
#include "../Ref/api.h" #include "../Ref/params.h" #include "stdio.h" #include "stdint.h" #include "string.h" int main() { int i; uint8_t sk[NTRU_SECRETKEYBYTES]; uint8_t c[NTRU_CIPHERTEXTBYTES]; uint8_t k2[NTRU_SHAREDKEYBYTES]; unsigned int a; char buffer[100]; char hex[2]; char name[6...
C
/******************************************************************************/ #ifndef MEMORY_H #include "MEMORY.h" #endif /******************************************************************************/ #ifndef GPIO_H #include "GPIO.h" #endif /*****************************************************************...
C
#include <stdio.h> #include <math.h> void main() { int k; long double Sum,a,x,y; //series vizualizacijas bloks; printf("\n\n\t 500 \n"); // ar \t taulaciju nocentre printf("\t -------- \n"); printf("\t \\ (k+1) k (2k-1)\n"); //pakapes printf("\t \\ (-1)^ *x^ *2^\n"); //d...
C
#include "klib.h" #if !defined(__ISA_NATIVE__) || defined(__NATIVE_USE_KLIB__) size_t strlen(const char *s) { int i = 0; while (s[i++]); return --i; } char *strcpy(char* dst,const char* src) { int i = 0; while (1) { dst[i] = src[i]; if (!src[i]) break; i++; } return dst; } char* strncpy(...
C
#include<stdio.h> int main(void) { int ways = 0; int i, j, k; int testCases, value; scanf("%d\n", &testCases); for (i = 1; i <= testCases; i++) { scanf("%d\n", &value); ways = 0; printf("Case #%d: %d", i, value); for (j = 2; j <= value / j; j++) { k ...
C
#include <omp.h> #include <stdio.h> #include <stdlib.h> #define THREADS_NO 4 int main() { int i; omp_set_num_threads(THREADS_NO); #pragma omp parallel { for(i = 0; i <= 5; i++) printf("[%d] Hello World, i = %d\n", omp_get_thread_num(), i); } return EXIT_SUCCESS; }
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <sys/types.h> #include <sys/uio.h> #include <sys/socket.h> #include <sys/select.h> #include <netinet/in.h> #include <netdb.h> #include <arpa/inet.h> void usage() { printf("Usage: hw1 <URL>\n"); exit(1); } int main(int argc, char...
C
//Implementacao de um TAD Lista //Feito por: Leonardo Fonseca Pinheiro #include <stdio.h> #include <stdlib.h> #include <string.h> #include "lista.h" struct item_{ int indice; int peso; int dist; item* prox; }; struct lista_ { item* ini; item* fim; int tamanho; }; /...
C
#include<stdio.h> float squareroot(int n) { float sqr,temp; sqr=n/2; temp=0; while(sqr!=temp) { temp=sqr; sqr=(n/temp+temp)/2; } return sqr; } int main() { int n; float sqr; printf("Enter a number\n"); scanf("%d",&n); sqr=squareroot(n); printf("The square ...
C
#include <stdio.h> main(){ int A,B,R; printf("Donner deux entiers A et B positifs"); do{ scanf("%d", &A); scanf("%d", &B); } while (A>0 && B>0); while (R>0){ R=R-B; } if(R=0) printf("%d est est divisible par %d",A,B); else ...
C
#include <stdlib.h> #include <stdio.h> #include <pthread.h> #include <limits.h> #include <linux/sched.h> #include <time.h> #define LEN 200 struct Borders { int start; int end; }; // int array[] = {4, 2, 3, 1, 5}; int array[LEN]; void prepareArray() { srand(time(0)); int i; for (i = 0; i < LEN; i++) { array[...
C
#include <stdio.h> #include <stdlib.h> int main(void) { int a; int b; int c; int wynik; scanf("%d", &a); scanf("%d", &b); scanf("%d", &c); wynik = a + b + c; printf("%d\n", wynik); return EXIT_SUCCESS; }
C
/* Byte queue library, implemented on single buffer Copyright © 2017 Eugene Mihailenco <mihailencoe@gmail.com> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, ...
C
/* Thomas Schultz * Lab: LAB4 * SECTION: CS1050C * Pawprint: TJS6F2 * TA: Dheeraj */ #include <stdio.h> //prototype functions int checkEven(int x); int errorCheck(int y); int checkPrime(int z); int addDigits(int a); void printMizzou(int b); int main (void) { int num;//delcaring variables int numtwo; ...
C
/* Tipos Triangulos */ #include <stdio.h> #define MAX 1000 int main (void) { float A,B,C; int tmp; scanf("%f", &A); scanf("%f", &B); scanf("%f", &C); if (A < B) { tmp = A; A = B; B = tmp; } if (A < C) { tmp = A; A = C; C = tmp; } if (B < C) { tmp = B; B = C...
C
#include"projet.h" int main(){ ImageCouleur *imageLena; ImageCouleur *imageMire; imageLena = chargerImage("C:/Users/AYOUB LABIDI/Desktop/Lena.ppm"); imageMire = chargerImage("C:/Users/AYOUB LABIDI/Desktop/Mire.ppm"); ImageGris *image1 = creerImageGris(imageLena->h,imageLena->l); image1->pixe...
C
#ifndef PIXEL_H #define PIXEL_H #include <stdlib.h> typedef struct PIXEL { int column; int r, g, b; struct PIXEL *pnext; struct PIXEL *pprev; }Pixel; /* * Funo make_vector(int n) * ---------------------------- * TV: n de elementos que o vetor tera * * retorno: vetor com...
C
int maiorSufixo(char s1[], char s2[]) { int i = strlen(s1) - 1, j = strlen(s2) - 1, conta = 0; while (s1[i] == s2[j]) { conta++; i--; j--; } return conta; }
C
//This code is used with the AlarmClockMp3 project //it is called when incrementing the time manually and //it ensures the time values stay within the bounds of a 12 hour clock #include "timeKeeping.h" void timeHourCheck(void) { //9 rolls over to 0 if((myclockTimeStruct.RTC_Hours & 0x0F) >= 0xA) { myclockTim...
C
#include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <string.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <string> #define SOCKET_ERROR -1 #define BUFFER_SIZE 100 #define HOST_NAME_SIZE 255 using namespace std; int main(int ...
C
#include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <unistd.h> #include <sys/wait.h> int main(void) { int p1,p2,p3,p4,p5; while ((p1=fork())==-1); if (!p1) { printf("p1 pid %d, ppid %d.\n",getpid(),getppid()); while ((p2=fork())==-1); if (!p2) { printf("p2 pid %d, ppid %d.\n",get...
C
#include<unistd.h> #include<fcntl.h> #include<stdio.h> #include<stdlib.h> #include<string.h> int main() { int fdisp,nbytes; fdisp=open("file1.txt",O_RDONLY); if(fdisp<0) { perr("open"); exit(1); } int length=135; char buffer[length]; nbytes=read(fdisp,buffer,length); if(nbytes<0) { perr("read"); exit(...
C
#include <stdio.h> int main(void){ int original, i = 0; int invertido[4]; scanf("%d", &original); do{ invertido[i] = original%10; i++; original = (original - original%10)/10; }while(original != 0); for(i = 0; i < 4; i++){ printf("%d", invertid...
C
#include "unity.h" #include "string.h" #include <stdlib.h> void setUp (void) {} void tearDown (void) {} /** * Test if empty string returns 0. */ void test_empty_string(void) { char* test_string = ""; int length = get_string_length(test_string); TEST_ASSERT_EQUAL(0, length); } /** * Test if string of ...
C
#include<stdio.h> int main(int argc,char **argv) { if(argc<2) { printf("Usage..."); } FILE* fp=NULL; fp=fopen(argv[1],"r"); if(NULL==fp) { printf("fopen()error\n"); return -1; } char ch; while(1) { ch=fgetc(fp); if(EOF==ch) { printf("over"); break; } printf("%c",ch); } fclose(fp); r...
C
#include "hash.h" static int count_params(char* query_string, int len) { int count = 1; while(*query_string) { if (*query_string++ == '&') { count++; } } return count; } static Entry new_entry(char* arg) { Entry e; e.key = strtok(arg,"="); e.value = strtok(NULL,"="); dd( "...
C
#include <stdio.h> // GDB will stop here int divide_by_zero(int num) { int result; int zero = 0; result = num / zero; return result; } int main() { int ret; printf("Start to calculate\n"); ret = divide_by_zero(1); return 0; }
C
#include <stdio.h> int main() { int year; printf("Enter ur birthday year to check its is leap year or not?"); scanf("%d", &year); if(year%4 == 0){ if (year%100 ==0) { if(year%400 == 0) printf("%d is a leap year",year); else printf("%d is not a leap year",year); ...