language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdbool.h> #include <stdint.h> #include <stddef.h> #pragma once #define MAX_MICROPHONES 8 struct AudioStream; struct SoundData; typedef struct Source Source; typedef struct Microphone Microphone; typedef enum { SOURCE_STATIC, SOURCE_STREAM } SourceType; typedef enum { UNIT_SECONDS, UNIT_SAMPLES ...
C
// General bit utilities #define sbi(PORT, bit) (PORT|=(1<<bit)) // set bit in PORT #define cbi(PORT, bit) (PORT&=~(1<<bit)) // clear bit in PORT #define tgl(PORT, bit) (PORT^=(1<<bit)) // toggle bit in PORT
C
#include <stdio.h> #include <stdlib.h> #include "indexes.h" char** createText(char* fileName, int* totalLines){ char aux; //Variável auxiliar de leitura. Lê '\n' e garante a mudança de linha do ponteiro do arquivo. int lineNumber; /*Inicialização do Arquivo de Entrada*/ FILE* input = fopen(fileName, "r"); whil...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #define MAX (int)1e4 void generateRandomInput(int n, int input[]) { for(int i = 0; i<n; i++) input[i] = rand()%MAX; } void generateSortedInput(int n, int input[]) { for(int i = 0; i<n; i++) input[i] = i; } int main() { srand(time(0)); int n;...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* swap.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include "stack.h" #define PRINT_STACK_STATUS(ps) \ printf("empty: %d full: %d\n", stack_empty(ps), stack_full(ps)) int main() { int i; struct stack *ps = stack_init(10); PRINT_STACK_STATUS(ps); for(i=0; i<10; i++){ stack_push(ps, &i); PR...
C
/** \file */ #ifndef __BML_MULTIPLY_H #define __BML_MULTIPLY_H #include "bml_types.h" // Multiply - C = alpha * A * B + beta * C void bml_multiply( const bml_matrix_t * A, const bml_matrix_t * B, bml_matrix_t * C, const double alpha, const double beta, const double threshold); // Multiply X^...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> /*Her opretter vi de forskellige funktioner som vi kommer til at bruge*/ double diskriminanten(double, double, double); double matRod1(double, double, double); double matRod2(double, double, double); void SolveQuadraticEquation(double, double, double); int main(...
C
#ifndef _CPU_IDT_H_ #define _CPU_IDT_H_ #include <cpu/types.h> /* Segment Selectors */ #define KERNEL_CS 0x08 typedef struct IDT_Gate { u16 low_offset; /* Lower 16 bits of handler function address */ u16 sel; /* Kernel segment selector */ u8 always0; /* First byte Bit 7 : "Interrupt...
C
#include<stdio.h> int main(){ int a,b; char c; scanf("%d%c%d",&a,&c,&b); if(c=='+'){ printf("%d",a+b); } else if(c=='-') printf("%d",a-b); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> char *inputString(FILE* fp) { char *str; int ch; size_t size = 16; size_t len = 0; str = realloc(NULL, sizeof(char) * size); if (!str) return str; while (EOF != (ch = fgetc(fp)) && ch != '\n') { str[len++] = ch; if (len == size) { str = realloc...
C
#include "List.h" /* Init List */ void kInitializeList(LIST* pstList) { pstList->iItemCount = 0; pstList->pvHeader = NULL; pstList->pvTail = NULL; } /* Return List count */ int kGetListCount(const LIST* pstList) { return pstList->iItemCount; } /* Add List to Tail */ void kAddListToTail(LIST* pstList, v...
C
#include "p18cxxx.h" #include "HardwareConfig.h" #if defined (__PIC18F4520__) #include <pic18f4520.h> #endif #if defined (__PIC18F4620__) #include <p18f4620.h> #endif #include "uart.h" void UARTInit(void) { // Procedimiento que inicializa la comunicacion serie // Inicializamos la comunicacion con una veloci...
C
#include <stdio.h> int main(){ int a=0,b=0,c=0,d=0; printf("Input a 3-digit integer: "); scanf("%d", &a); b = (a/100) % 10; c = (a/10) % 10; d = a % 10; printf("%d is composed of [%d,%d,%d]\n",a,b,c,d); return 0; }
C
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward d...
C
#include <stdio.h> int main() { long white_c, other_c, total_c; white_c = other_c, total_c = 0; char c; long num_c_bucket[10]; for (int i = 0; i <= 9; i++) num_c_bucket[i] = 0; // input loop while ((c = getchar()) != EOF) { total_c++; if (c >= '0' && c <= '9') ...
C
#include <nds.h> #include <nds/memory.h> #include <unistd.h> //sbrk() //coto: small memory handler given POSIX LIBNDS memory allocation is broken when different MPU mapping is in use. #include "mem_handler.h" //at start 0 __attribute__((section(".dtcm"))) u32 * this_heap_ptr = 0; __attribute__((section(".dtcm"))) i...
C
struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; }; struct qnode { int layer; struct TreeNode *tree_node; struct qnode *next; }; #include <stdlib.h> #define STEP 8 int *rightSideView(struct TreeNode *root, int *n) { int nr, *buf, bufsz; struct qnode *head, *tail; ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <arpa/inet.h> #include <time.h> #define exit_on_error(msg) \ do { perror(msg); exit(EXIT_FAILURE); } while(0) #define nexit_on_error(r, msg) \ do { errno = r; perror(msg); exit(EXIT_FAILURE); } while(0) #define scast(x) (struct sockaddr*)x int mai...
C
#include<stdio.h> int main(){ float n=0; while(scanf("%f",&n)!=EOF){ n=n*1.8+32; printf("%.1f\n",n); } return 0; }
C
#include "bloom.h" /* Create a new empty bloom filter */ BF BF_empty() { BF b; memset(b.filter, 0, _FILTER_SIZE); return b; } /* Add more data to the filter */; void BF_add(char *data, int size, BF *b, int print, int debug) { uint32_t hash[_HASH_NUM+(4-(_HASH_NUM%4))]; for(int i = 0; i < _HASH_NUM; i+=4) ...
C
#include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/socket.h> #include <netinet/in.h> #include <errno.h> #include <arpa/inet.h> #define PORT 9877 #define MAXLINE 100 #define LISTENQ 10 int connect_num; int connfd[LISTENQ]; char NAME[10][20]; void list(int n){ char tmp[] = ...
C
#include <stdio.h> #include <conio.h> #include <math.h> int main() { int a, b, count; printf("Enter a and b- "); scanf("%i%i", &a, &b); while (a>=b){ a=a-b; count++; printf("a1=%i\nb1=%i\n",a, count); } printf("a=%i\nb=%i",a, count); getch(); return 0; }
C
/* input_file -- 入力ファイルから取得したデータ 2つの現在の文字はcur_charとnext_charに格納される 各業は組み立てられた後、画面に出力可能なように バッファに蓄えられる 関数 in_open -- 入力ファイルをオープン in_close -- 入力ファイルをクローズ read_char -- 次の文字を読む in_char_char -- 現在の文字を返す in_next_char -- 次の文字を返す in_flush -- 行を画面に表示する */ /* in_open parameters name -- ディスク・ファイルの名前 戻り値 0 -- ...
C
#include "snprintf.h" #include "types.h" #include "uart.h" static u32 strlen(const char *s) { u32 len = 0; while (s[len] != '\0') len++; return len; } static u32 itoa(i32 value, u32 radix, u32 uppercase, u32 unsig, char * buffer, u32 zero_pad) { char * pbuffer = buffer; int negative = 0; if (...
C
/* Задача 5. Дефинирайте потребителски тип към масив. Инициализирайте масива, изведете наконзолата. */ #include <stdio.h> typedef char t_hText[64]; typedef char t_lText[2048]; int main() { t_hText title = "The Life and Grievances of a Dead Man"; t_lText synopsis = "In present-day Salem, a serial killer...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include "curve.h" double find_amplitude(double* data, int size) { float max=0, min=0, amplitude; for(int i=0;i<size;i++) { if(data[i]>max) { max=data[i]; } } for(int i=0;i<size;i++) { if(data[i]<min) { min=data[i]; } } amplitude =...
C
#include <string.h> int _dx8_strcmp(s1, s2) char* s1; char* s2; { return strcmp(s1, s2); } int _dx8_strlen(s) char* s; { return strlen(s); } int _dx8_isalpha(c) char c; { return isalpha(c); } int _dx8_islower(c) char c; { return islower(c); } int _dx8_isspace(c) char c; { return isspace(c); }...
C
#include <stdio.h> #include <string.h> #define MAX_WORD_LENGTH 50 #define MAX_WORD_PER_LINE 80 #define CHARACTER_PER_LINE 80 char line[80][50]; int main() { FILE *read, *write; char buffer[MAX_WORD_LENGTH]; fopen_s(&read, "harry.txt", "r");// fopen_s(&write, "aligned.txt", "w");// int wInd = 0, lL...
C
#ifdef CHCORE #include <mm/kmalloc.h> #include <common/kprint.h> #include <common/macro.h> #include <common/radix.h> #endif #include <common/errno.h> struct radix *new_radix(void) { struct radix *radix; radix = kzalloc(sizeof(*radix)); BUG_ON(!radix); return radix; } void init_radix(struct radix *radix) { radi...
C
/* * token.c * * Created on: May 30, 2015 * Author: sudipta */ const char *token_next(const char *str, int *pos) { const char *ret; while (str[*pos] == ' ') { (*pos)++; } ret = str+*pos; /* Advance to the next space or end of string. */ while (str[*pos] != ' ' && str[*pos] != '...
C
#include <stdio.h> #include <stdlib.h> struct Scomplex { double real; double img; }; int main() { struct Scomplex x,y,sum; printf("for 1st complex number\n"); printf("Enter the real and imgainary respectively: "); fflush(stdin); fflush(stdout); scanf("%lf %lf", &x.real,&x.img); printf("for 2nd complex numbe...
C
/* Курсовой проект по дисциплине "Вычислительные сети" Демонстрация выполнения задания лабораторной работы № 3 "Отправление пакетов типа ECHO протокола ICMP, получение пакетов типа ECHO-REPLY протокола ICMP" Подготовил: Акинин М.В. 01.12.2010 */ #include <stdio.h> #include <stdlib.h> #include <stdint.h> #includ...
C
#include "Stack.h" #define _CRT_SECURE_NO_WARNINGS 1 #include <stdlib.h> #include <assert.h> #include <stdio.h> #include <errno.h> #include <string.h> #include <stdbool.h> void StackInit(Stack* ps) { assert(ps != NULL); ps->_capacity = DEFAULT_STACK_CAPACITY; ps->_pa = (STDataType*)malloc(ps->_capacity * sizeof(STDa...
C
/**************************************************************************************************/ /* Copyright (C) JG14225101, SSE@USTC, 2014-2015 */ /* */ /* FILE NAME ...
C
/*====================================================================* * * dash1.c - place double-dashed arguments on single lines; * *. Motley Tools by Charles Maier; *: Copyright (c) 2001-2006 by Charles Maier Associates Limited; *; Licensed under the Internet Software Consortium License; * *-----------...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char command[80],temp[80]; int i,j; for(;;){ printf("\nOperation? \n"); gets(command); if(!strcmp(command,"quit")) break; printf("Enter your first number: "); gets(temp); i=atoi(temp); ...
C
#ifndef WAD_HEADER #define WAD_HEADER #define LE_FOURCC(a, b, c, d) ( \ ((unsigned)(a)) | \ ((unsigned)(b) << 8) | \ ((unsigned)(c) << 16) | \ ((unsigned)(d) << 24) \ ) #define WAD_HEADER_SIZE (4 + 4 + 4) #define WAD_DENTRY_SIZE (4 + 4 + 8) enum wad_error { WAD_SUCCESS = 0, WAD_ERROR_FILE_O...
C
#include <stdio.h> #include "matriks.h" /* DEFINISI PROTOTIPE PRIMITIF */ /*** Konstruktor ***/ void MakeMatriks (int NB, int NK, Matriks *M) { /* I.S. NB dan NK adalah valid untuk memori matriks yang dibuat */ /* F.S. Matriks M sesuai dengan definisi di atas terbentuk */ //Algoritma NBrsEff(*M)=NB; NKol...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #define NUM_ITERATIONS (100000) /* Calls getpid() in a loop */ int main() { int i = 0; for (i = 0; i < NUM_ITERATIONS ; ++i) { getpid(); } return 0; }
C
/////////////////////////////////////////////////////////////////////////////////// // File : coff_browser.c // Contains: coff file browser // // Written by: Jean-François DEL NERO /////////////////////////////////////////////////////////////////////////////////// #include <stdlib.h> #include <string.h> #incl...
C
#define N 5 #define LEFT (i+N-1)%N #define RIGHT (i+1)%N #define THINKING 0 #define HUNGRY 1 #define EATING 2 typedef int semaphore; int state[N]; semaphore mutex = 1; semaphore s[N]; void philosopher(int i) { while (true) { think(): take_forks(i); eat(); put_forks(i); } } void take_forks(int i) { down(&...
C
#include <stdio.h> void sieve(int a[], int n) { int i,j,k; for(i=3,k=3;i<n/2;i++,k+=2) { if(a[i]) continue; for(j=i+k;j<n;j+=k) a[j]=1; } printf("2 "); for(i=3, j=3;i<n;i++,j+=2) { if(a[i]) continue; else printf("%d ", j); } printf("\n"); } int main() { int a[100]={0}; sieve(a, 99); }
C
#include "symbolTable.h" #include <regex.h> #include <stdio.h> #include <stdlib.h> #include <string.h> void pop_entry(SymbolTable* table) { int i; TableEntry* ptr; for (i = 0; i < table->position; i++) { ptr = table->Entries[i]; if (ptr->level == table->current_level) ...
C
#include <stdio.h> #include <limits.h> #include <stdlib.h> #include <conio.h> #include "include.h" struct nodo *raiz = NULL; struct nodo *fondo = NULL; void push(int x){ struct nodo * new; new = malloc(sizeof(struct nodo)); new ->informacion = x; new-> sig = NULL; if(is_empty()){ raiz = new...
C
#include "../striVe_defs.h" // -------------------------------------------------------- /* GPIO Test Tests PU and PD on the lower 8 pins while being driven from outside Tests Writing to the upper 8 pins Tests reading from the lower 8 pins */ void main() { int i; /* Lower 8 pins are input and upper 8 pins are o...
C
#ifndef __MAIN_H__ #define __MAIN_H__ /* System Header Files*/ #include <stdio.h> #include<stdlib.h> #include<unistd.h> #include<stdbool.h> #include<string.h> #include <getopt.h> #include <stdint.h> /* Structure to store the input arguments from the terminal */ struct handler { char name[19]; // Array to store th...
C
#include<stdio.h> #include<stdlib.h> int count,top,bottom; int *stack; int depth_fs(int **,int *,int,int); int main() { int t,temp; int **adjacent,*visit; scanf("%d",&t); while(t--) { int flag=0; top=0; bottom=1; int out=0; int i,j,n; temp=0; scanf("%d",&n); adjacent=(int **)malloc(sizeof(int *)*n)...
C
#include "set.h" int set_create(set_t* self, int index) { self-> index = index; for (int i = 0; i < block_count; i++) { self->blocks[i] = NULL; } return SUCESS; } int set_destroy(set_t* self) { for (int i = 0; i < block_count; i++) { if (self->blocks[i]) { block_destroy(self->blocks[i]); free(self->bl...
C
// Shell. #include "types.h" #include "user.h" #include "fcntl.h" // Parsed command representation #define EXEC 1 #define REDIR 2 #define PIPE 3 #define LIST 4 #define BACK 5 #define MAXARGS 10 struct cmd { int type; }; struct execcmd { int type; char *argv[MAXARGS]; char *eargv[MAXARGS]; }; struct re...
C
#include<stdio.h> #define SIZE 5 int main() { char aray[SIZE],a; int pass,temp; printf("Enter 5 characters : \n"); for(a=0;a<SIZE;++a) { scanf("%c",&aray[a]); } printf("The characters you entered in ARAY are : \n"); for(a=0;a<SIZE;++a) { printf("...
C
/***************************************************************************** * PSRGEOM * Sam McSweeney, 2018 * * This program prints out a series of points (in the magnetic frame) * representing the line of sight as the pulsar rotates. * *************************************************************************...
C
/* 48. Scrivere un programma che, letta una matrice di interi o reali, individui la colonna con somma degli elementi massima. */ #include <stdio.h> #define LEN 100 int main (int argc, char const *argv[]) { int colIndex; /* indice della colonna maggiore */ int rows; /* righe di...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* fta_append.c :+: :+: :+: ...
C
// Name - Shubhkarman Sohi // Student Number - 11219687 // NISD - sss669 #ifndef CGR_PLOT_H #define CGR_PLOT_H #include "cgr_aux.h" //global variable Plot as pointer pointer to char extern bit** Plot; /* * function to print the plot with values from Plot[i][j] * with bottom left most point to be (0,0) top left m...
C
#include "helpers.h" typedef struct { int x, y; } Node; void start_game(int len, int n_apples) { nib_init(); /*Constants*/ const int screenSize = 50; const int maxLen = 50; const int maxApples = 100; const int sleepTime = 10000; int currentLength = len; int direction = 0; int hit = 0; int done = 0; in...
C
#include <stdio.h> #include <string.h> #include <stdbool.h> int lengthofStr(char string[]) { int len=0; while(string[len]!='\0') len++; return len; } bool isPalindrome(char string[]) { int length=lengthofStr(string)-1; int start=0; bool result=true; while(start<length) { if (string[start]...
C
#include <stdio.h> #include "biblioteca.h" /** \brief Funcion que pide al usuario ingresar datos y los toma. * * \param void No recibe parametros. * \return int retorna la opcion ingresada por el usuario. * */ int tomarDato(void) { int opcion; printf(" Ingrese una opcion: "); ...
C
#include<stdio.h> void main() { int n,i,j,k,m; printf("enter the value : "); scanf("%d",&n); for(i=n;i>=0;i--) { for(m=0;m<n+1;m++) if(i<m)printf(" "); for(j=i;j>=0;j--) printf("O"); for(k=i;k>=0;k--) printf("K"); if(i!=0) printf("\n"); } }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* fractol_coloring.c :+: :+: :+: ...
C
/* Program to implement the shell sort */ #include<stdio.h> void shell_sort(int nums[], int array_size); void main(){ int nums[10], i, n; printf("Enter the number of elements: "); scanf("%d", &n); printf("Enter %d elements one by one :", n); for(i=0; i < n; i++){ scanf("%d", &nums[i]); } shell_sort(nums,...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int totalComparacoes = 0, totalTrocas = 0; int totalComparacoesSentinel = 0, totalTrocasSentinel = 0; void imprime_vetor(int *vetor, int tamanho_vetor) { printf("\nVETOR = {"); for (int x = 0; x < tamanho_vetor; x++) { printf("%d", vetor[x]); ...
C
#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdio.h> int main(int argc, char **argv) { char ch; int fd,fd0,fd1,fd2; int tmp; int tmpFd; int val = 0; char retChar[12]; fd = open("/dev/leds", O_RDWR); fd0 = open("/dev/led0", O_RDWR); fd1 = open("/dev/led1", O_RDWR); fd2 = ope...
C
#include <stdio.h> #include <stdlib.h> #include "mysql.h" MYSQL my_connection; MYSQL_RES *res_ptr; MYSQL_ROW sqlrow; // c语言连接MySQL数据库,操作系统linux int main(int argc,char *argv[]){ int res; mysql_init(&my_connection); if(mysql_real_connect(&my_connection,"localhost","root",NULL,"test",0,NULL,0)){ printf("C...
C
#include<stdio.h> int fibonacci(int n) { if (n==0) { return 0; } else if (n==1) { return 1; } else { return fibonacci(n-1) + fibonacci(n-2); } } void main() { int i,n; printf("Enter the number of terms in the fibonacci series to ...
C
#ifndef __FUNCIONESSTRINGS_H__ #define __FUNCIONESSTRINGS_H__ #include <string.h> #include "grafo.h" //dado un nombre y un numero, insertamos en nuestra estructura grafo //el nombre recibido en la posicion establecida //la utilizamos para poder recibir strings como nombres de veritices //y sin problema trabajar con...
C
#include <stdio.h> #include <stdbool.h> #include "Stack.h" bool StackInit(pSStack stack) { stack = (pSStack)malloc(sizeof(SStack)); if (stack) { for (int i = 0; i < MAX_SIZE; i++) { stack->data[i] = 0; } stack->bottom = 0; stack->top = 0; stack->length = 0; ...
C
#include "../Entity.h" #include "../Data.h" #include "../Globals.h" #include "../network/Synchronizer.h" void tickEntityItem(Entity *e, PlayerData *nearestPlayer); Entity newEntityItem(Item item, int x, int y, int level) { Entity e; e.type = ENTITY_ITEM; e.level = level; e.entityItem.age = 0; e.e...
C
#include<stdio.h> int f91(int n); int main() { int num; while(scanf("%d",&num) == 1) { if(num == 0) break; printf("f91(%d) = %d\n",num,f91(num)); } return 0; } int f91(int n) { if(n >= 101) return n-10; else return f91(f91(n+11)); }
C
#include<stdlib.h> #include<stdio.h> struct student{ int code; int birth; int grade; }; struct student fill(struct student student,int code,int birth,int grade){ student.code=code; student.birth=birth; student.grade=grade; return student; } void main(void){ struct student s...
C
/* * Tutorial for printf() and scanf() functions */ #include <stdio.h> int main (void) { char name[100]; printf("Please enter your name: "); scanf("%s", name); printf("Hello %s!\n", name); }
C
#include "../headerFiles/keyValueList.h" int findKV(kvList_t list, string key, kvNode_t** result) { for (int i = 0; i < list.bufferSize; i++) { if (list.buffer[i].key.content != NULL && stringCmp(list.buffer[i].key, key) == 0) { *result = &(list.buffer[i]); return 0; } } kvNode_t* current = ...
C
/****************************************************************************** @file shell_token.c @brief DESCRIPTION: utility to extract ash compatible tokens. <command>[params][operators] ****************************************************************************/ #include <stddef.h> /* Redirection ope...
C
/** * * Take the line * split the time * put in format dakika saat * * * play komutu filename * * * / */ #include "birdakika.h" #include "consts.h" #include <stdlib.h> #include <stdio.h> #include <string.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> void crontab(char* command){ ...
C
/********************************************************************** Dr_VNAF.c: Dr_VNAF.c is a subroutine to calculate the derivative, with respect to R, of neutral atom potential of one atom specified by "Gensi". Log of Dr_VNAF.c: 22/Nov/2001 Released by T.Ozaki ************************...
C
#include <stdio.h> #include "Lab1_1.h" void Part1() { printf("\nPart 1: Data Type and their Sizes\n"); printf("========================\n"); printf("Byte Size: %lu\n", sizeof(unsigned char)); printf("Short Int Size: %lu\n", sizeof(short int)); printf("Integer Size: %lu\n", sizeof(int)); printf("Long...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <fcntl.h> #include <time.h> #include <unistd.h> #include <wiringPi.h> #include "Nokia/Nokia.h" #include "Nokia/Images.h" #define BUF_SIZE 500 ///////////////////////// // Game of Life functions ///////////////////////// int** gol_alloc_cells(){ ...
C
/****************************************************************************** * Programa: Sudoku * Programador: Jesus Urrutia (16.073.876-6) * Ramo: Fundamentos de Programacion * Profesora: Francia Jimenez * Comentarios: * Si bien los numeros del tablero de sudoku son numeros enteros, estos son * numeros enter...
C
#include <stdio.h> #include <string.h> #include <stdbool.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #define MAX_LEN_LINE 100 #define BUFSIZE 10000 int main(void) { char argv[MAX_LEN_LINE]; char command[MAX_LEN_LINE]; char *args[] = {command, argv, NULL}; //co...
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <string.h> #include <time.h> // Definitions #define MALLOC_MAX_SIXE 1024 #define SUCCESS (char *)haystack #define FAILURE (void *)NULL #define UBUNTU //#define WINDOWS // Support functions void delay(int milliseconds); int exist(int argc, char** arg...
C
/* * Copyright (c) 2022 HPMicro * * SPDX-License-Identifier: BSD-3-Clause * */ #include "hpm_mchtmr_drv.h" void mchtmr_init_counter(MCHTMR_Type *ptr, uint64_t v) { volatile uint32_t *p = (volatile uint32_t *) &ptr->MTIME; /* * When [31:29] == 7, low 32 bits need to be set to 0 first, * then set...
C
// AsyncHTTPRequest request; #include <ESPAsyncTCP.h> #define SERVER_HOST_NAME "161.35.28.53" #define TCP_PORT 3500 static void replyToServer(void* arg) { AsyncClient* client = reinterpret_cast<AsyncClient*>(arg); // send reply if (client->space() > 32 && client->canSend()) { char message[32]; sprintf(message...
C
/* * Academic License - for use in teaching, academic research, and meeting * course requirements at degree granting institutions only. Not for * government, commercial, or other organizational use. * File: cholesky.c * * MATLAB Coder version : 4.3 * C/C++ source code generated on : 10-Feb-2020 20:1...
C
#include <vitasdk.h> #include "font.h" int vsnprintf(char *s, size_t n, const char *format, va_list arg); #define MAX_STRING_LENGTH 512 static SceDisplayFrameBuf frameBuf; static uint8_t fontScale = 1; static uint32_t colorFg = 0xFFFFFFFF; static uint32_t colorBg = 0xFF000000; uint32_t osdBlendColor(uint32_t fg, ui...
C
#ifndef ARCA_STONE_H #define ARCA_STONE_H enum stone { S_NONE, S_BLACK, S_WHITE, S_OFFBOARD, S_MAX, }; static char stone2char(enum stone s); static enum stone char2stone(char s); char *stone2str(enum stone s); /* static string */ enum stone str2stone(char *str); static enum stone stone_other(enum stone s); st...
C
#include "my_server.h" #include "my.h" #include "xlib.h" #include "buf_size.h" void set_other(char *abso, int i, mode_t *mode) { if (abso[i] == '1') *mode |= S_IXOTH; if (abso[i] == '2') *mode |= S_IWOTH; if (abso[i] == '4') *mode |= S_IROTH; if (abso[i] == '5') *mode |= (S_IROTH | S_IXOTH); ...
C
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward d...
C
#include<stdio.h> #include<stdlib.h> int data; void display(); struct node { int info; struct node *next; }*start=NULL; void add_beg() { printf("\nEnter element to add "); scanf("%d",&data); struct node *newnode; newnode=(struct node*)malloc(sizeof(struct node)); newnode->info=data; newnode->next=star...
C
#include <stdio.h> #include "./recognition.h" #include "./resample/resample.h" #include "./params.h" #include "./util/io.h" void outputFaceIndex(int faceIndex) { printf("face index: %d\n", faceIndex); } int main() { // read input image size int imgSizes[2]; readInts("../data/input_size.txt", 2, imgSizes); int i...
C
#include <string.h> #include "utils.h" short sfabs(short i) { return (i > 0) ? i : -i; } /* Source: Wikipédia */ /* reverse: reverse string s in place */ void reverse(char s[]) { int i, j; char c; for (i = 0, j = strlen(s) - 1; i < j; i++, j--) { c = s[i]; s[i] = s[j]; s[j] = c; } } /* Sour...
C
#include<stdio.h> #include<conio.h> void main() { int a[5]; int i,min,max; printf("Enter elements of Array"); for(i=0;i<5;i++) { scanf("%d",&a[i]); } min=a[0];max=a[0]; for(i=0;i<5;i++) { if(a[i]<min) min=a[i]; if(a[i]>max) max=a[i]; } printf("Minimum in Array= %d\nMaximun in Array= %d",min,max); }...
C
#include<stdio.h> #include<limits.h> #define NVAL 10 struct val{ int x; int y; char ch; int *pt; }; int main(void) { typedef struct val Dummy; Dummy a[NVAL]={ 1,2,'c',NULL}; Dummy *pt=a; int v[5]={1,2,3,4,6}; printf("%d",a[0].x); printf("%d",pt->y); printf("\n%d %d",EOF,INT_MAX); return 0; }
C
#include <stdio.h> int main() { int sum= 0, number=1; printf("1에서 10까지 합을 구합니다.\n" ); while (number<=10) { sum+=number; number++; } printf("합은 %d입니다.\n",sum ); return 0; }
C
#include<stdio.h> int main(){ int i = 0; int j = 0; int a; int m; int k; char substring[1000]; char string[1000]; char c; printf("Enter the substring\n"); while ((c = getchar()) != '\n' ){ substring[i] = c; ++i; } printf("Enter the string\n"); while ((c = getchar()) != '\n' ){ string[j] = c; ++j; } for ...
C
#include<stdio.h> main(){ int a=10,b=20; printf("%d\n",add(a,b)); printf("%d\n",mul(10,39)); }
C
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward d...
C
#include <stdio.h> #include <windows.h> #include "push.h" extern int (*map[LEVEL])[SIZE]; extern int ground[SIZE][SIZE]; extern Point player; void init(int level) { int i, k; for (i = 0; i < SIZE; i++) { for (k = 0; k < SIZE; k++) { ground[i][k] = map[level][i][k]; if (ground[i][k] == ICON_USER) { ...
C
#include "ud_ucase.h" int main(int argc, char* argv[]) { int len; int j; int numBytes; char buf[BUF_SIZE]; int sfd; struct sockaddr_un svaddr, claddr; /*Create the server socket and bind it to a well known address*/ sfd = socket(AF_UNIX, SOCK_DGRAM, 0); if(-1 == sfd) { perror("socket"); return 1; } ...
C
/* * simpledraw.c * * Created on: 16.07.2019 * Author: Megacrafter127 */ #include "simpledraw.h" #include <SDL2/SDL.h> #include <assert.h> #include <time.h> #include <math.h> #include <stdio.h> static void __attribute__((constructor)) construct() { if(SDL_Init(SDL_INIT_VIDEO)) { fprintf(stderr,"InitErr...
C
/* ** EPITECH PROJECT, 2018 ** null ** File description: ** null */ #include "my.h" #include "rpg.h" void write_help_instruction(void) { my_printf("############# Welcome in Lands Of Valoran #############\n\n" "Comment lancez le jeu ? {./my_rpg}\n" "Comment lancez le -h ? {./my_rpg -h}\n" "Comment connaitre la ver...