language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <includes.h> #include "data.h" #include "datadesc.h" #include "fram.h" #include "time.h" #include <stdlib.h> #include <stddef.h> // int GetData(const TDataDescStruct* desc, void* buf, CPU_INT32U index, CPU_INT08U flags) { TVariant32 Val; CPU_INT32U ofst = 0; // . if (desc->IsArray) { ...
C
/* * Maria Deslis * Fall 2014 - Hellman * Linx Programming * Sample 1 */ #include <stdio.h> #include <math.h> #include <cstdlib> void diamondT(int width); void diamondB(int width); void printSpace(int num); int main() { int n; char symbol; printf("%s","Enter a width: "); scanf("%i", &n); // printf("%s","Ent...
C
/* * main.c * * Created on: May 11, 2013 * Author: Iulian Gheorghiu (morgoth.creator@gmail.com) */ #include "board_init.h" int main(void) { board_init(); register int CntDelay; while(1) { CntDelay = 8000000; do { if(!CntDelay) break; CntDelay--; } while(1); gpio_out(LED1, 1); gpio_out(L...
C
#include<stdio.h> int main() { int grade; printf(""); scanf("%d", &grade); grade /= 10; switch (grade) { case 10: case 9:printf("\n");break; case 8:printf("\n");break; case 7:printf("һ\n");break; case 6:printf("\n");break; case 5: case 4: case 3: case 2: case 1:printf("\n");break; default:printf("\n");...
C
#include "lexer.h" void tokeniseSourcecode( char* filename, tokenStream *s) { FILE* code = fopen(filename,"r"); tokenStream *head = s; tokenStream* curr = head; char* BUF = (char*)calloc(200,1); int linenum = 0; while(!feof(code)){ linenum++; fgets(BUF,200,code); if(strl...
C
#include <stdio.h> #include <criterion/criterion.h> #include "../src/baseencode.h" Test(b32_decode_test, b32_all_chars) { baseencode_error_t err; const char *k = "IFCEMRZUGEZSDQVDEQSSMJRIFAXT6XWDU7B2SKS3LURSSLJOFR6DYPRL"; const char *k_dec = "ADFG413!£$%&&((/?^çé*[]#)-.,|<>+"; char *dk = base32_decod...
C
#include<stdio.h> void gencard(int ,int, int *, int ); int main() { int card[6]; int i;int val; int u1,l1,u2,l2; // u1 and li for the limits of hypotender u2 and l2 for hypertender int cheker =50; int h; // to select who plays first. the opposite player gets to select the range ...
C
#include<stdio.h> int main() { int num; printf("\nEnter a number:"); scanf("%d", &num); if (num>70) {printf("\nHurray!!You won the lottery");} if (num<70) { printf("oh!you loss"); } return 0; }
C
#ifndef _MFILEHANDLER #define _MFILEHANDLER // maksymalne rozmiary poszczególnych elementów w bazie #define NBAZ 4 #define NTAB 8 #define NREC 32 #define NKOL 8 #define NSIZE 32 #define FBASE "baza.6r" // cała baza zajmuje w pamięci <300 kB typedef struct{ /** NAGŁÓWEK **/ // nazwy poszczególnych elementów w...
C
/************************** * Name: Vicky Mohammad * ID: 0895381 **************************/ //import libraries #include <stdlib.h> #include <stdio.h> #include <errno.h> #include <stdbool.h> #include <string.h> #include <ctype.h> #include "hashTable.h" /**Function to point the hash table to the appropriate functio...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(){ int tam = 0, contIguais = 0, contM = 0, contF = 0, k = 0, x = 0; char caixa[10000], chNum[3]; //Le o n do calcado while(scanf("%s\n", chNum) != EOF){ //Incremento da quantidade de casos x++; ...
C
typedef struct JsonObject { struct { char *name; JsonValue *value; } *fields; } JsonObject; typedef struct JsonArray { JsonValue *values; } JsonArray; typedef struct JsonValue { enum { JSON_OBJECT, JSON_ARRAY, JSON_STRING, JSON_NUMBER, JSON_BOOLEAN } type; union { ...
C
#include <stdio.h> #include <conio.h> int main(){ int koltuk[11]={0},count=0,firstClass=5,economy=0,secim,koltukSec; char cevap[2]; printf("------WELCOME TO YARASA REYIS AIRLINES RESERVATION SYSTEM------\n"); while(count<10){ printf("Please type 1 for Economy Class\nPlease type 2 for First Class:"); scanf("%...
C
#include<stdio.h> void main() { int n,res=0,rem,remin; scanf("%d",&n); while(n!=0) { rem=n%10; res=res*10+rem; n=n/10; } while(res!=0) { remin=res%10; printf("%d\t",remin); res=res/10; } }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_write_o.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> /* sqrt ???????sqrt(a)*sqrt(a)=n ???*/ int dig(long long x){ int c = 0; while(x>0){x/=10;c++;} return c; } int main(void){ long long n,i,j; scanf("%lld",&n); int c=dig(n); for(i=1;i*i<=n;i++){ if(n%i==0){ if(n/i>i)j=n/i; else j=i; int d = dig(j)...
C
#include <stdio.h> int main(void) { int a = 123; if(a >= 0 && a < 10) { printf("weishu: 1\n"); } if(a >= 10 && a < 100) { printf("weishu: 2\n"); } if ( a >= 100 && a<1000) { printf("weishu: 3\n"); } if ( a >= 1000 && a<10000) { prin...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* type_p.c :+: :+: :+: ...
C
#include <stdio.h> int main (void) { int x , b , v[6] , dabriel , guarte ; scanf("%d", &x); while( x != 0 ){ scanf("%d",&b); scanf("%d %d %d", &v[0], &v[1] ,&v[2]); scanf("%d %d %d", &v[3], &v[4] ,&v[5]); if( v[2] % 2 == 0 ) dabriel = (v[0]+v[1])/2 + b; else dabriel = (...
C
#include <stdio.h> #include <stdlib.h> char inverte(char s[], int n) { char resposta[n]; for(int i=0; i<n; i++){ resposta[i] = s[n-1-i]; printf("%c", resposta[i]); } printf("\n"); } int lenght(char s[]) { int i = 0; while(s[i]!='\0') i++; return i; } int main() { int n; char entrada[255]; fgets(entrada...
C
//Author: LinusDev //overworld 0-1 //nether 2.0 //end 3.0 float dimension(in sampler2D source, float nightDay){ vec3 topLeftLight = texture2D(source, vec2(0.0, 0.0)).rgb; vec3 bottomLeftLight = texture2D(source, vec2(0.0, 1.0)).rgb; #ifdef UNDER_WATER //End's and Nether's TopLeftCorner and BottomL...
C
/* ** EPITECH PROJECT, 2018 ** my_rpg_2017 ** File description: ** object disp */ #include "../../../include/rpg.h" int disp_objects(sfRenderWindow *wd, map_t *map) { list_t *objs = map->objects; object_t *obj = NULL; for (; objs != NULL; objs = objs->next) { obj = (object_t*)objs->data; if (obj->sprite != NU...
C
#include <stdio.h> #include <stdint.h> #include <assert.h> #include "instance.h" #include "sortarray.h" #include "game_srv.h" int enter_instance(ROLE *role, INSTANCE *instance) { int ret; IDX idx_role; assert(instance); assert(role); assert(role->instance.p == NULL); if (instance->role_num >= MAX_ROLE_PER_INSTAN...
C
/* ** make_team_tab.c for Project-Master in /home/nathalie/rendu/network/PSU_2016_ ** ** Made by Nathalie CAI ** Login <nathalie.cai@epitech.eu> ** ** Started on Mon Jun 26 17:52:26 2017 Nathalie CAI ** Last update Sat Jul 1 15:12:36 2017 Baptiste Veyssiere */ #include <stdlib.h> #include <string.h> #include "serv...
C
#include <stdio.h> int main(void) { puts(" A"); puts(" B B"); puts(" C C"); puts(" D D"); puts(" E E"); puts(" D D"); puts(" C C"); puts(" B B"); puts(" A"); return 0; }
C
/* ** quaternion.c for Recalage in /goinfre/recalage/src ** ** Made by thomas moulard ** Login <moular_t@epita.fr> ** ** Started on Wed Dec 14 21:11:02 2005 thomas moulard ** Last update Fri Dec 23 01:52:57 2005 thomas moulard */ #include <stdio.h> #include <assert.h> #include "recalage.h" /** ** Initialize a quate...
C
#ifndef GAMEPADEVENTHANDLER_H #define GAMEPADEVENTHANDLER_H #include <errno.h> #include <mqueue.h> #include <unistd.h> #include <string.h> #include <stdio.h> #include <stdlib.h> #define JS_EVENT_BUTTON 0x01 /* button pressed/released */ #define JS_EVENT_AXIS 0x02 /* joystick moved */ #define J...
C
// // Created by Christop Reek on 2019-05-12. // #include "libft.h" #include "ft_ls.h" static void ft_rbtforeach_pre(t_rbtree *root, void (*f)(t_rbtree *elem)) { if (root->content) f(root); if (root->left->content) ft_rbtforeach_pre(root->left, f); if (root->right->content) ft_rbtf...
C
#include <stdio.h> #define taille (8) void montreTableau(int tableau[taille]); int main() { int tableau[taille] = {3, 2, 4, -1, 6, 0, -5, 18}; int permute = 0, i, temp, compteurBoucles = 0, permutations = 0; do { montreTableau(tableau); permute = 0; compteurBoucles++; ...
C
/** * Handles the logs by sending the printw statements to a pop up window * * This is terrible code, but relies on v_init() in view.c to be called first * to work. * Todo: Refactor this into the view.c */ #include <ncurses.h> #include "logger.h" #include "view.h" static WINDOW *log_win; /** Prints the log lev...
C
#include <stdio.h> int main() { int a,b,c,i,j,k,l,r,p; int sa,m,d,day,hr,mi,sec; char cd[5],cd2[5],e[4],f[4],g[4],h[4]; scanf("%s %d",&cd ,&a); scanf("%d %s %d %s %d", &l, &e, &c, &f,&d); scanf("%s %d",&cd2 ,&b); scanf("%d %s %d %s %d", &i, &g, &j, &h ,&k); r = (a*24*60*60) + (l*60*60...
C
#include <stdio.h> #include <stdlib.h> #include <getopt.h> #include <sys/resource.h> #include "entradaSaida.h" Arquivos* argumentosEntrada(int argc, char* argv[]){ Arquivos* arq = malloc(sizeof(Arquivos)); // armazena os ponteiros dos arquivos int opcao; arq->flag = 1; // passados...
C
void Index(void) { printf("\n1.Input record\n2.Calculate total and average score of every course\n" "3.Calculate total and average score of every student\n" "4.Sort in descending order by total score of every student\n" "5.Sort in ascending order by total score of...
C
#include<stdio.h> int main(){ int var= 20; int *ip; *ip = &var; printf("Address of variable var : %p\n", &var); printf("Value stored in pointer *ip : %p\n", ip); printf("Value of *ip variable : %d\n", *ip); return 0; }
C
#include <stdio.h> #include <stdlib.h> /* Structura unei liste simplu inlantuite*/ struct node { int data; struct node *next; } *LLOne, *LLTwo, *unionLL; void initialize(){ LLOne = LLTwo = NULL; } void insert(struct node **head, int num) { /* Se creaza un nou nod */ struct node* new...
C
#include <stdio.h> #include <stdlib.h> void handler1(void) { printf("Executing exit handler 1\n"); } void handler2(void) { printf("Executing exit handler 2\n"); } int main(void) { atexit(&handler2); atexit(&handler1); printf("Main done!\n"); exit(0); }
C
#include <stdio.h> #include <stdlib.h> int main() { char sex; float height,age,weight; printf("Input sex initial: "); scanf("%c",&sex); printf("\nInput height: "); scanf("%f",&height); printf("\nInput age: "); scanf("%f",&age); weight=50+0.75*(height-150)+(age-20)/4; if(sex=='m...
C
#include<stdlib.h> void lost_memory(); int* get_size( int s ); int main(){ lost_memory(); int* i = get_size(4); } void lost_memory(){ int* i = malloc(sizeof(int)); } int* get_size( int s ){ int* i = malloc(sizeof(int)*s); return i; }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/time.h> #include "uci.h" #include "search.h" #include "movegen.h" int parseMove(Board* board, char *move_string) { MoveList move_list[1]; generateMoves(board, move_list); int source_square = (move_string[0] - ...
C
#pragma once #include <math.h> #include <stdint.h> #include <algorithm> #include <assert.h> __global__ void scan_kernel( const unsigned int num_samples_per_thread, const unsigned int *const bin_count, unsigned int *const prefix_idx, unsigned int *const block_sum) { const unsigned int tid = (bl...
C
/* * Preparation for lecture. * Rewrote the code in the lecture video to get a better understanding of it. */ #include <stdio.h> int main(void) { /* Initialization of variable */ int grade; printf("Please enter the danish grade to be translated: "); scanf("%d", &grade); printf("The correspon...
C
#include <stdio.h> #include <pthread.h> #include<stdlib.h> #include<unistd.h> #include<sys/types.h> typedef struct Goods { int data; struct Good *next; } Goods; Goods *head = NULL; pthread_mutex_t headlock = PTHREAD_MUTEX_INITIALIZER; pthread_cond_t hasgood = PTHREAD_COND_INITIALIZER; void *producer(void *a...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> typedef unsigned char u8; /* Board Width */ static const u8 BOARDWIDTH = 10; #define SQR(x) ((x) * (x)) /* Symbol Definition */ static const char BOAT_SYM = 'b'; static const char HIT_SYM = 'x'; static const char MISS_SYM = '0'; static const char WATER_SYM =...
C
#include "main.h" /* To save battery, this firmare is always racing to sleep. On an interrupt (button press or timeout), the ARM core executes the small routine associated with the current mode and interrupt source then goes back to sleep. */ static MachineState state; #ifdef ENABLE_SERIAL_DGB ch...
C
#include <assert.h> #include <ctype.h> #include <limits.h> #include <math.h> #include <stdbool.h> #include <stddef.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> char* readline(); char* ltrim(char*); char* rtrim(char*); char** split_string(char*); int parse_int(char*); /* * Comple...
C
#include <avr/pgmspace.h> #include <avr/eeprom.h> #include <avr/io.h> // PORTC #include <util/crc16.h> #include <stdio.h> // sprintf_P #include <stdlib.h> // strtol #include <errno.h> // errno #include <limits.h> // LONG_MIN #include <ctype.h> // isalnum #include <string.h> // strlen #include "setup.h" #include "usart....
C
#include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct ThreadArg_tag { int i; char* fileName; } ThreadArg; void* doWork(ThreadArg* arg) { free(arg->fileName); free(arg); return NULL; } void readString(char* buf,size_t sz) { char* end = buf + sz; char ch; ...
C
#include <stdio.h> #include "LibFS.h" void usage(char *prog) { fprintf(stderr, "usage: %s <disk image file>\n", prog); exit(1); } int main(int argc, char *argv[]) { if (argc != 2) { usage(argv[0]); } char *path = argv[1]; FS_Boot(path); FS_Sync(); char buffer[100]; Dir_Cre...
C
#include "lists.h" dlistint_t *ad_node(const int n, dlistint_t *next, dlistint_t *prev); /** * insert_dnodeint_at_index - insert a node at given index * @h: header of double linked list * @idx: index to insert the node * @n: int data to insert * Return: size of the printed double list */ dlistint_t *insert_dnodei...
C
#include<stdio.h> #include<string.h> int main() { char str_1[10],str_2[10]; int i,n,tot=0,j,sum,num,a,t,on; scanf("%d",&t); getchar(); while(t--){ gets(str_1); if(strcmp(str_1,"report")==0){on=1;} else{ n=strlen(str_1); printf("n--%d\n",n); sum=0; a=1; for(i=n-1;i>=7...
C
// This is just a mock server that I will create on the local network, just to test the actual client server that I must make #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <stdio.h> #include <string.h> #define bufsize 1024 #define RECVDMSG "Received Message" int main(){ // variables...
C
#include <stdio.h> #include <stdlib.h> #include "getEntries.c" char chaine[MAX_SIZE]; typedef struct cellule { int id; struct cellule *suivant; }; void desallocation(struct cellule *cellule, int i); void affichage(struct cellule *cellule, int i); void creation(struct cellule *cellule, int i); int main() { ...
C
#include "holberton.h" /** *reverse_array - reverse a array of the integers *@a: Parameter *@n: legenth of array *Return: Always void */ void reverse_array(int *a, int n) { int *start, *end, c, i, j; start = a; end = a; j = n - 1; for (i = 0; i < n / 2; i++) { c = start[i]; start[i] = end[j]; end[j...
C
#include <stdio.h> #include <stdlib.h> #include "TAD_BufferSaida.h" #include "big_file.h" //Cria buffer saida e seta seus valores BUFFER* BufferSaida_Criar(int n_reg_b_s) { BUFFER* buffer = malloc(sizeof(BUFFER)); ITEM_VENDA* iv = malloc(sizeof(ITEM_VENDA) * n_reg_b_s); for(int i = 0; i < n_reg...
C
#include <stdio.h> int main() { int x[5] = {1,200,3,4,5}; int *ptrX = &x[0]; *(ptrX+2) = 300; printf("x[0]: %d\n", *(ptrX) ); printf("x[1]: %d\n", *(ptrX+1) ); printf("x[2]: %d\n", *(ptrX+2) ); printf("x[3]: %d\n", *(ptrX+3) ); printf("x[4]: %d\n", *(ptrX+4) ); return 0; ...
C
/* * queue.h * * Created on: May 30, 2018 * Author: houxd */ #ifndef QUEUE_H_ #define QUEUE_H_ #include "rtos_wrapper.h" struct Queue_t { uint32_t item_size; uint8_t *buffer_beg; uint8_t *buffer_end; uint8_t *head; uint8_t *tail; int empty; }; /** * @param buffer queue data buffer, the size must ...
C
#ifndef BINTREE_H #define BINTREE_H typedef struct Tnode { char *word; int cnt; struct Tnode *left; struct Tnode *right; } Tnode; // when 'word' not in tree, add a 'word' node // else, ++cnt of the node Tnode *addtree(Tnode *pn, char *word); Tnode *freetree(Tnode *pn); void printtree(Tnode *pn); // see wor...
C
#include<stdio.h> int gre(int a); int gre(int a) { int b[10],i,l; printf("Enter the elements"); for(i=0;i<a;i++) { scanf("%d",&b[i]); } l=b[0]; for(i=1;i<a;i++) { if(l<b[i]) { l=b[i]; } } return l; } void main() { int x,y; printf("Enter the limit"); scanf("%d",&x); y=gre(x); printf("largest %d...
C
#include <msp430g2553.h> int main(void) { WDTCTL = WDTPW + WDTHOLD; //Disable the Watchdog timer for our convenience. P1DIR |= BIT2; //Set pin 1.2 to the output direction. P1SEL |= BIT2;//Select pin 1.2 as our PWM output. P1REN |= BIT3;//enable pull up/down reg P1OUT |= BIT3;//p1.3 is set as outpu...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* bitwise.h :+: :+: :+: ...
C
#include <stdio.h> int main(void) { int no,rem,count=0; printf("enter the number"); scanf("%d",&no); while(no!=0) { rem=no%10; count++; no=no/10; } printf("the number of digits in a number is %d",count); return 0; }
C
#include <stdio.h> #define square(x) ((x)*(x)) int main() { int n; printf("enter a number between 1 and 7\n"); scanf("%d", &n); switch(n) { case 1: printf("Sunday\n"); break; case 2: printf("Monnday\n"); break; case 3: printf...
C
/* ----------- * project2.c * Project for CSCI 2021, Fall 2018, Professor Chris Dovolis * Written by Ry Wiese * This program will get the interger value from the user then change to the binary version and store it. * operate a variety of bitwise operations such as add, subtraction, and, or, not, left shift, and ri...
C
#include <stdio.h> #define MAXIDLEN 63 /** FUNCTION: skipspaces * INPUT: FILE* * OUTPUT: void * DESCRIPTION: skipspaces advances the file pointer * to the first non-space char **/ void skipspaces(FILE *tape); /** FUNCTION: gettoken * INPUT: FILE* * OUTPUT: int (token) * DESCRIPTION: gettoken will read the tape...
C
#include <stdio.h> void replace(char str[]) { int i=0; int length =0; while(str[i]!='\0') { if(str[i]==' ') { str[i] = '-'; } i++; length++; } printf("String replaced with - is : "); for(i=0;i<length;i++) { ...
C
#pragma once #include "lib.h" // List.h #define ELLIPSE_TYPE 0 #define BRICK_TYPE 1 #define TETRAHEDRON_TYPE 2 #define LIGHT_TYPE 3 typedef struct Element_ { char type; double *object; struct Element_ *next; } Element; typedef struct List_ { Element *head; double nbElement; } List; //Initialis...
C
// 合理利用数组,既可以节省变量,又方便循环 /* 1058 A+B in Hogwarts (20)(20 分) If you are a fan of Harry Potter, you would know the world of magic has its own currency system -- as Hagrid explained it to Harry, "Seventeen silver Sickles to a Galleon and twenty-nine Knuts to a Sickle, it's easy enough." Your job is to write a program to ...
C
//Jovani de Souza & Davi Pegoraro //roteamento com UDP #include "roteador.h" tabela_roteamento linhas[LINHAS];//vetor de linhas//cria a tabela de roteamento int count_table=0; roteador roteadores[NROTEADORES];//vetor de roteadores, usa paenas o ID, mas instancia um vetor para facilitar a leitura do arquivo int op=...
C
#include<stdio.h> int main() { int i; printf("һλʮ"); scanf("%d",&i); printf("%d,ΪʮΪ%X",i,i); getch(); return 0; }
C
/* ** EPITECH PROJECT, 2020 ** MUL_game ** File description: ** display_text.c */ #include "my.h" #include "gui.h" void display_texts(sfRenderWindow *window, sfText **texts) { if (texts && window) for (size_t a = 0; texts[a]; a++) { sfRenderWindow_drawText(window, texts[a], NULL); } } ...
C
#include <stdio.h> #include <stdlib.h> #include "biblioteca.h" #include <string.h> #include <ctype.h> #include <windows.h> /// @brief pide al usuario ingresar caracteres y de forma segura se guardan en una variable. /// /// @param cadena - es el vector char en la cual se guarda lo que el usuario ingreso //...
C
#include "killer.h" #include "move_generation.h" #include "utils.h" #define MAX_KILLERS 8 typedef struct Killers { int count; int next; Move killer[MAX_KILLERS]; } Killers; Killers killers_at_ply[16]; void clear_killers() { for (int ply = 0; ply < 16; ply++) { Killers killers = {}; killers_at_ply[pl...
C
#include <stdio.h> // Count spaces, tabs, and newlines. int main() { long count = 0; int c; while ((c = getchar()) != EOF) { if (c == ' ' || c == '\t' || c == '\n') { count += 1; } } printf("Spaces, tabs, or newlines: %ld\n", count); }
C
/*! \file flood_fill.c \author MMteam \brief This file contains the implementation of the different MM brain function such as flood fill algorithm. \see flood_fill.h \date 2020 */ #include <flood_fill.h> /* Fill a case of the maze with a color */ void fill(struct Maze maze, int16_t OX...
C
#include <stdio.h> #include <stdlib.h> /* concatenate two integer arrays */ int *intarrayadd(int *a, int asize, int *b, int bsize) { int *c,larger,smaller,x; /* allocate for the larger array */ larger = asize > bsize ? asize : bsize; /* and get the smaller size as well */ smaller = larger > asize ? asize : bsize...
C
#include<stdio.h> #include<stdlib.h> #include<math.h> /* Método de Romberg: - Método de los trapezios 1. Dividir el intervalo [a,b] en 2**i partes iguales en cada paso i 2. Aplicar la fórmula de los trapezios 3. Parar cuando se llege a una precisión o se evalue num veces. - Método de extrapolación de Richardson: 1...
C
#include <stdio.h> #include <stdlib.h> #include <linux/i2c-dev.h> #include <fcntl.h> #include <string.h> #include <sys/ioctl.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <sys/ipc.h> #include <sys/shm.h> #include <errno.h> #include <wiringPiSPI.h> #include "misc.h" #include <sys/types.h> ...
C
#include <stdio.h> int f(int m,int n) { if(m<n||m<1||n<1) return 0; if(n==1) return m; if(m==n) return 1; return f(m-1,n)+f(m-1,n-1); } int main() { int m,n,y; scanf("%d %d",&m,&n); y=f(m,n); printf("%d",y); return 0; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* print_board.c :+: :+: :+: ...
C
#include <stdio.h> int main() { float R,pi,b; scanf("%f",&R); pi=3.14159; b=4.0/3*pi*R*R*R; { printf("VOLUME = %.3f\n",b); } return 0; }
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 i=5; //Ps-incremento i++ printf("Pos-increemento: %d",i++); printf("\ni: %d",i); i = 5; printf("\nReiniciado i: %d",i); //Pr-i...
C
//LU Decomposition //Siddhartha #include<stdio.h> #include<gsl/gsl_linalg.h> #include<gsl/gsl_matrix.h> int main() { float a[3][3]={{1, 0.67, 0.33}, {0.45, 1, 0.55},{0.67, 0.33, 1}}, U[3][3], L[3][3], P[3][3]; gsl_matrix *A = gsl_matrix_alloc(3,3); gsl_permutation *p = gsl_permutation_alloc(3); int i, j; printf("A...
C
#include<stdio.h> #include<conio.h> void displayarray(int arr[3][3]); int main() { int arr[3][3],i,j; clrscr(); for(i=0;i<3;i++) { for(j=0;j<3;j++) { scanf("%d",&arr[i][j]); } } displayarray(arr); getch(); return 0; } void displayarray(int arr[3][3]) { int i,j; for(i=0;i<3;i++) { printf...
C
#include "headers.h" //no 0 indexing for value and suit system because they make calculating card values more confusing while writing code //value system is 3 as 1, 4 as 2 ... A as 12, 2 as 13 //suit system is diamonds as 1, clubs as 2, ... //(PART 1) INIIALIZING THE DECK //purpose: inputs information into a card /...
C
//Write a recursive program which accept number from user and return summation of its digits //Input: 879 //Output:24 #include<stdio.h> int Sum(int iNo) { static int iSum=0; int iDigit=0; if(iNo>0) { iDigit=iNo%10; iNo=iNo/10; iSum=iSum+iDigit; Sum(iNo); } return iSum; } int main() { int iValue=0,iRet=...
C
#include <stdio.h> #include <sys/param.h> #include <signal.h> #include <string.h> #include <zconf.h> #include <sys/wait.h> #include <stdlib.h> #include <errno.h> /**************************************************** * * * Operating Systems (0368-2162) ...
C
#include <stdio.h> #include <stdlib.h> //----------------------------------------------------------------------------- int main(void) { int OuterIndex; int Index; for (OuterIndex = 0; OuterIndex < 3; OuterIndex++) { int Index; printf("Outer index is %d\n",OuterIndex); for (Index = ...
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <limits.h> #define STACK_LENGTH 5 #define EMPTY (-1) #define STACK_FULL (STACK_LENGTH-1) #define STACK_EMPTY INT_MIN // = -2147483648 typedef struct { int stackValues[STACK_LENGTH]; int top; }stack; bool push(stack* mystack...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_diu_parse.c :+: :+: :+: ...
C
#include <stdio.h> int main() { int i = -3, j = 2 , k = 0, m; m = j || i && k; printf("m = %d, i = %d, j = %d, k = %d\n", m, i, j , k); return 0; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* i_aff.c :+: :+: :+: ...
C
#include <stdio.h> #include<string.h> #include <unisd.h> /** * main - run all function * * Return: Return 1 and exit */ int main(void) { int l; l =strln("and that piece of art is useful\" - Dora Korpar, 2015-10-19"); write(2 ,"and that piece of art is useful\" - Dora korpar, 2015-10-19\n",l); return (1); }
C
//c program to swap two integers with using a third variable. #include<stdio.h> void main() { int a,b,temp; printf("enter two no.s to be swapped: "); scanf("%d %d",&a,&b); printf("before swap,\n a=%d and b=%d",a,b); temp = a; a=b; b=temp; printf("\nafter swap,\n a=%d and b=%d",a,b); }
C
#define rule 30 extern void bputs(char *state, int count); extern void shift(char *state, int count); void _main() { char state[20] = {0}; state[10] = 4; for(int i = 0; i<75; i++) { bputs(&state, 20); eval(&state, 20); } } void eval(char *state, int count) { char news[129] = {0}; char tmp = 0; for(int i ...
C
#include <stdio.h> #include <conio.h> #define SIZE 10 void readValues(double arr[], int size) { for (size_t i = 0; i < size; i++) { printf("Enter Value %d: ", i + 1); scanf("%lf", &arr[i]); } return arr; } void displayValues(double arr[], int size) { for (size_t i = 0; i < size; i++) { printf("%lf\n", a...
C
#include <ltrace.h> #include <signal.h> #include <errno.h> /* * POSIX signal set operations * sigaddset() add signal signum from set. * return 0 on success and -1 on error. */ int sigaddset(sigset_t *set, int signo) { TRACE if (signo < 0 || signo > 31) { errno = EINVAL; return -1; } *set |= 1 << signo; ...
C
/****************************************************************************** * unittest3.c * David Adams * CS 362 * Spring 2015 * Assignment 3 * This file has been added for Assignment 3 in order to provide unit tests * for the gainCard() function within the dominion.c file. ****************************************...
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. */ /* * File: main.c * Author: nderouelle * * Created on 10 septembre 2019, 11:36 */ #include <stdio.h> #include <stdlib.h> #inc...
C
/************************************************** * Happy C64 * * ---------------------------------------------- * * Peek et Poke * * ---------------------------------------------- * * Lire et écrire dans la mémoire du c64 * ...
C
#include<stdio.h> int main() { int n,a[10],i,j,temp,flag; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&a[i]); } for(i=1;i<n;i++) { flag=0; for(j=0;j<=n-i-1;j++) { if(a[j]>a[j+1]) { temp=a[j]; a[j]=a[j+1]; a[j+1]=temp; flag=1; } } if(flag==0) break; } for(i=0;i<n;i++) printf("\n%d",a[i]); } ...