language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
typedef struct _inode { int id; char name[51]; char ext[5]; int address; int next_address; struct _inode * next; } inode ; typedef struct _block{ int ind; int position; struct _block * next; }block; void flush() { while (getchar() != '\n'); } void cleardisk(int disk[], int n...
C
#define _GNU_SOURCE #include <stdio.h> #include <pthread.h> #include <sched.h> const int N = 1000000; int count = 0; void *increment(void*); int main() { const int TRIALS = 10; pthread_attr_t myattr; cpu_set_t cpuset; pthread_attr_init(&myattr); CPU_ZERO(&cpuset); CPU_SET(0, &cpuset); ...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <errno.h> #include <umem.h> #include "./headers/project_file_check.h" void projdel_usage_fn() { printf("Usage: projdel [-f filename] project\n"); } int main(int argc,char **argv) { FILE* proj_file_ptr; // File pointer for project file FILE*...
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[]) { int r,h,V; printf("Ban kinh\n"); scanf("%d",&r); printf("Chieu cao\n"); scanf("%d",&h); V=r*r*h*3.14; printf("The tich=%d\n",V); re...
C
#include "mod.h" #include "video.h" #define FALSE 0 #define TRUE (!FALSE) /*-------------- window management declarations --------------------*/ static windowptr my_window,temp_window; static short window_count=4; /*------------------------------------------------------------------*/ void main() { my_window=o...
C
#include "solver.h" tmatrix *newtmatrix(matrix *m) { tmatrix *tm = (tmatrix*) malloc(sizeof(struct tmatrix_s)); tm->x = m->x; tm->y = m->y; tm->matrix = (int*) malloc(sizeof(int) * m->x * m->y); int i,j; for(i = 0; i < tm->x; i++) { for( j = 0; j < tm->y; j++) { if(m->matrix[i*tm->y+j] >= 0) tm->matr...
C
/******************************************************************************* -Ws8 -Itai Marienberg -Mon 20 Nov 2019 14:50:59 -Reviewer: *******************************************************************************/ #include "myprogram.h" /*********************************************************************...
C
#include<stdio.h> #include<stdlib.h> #define MAX 10 struct Stack{ int top; int arr[MAX]; }s; void push(){ if(s.top==MAX-1){ printf("Stack is Full"); } else{ int num; printf("Enter element to be popped : "); scanf("%d",&num); s.top++; ...
C
///////////////////////////////////////////////////////////////////////////////////////////////////// // Project Name : Automated_Gardening // // Target Board : atmega32 // // Date Created : 06-11-2017 12:56:07 // // Online Resource : www.electronicsforstudents.com // // Libraries Included : ///////////////////...
C
#include <stdio.h> int main() { int i=1, j=1; while(i < 80*50) { printf("%c", j); i++; } return 0; }
C
/// quicksort.c ///Uses Function:quicksort(1,2) ///the quicksort algorithm to sort values and return a pointer to an array /// Function:quicksort_threaded(1) /// this function returns a sorted array pointer using thread /// Auhor Gayathri Kanagaraj /// Date 11/13/2020 /// #include <stdio.h> #include <pthread.h> #inc...
C
/** * @file parse.c * @author your name (you@domain.com) * @brief * @version 0.1 * @date 2019-09-05 * * @copyright Copyright (c) 2019 * */ #include "parse.h" /* getopt_long stores the option index here. */ static int option_index = 0; static struct option long_options[] = { /* These options set a fl...
C
#include <stdio.h> #include <stdlib.h> #include "debug-state.h" #include "define.h" struct debug_state *init_debug_state() { // struct debug_state *ret = calloc(1, sizeof(struct debug_state)); struct debug_state *ret = malloc(sizeof(struct debug_state)); memset(ret, 0, sizeof(struct debug_stat...
C
#include <stdio.h> #include <stdlib.h> int rotateArray(int *a,int d,int n){ for(int i=0;i<d;i++) leftRotatebyOne(a,n); } int leftRotatebyOne(int *a,int n){ int temp=a[0],i; for(i=0;i<n-1;i++) a[i]=a[i+1]; a[i]=temp; } int main() { int a[10]; int d=3,n=5; // scanf("%d %d",&n,...
C
/****************************************************************************** * @File: eeprom.c * @Author: Milandr, L. * @Project: Demo_Project_12-1 * @Version: 1.0.0 * @Compiler: ARM Compiler V5.06 (build 750) * @Microcontroller: К1986ВЕ92QI * @Device: Отладочная плата «МилКиТЭС» * @Date: 16.04.2020 * @Purp...
C
#include <stdio.h> /* Generate all integer compositions * The following algorithm is from this paper: * Toufik Mansour and Ghalib Nassar * "Loop-Free Gray Code Algorithms for the Set of Compositions" * Journal of Mathematical Modelling and Algorithms December 2010, * Volume 9, Issue 4, pp 343-356 */ int main(vo...
C
#include "pq.h" #include <stdio.h> #include <stdlib.h> /** * General description: priority queue which stores pairs * <id, priority>. Top of queue is determined by priority * (min or max depending on configuration). * * There can be only one (or zero) entry for a particular id. * * Capacity is fixed on creat...
C
#include<stdio.h> #include<stdlib.h> void main() { int l,s,b,t_sales,flag=0; float com; printf("enter the total number of locks\n"); scanf("%d",&l); if((l<0)||(l>70)) flag=1; printf("enter the total number of stocks\n"); scanf("%d",&s); if((s<0)||(s>80)) flag=1; printf("enter the total number of barrels\n"); scanf("%d"...
C
/* file pltrim.c */ #if !defined(COMPILE_ENVIRONMENT) #include <phone/stdcenvf.h> /* std compile environment for functions */ #endif /***********************************************/ /* pltrim(s) */ /* Trims leading non-whitespace from *s, */ /* returning s, which is not ch...
C
#include <stdlib.h> #include <stdio.h> #include <pthread.h> #include "filterParallel.h" void applyThread(BMPImage * imageIn, BMPImage * imageOut, BoxFilter f, int tid, int numThreads) { //FILL IN. This is the work that thread #tid should do //You may find it useful to know the number of threads (numThreads) to //...
C
#include "monty.h" #include <stdio.h> #include <stdlib.h> #include <string.h> /** *save_things - save variables * *Return: No return */ void save_things(void) { things.stack = NULL; things.buffer = NULL; things.line_num = 0; things.value = 0; } /** *main - start of the program *@argc: count of arguments *...
C
#include <stdio.h> #include <stdbool.h> #include <string.h> #include "abnf.h" int est_comment(char *c, int l, char *s, int ls, void (*callback)()) { char S[] = "comment"; int i_search = 0; if (ls == 7) { while (i_search < ls && s[i_search] == S[i_search]) { i_search++; } ...
C
/*********************************************************************** *Function:main *Description:this program is used to solve the problem in dup.c, dup2 is at * omic *Input:node *Output:write the sting "hello world!" to /tmp/out * **************************************************************...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> typedef struct binaryHeap{ void *h; size_t heapSize; size_t maxSize; size_t size; int (*cmp)(const void *,const void *); } heap; heap* newHeap(const size_t size,int (*cmpF)(const void *,const void *)){ const size_t maxSize=1; heap *re...
C
#ifndef TIMERS_H #define TIMERS_H #ifndef TIMER_MAX #define TIMER_MAX 1024 #endif #define REGISTER_TIMER(TimerMax) register_timer(TimerMax, timer_controller) #define START_TIMER(Handle) start_timer(Handle, timer_controller) #define STOP_TIMER(Handle) stop_timer(Handle, timer_controller) #define TIMER_DONE(Handle) time...
C
#include <stdio.h> int division(int dividend, int divisor, float *rest) { float result = (float)dividend/(float)divisor; *rest = result - (int)result; return result; } void sort4(int *zahl1, int *zahl2, int *zahl3, int *zahl4) { int tmp; int zahlen[4] = {*zahl1, *zahl2, *zahl3, *zahl4}; char i...
C
/* ************************************************************************** */ /* LE - / */ /* / */ /* ft_printf.h .:: .:/ . .:: ...
C
/* Ŀ һٷƳɼҪɼȼABCDE 90Լ90ΪA80-89ΪB70-79ΪC60-69ΪD60ΪE һ0100 һַʾɼȼ 90 A */ #include<stdio.h> int main8() { int n = 0; scanf("%d",&n); if(n < 0 || n > 100) { printf("wrong\n"); } else if(n >= 90) { printf("A\n"); } else if(n >= 80) { printf("B\n"); } ...
C
#include <stdio.h> int main(){ int a; //정수형 a를 선언 a = 10; // a에 10을 대입 printf("%d", a); //%d는 정수형을 뜻함 a를 출력 return 0; //함수를 종료하겠다; }
C
/* * TINYEXPR - Tiny recursive descent parser and evaluation engine in C * * Copyright (c) 2015-2018 Lewis Van Winkle * * http://CodePlea.com * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of t...
C
/** * Reverse words in a given string */ #include <stdio.h> #include <string.h> #include <ctype.h> void custom_revert(char *str, int i, int j) { if (str == NULL || i >= j || i < 0 || j >= strlen(str)) return; while(i < j) { char tmp = str[i]; str[i] = str[j]; str[j] = tmp; ...
C
#include "events.h" #include <stdio.h> #include "queue.h" void Entry(Terminal* terminal, int passsenger_id, enum Type type) { Passenger* new_passen = CreatePassenger(passsenger_id, type); InsertPassengerTerminal(terminal, new_passen); } void Abord(Terminal* terminal, int door_id) { int aborded_ids[8]; // Di...
C
#include "clase5.h" #include "stdio.h" /** El ARRAY se pasa por referencia por que cambia el parametro actual del array porque se pasa la direccion de memoria y "cantidad " es una copia del valor original del main y no se modifica*/ int contarPares (int array[],int cantidad) { int contaPares=0; int i; /**todos los arr...
C
#include <stdlib.h> #include <stdio.h> #include "mymalloc.h" int main(int argc, char** argv){ char* a=(char*)malloc(5); char* b=(char*)malloc(5); char* c=(char*)malloc(5); *a = 'a'; *b = 'b'; *c = 'c'; printf("a = %c, b = %c, c = %c\n", *a, *b, *c); free(a); free(a); char* t=(char*)malloc(5); *t...
C
#include<stdio.h> int main() { int day = 0, inputDate = 0, endFlag = 0; char *charDay[] = {"土","日","月","火","水","木","金"}; do{ printf("日付を入力して下さい。----"); if(scanf("%d", &inputDate) != 1){ scanf("%*s"); printf("値が不正です。\n"); continue; } //31よ...
C
#include <stdio.h> #include <stdlib.h> int main(void) { int a,b,c; scanf("%d %d %d",&a,&b,&c); printf(b*b==4*a*c ? "1\n":"0\n"); return 0; }
C
// Practice01.c /* Է ް, ū > main() Է ް, Լ Լ : int Calc(int iNum1, int iNum2) */ #include <stdio.h> //[] int iSub(int iN1, int iN2); void main() { int i1 = 0, i2 = 0; printf(" Է : "); scanf("%d %d", &i1, &i2); printf(" : %d\n", iSub(i1, i2)); } //[] int iSub(int iN1, int iN2) { if (iN1 > iN...
C
/* * midi.h * * Collection of enums and struct dedicated to incoming MIDI messages * * Created on: Oct 1, 2018 * Author: S. Reynal */ #ifndef MIDI_H_ #define MIDI_H_ #define MAX_MIDI_VALUE 127.0 #define MIDICC_VALUE_OFF 0 #define MIDICC_VALUE_ON 1 /** * a struct for incoming midi messages of type Not...
C
#include <stdio.h> int main (){ float K, M; scanf ("%f", &M); K = M * 3.6; printf ("%f", K); return 0; }
C
//Sharline Aparecida Vieira #include <stdio.h> #include <stdlib.h> #include <locale.h> /* 1. Escreva uma funo que computa a elevncia ab para valores a (double) e b (int) passados por parmetro (no use bibliotecas como math.h). Use a funo anterior e crie um programa que imprima todas as elevncias: 2^0, 2^1,...2^10; ...
C
#include <sys/stat.h> #include <fcntl.h> #include <sys/mman.h> #include <unistd.h> #include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <dirent.h> #include <ctype.h> #include <errno.h> #include <time.h> #include <pthread.h> #include <signal.h> #include "../libfm...
C
#include<stdio.h> int a = 10; void function1() { printf("\nFrom function Global a = %d\n", a); } int main(){ function1(); return 0; }
C
#include "display.h" #include "lcd.h" #include "eeprom.h" #include "eepromSubroutine.h" //sharing define statements volatile unsigned char printSwap; void display(unsigned char number) { if(number < 10) //if time is < 10 add 0. e.g. 05 write_char('0'); write_int(number); //displays value } //display general ite...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* math.c :+: :+: :+: ...
C
#include<stdio.h> int main() { int n,j; scanf("%d",&n); printf("\n"); for(int i=1;i<=n;i++) { for(j=1;j<=n-i;j++) { printf(" "); } for(j=1;j<=2*i-1;j++) { printf(" * "); } printf("\n"); } for(int i=n;i>=1;i--) { for(j=1;j<=n-i;j++) { printf(" "); } for(j=1;j<=2*i-1;j++) { ...
C
// // Created by Rasmus Nylander on 16-04-2021. // #include "LinkedList.h" #include "LinkedListInternalFunctions.h" #include <stdlib.h> #include <time.h> struct _node{ struct _node* next; void* data; }; Node* newNode(void* data){ Node *node = (Node *) malloc(sizeof(Node)); node->next = NULL; node->data = data; ...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> int main(void){ int n; printf("%s","行列のサイズを入力してください:"); scanf("%d",&n); int A[n][n]; int B[n][n]; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ A[i][j] = rand() % 10; B[i][j] = rand() % 10; } ...
C
#include "littlePrime.h" #include <stdlib.h> /** * Euler fai function, fai(m) = fai(p)*fai(q),p and q are prime. fai(p^k) = p^k - p^(k-1), p is prime. * input: x, ptable * output: none * return: positive result for success, -1 if x factorization failed */ u64 funcFai(u64 x, PTable *ptable) { PFtable pf; u6...
C
#include<stdio.h> #include<stdlib.h> typedef struct iterator_array* Iterator_A; typedef struct iterator_list* Iterator_list; typedef struct element* Element; typedef struct node* Node; struct element{ Node tree; Element next; }; struct iterator_array{ Element* array; int currentidx; int maxidx; }; struct iterat...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_split_space.c :+: :+: :+: ...
C
#include"process.h" int mainProcess(int clientFileDiscripter) { int n = 0; int fileDescriptor; /*각 메시지를 담을 변수들*/ char buf[BUFSIZE+1] = {'\0', }; char message[BUFSIZE+1] = {'\0', }; char method[BUFSIZE+1] = {'\0', }; memset(headerStruct.method, '\0', 50); memset(headerStruct.contentType...
C
#include<stdio.h> #include<stdlib.h> #include<time.h> #include<pthread.h> #include "mm.h" // Task 1: Flush the cache so that we can do our measurement :) void flush_all_caches() { //For now will just do this with a fixed block size //Will work out later how to dynamically figure out cache size char* temp; //ass...
C
/* * @file : raw_video_player.c * * @description : This file contains the code of raw video player. * * @author : Aman Kumar (2015) * * @copyright : The code contained herein is licensed under the GNU General * Public License. You may obtain a copy of the GNU General * Public License Version 2 or later...
C
#include <stdio.h> #define IN 1 #define OUT 0 int main(void) { int wordlength[50]; int i,j, c, length, state, max; i = j = c = length = max = 0; state = OUT; for (i = 0; i < 50; ++i) wordlength[i] = 0; while((c = getchar()) != EOF){ if(c == '\n' || c == '\t' || c == ' '){ state = OUT; ...
C
/* Segunda tentativa para a P1, dessa vez * simplesmente por vontade própria e com * um tempo que não me leve à loucura */ #define NULO '2' #define FALSE '0' #define TRUE '1' #define LIN 40 #define COL 10 #include <stdio.h> #include <stdlib.h> #include <string.h> int main () { short unsigned int sala, ingresso...
C
#include <stdlib.h> #include "grammar.h" #include "parser.h" #include "lexer.h" #include "../General/hashtable.h" #define DEFAULT_OUTPUT_SIZE 500 Node *matchGrammar(GrammarHead *head); int matchPart(GrammarPart *part); #define TOKEN 0 #define NODE 1 typedef struct{ unsigned int type : 1; union{ To...
C
/** Program to Demonstrate the working of Strings using String Functions 1. String Compare - strcmp(s1,s2) - int (0/-1) 2. String Concatenate - strcat(s1,s2) 3. String Length - strlen(s1) - int 4. String Copy - strcpy(s1,s2) */ #include<stdio.h> #include<string.h> int main() { char str1[...
C
#include<stdio.h> #include<string.h> int main() { char name[10]; int n,i; printf("\nEnter the string"); scanf("%s",&name); printf("\nEnter how many times it should be repeated"); scanf("%d",&n); for(i=0;i<n-1;i++) { printf("\n%s\n",name); } return 0; }
C
#include <stdlib.h> #include <time.h> #include <stdio.h> /** * main - main * * * Return: 0 */ int main(void) { int n, d; srand(time(0)); n = rand() - RAND_MAX / 2; /* your code goes there */ d = n % 10; if (d > 5) printf("Last digit of %d is %d and is greater than 5\n", n, d); else if (d < 6 && d != 0) printf("Las...
C
/* NOTES: Trivial exercise for practice */ #include "../include/que.h" /* Initialize Array based Queues */ int queInit(Que **head, const uint8_t MAX_SIZE) { if(head == NULL) return ERR_ARGS; (*head) = malloc(sizeof(Que)); if(*head == NULL) return ERR_MALLO...
C
#include <stdio.h> #include <stdlib.h> /* * */ int main(int argc, char** argv) { int f=8; int x = 0; int xn = 1; int a=1; while (a < f){ printf("%d\n",x); printf("%d\n",xn); x = x + xn; xn = xn + x; a = a+2; } return 0; }
C
#ifndef GENERAL_POINTF_H #define GENERAL_POINTF_H #include <stdbool.h> typedef struct Point Point; typedef struct SizeF SizeF; typedef struct PointF PointF; struct PointF { float x; float y; }; PointF PointF_Construct(float xx, float yy); PointF PointF_ConstructFromPoint(const Point *p); PointF PointF_AddSi...
C
#include "menu.h" #include "term_cmd.h" #include "debug.h" #include <pthread.h> #include <unistd.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #define SEPARATION_LINE_LENGTH 80 #define STATUS_FIELD_OFFSET 2 #define LIVE_SECTION_OFFSET 3 #define MAX_ACTION_LENGTH 3 static pthread_t menu_thr; static...
C
#include "queue.h" #include <stdlib.h> #include <string.h> #include <assert.h> void QueueNew(Queue* q, int elem_size, QueueFreeFunction freeFn){ q->logLen = 0; q->allocLen = 1; q->elem_size = elem_size; q->base = malloc(q->elem_size); assert(q->base != NULL); q->freeFn = freeFn; } int QueueI...
C
#include <stdio.h> #include "headers/exo0.h" #include "headers/exo1.h" int* merge_sorted_arrays(int* first, int* second) { int* mergedArr; int firstSize, secondSize, totalSize, i, j, k; j = k = 0; firstSize = array_size(first); secondSize = array_size(second); totalSize = firstSize + seco...
C
/* * Author : Alvin Baldemeca * Version : 11.23.2013 * * Copy Right (C): * 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, or * any later version. * * ...
C
#include<stdio.h> #include<string.h> int spchar(char pass[]) { int i,count_spchars=0; for(i=0;i<strlen(pass);i++) { if(pass[i]>=33 && pass[i]<=47 || pass[i]>=58 && pass[i]<=64) count_spchars++; } return count_spchars; } int nums(char pass[]) { int i,count_nums=0; for(i=0;i<strlen(pass);i++) { if(pass[i]<=...
C
/***********************************************************************/ // INF-01191 - Arquiteturas Avançadas // // Trabalho 1 // // Calculo de Pi utilizando método Montecarlo e OpenMP // // // Gabriel Piscoya Dávila 00246031 // Rubens Ideron dos Santos 00243658 // /***************************...
C
//Nearest even Number #include<stdio.h> main() { int num; scanf("%d",&num); if(num%2) printf("%d",num-1); else printf("%d",num); }
C
/* * File: Blink_LED.c * Author: Paras * * Created on May 21, 2017, 10:57 AM */ #include "LED_header.h" #define LED 1 void BlinkLED() { //setvbuf(stdout, NULL, _IONBF, 0); printf ("Raspberry Pi - Blink LED\n"); fflush(stdout); wiringPiSetup(); pinMode(LED, OUTPUT); while(1){ ...
C
static Uint32 DivFix(Uint32 p1, Uint32 p2, Uint32 fix) { Uint32 ret; ret = p1 / p2; p1 = p1 % p2;/* p1 = p1 - p2 * ret; */ while (fix--) { p1 += p1; ret += ret; if (p1 >= p2) { p1 -= p2; ret++; } } return ret; }
C
/*Author: Prasad Ghangal * Title: Codechef-Factorial(codeERA)*/ #include<stdio.h> #include<stdlib.h> int main() { long double *a; int t,n,i; // scanf("%d",&t); a=(long double*)malloc(sizeof(long double)*101); a[0]=a[1]=1; for(i=2;i<101;i++) { a[i]=i*a[i-1]; } /* for(i=0;i<=100;i++) { printf("%Lf ",a[i]); ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> //int candidates[] = {10,1,2,7,6,1,5}; int candidates[] = {1,1,2,5,6,7,10}; int result[] = {0, 0, 0, 0, 0, 0, 0}; int target = 8; int sum(int a[]) { int total = 0, i; for (i = 0; i < 7; ++i) { total += a[i]; } re...
C
#include <stdio.h> #include <stdlib.h> #include <errno.h> int BinarySearch(int SearchArray[100],int SearchNum,int length) { int low_bound=1; //position of 1st element in the array int up_bound=length;//position of last element in the array int midPoint; //midpoint of array int comparisons=0; //to g...
C
#include "libft.h" void *ft_calloc(size_t count, size_t size) { void *ptr; ptr = malloc(size * count); if (!ptr) return (0); ft_bzero(ptr, size * count); return (ptr); }
C
/** * @brief Creates the links between spaces * * @file link.h * @author Pablo Sánchez * @copyright GNU Public License */ #ifndef LINK #define LINK #include "../include/types.h" #define MAX_LINK 1024 typedef struct _Link Link; /** * @author: Pablo Sánchez * @brief: Allocs memory for one link * @param: Null *...
C
#include "WiltDS.h" #include <unistd.h> #include <stdlib.h> // A simple test case to run the code on a desktop machine. // Only works on little-endian machines. int main(int argc,char **argv) { uint32_t size; read(0,&size,4); uint32_t shifts=0; read(0,&shifts,3); uint16_t *buf=malloc(size); DecompressData(0,...
C
#include <stdio.h> int main() { int num1; //변수를 '선언'한다. int num2, num3; int num4 = 10; //변수를 선언하면서 할당하여 초기화한다. int num5 =1, num6=2, num7 =8; num1 = 100; //변수에 값을 '할당'한다. num2 = 50; num3 = 20; printf("%d,%d,%d",num1,num2,num3); //'d'ecimal(10진수) return 0; }
C
/****************************************************************************** * Copyright (C) 2017 by Alex Fosdick - University of Colorado * * Redistribution, modification or use of this software in source or binary * forms is permitted as long as the files maintain this copyright. Users are * permitted t...
C
#include <stdio.h> #include <stdlib.h> int main() { float nota[3]; printf("Digite a primeira nota: "); scanf("%f", &nota[0]); printf("Digite a segunda nota: "); scanf("%f", &nota[1]); printf("digite a terceira nota:"); scanf("%f", &nota[2]); nota[3] = (nota[0] + nota[1] + nota[2]) / 3; if (nota[3] >= 7) { printf(...
C
#include <ctype.h> #include <stdio.h> #include <string.h> #include <time.h> #include <unistd.h> #include "CalendarParser.h" #include "Helpers.h" int main(int argc, char *argv[]) { char *toPrint; char choice[256]; char fileName[256]; time_t t = time(NULL); struct tm tm = *localtime(&t); Alarm *alarm; Calend...
C
#include "option.h" /** * options - initialize and access a static table of options indexed by name * * Return: a pointer to the static option table */ option_table_t *options(void) { static option_table_t option_table = {{0}}; static option_t option_table_init[] = OPTION_TABLE_INIT; static option_t *opt = opti...
C
/* ** join_chan.c for epitech in /home/chapuis_s/rendu/ ** ** Made by chapui_s ** Login <chapui_s@epitech.eu> ** ** Started on Tue Apr 7 16:18:21 2015 chapui_s ** Last update Thu Apr 16 00:05:36 2015 chapui_s */ #include "server.h" static void send_to_chanel(t_client *root, char *from, char *channel) { t_client...
C
#pragma once struct WaveFormat { WaveFormat() { for (int i = 0; i < 4; ++i) { chunkId[i] = NULL; format[i] = NULL; subchunk1Id[i] = NULL; subchunck2Id[i] = NULL; } chunkSize = NULL; subchunk1Size = NULL; audioFormat = NULL; numChannels = NULL; sampleRate = NULL; byteRate = NULL; block...
C
#include "wild.h" char *pageNotFound() { return "<html><title>PAGE NOT FOUND</title><body> <p> </p> <p>WildBrowser is afraid to inform you that it was unable to reach the site you gave. Press Enter to go type an address.</p> </body></html>"; } char *openingPage() { return "<html> <title>Welcome to WildBrowser!</tit...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <sys/stat.h> #include "holberton.h" /** * main - copies the content of a file to another file * @argc: integer number of arguments (must be 3) * @argv: array of arguments * * Return: 1 on success, exit with error code otherwise...
C
#ifndef __ANGLE_CHECKER__ #define __ANGLE_CHECKER__ struct AngleChecker { struct Checker { bool Check( float Angle ) { if( Angle >= Start && Angle <= End )return true; Angle -= 2; if( Angle >= Start && Angle <= End )return true; return false; } void Set( const float& S, const float& E ) { i...
C
#include <stdio.h> #include <stdlib.h> extern int CheckABS( int numx, int tam, int *seq); int main(void) { int x = 20; int tamanho = 8; int ve[] = {7, -8, -23, 56, 20, -10, 0, 40}; int res; res = CheckABS(x, tamanho, ve); printf("Foram modificados %d elementos da sequencia ve[]", re...
C
//########################################################## //## R O B O T I S ## //## CM-700 (Atmega2561) Example code for Dynamixel. ## //## 2009.11.10 ## //########################################################## //Edited By Cur...
C
#include "avm.h" unsigned currLine = 0; unsigned pc = 0; unsigned char executionFinished = 0; unsigned totalActuals = 0; unsigned codeSize = 0; instruction* code = (instruction*) 0; unsigned currCode = 0; avm_memcell ax; avm_memcell bx; avm_memcell cx; avm_memcell retval; execute_func_t executeFuncs[] = { execut...
C
#include <stdbool.h> #include <math.h> double nop(double x, int n); double ln(double x, int n); int main (int argc, char *argv[] ) { double result; result = ln(atof(argv[1]), 1000); printf("ln: %f", result); return 0; } double nop(double x, int n) { return x; } double ln(double x, int n) { int i; double...
C
#include <stdlib.h> #include <assert.h> #include <unistd.h> #include <stdio.h> #include <signal.h> #include <limits.h> #include <e-hal.h> #include <e-loader.h> #include "addresses.h" #define BARRIER() __asm__("DMB") e_epiphany_t workgroup; e_mem_t memory; #define EXTERNAL_BASE 0x8e000000 #define READ(CORENO,...
C
//Header files #include <at89c5131.h> #include <stdio.h> //for sprintf functions #include <stdlib.h> //Bit definitions sbit RS=P0^0; sbit RW=0x81; //Also can use P0^1 or 0x80^1 sbit EN=P0^2; //Global variables //LCD functions void lcd_init(void); void lcd_cmd(unsigned int i); void lcd_char(unsigned ch...
C
#include <stdio.h> int main () { int coordinate; printf("Input target coordinate: "); scanf("%d", &coordinate); if (coordinate >= -5 && coordinate <= 5 ) { puts("Close enough!"); } else { puts("Target is out of range."); } return(0); }
C
// lac_data.h #pragma once #include <stdint.h> #include <stdlib.h> #include <string.h> // counted strings are used as dictionary keys typedef struct { size_t size; uint8_t data[]; } lac_data; // allocate lac_data and copy data // use free() to free static inline lac_data* lac_data_alloc(size_t size, const uint8_t*...
C
#include <stdio.h> #include <stdlib.h> int* pascal(int size){ int* thisRow; if (size == 1){ thisRow = malloc(sizeof(int)); thisRow[0] = 1; }else{ int* lastRow = pascal(size-1); thisRow = malloc(sizeof(int)*size); thisRow[0] = 1; thisRow[size-1] = 1; for(int i = 1 ; i < size-1 ; i++){ thisRow...
C
# include "shared_tools.h" void delay(float number_of_seconds) { uint32_t dlyTicks = number_of_seconds * 667; uint32_t curTicks; curTicks = msTicks; while ((msTicks - curTicks) < dlyTicks) ; } void flushLocalBuffer(unsigned char *buf, int maxlen) { for (int i = 0; i < maxlen + 1; ++i) { buf[i]...
C
#include <ons/ons.h> #include <memoria/memoria.h> #include <stdio.h> int main() { unsigned long i, ii, COUNT = 10000; mem_rbtree_t tree; mem_rbnode_t *nodes[COUNT]; char buffer[100]; for(i = 0; i < COUNT; ++i) nodes[i] = NULL; mem_rbt_init(&tree, NULL); for(ii = 0; ii < 100; ++ii) { ...
C
#include <stdio.h> #include <stdlib.h> #include "board.h" //set up the board void set_up(Board* b, int num_rows, int num_cols){ b->board = make_b(num_rows,num_cols); b->num_rows = num_rows; b->num_cols = num_cols; //pass in the type of numrows and numcols from struct return; } //make the boa...
C
//[TITANS] Processo Seletivo 01/2017 //Projeto Fantasma - Eletrônica Digital //Código Auxiliador v1.0 #include <stdlib.h> #include <stdio.h> int SF=0,ST=0,SD=0,SE=0; int MD=0, ME=0, AR=0; int estado_atual = 0; /* Sinais de entrada: SF: Sensor da Frente ST: Sensor de Trás SD: Sensor da Direita SE: ...