language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> int main() { int n, tam, Q, soma; while (1) { scanf("%d", &n); if (n==0) break; soma =0; while (n--) { scanf("%d%d", &tam, &Q); if (Q%2!=0) Q--; soma += Q...
C
/* ========================================================================= * Project: Special IO Finction(IR_PWM_BZ) * File: main.c * Description: Output IR/PWM/Buzzer * 1. using internal 4MHz (Instruction clock: 4T) * 2. IR output frquency : 41.666KHz (set config ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_spacer.c :+: :+: :+: ...
C
#include <stdio.h> #include <pthread.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> #include <string.h> #include <sys/mman.h> typedef struct INFO { int max; int num; size_t size; char *sc_addr, *desc_addr;...
C
#include <stdio.h> #include <sys/socket.h> #include <netinet/in.h> #include <string.h> #include <stdlib.h> int main(){ int welcomeSocket, newSocket, clientLen, nBytes; // дескрипторы сокетов char buffer[1024]; // буфeр для приема struct sockaddr_in serverAddr; // структура с адресом struct sockaddr_sto...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include "conversion.h" #include "hamming.h" #include "xor.h" /* New functions written for this challenge in hamming.h */ /* Set the maximum keysize to guess */ int KEYSIZE_MAX = 47; int main(int argc, char** argv) { FILE *fp; ...
C
#include <stdio.h> int main(){ FILE *ae; FILE *as; char lin[100]; char nome1[100]; char nome2[100]; printf("Digite o nome de um arquivo a copiar\n"); scanf("%s", nome1); printf("Digite o nome do arquivo a gravar\n"); scanf("%s", nome2); ae = fopen(nome1, "r"); if(ae == NULL){ printf("Nao conse...
C
#include "movie.h" #include <malloc.h> #include <string.h> /*Struct que representa um filme no programa*/ struct movie { char* name;/*Nome do filme*/ int year;/*Ano do filme*/ char** gender;/*Ponteiro que irá representar o vetor de gêneros que o filme contém*/ int nGenders;/*Número de gêneros que o filme contém*/ ...
C
#include <stdio.h> #include <math.h> int main() { double x, v, k, t=0, dt, a, m; int i, N; FILE * fileout; fileout = fopen("Dumbledore10.txt", "w"); printf("\nEnter initial x, v\n"); scanf("%lf %lf", &x, &v); printf("\nEnter k, m, N, dt\n"); scanf("%lf %lf %i %lf", &k, &m, &N, &dt); f...
C
#include <stdio.h> #include <stdlib.h> typedef unsigned long long int ULong; ULong data; ULong result; extern void shrl32_with_0x10 ( void ); asm("\n" "shrl32_with_0x10:\n" "\tpushq %rdx\n" "\tmovq data, %rdx\n" "\tshr $0x10, %edx\n" "\tjne shrl32_with_0x10_jump\n" "\tshrl32_with_0x10_cont:\n" "\tmovq %rdx, result\n...
C
/* --PROGRAM NAME: knkcch04.c --FLAGS: -std=c99 --PROGRAM STATEMENT: Show the output produced by each of the following program fragments. Assume that i and j are int variables. (a) i=5; j=++i * 3 - 2; printf("%d %d",i,j); (b) i=5; j=3-3*i++; printf("%d %d",i,j); (c) i=7; j=3 * i-- + 2; printf("...
C
#pragma once #include<stdlib.h> #include "util.h" typedef struct rb_node { void* value_field; void* key_field; struct rb_node* left, * right, * parent; int color; } rb_node; typedef struct rb { rb_node* root; compare func_comp; size_t key_size; size_t value_size; } rb; extern rb* rbCreate(compare func_comp, ...
C
/* 函数alarm实现思路: 使用setitimer设置定时器 到期发送SIGALRM */ #include "main.h" #include <time.h> #include <sys/time.h> unsigned int user_alarm(unsigned int seconds) { struct itimerval new_value,old_value; new_value.it_value.tv_sec = seconds; new_value.it_value.tv_usec = 0; new_value.it_interval.tv_sec = 0; ...
C
// The midware #include <stdio.h> #include <stdlib.h> typedef unsigned char byte; int read_cmd(byte *buff); int write_cmd(byte *buff, int len); int sum(int x,int y); int twice(int x); int main(){ int fn, arg1, arg2, result; byte buff[100]; //fprintf(stderr, "driver has been launched\n"); while(read_cmd(buff)>0)...
C
void printString (char*); void readString (char*); int divide(int,int); int modulus (int,int); void readSector(char*, int); void handleInterrupt21(int, int , int, int ); // main() // { // char line[80]; // printString("Enter a line: \0"); // readString(line); // printString(line); // while(1); // } void printS...
C
#include <stdio.h> int main(int argc, const char * argv[]) { int year; while(scanf("%d",&year)!=EOF){//every year belong to one animal if(year%12==6) printf("tiger\n"); else if(year%12==7) printf("rabbit\n"); else if(year%12==8) printf("dragon\n"); else if(year%12==9) printf("sn...
C
// // Created by test on 2021/5/29. // #include <stdlib.h> #include "stdio.h" #include "string.h" #define maxsize 1000 int main(){ int n,k,i,j; scanf("%d %d",&n,&k); int * a=(int *)malloc(sizeof(int)*n); memset(a,0,sizeof (int)*n); for(i=1;i<=k;i++){//k个人 for(j=i;j<=n;j+=i){//n盏灯 ...
C
// // Written by Waloen for the NTNU Cyborg Spring 2017 // Code is for the Start Box // See my thesis for more documentation // #include <avr/io.h> #include <stdio.h> #include "USART.h" void USART_init(unsigned int ubrr){ DDRD = (1<<PD1); UBRR0H = (unsigned char)(ubrr>>8); // Baudrate UBRR0L = (unsigned ch...
C
#include <stdio.h> #include <stdlib.h> void duplicateChar(char *s) { int i=0, duplicate=0, j; for(;s[i]!= '\0';i++) { for(j=i+1;s[j] != '\0';j++) { if(s[i] == s[j]) { printf("%c\n",s[j]); } } } } int main() { char A[] = "...
C
#include <stdio.h> unsigned long long combi(int a,int b) { int i; unsigned long long C=1; for(i=1;i<=b;i++) C = C*(a-i+1)/i; return C; } int main() { int N,A,B,i,j,sum=0,sub=0; unsigned long long v[50],max,C=0,ave=0; scanf("%d %d %d",&N,&A,&B); for(i=0;i<N;i++){ ...
C
#include <stdio.h> int main() { int n; scanf("%d", &n); for(int i = n; i >=1; i--) { for(int s = n; s - i > 0;s--) printf(" "); for(int k = 1; k <= (2 * i - 1); k++) printf("#"); printf("\n"); } return 0; }
C
/* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ #include <tfm_private.h> void fp_rshd(fp_int *a, int x) { int y; /* too many digits just zero and return */ if (x >= a->used) { fp_zero(a); return; } /* shift */ for (y = 0; y < a->used -...
C
#define N 5 #include <stdio.h> #include <time.h> #include <math.h> int cards[N]; void Init() { int i; for(i = 0; i < N ; i++) cards[i] = i + 1; srand(time(NULL)); } void Print() { int i; for(i = 0; i < N ; i++) printf("%d, ",cards[i]); printf("\n"); } void Shuffle() { int tmp, r1, r2; do { r1 = ra...
C
#include <stdio.h> #include <unistd.h> #include <time.h> #include <stdlib.h> #include "semaphore.h" #define CONSUMING_TIME_S (5) #define PRODUCING_TIME_S (1) #define MAX_PRODUCTS (10) int main(void) { int full = init_semaphore(0); int empty = init_semaphore(MAX_PRODUCTS); int mutex = init_semaphore(1); ...
C
/* * ejercicio5.c * * Created on: 29 nov. 2019 * Author: Manu Cabello */ #include "ejercicio5.h" void ejercicio5(char* nombreFich) { iterator it = file_iterable_pchar(nombreFich); printf("-------------------- TEST DEL MTODO ITERATIVO --------------------\n"); while (iterable_has_next(&it)) {...
C
#include "holberton.h" /** * format_uint - return formatted string of an unsigned integer argument * @buf: buffer to write to * @size: size of buffer * @args: argument list * @settings: format setting struct * Return: length of string written to buffer **/ int format_uint(char *buf, int *size, va_list args, set...
C
#include "edge.h" // Implementation of the friend function, extending osstream and not an edge_t // member std::ostream& operator<<(std::ostream& os, const edge_t& e) { os << e.data.first << "-" << e.data.second; return os; }
C
#include "param.h" #include <stdio.h> void debugInt(Int *, int); void debugBool(Bool *, int); void debugClsr(Clsr *, int); void debugClsrRec(ClsrRec *, int); void debugConsv(Consv *, int); void debugEnv(Env *, int); void debugVal(Val *, int); void debugVar(Var *, int); void debugOp(Op *, int); void debugIf(If *, int);...
C
#include <stdio.h> int main() { int t, n,i,j, count, temp; scanf("%d", &t); while(t) { count=0; scanf("%d", &n); int ara[n]; for(i=0; i<n; i++) scanf("%d", &ara[i]); for(i=0;i<n-1; i++) for(j=i+1; j<n; j++) if(ara[i]>ara[j]) { count++; ...
C
#include <stdio.h> #include <math.h> double attackerSuccessProbability(double q, int z){ double p = 1.0 - q; double lambda = z * (q/p); double sum = 1.0; int i,k; for(k=0;k<=z;k++){ double poisson = exp(-lambda); for(i=1;i<=k;i++){ poisson *= lambda/i; } ...
C
#include "system.h" #include "io.h" /* *Correct the below mentioned code to get an expected result: If the switch is pressed, LEDs should turn on */ int * key_ptr; int main() { key_ptr = (int *) KEY_BASE; IOWR(LED_BASE,0,0x00); while (*key_ptr == 3); IOWR(LED_BASE,0,0xff); return 0; }
C
// // test_chapter_09_01.c // // Testing purposes - Chapter 9 // Letterhead print #include <stdio.h> #include <string.h> #define NAME "Busy Superhero" #define STREET "7 Lifeguard Ave" #define CITY "04939 Crypton" #define STARS 40 void print_spaces(int stars, int text); void print_stars(int stars); int main(void) {...
C
#include <stdio.h> int main() { printf("This is not my first message\n"); printf("I already printed Hello World\n"); printf("Now everything is clear\n"); printf("YUPY!!\n"); printf("This is not my first message\nI already printed Hello World\nNow everything is clear\nYUPY!!"); }
C
/* STDWIN -- TEXT BREAK ROUTINE. */ #include "stdwin.h" /* Portable version of wtextbreak(); use on systems where such an operation is not an available primitive and wtextwidth has a high overhead per call. This function makes an educated guess and then uses linear interpolation to find the exact answer. ...
C
// // problem43.h // LeetCode // // Created by apoptoxin on 2018/8/16. // Copyright © 2018年 micronil.com. All rights reserved. // #ifndef problem43_h #define problem43_h #include <stdio.h> #endif /* problem43_h */ //字符串相乘 //给定两个以字符串形式表示的非负整数 num1 和 num2,返回 num1 和 num2 的乘积,它们的乘积也表示为字符串形式。 // //示例 1: // //输入: num...
C
/**/ /* 1996.10.11 */ /**/ #define NAME list /**/ typedef struct _NAME{ int value; struct _NAME *next; } NAME; NAME *allocate_NAME(void); void collect_NAME(NAME *top); /**/ /**/ #include <stdio.h> #include <stdlib.h> static NAME *pool = NULL; #define P_INCREMENT 500 /**/ #include <limits.h> #define SIZE_T_...
C
/* #include<stdio.h> #include<pthread.h> int hr,min,sec,tid1,tid2; void *read(); void *write(); void *ret; pthread_t rth,wth; pthread_mutex_t mu; void main() { tid1 = pthread_create(&rth,NULL,&read,NULL); if(tid1 == 0) printf("\nrth created successfully\n"); tid2 = pthread_create(&wth,NULL,&write,NULL); if(tid...
C
#include<stdio.h> #include<cs50.h> int main(void) { int number; do { number = get_int("Height :"); } while (number < 1 || number > 8);//check the negative number and accept between 1 to 8 for (int i = 0; i < number; i++) { for (int a = number - 1; a > i; a--) ...
C
#include <cuda.h> #include <string.h> #ifdef __KERNEL__ /* just for measurement */ #include <linux/vmalloc.h> #include <linux/time.h> #define printf printk #define malloc vmalloc #define free vfree #define gettimeofday(x, y) do_gettimeofday(x) #else /* just for measurement */ #include <sys/time.h> #include <stdio.h> #i...
C
#include<stdio.h> int main() { int a; printf("Enter the number:"); scanf("%d",&a); int arr[a],i; printf("Enter the %d of element:",a); printf("\nBefore reversing:"); for(i=0;i<a;i++) { scanf(" %d ",&arr[i]); } printf("After reversing:"); for(i=a-1;i>=0;i--) { printf(" %d ",arr[i]); } return 0; }
C
#include <stdio.h> #include <stdlib.h> int main(void){ int i, n, *pvetor; float media; //define valor para n, scanf, ou n = scanf ("%d", &n); //aloca espaço na memoria pvetor = (int *) malloc(n * sizeof(int)); if(!pvetor){ puts("Sem memoria."); return 1; } //Voltando a vetores comuns...
C
#include <math.h> #include <time.h> #include <stdlib.h> #include <string.h> #include <fcntl.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/mman.h> #include "file_system.h" /** * Opens the specified image file and maps it into virtual memory, so that everything can be read from it....
C
/******************************************************************************** *Fonction : ********************************************************************************* * FICHIER : * PROJET : PE168 * DEV : JFA * VERSION : 1.0 * OUTIL : ****************************************************************...
C
#include <stdio.h> #include <string.h> char in[5000], pre[5000], ans[1000]; int chkspecial(int s){ int chk=1; for (int i=s; i<s+5; i++){ if ((('0'<=in[i] && in[i]<='9')==0) && (('A'<=in[i] && in[i]<='Z')==0)) chk=0; } return chk; } int main(){ int m[43]= {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, ...
C
#include <stdio.h> #include "holberton.h" /** * print_to_98 - prints the numbers until 98 * @n: init type int * Return: void */ void print_to_98(int n) { if (n > 98) { for (n = n; n >= 98; n--) { printf("%d", n); if (n != 98) { printf(", "); } } } else { for (n = n; n <= 98; n++) { printf("%d", n); if (n != 98) { p...
C
#include <stdio.h> #include <memory.h> #include <pthread.h> #include <string.h> #include <netinet/in.h> #include <sys/socket.h> #include <unistd.h> #include "common.h" #include "server.h" void* pthread_send(void * a) { U8_T *send_buf = (U8_T *)(a); U8_T send_obj[2] = {0}; while(1) { memset(...
C
/*! * \file curses.c * \brief * \author sunshine * contact mxdhlj@163.com * \version 0.00 * \date 11-08-19 14:35:30 */ #include<unistd.h> #include<curses.h> int main(int argc, char* argv[]) { initscr(); box(stdscr, ACS_VLINE, ACS_HLINE); /*draw a box*/ move(LINES/2, COLS/2); /*move the cursor to...
C
#include "commandFunc.h" int putSrcPath(char **srcPath,char **msg){ } int freeDestPath(char *destPath, char **msg){ if(destPath == NULL){ *msg = "there is no path to free"; return -1; } if(msg == NULL){ *msg = "there is no argument"; return -1; } free(destPath); *msg = " freeing is done"; retur...
C
//Queue using Pointer #include<stdio.h> #include<stdlib.h> void enqueue(); void dequeue(); void display(); struct queue{ int data; struct queue *link; }*front=NULL,*rear=NULL; int main(){ printf("\n Queue using Pointer \n"); printf("\n 1.Insert \n 2.Delete \n 3.Display \n 4.Exit"); do{ int choice; ...
C
#include <stdio.h> #include <stdlib.h> int dividir (float* resultado, float a, float b); int main() { float x,y,z; printf("Ingrese primer numero\n"); scanf("%f",&x); printf("Ingrese segundo numero\n"); scanf("%f",&y); if (dividir(&z,x,y) == -1) { printf("eRROR"); }else { ...
C
#include <stdio.h> #include "myJpeg.h" int main(int argc, char* argv[]) { RAWDATA_t raw; int x, y; unsigned char r, g, b; char outname[256]; if (argc != 2) { printf("t@Cw肵Ă\n"); return -1; } if (jpegFileReadDecode(&raw, argv[1]) == -1) { printf("jpegFileReadDecode error\n"); return...
C
#include <stdlib.h> #include <stdio.h> int main() { /*int num, A; while ((A = getchar()) != EOF) { if (A == '\n') num++; } printf("%d", num);*/ int A, B, C, D, max; scanf("%d%d%d", &A, &B, &C); /*if(A > B){ C += A; } else { C += B; } if(A > B){ ...
C
#include<stdio.h> char arr[2665]; int prime[1000]; int ans[1000]; int main() { int i,j,ct=0,flag=0; for(i=1;i<2665;i=i+2) arr[i]='0'; for(i=4;i<2665;i=i+2) arr[i]='1'; prime[0]=2; ct++; for(i=3;i<2665;i=i+2) { if(arr[i]!='1') { prime[ct++]=i; for(j=2;j*i<1001;j++) arr[j*i]='1'; } } ans[0]=3...
C
#include <stdio.h> int ft_fibonacci(int index) { int f; if (index < 0) f = -1; else if (index > 1) f = ft_fibonacci(index - 2) + ft_fibonacci(index - 1); else f = index; return (f); } int main(void) { int f; int i = -3; while (i < 15) { f = ft_fibonacci(i); printf("%i:\t%i\n", i, f); i+...
C
// input: ALSA #include "input/alsa.h" #include "debug.h" #include "input/common.h" #include <alloca.h> #include <alsa/asoundlib.h> #include <math.h> // assuming stereo #define CHANNELS_COUNT 2 #define SAMPLE_RATE 44100 static void initialize_audio_parameters(snd_pcm_t **handle, struct audio_data *audio, ...
C
#include "queue.h" #include "stdlib.h" void enqueue(queue* q, void* p) { node* newitem = (node*)malloc(sizeof(node)); newitem->base = p; newitem->next = NULL; if ((q->tail == NULL)||(q->head==NULL)) { //queue is empty q->tail = newitem; q->head = newitem; } else { ...
C
#include "holberton.h" /** *reset_to_98 - do something *@n: do something */ void reset_to_98(int *n) { *n = 98; }
C
/* FOR TESTING ONLY */ #define PO previous_object() main(string str) { string str2; int amt; if(!str) return 0; if(sscanf(str,"%s %d",str2,amt) != 2 ) { write("Usage: skill_test <skill> <amount>\n"); return 1; } if(str2 == "skill") { PO->adj_skill_points(amt); write(str2+" now at: "+PO->qu...
C
#include <stdio.h> int main() { int n=10; if(n<30){ printf("n is less than 30\n"); } else if(n<50){ printf("n is less than 50\n"); } return 0; }
C
/*data_items.h */ #ifndef DATA_ITEMS_H_INCLUDED #define DATA_ITEMS_H_INCLUDED #include "display_items.h" /*contains display_item() , and this function is called from this program*/ int validate(char s[]); //const char *items[20]; int n=0,q[20],item_no[20]; const int price[20]={10,5,10,20,25,45,3,10,15,20,25,125,100,...
C
#include "elevator_cart.h" # int get_floor_number(){ if (hardware_read_floor_sensor(0)) return 0; else if (hardware_read_floor_sensor(1)) return 1; else if (hardware_read_floor_sensor(2)) return 2; else if (hardware_read_floor_sensor(3)) return 3; else return -1; } void set_prev_fl...
C
#include <stdio.h> /* Try using /c in code */ int main(void) { printf("\"Hello \c World\""); printf("\n"); }
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 an...
C
#include "holberton.h" /** * _strlen_recursion - Is the prototype. * @s: Is the variable we are working with. * Return: 0 */ int _strlen_recursion(char *s) { if (*s) { return (1 + _strlen_recursion(++s)); } else return (0); }
C
#include<stdio.h> main(){ int x; while(x<=100){ if(x%10==0){ printf("\n"); } printf("*"); x=x+1; } }
C
/* * s.h - macro definitions for the screen editor */ #include <stdio.h> #include <ctype.h> #define CR '\r' /* sent by <return> key */ #define ctrl(x) (x & 037) /* control character 'x' */ #define ESCAPE 27 /* end-of-insertion character */ #define MAXTEXT 1000 /* maximum length of a line */ #define SCROLL_SIZE ...
C
#include <stdio.h> #include <string.h> int re, op1, op2; char sign1, sign2, sign3; int main() { sign1 = '+'; while (sign1 != '=') { scanf("%d %c", &op1, &sign2); while (sign2 == '*' || sign2 == '/') { scanf("%d %c", &op2, &sign3); if (sign2 == '*') { op1 *= op2; } if (sign2 == '/') { op1 /= o...
C
#ifndef __RESTAURANT_LIST__ #define __RESTAURANT_LIST__ #include <stdbool.h> /* Provides bool */ #include <stddef.h> /* Provides size_t */ #include <stdlib.h> /* Provides calloc */ #define _LIST_EL_META_FIELD __list_el_meta #define LIST_EL_STRUCT(type) \ struct _LIST_EL_META_FIELD { \ type *prev; ...
C
/* * EL7373 (Spring 2014) High Performance Switches and Routers * * Lab 1 - IP Lookup Algorithms * * test_pcap_offline.c * * TA: Kuan-yin Chen (cgi0911@gmail.com) * * Description: * 1. The program first reads filename from command line (argv[1]). * 2. It then opens a PCAP descriptor using the input filena...
C
#include <stdio.h> #include <string.h> int main() { char sentence[] = "this is a sentence with 7 tokens"; char *tokenPtr = strtok(sentence, " "); while(tokenPtr != NULL) { printf("%s\n", tokenPtr); tokenPtr = strtok(NULL, " "); } return 0; }
C
#include <stdio.h> #include <sys/types.h> #include <signal.h> #include <stdlib.h> #include <unistd.h> #include <wait.h> int main(int argc, char *argv[]) { int i = 0; printf("alarm star\n"); alarm(3); //默认3s后终止进程 printf("alarm end\n"); while(i < 20) //为了能等待进程能接受信号 { i++; sleep(1); printf("%d\n",i); } re...
C
#include <sys/mman.h> #include <sys/stat.h> #include <fcntl.h> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <signal.h> #include <time.h> #include <unistd.h> #include <string.h> #include <sys/types.h> #include <semaphore.h> #define NAMEMAX 100 //tamaño máximo del numbre del buffer #define LOGMAX ...
C
#ifndef LL_H #define LL_H #define SYMBOL_MAX_LENGTH 16 typedef struct LLNode { struct LLNode *next; void *val; } LLNode; typedef struct LL { LLNode *head; LLNode *tail; int len; } LL; // Very inefficient linked list-backed map typedef struct Map { LL *list; // Linked list of Tuples int (*eq)(void *, ...
C
#define _POSIX_C_SOURCE 200809L #include "abb.h" #include "pila.h" #include <stdlib.h> #include <stdbool.h> #include <string.h> #define LADO_IZQUIERDO -1 #define LADO_DERECHO 1 /* ****************************************************************** * DEFINICION DE LOS TIPOS DE DATOS * ***************...
C
#include "comnet.h" int getData(int sd) { struct ifreq nic; int index, i; char select, interface_name[10]; printf("Elije la interfaz de red a utilizar\n 1.-enp2s0\n 2.-wlp3s0\n 3.-Salir\n -> "); scanf("%c", &select); switch (select) { case '1': strcpy(interface_name, "enp2s0"); break; case '2': ...
C
#include <stdio.h> #include <string.h> #include <assert.h> #include <stdlib.h> #include "slist.h" /* *this is the list with head,noloop;by Jack @2015.03.04 */ #define NOLOOP Node_t *add_head(Node_t *head,int data) { //assert(head != NULL); Node_t *node = (Node_t *)malloc(sizeof(Node_t)); //...
C
/* ************************************************************************** */ /* */ /* :::::::: */ /* verify_syntax.c :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> int main(){ printf("Initial Value: "); double n, sum = 0; scanf("%lf",&n); printf("\n"); sum = n; while(1){ char operator; printf("Operator: "); scanf(" %c",&operator); if(operator == '+' || operator == '-' || operator == '*...
C
/*Descrio Faa um programa que calcule e escreva a soma dos n primeiros termos da srie: Formato de entrada Um inteiro n indicando a quantidade de termos da srie Formato de sada Um nmero de ponto flutuante formatado com duas casas decimais, seguido de um final de linha.*/ #include <stdio.h> //#include <conio.h> int f...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* for_flags.c :+: :+: :+: ...
C
/* In Class Challenge 2 This program prints three different phone numbers Uses a whole bunch of printf statements Author Peter Dobbs Created: September 2015 */ #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { //variable declaration char *phoneNum1 = "(123) 456-7890"; char *phoneNum2 = "(...
C
#include <stdio.h> #include <stdlib.h> void Ex1L01(int v, int r) { float i; printf("\nDigite a Voltagem: "); scanf("%d", &v); printf("\nDigite a Resistencia: "); scanf("%d", &r); i = v / r; printf("\nA corrente e igual a: %.2fV\n", i); } int Ex3L02 (int num1, int num2) { int num3;...
C
#include <lib/debug.h> #include "import.h" #define PAGESIZE 4096 #define VM_USERLO 0x40000000 #define VM_USERHI 0xF0000000 #define VM_USERLO_PI (VM_USERLO / PAGESIZE) #define VM_USERHI_PI (VM_USERHI / PAGESIZE) /** * The initialization function for the allocation table AT. * It contains two major parts: * 1. Calcu...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "funciones.h" #define LIBRE 0 #define OCUPADO 1 int menu() { int opcion; system("cls"); printf("***Menu de Opciones***\n\n"); printf("1- Alta\n"); printf("2- Baja\n"); printf("3- Modificar\n"); printf("4- Lis...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <pthread.h> #include <unistd.h> #include "event_counter.h" void event_counter_init(struct Event_Counter *ev, int c) { pthread_mutex_init(&ev->mute, NULL); pthread_cond_init(&ev->signal, NULL); ev->event_val = c; } int count_read(struct Ev...
C
/*++ Copyright (c) Breaks Project Module Name: peeker.c Abstract: Module required for storage of intermediate values of reactive variables and output into file as needed. --*/ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "reactive.h" #define PADDING "%-10s: " #...
C
#include <ctype.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #include <dirent.h> // showing everything in a dir /* int main(int argc, char *argv[]) { DIR *dp; struct dirent *dirp; if(argc!=2) ...
C
#ifndef TESTSUNITAIRES_H_INCLUDED #define TESTSUNITAIRES_H_INCLUDED #include "../BibliReseauNeurones/constantes.h" #include "../InterfaceNeuroneDataSet.h" // Le nombre de tests #define NB_TESTS 12 // Format des fonctions de test typedef T_ERREUR T_FONCTION_TEST(void) ; // Definition d'un type booleen typedef enum {...
C
#include <stdlib.h> #include <stdio.h> #include <math.h> #include <omp.h> #include "Lab3IO.h" #include "timer.h" double *X; double **G; int N, p; void swapRow(int row1, int row2); int findAbsoluteMax(double **U, int k, int n); void Gaussian(void * rank); void Jordan(void * rank); int main(int argc, char const *arg...
C
#include "msg.h" #include "elf_read.h" #include "elf_write.h" #include "elf_relocate_arm.h" bool relocate_abs8(Elf_s elf, int32_t file_offset, int32_t s); bool relocate_abs16(Elf_s elf, int32_t file_offset, int32_t s); bool relocate_abs32(Elf_s elf, int32_t file_offset, int32_t s); bool relocate_jump24_call(Elf_s elf,...
C
#include "holberton.h" /** *rot13 - mono-alphabetic substitution cipher. *@s: pointer string *Return: s. */ char *rot13(char *s) { int t1; int t2; char *ax = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; char *ly = "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM"; for (t1 = 0; s[t1]; t1++) { ...
C
/* Copyright (c) 1990 UNIX System Laboratories, Inc. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */ /* UNIX System Laboratories, Inc. */ /* The copyright notice above does not evidence any */...
C
#include <stdio.h> void creatMatrix (int size, int matrix[][size]); int sumMatrix (int size, int matrix[][size]); //void printMatrix(int size, int matrix[][size]); int main(){ int n; scanf("%d", &n); int matrix[n][n]; creatMatrix(n, matrix); //printMatrix(n, matrix); printf("...
C
/************************ * DAC Stream Control * ***********************/ // (Custom Driver to handle PCM Streams of YM2612 DAC and PWM.) // // Written on 3 February 2011 by Valley Bell // Last Update: 25 April 2011 // // Only for usage in non-commercial, VGM file related software. /* How it basically works: 1...
C
#include <stdio.h> int main() { int a,b,c,d,e,f,g,h,i,j; while (scanf("%d %d %d %d %d %d %d %d %d %d",&a,&b,&c,&d,&e,&f,&g,&h,&i,&j)==10) { if(a=f) printf ("N"); else if (b=g) printf ("N"); else if (c=h) printf ("N"); else if (d=i) printf ("N"); else if (e=j) print...
C
#include "jms_console_utilities.h" void OpenCommunicationChannel(int *read_pipe, int *write_pipe, char* read_fifo, char* write_fifo){ // open pipes *read_pipe = open(read_fifo, O_RDONLY | O_NONBLOCK); //Open for reading only. if(*read_pipe >= 0) //Upon successful completion, open function return...
C
// Program to print all possible combinations of given characters // Faheem Hassan Zunjani #include<stdio.h> void main(){ char str[1000],tstr[1000]; int len; int i,j,f,g,h,k,l; printf("Enter string: "); gets(str); for(len=1;str[len]!='\0';len++); for(i=0;i<len+1;i++){ tstr[i]=str[i]; } f=0;...
C
/* * ===================================================================================== * * Filename: getpwnam.c * * Description: getpwnamʾ * * Version: 1.0 * Created: 20130604 09ʱ3751 * Revision: none * Compiler: gcc * * Author: aowen (newaowen@yahoo.com...
C
/* * Copyright (c) 2012-2017 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applica...
C
/* * vm_pager.h * * Header file for the pager */ #ifndef _VM_PAGER_H_ #define _VM_PAGER_H_ #include <sys/types.h> #include "vm_arena.h" /* * ****************************************** * * Interface for student portion of pager * * ****************************************** */ /* * vm_init * * Called when...