language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include "lists.h" #include <string.h> /** * add_node_end - function will add new node to end of list * @head: represents pointer to pointer of first node * @str: represents string to be duplicated * Return: function will return address to new element */ list_t *add_node_end(list_t **head, const char *str) { lis...
C
#include<stdio.h> void swap(double *pa, double *pb); void line_up(double *maxp, double *midp, double *minp); int main (void) { double max, mid, min; printf("silsu three : "); scanf("%1f%1f%1f", &max, &mid, &min); line_up(&max, &mid, &min); printf("real : %.1lf, %.1lf, %.1lf \n", max, mid, min); ...
C
#include<stdio.h> #include<string.h> #include<errno.h> #include<stdlib.h> #include<assert.h> #include "bst.h" // #include "bst.c" #include "pds.h" struct PDS_RepoInfo repo_handle; int deleted_record_offset[105]; int findfileSize(char f_n[]) { FILE* fp = (FILE *)fopen(f_n, "r"); // opening a file in read mode f...
C
/** ****************************************************************************** * @file : 24c02.h * @brief : header for 24c02.c file. * AT24Cxx 读写模块. ****************************************************************************** * * ******************************...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> int simple() { char a[] = "a"; char b[] = "bb"; char c[] = "cc"; char *data = NULL; int total = 0; total = bee_tlv_appender(1, strlen(a), a, &data, total); total = bee_tlv_appender(2, strlen(b), b, &data, total); total = bee_tlv_...
C
//Q4 - LUCAS MIRANDA - Numero USP: 12542838 #include <stdio.h> void main(){ int matr[][4] = {1,2,3,4,5,6,7,8,9,10,11,12}; //(A) **matr é 1? //VERDADEIRO //**matr é o mesmo que matr[0][0] printf("A) %d\n", **matr ); //(B) *(*(matr+1)+2) é 7? //VERDADEIRO //matr+1 faz o programa ava...
C
#include <stdlib.h> #include <stdio.h> #include "stack.h" int main(){ struct Stack* stack = new_stack(); push(stack,3); push(stack,2); push(stack,1); while(stack->size > 0) printf("%d\n", pop(stack)); return 0; }
C
/* * @Author : G.F * @Date : 2021-03-26 00:13:06 * @LastEditTime : 2021-03-26 00:30:05 * @LastEditors : G.F * @FilePath : /CL/format.c * @Description : */ // %d 十进制有符号整数 // %ld 十进制 long 有符号整数 // %u 十进制无符号整数 // %o 八进制表示的整数 // %x 十六进制表示的整数 // %f float 型浮点数 ...
C
#include <stdlib.h> #include <stdio.h> #include <limits.h> #include <assert.h> #include "util.h" #include "amino_acids.h" #include "closest_seqs.h" // Define a collection of structures. typedef struct { int seq_idx; int hamming_dist; } index_and_dist; void hamming_distance_considering_unknown(char **ref_seqs, ch...
C
#include <stdio.h> int main() { int num[9], max = -100; int i; int important_i; for (i = 0; i < 9; i++) { scanf("%d", &num[i]); if (num[i] > max) { max = num[i]; important_i = i; //remember this 'i' using a variable!! } } printf("%d %d", max, important_i + 1); }
C
#include<stdio.h> int main() { double ans; double n; while(scanf("%lf",&n) != EOF) { ans = (n*(n+1) / 2); printf("%.0lf\n",ans); } return 0; }
C
#include "lab05_Task1.h" // each of the files has 6834 lines #define MAX_SAMPLES_2 6834 void lab05_Task1(int type, int arg_N, float arg_fc, int arg_M) { /* Define all variables*/ /* INSERT CODE HERE */ float data[MAX_SAMPLES_2], time[MAX_SAMPLES_2]; float ss[MAX_SAMPLES_2],bs[MAX_SAMPLES_2]; i...
C
int find_pattern(char text[],char pattern[]) { int d = 26; long q = 1e9+7; long p = 0,t = 0; int h = 1; int m = strlen(pattern),l = strlen(text); if(m > l) { return -1; } for(int i = 0;i < m-1;++i) { h = (h*1ll*d)%q; } for(int i = 0;i < m;++i) { ...
C
#include <stdio.h> #define MAXLENGTH 80 void itoa(int number, char str[], int field_width); /* test the itoa function */ main() { int n, fw; char s[MAXLENGTH]; printf("convert integer to string: "); scanf("%d", &n); printf("filling a field width of : "); scanf("%d", &fw); itoa(n, s, fw); ...
C
#include "utils/node_list.h" #include <stdlib.h> #include <utlist.h> // keeps the pointers dangling void free_sequence(mks_node_t *seq) { mks_free_type(seq->type); free(seq->sequence); free(seq); } void mk_seq_to_list(mks_node_t *seq, node_list_t **dest, bool free_seq) { node_list_t *list = malloc(si...
C
/*--------------- main.c ---------------*/ /* BY: Sudha Shunmugam Computer Engineering Dept. UMASS Lowell */ /* PURPOSE Assignment 4 - Operating Systems Course (16.573) CHANGES 11-25-2006 - Created. 11-25-2006 - */ /************* Include files **************/ #include <stdio.h> #include <pt...
C
#include<stdio.h> int main() { float r,luas; scanf("%f",&r); luas=3.14159*r*r; printf("A=%.4f\n",luas); return 0; }
C
#include "ncurses.h" int main() { const int width = 50; const int height = 20; if (!initscr()) { fprintf(stderr, "Error initialising ncurses.\n"); exit(1); } initscr(); curs_set(0); refresh(); int offsetx = (COLS - width) / 2; int offsety = (LINES - height) / 2; // инициализация окна // WINDOW *new...
C
#include <stdio.h> int Sort(char); int main() { char teste[14], d; int n,y; scanf("%s", teste); for(n=1; n<13; n++) { for(y=0; y<13-n; y++) { if(Sort(teste[y]) > Sort(teste[y+1])) { d=teste[y]; teste[y]=teste[y+1]; ...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <errno.h> #include <signal.h> #ifndef EXEC_H #define EXEC_H #include "exec.h" #endif #ifndef PARSER_H #define PARSER_H #include "parser.h" #endif static int LAST_EXIT; //Ignore Ctrl - C void ignore(int sigNum) { return; } //Rea...
C
// // Created by Thinkpad on 2019/6/30. // #include <stdio.h> #include <time.h> #include <math.h> #include <stdlib.h> #include <string.h> #include "uno.h" #define JACK 11 #define QUEEN 12 #define KING 13 #define ACE 14 void card_print(card a, FILE* fp){ if(a.num == JACK){ printf("-%s Jack ",a.kind); ...
C
// // Created by messi-lp on 18-9-14. // #include <stdio.h> //#include "ChapterTwo.c" #include "ArraySort.c" int main(){ SqList list; list.length=20; for (int i = 0; i <= 20; ++i) { list.elem[i]=i; } list.elem[4]=20; list.elem[5]=43; list.elem[11]=9; list.elem[3]=0; list.e...
C
#include "stdio.h" #include <math.h> int main() { int x,b,i=0,y=0,sum=0; scanf("%d",&x); if(x<0) { printf("fu "); x=-x; } b=x; while(b/10>0) { b/=10; i++; } i++; int a[i]; while(x/10>0) { a[y]=x%10; y++; x/=10; } a[i-1]=x; int temp,u=...
C
#include<stdio.h> #define max 7 void ins(int [],int *,int *); void del(int [],int *); void dis(int [],int *,int *); void main() { int ch,q[max]; int f=-1,r=-1; do{ printf("\n\n1 2 3 4\n"); scanf("%d",&ch); switch(ch) { case 1: ins(q,&r,&f); if(*f==-1) /...
C
#include <stdlib.h> #include <time.h> #include <stdio.h> /** *main - Entry point *Description: prints alfhabets in revers *Return: 0 Always */ int main(void) { char asd; for (asd = 'z' ; asd >= 'a'; asd--) putchar(asd); putchar('\n'); return (0); }
C
#include <math.h> #include <stdio.h> #include <string.h> #include <stdlib.h> int main(){ int n,m,x,sum=0; scanf("%d%d",&n,&m); sum=n; x=n/m; while(x>0) { sum=sum+x; x=x/m; } if(sum%m==0) printf("%d\n",sum+1); else printf("%d\n",s...
C
/* * File: main.c * Author: student * * Created on May 2, 2016, 8:29 AM */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <time.h> #include <sys/time.h> #define ERR_SUCCESS (0) #define ERR_NOTCREATE (1) #define ERR_EMPTY (2) #define EXIT_ERROR (1) #define IPCOUNT (1000000) #define NETCOU...
C
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @param socket * @param port */ void bind_to_port(int socket, int port) { struct sockaddr_in name; name.sin_famil...
C
#include "parser.h" #include <ctype.h> #include <string.h> #include "exceptions.h" #include "parser_private_defns.h" /* String processing macros */ #define to_index(literal) ((int)strtol(literal + 1, NULL, 0)) #define is_equal(literal) (literal[0] == '=') #define is_hash(literal) (literal[0] == '#') #define remove_...
C
#include "holberton.h" /** * _print_ptr - prints a long argument converted into hexadecimal * @p: Pointer to count buffer * @n: Decimal number to be converted * @buffer: buffer array * @count: Count chars * Return: Counter for number of chars printed */ int _print_ptr(int *p, unsigned long n, char *buffer, int ...
C
#include<stdio.h> /* copies input to output and replaces each tab by \t and each backspace by \b and each backslash by \\ */ main() { int c; char t; char b; c = 0; b = 'b'; t = 't'; while( (c = getchar()) != EOF ) { ...
C
#include <common.h> #include <os.h> #include <thread.h> #include <spinlock.h> #include <semaphore.h> #include <debug.h> extern struct spinlock os_trap_lock; extern struct task **cpu_tasks; extern struct task root_task; void semaphore_init(struct semaphore *sem, const char *name, int value) { spinlock_init(&sem->loc...
C
#ifndef __header_Monitor_h__ #define __header_Monitor_h__ #ifdef __cplusplus extern "C" { #endif /** \brief Define mode for monitoring @note an example should be a=MonitorMode_STD | MonitorMode_LOG */ enum __eMonitorMode { MonitorMode_OFF = 0,/*!< default logical value*/ MonitorMode_STD...
C
#include <stdio.h> #include <stdarg.h> #include <stdbool.h> #include <malloc.h> //-----------function prototyping------------- /*int getAddition(int a,int b){ return a+b; } int main(){ int(*addition)(int,int); addition = &getAddition; printf("functionspointer mit malloc: %d",addition(2,3)); return 0...
C
#include "holberton.h" /** *print_sign- use only user defined variables to create output *@n : variable input *Return: 0 if the character is lower 1 fi not **/ int print_sign(int n) { if (n > 0) { _putchar(43); return (1); } else if (n == 0) { _putchar(48); return (0); } else _putchar(45); return (-1); }
C
/* Regula-Falsi method. */ #include <stdio.h> #include <conio.h> float fx(float x) { float result; result = ((x*x*x)-x-1); return result; } void main() { int cnt=0; float x0,x1,x2; clrscr(); printf("Enter the value of x0 and x1 : "); scanf("%f %f",&x0,&x1); printf("x0 x1 F(x0) F(x1) x2 Count\n"); x2 = x1-(fx(x1)/(fx(...
C
/** * Note: The returned array must be malloced, assume caller calls free(). */ enum work_state{ down, left, up, right, }; int* spiralOrder(int** matrix, int matrixSize, int* matrixColSize, int* returnSize){ int i=0,j=0,row_step=0,col_step=0,count=0,state=down,step=0; int * ans; count=matr...
C
#include<stdio.h> #include<stdlib.h> #define ZERO 1e-4 #define N 110 void swap(int row1,int row2,int n); int correct(int); void det(int n,double *determine); void findans(int n); void printMat(int,double,FILE*); void solve(int n, double determine); double mat[N][N],sol[N]; /* Matrix = 00 01 02 03.. 10 11 12 13....
C
/* ** EPITECH PROJECT, 2018 ** poor_realoc.c ** File description: ** realloc where adress change */ #include "my.h" char *poor_realloc(char *s) { int number = my_strlen(s); char *dest = malloc(sizeof(char) * number + 1); dest = my_strcpy(s, dest); free(s); return (dest); }
C
//bailian.openjudge.cn/practice/2797/ #include <stdio.h> #include <string.h> #include <stdlib.h> typedef struct tree { struct tree *next[26]; int below; } Node; void MarkWord(char word[]); void CheckWord(char word[]); Node *root; int main() { root=(Node *)malloc(sizeof(Node)); for(int i=0;i<26;i++) root->next[i]...
C
#include<stdio.h> #include"headerfile.h" int main(int argc, char **argv) { if(argc==2) { int nNum; nNum=atoi(argv[1]); if(nNum >= 1 && nNum <= 41) computeGoodNumber(nNum); else printf("\nError: no of digit should be > 0"); } else printf("\nError: no of digit should be > 0"); ...
C
#include <cs50.h> #include <stdio.h> #include <string.h> #include <ctype.h> int main(int argc, string argv[]) // check if there are two arguments { if (argc == 2) { // iterate over the second argument, argv[1] for (int i=1; i<argc; i++) { // iterate over each el...
C
#include<stdio.h> void main() { int fact=1,n; printf("Enter any Number : - "); scanf("%d",&n); printf("\nFactorial of %d is ",n); while(n>1) { fact=fact*n; n--; } printf("%d",fact); getch(); } /* Enter any Number : - 7 Factorial of 7 is 5040 */
C
#ifndef MATRICES_RESOLVER_MATRIXLIBRARY_H #define MATRICES_RESOLVER_MATRIXLIBRARY_H #include <stdbool.h> #include <stdint.h> uint8_t ** new_matrix(int n, int m); void freeMatrix(uint8_t ** matrix, int n, int m); void add_matrix (uint8_t ** matrix1, int n1, int m1, uint8_t ** matrix2, uint8_t ** answer); void substrac...
C
#pragma once #include <stdint.h> enum data_publish_types { data_publish_imu = 1, data_publish_flow = 2, data_publish_baro = 4, data_publish_gps = 8, data_publish_binary = 0x8000, }; typedef struct { uint32_t timestamp; // all time unit is microsecond (μs). int16_t acc[3]; // all acceleration unit is mill...
C
#include <ctype.h> #include <stdio.h> #include <sys/resource.h> #include <sys/time.h> bool load(const char* dictionary) { //open dictionary to read from FILE* dictionary = fopen(dictionary, "r"); //base for a trie node* root; node* curr; node* next; char* storage[1]; int maxCh...
C
/** * @author Karen Troiano 09-10855 * @author Yeiker Vazquez 09-10855 * @grupo * * Archivo: Lista.h * * Descripcion: Contiene las definiciones y librerias utilizadas * por las listas. */ #include <pthread.h> /** * Estructuras utilizadas. */ /** * @struct Item * Tipo de dato para manejar los elementos de las...
C
/* * NOMBRE: esshell.h * AUTOR: Carlos Cotta * FECHA: 4-02-99 * PROPOSITO: Fichero de cabecera del frontend para el uso de ES. * */ #ifndef __ES_SHELL_H__ #define __ES_SHELL_H__ #include "es.h" #include "esindiv.h" /*----------------*\ | Funciones | \*----------------*/ ...
C
#include "sac_a_dos.h" int CalculMeilleurChargement (int nomb, int pmax, int*p, int*V) /*Calcul le meilleur chargement*/ { int i,j; for(j=0;j<=pmax;j++) if(p[0]>j) Matrice_Sac[0][j]=0; else Matrice_Sac[0][j]=V[0]; for(i=0;i<nomb;i++) for(j=1;j<=pmax;j++) { Matrice_Sac[i+1][j]=Matrice_Sac[i][j]; ...
C
/* * pnguy092_lab7.c * * Created: 4/24/2019 9:40:20 PM * Author : iiNza */ #include <avr/io.h> #include "io.c" int main(void) { DDRC = 0xFF; PORTC = 0x00; // LCD data lines DDRD = 0xFF; PORTD = 0x00; // LCD control lines const unsigned char *string = "Hello"; // Initializes the LCD display LCD_init(); ...
C
#include "Keypad.h" void Keypad_Init(KEYPAD_HANDLER * key){ key->Key=HICH; key->output_turn=0; key->reading_state=MAKE_OUTPUT; key->Number=0; key->k_pin[0].pin=K1_PIN; key->k_pin[0].port=K1_PORT; key->k_pin[1].pin=K2_PIN; key->k_pin[1].port=K2_PORT; key->k_pin[2].pin=K3_PIN; key->k_pin[2].port=K3_PORT...
C
#include <ctype.h> #include <stdbool.h> #include <stdio.h> #include <string.h> #define MSG_LEN 50 bool is_palindrome(const char* message); void reverse(char* message); void tolower_string(char* message); int main(void) { char msg[MSG_LEN + 1]; printf("Enter a message: "); gets(msg); if (is_palindrome(msg)) ...
C
case 1: printf("nU`h пJjwXoƦr\n"); scanf("%d", &c); printf("nj٤p jO1pO2 2\n"); scanf("%d", &a); b = rand() % 10 + 1; e = rand() % 10 + 1; printf("AIƬO%d aoIƬO%d\n",b,e); if (a = 1) { if (b > e) { money = money + c * 2; printf("ĹF\n"); winlose(mo...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <string.h> #define SWAP(a,b){int tmp; tmp=a; a=b; b=tmp;} void algorithm1(int* list, int n); //bubble sort void algorithm2(int* list, int left, int right); //quick sort void algorithm3(int* list, int left, int right); //merge sort void algorithm4(int* ...
C
#include <stdio.h> #include <stdlib.h> #define TAM 2 typedef struct { //campos o atributos. int leg; char name[25];//porque es un solo nombre; float prom;//promedio. int estado; /*LA ESTRUCTURA: -NO es un vector. -guarda la direccion de memoria del primer elemento. -son datos por v...
C
#include <stdio.h> #include <math.h> int main () { float x, x2, y, y2; float distancia; printf("DIGITE O PRIMEIRO PONTO\n"); scanf("%f %f", &x, &y); printf("DIGITE O SEGUNDO PONTO\n"); scanf("%f %f", &x2, &y2); distancia = sqrt (pow(x2-x, 2) + pow(y2-y, 2)); printf("%.4f\n", distancia); ...
C
#include <stdio.h> #include<math.h>//为了使用sin(),cos()函数 在VS Code上编译需要指明路径 gcc xx -lm int main () { double R1, P1, R2, P2; printf("请输入R1"); scanf("%lf", &R1); printf("请输入P1"); scanf("%lf", &P1); printf("请输入R2"); scanf("%lf", &R2); printf("请输入P2"); scanf("%lf", &P2); double...
C
//IN THIS PROGRAM WE TRY TO STORE SPARSE MATRIX BY STORING ONLY THE NON-ZERO ELEMENTS AS THE (POSITION,ELEMENT) TUPPLE AND AFTER THAT WE ALSO HAVE DONE ADDITION OF 2 SPARSE MATRICES // NOTE::: While taking input to create a matrix, store the elements in order of their row and column positions. EXAMPLE: For storing ele...
C
/* set-length.c -- vector - flexible array */ #include <stdlib.h> #ifdef FORTIFY #include "fortify/fortify.h" #endif #include "datastruct/vector.h" #include "impl.h" result_t vector_set_length(vector_t *v, unsigned int length) { void *newbase; newbase = realloc(v->base, length * v->width); if (newbase == NU...
C
#include <stdio.h> #include <string.h> void DecToBinary(int n){ if(n < 2) printf("값 : %d\n",n); else{ DecToBinary(n/2); printf("%d",n%2); } } int main(void){ int d; printf("정수입력 : "); scanf("%d",&d); DecToBinary(d); printf("\n"); return 0; }
C
/** * @file setitimer.c * @brief * @author Airead Fan <fgh1987168@gmail.com> * @date 2013/01/14 10:04:10 */ #include <sys/time.h> #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <signal.h> #include <string.h> #include <errno.h> #if 0 int getitimer(int which, struct itimerval *curr_value); in...
C
#include <linux/init.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/interrupt.h> #include <linux/slab.h> /** * Struct to describe the IDTR register structure. * * addr: Base address of Interrupt Descriptor Table (8 bytes) * limit: Size of Interrupt Descriptor Table (2 bytes) */ typedef str...
C
#include "veclib.h" void print(vector vec_a) { printf("["); for (int i=0;i<DIM;i++) printf("%f ",vec_a[i]); printf("]"); printf("\n"); } void input(vector vec_a) { for (int i=0;i<DIM;i++) scanf("%f",&vec_a[i]); } int main() { vector vecA, vecB, vecC, vecD; // read vectors A and B printf("Enter vector ...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> int main() { // fopen("$HOME/.diary", "r"); -> fails git a // get $HOME char* home_location = getenv("HOME"); if (home_location == NULL) { fprintf(stderr, "Failed to get HOME"); } char * diary_string = "/.diary"; size_...
C
/* ** EPITECH PROJECT, 2018 ** . ** File description: ** . */ #include <stdlib.h> #include "navy.h" #include "tools.h" void init_sigaction_sig(struct sigaction *action1, struct sigaction *action2) { action1->sa_sigaction = (void *) success1; action1->sa_flags = SA_SIGINFO; sigemptyset(&action1->sa_mask); action2-...
C
#include "max7221.h" //************************************* // MAX7221 //************************************* void Send_Byte_7221(uint8_t dat) { uint8_t i; for (i = 0; i < 8; i++) { if (dat & 0x80) DAT_MAX = 1; else DAT_MAX = 0; CLK_MAX = 1; /...
C
//#include <stdio.h> /* int main() { int num = 3; int *pnum = &num; printf("num = %d \n", num); printf("&num = %d \n", &num); printf("pnum = %d \n", pnum); printf("*pnum = %d \n", *pnum); printf("&pnum = %d \n", &pnum); getchar(); getchar(); return 0; } */ // 12-1 (1) /* int main(...
C
#include "main.h" /* Пример кнопки с срограмной проверкой на дребезг */ int main(void){ DDRD |= (1 << PD7);//Седьмой пин порта D на выход PORTD &=~(1 << PD7);//Низкий уровень на седьмом пине порта D DDRB &=~(1 << PB0);//Нулевой пин порта B на вход PORTB |= (1 << PB0);//Высокий логический уровень ...
C
//pythonԴʼ /* C 궨: #ı滻 ##ı滻ǰַ do-while(0) #define XXXX(i) do {a(xxx); b(xxx)} while (0) ɱ: #ifdef _M_ALPHA typedef struct { char *a0; int offset; } va_list; #else typedef char * va_list; #endif _M_ALPHAָDEC ALPHAAlpha AXPܹһva_listΪַָ롣 INTSIZEOF ,ȡռõĿռ䳤ȣСռóΪint #define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - ...
C
#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <signal.h> #include <unistd.h> #include <string.h> static unsigned long long fm_count; static volatile bool proceed = false; static void done(int unused) { proceed = false; unused = unused; } typedef struct rat rat; struct rat { int a; ...
C
/* re.c */ /* Henry Spencer's implementation of Regular Expressions, used for MiniScheme */ /* Refurbished by Stephen Gildea */ #include <sys/types.h> #include <stdlib.h> #include "regex.h" #include "miniscm.h" pointer foreign_re_match(pointer args) { pointer retval = F; int retcode; regex_t rt; pointer first_a...
C
#include<stdlib.h> #include<stdio.h> #include<string.h> #include<sys/types.h> #include<sys/socket.h> #include <sys/un.h> #include<netinet/in.h> #define IP_FOUND "IP_FOUND" /*IP发现命令*/ //#define IP_FOUND "127.0.0.1" /*IP发现命令*/ #define MCAST_PORT 1333 #define IP_FOUND_ACK "IP_FOUND_ACK" /*IP发现应答命令*/ void Ha...
C
#include "monty.h" /** * intcheck - checks if a char string is a 'pure' negative or positive number * Description: verifies a string only has digits, and if negative, a '-' at * only the beginning. * Return: -1 if not pure, 0 if pure */ int intcheck(void) { int count = 0; if (all.arr[1] == NULL) { all.erro...
C
/*Задача 3 Напишете функции, с помощта на които да реализирате динамичен масив от елементи, чиято големина може да се променя по време на изпълнение на програмата*/ #include<stdio.h> #include<stdlib.h> void resizeArr(){ int *p, i, n; printf("Initial size of the array is 4\n\n"); p = (int*)calloc(4, sizeof(in...
C
/* ** op_pos.c for raytracer2 in /home/guts/Projects/MUL_2016/raytracer2/parser_Lucas/src_options ** ** Made by Guts ** Login <lucas.le-ray@epitech.eu> ** ** Started on Fri Apr 28 14:07:00 2017 Guts ** Last update Fri May 26 17:50:39 2017 Guts */ #include "raytracer.h" int check_syntax_pos(char *cpy, char *s, in...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> int main() { char input_buffer[513]; char delimit[]=" \t\r\n\v\f"; char *ch_ptr, *token; ch_ptr = fgets(input_buffer, 512 + 1, stdin); puts(ch_ptr); puts(input_buffer); token = strtok(input_buffer, delimit); while(token) { printf("token: ...
C
/* * floatPoint_nr_mainTest.c * * Created on: Sep 9, 2012 * Author: BLEE * * Description: This is the test program for spectrum subtraction noise reduction experiment * * For the book "Real Time Digital Signal Processing: * Fundamentals, Implementation and Application, 3rd Ed" * ...
C
/* * ctrlUnit.c * * Created on: Dec 9, 2019 * Author: OmarG */ #include "tempCOntroller.h" #include "PIR.h" #include "LDR.h" int main(void){ CLEAR_BIT(PTR_STATE_DIR , PA7 ); SET_BIT(PIR_CTRL_PORT_DIR,INPUT1); SET_BIT(PIR_CTRL_PORT_DIR,INPUT2); SET_BIT(LED_CTRL_DIR,LED); Stop_motor(); uint8 TCtrl[...
C
#include <ctype.h> #include <stdio.h> #include <string.h> /* * Exercise: 18 * Page: 126 * Make dcl recover from input errors * */ /* * Recover from input errors is interrupted here as continue to operate after * faulty declarator without affecting the next declarator, * it doesn't try to correct the error or eve...
C
/****************************************************************************** * Filename : tcpclient.c * Author : Pranit Ekatpure * Description : This file contain TCP client-server example's client * implementation. ***************************************...
C
// MIT License, Copyright (c) 2020 Marvin Borner #include <assert.h> #include <def.h> #include <fs.h> #include <ide.h> #include <mem.h> #include <print.h> #include <random.h> #include <str.h> /** * VFS */ static struct list *mount_points = NULL; char *vfs_normalize_path(const char *path) { char *fixed = strdup(p...
C
/* averaged_perceptron_tagger.h ---------------------------- An averaged perceptron tagger is a greedy sequence labeling algorithm which uses features of the current token, surrounding tokens and n (typically n=2) previous predictions to predict the current value. */ #ifndef AVERAGED_PERCEPTRON_TAGGER_H #define AVER...
C
#include <stdio.h> #include <stdlib.h> struct Graph { int V; int E; int adj[2001][2001]; }; struct Edge { int v; int w; }; typedef struct Graph *Graph; typedef struct Edge *Edge; // int ** matrix_init(int l, int c) { // int ** matrix; // matrix = (int **) calloc(l, sizeof(int *)); // ...
C
#include <stdio.h> #include <wiringPiI2C.h> int main(void) { int fd[2]; int i, ret; for (i=0; i<2; i++) { fd[i] = wiringPiI2CSetup (i); ret = wiringPiI2CReadReg8 (fd[i], 0x7a); //device_id printf("fd[%d]:%d, DEV_ID:0x%x\n", i, fd[i], ret); } return 0; }
C
#include<stdio.h> #include<conio.h> void main() { char leter; printf("the character is":): scanf("%d",&letter); if(letter==a||letter==e||letter==i||letter==o||letter==u) { printf("vowel"); } else { printf("constant"); } getch(); }
C
typedef struct { int key; // the key for deciding position in heap int dataIndex; // the payload index provided by the calling program } HeapItem; typedef struct { HeapItem *H; // the underlying array int small_large; // smallest val on top int *map; // map[i] is index into H of location of payload with dataIndex...
C
#include <stdlib.h> #include <stdio.h> #include <errno.h> #include <limits.h> #include "utils.h" /********************************************************************* * * fibonacci function. * * This is the target program to be profiled. * *******************************************************************...
C
int main(){ int k,n,j,i; double x[100],t,s; scanf("%d",&k); for ( i=0;i<k;i++){ scanf("%d",&n); t=0; for ( j=0;j<n;j++){ scanf("%lf",&x[j]); t+=x[j]; } t/=n; s=0; for ( j=0;j<n;j++){ s+=(x[j]-t)*(x[j]-t); } s/=n; s=sqrt(s); printf("%.5lf\n",s); } return 0; }
C
#include "transform.h" #include <assert.h> aout_transform aout_transform_add( aout_transform a, aout_transform b) { return (aout_transform) { .position = aout_vec2_add(a.position, b.position), // TODO: Maybe clamp rotation to [0,2pi] ...
C
#include <stdio.h> #include <stdlib.h> /** * @brief an example struct */ struct example { int a; }; /** * @brief database record struct grouping a row id, an age and a salary. */ struct dbRecord { int rowId; int age; float salary; }; struct dbRecord newEmployee(); int main() { // to declare a st...
C
#include <stdio.h> #include <stdlib.h> #include <sys/stat.h> #ifndef NULL #define NULL ((void*)0) #endif typedef struct r_node { int value; struct r_node *prev; struct r_node *next; } cpu_f_node; cpu_f_node *top=NULL; int insert( int val ) { //ptr cur 초기화 cpu_f_node *ptr = NULL; cpu_f_node *cur = NUL...
C
#include <stdlib.h> #include <stdio.h> #include "line-arg.h" lnA_Parser* par = NULL; lnA_Usage* usg = NULL; void helpCb( char* opt, void* udata ) { lnA_printUsage( par ); exit( 1 ); } void paramCb( char* arg, void* udata ) { printf( "Got argument: %s\n", arg ); } int main( int argc, char** argv ) { ...
C
int main() { float pi=3.14,radius,area; printf("Enter the radius of circle \n "); scanf("%f",&radius); area=pi*radius*radius; printf("\nArea of a circle=%f\n",area); }
C
/** * A short and concise description goes here. * ************************************************* * * Author: Shuo Yang * Email: imsure95@gmail.com */ #include "bitvector.h" #include "protos.h" #include "syntax-tree.h" #include "basic_block.h" extern void printtac( TAC *tac ); extern void print_bv( const cha...
C
#include "heap.h" #include <pthread.h> #include <stddef.h> #include <sys/mman.h> #include "debug/log.h" heap_chunk_t start; void* curr_addr = HEAP_START; pthread_mutex_t heap_mutex = PTHREAD_MUTEX_INITIALIZER; size_t roundUp(size_t numToRound, size_t multiple) { // assert(multiple && ((multiple & (multiple - 1)...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <limits.h> #include <errno.h> /* Define Section */ #define PATH_SEPERATOR "/" #define DIRECTORY_ENV_NAME "HW1DIR" #define FILE_ENV_NAME "HW1TF" #define PRINT_REPLAC...
C
#include<stdio.h> void swap(int*,int*); void main() { int a=10,b=20; printf("before swapping:%d\t%d\n",a,b); swap(&a,&b); } void swap(int* x,int* y) { int temp=*x; *x=*y; *y=temp; printf("after swapping:\t%d\t%d",*x,*y); }
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};} //pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define SWAP(type, x, y) do { type tmp =...
C
/* ======================================== * * Copyright YOUR COMPANY, THE YEAR * All Rights Reserved * UNPUBLISHED, LICENSED SOFTWARE. * * CONFIDENTIAL AND PROPRIETARY INFORMATION * WHICH IS THE PROPERTY OF your company. * * ======================================== */ #include "SerialCom.h" uint8 errorStatus...
C
/*H****************************************************** *<<<<<<<<<<<<<<<<<<< C Language Tasks >>>>>>>>>>>>>>>>>>> * TASK NO. : 24 * AUTHOR : AlHasan Sameh * DATE : May 3rd 2019 * COMPILER : gcc * DESCRIPTION : * Program to find the greatest common divisor of 2 numbers *H*/ #in...