language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#define _CRT_SECURE_NO_WARNINGS #pragma warning (disable:4996) #include <stdio.h> #include <stdlib.h> #define ROWT 4416 #define COLT 1 #define sep ";" #define MAX 100000; double flipmask = (double)0; void ue(double array[][COLT], int row, int col, const char *colstr) { double throw; int bit; long long flipmas...
C
#include "../includes/cub3d.h" void screen_resolution(t_game *game) { int max_w; int max_h; mlx_get_screen_size(game->data.mlx, &max_w, &max_h); if (game->file.width > max_w) game->file.width = max_w; if (game->file.height > max_h) game->file.height = max_h; } void get_resolution(t_game *game, char *line)...
C
#include <stdio.h> int main(int argc, char const *argv[]) { char a = 'a'; char b = 'b'; printf("%d\n",a-b); return 0; }
C
#include "binary_trees.h" /** * binary_tree_uncle - goes through tree * @node: a node * Return: 1 if a node is a leaf, 0 if not */ binary_tree_t *binary_tree_uncle(binary_tree_t *node) { binary_tree_t *parent, *gparent; if (node == NULL) return (NULL); if (node->parent == NULL) return (NULL); if (node->pa...
C
#include <stdio.h> #include <signal.h> #include <stdlib.h> #include <fcntl.h> /* Gestion de señales en proceso padre. */ void gestion_padre(int segnal) { printf("Padre recibe señal.. %d\n", segnal); } void gestion_hijo (int segnal) { printf("Hijo recibe señal..%d\n", segnal); } int main() { int pid_padre, pi...
C
#include <avr/io.h> #include "MCP.h" #include "SPI.h" #include "util\delay.h" /** * Function bit modifies a content of register * Function bit modifies a content of register with given data using given mask * * @param Data new data to be written * @param Mask Mask used for modification * @param Address Address ...
C
#include <CUnit/Basic.h> #include <CUnit/CUnit.h> #include "student_code.h" #include <setjmp.h> #include <signal.h> #define VALUE_A 500 // If we want to test some values #define VALUE_B 600 //Ces 2 variables sont à déclarer globalement car utilisées dans mymalloc.c int nb_times_malloc_used = 0; int let_malloc_fail = ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #define MAXLINE 1000 typedef enum { A_COMMAND = 1, C_COMMAND, L_COMMAND } command_type; // A parsed command typedef struct { command_type type; int error; // if any // For A or L commands char var[MAXLIN...
C
void TransferFile(int client_socket , char username[] , char filename[] , FILE * file){ char buffer[1024]; //buffer for transferring int option = -1; // used as a flag for tranfer //TRANSFER START printf("-> Transferring file : \"%s\" from User : \"%s\" ...\n" , filename , username); recv(client_socket , &option ...
C
#include "synchro.h" #define DEBUG 1 static bool test_and_set(bool *lock) { cli(); bool rv = *lock; *lock = true; sei(); return rv; } void mutex_init(mutex_t *m) { m->lock = false; m->waitlist = Queue_create(8); } void mutex_lock(mutex_t *m) { while(test_and_set(&m->lock)) { // acquire ...
C
#include <stdio.h> int main() { int value,j; scanf("%d",&value); for(int i=1;i<=value;i++,j=0) { printf("\n"); int k=i; while(k<=value) { printf("\t"); k=k+1; } j=i-1; j=j+j+1; while(j>0) { printf...
C
#include <stdio.h> int searchNumFromArray(int arr[][4], int num); int searchNumFromArray2(const int * pArr, int cols, int rows, int num); int main() { int arr[4][4] = {.......}; int ret = searchNumFromArray(arr, 7); int iArr[] = {....}; int iRet = searchNumFromArray2(iArr, 4, 4, 7); if (TRUE == ret) printf("g...
C
#include<stdio.h> int main() { float table[2][3] = { { 1.1,1.2,1.3 },{ 2.1,2.2,2.3 } }; printf("%p\n", table);//base address of table printf("%p\n", table+1);//1st row starting address printf("%p\n", *(table+1));//1st row ist element address printf("%p\n", (*(table + 1)+1));//1st row 1st element address printf("...
C
/* * main.c * * Created on: Apr 24, 2018 * Author: Batuhan Faik Derinbay */ #include <stdio.h> #include <string.h> #include <locale.h> #define MAXCHAR 1000 #define MAXWORD_LENGTH 48 /*onerilen uzunluklar * 20 - kisa kelimelerden olusan basit cumleler icin * 32 - turemis yapida kelimeler i...
C
/* * nvic.h * * Created on: Jan 4, 2013 * Author: jon */ #include <stdint.h> #ifndef NVIC_H_ #define NVIC_H_ #ifdef __cplusplus #define __I volatile /*!< Defines 'read only' permissions */ #else #define __I volatile const /*!< Defines 'read only' permissio...
C
#include "button_driver.h" /** * Function to initialize peripheral registers concerning the button. * Button connections: * Port: PIOB * Pin: PIO_PB26 (Arduino pin 22) */ void Init_Button(void) { #ifdef DEBUG trace_puts("Initializing button...\n"); #endif //Disable pmc writeprotect PMC->PMC_WPMR = 0x504D430...
C
/** * Program to implement the tower of hanoi function using Recursion. * Compilation: gcc -o recursion_3 recursion_3.c * Execution: ./recursion_3 * * Assignment_5 - Recursion * @Aanchal, 1910990158, 6/8/2021 */ #include <stdio.h> int count = 0; // Prints the movement of disk along with count of movements v...
C
#include <stdio.h> #include <conio.h> #include <stdlib.h> main (){ int a[5][5]; int i,j; printf("Dame los valores de la matriz A \n"); for(i=1;i<=4;i++){ for(j=1;j<=4;j++){ printf("a[%d][%d] \n",i,j); scanf("%i",&a[i][j]); } printf("\n"); } printf("\n\n"); for(i=1;i<=4;i++){ for(j=1;j<=4;j++){ if (i==j)...
C
#include <stdio.h> #include <stdlib.h> int main() { char resp='s',preg; int conta=0,num,suma=0; float promedio; do{ printf("\nIngrese Numero: "); scanf("%d",&num); suma=suma+num; printf("\nDesea Ingresar otro Numero: 's' 'n'"); scanf("%s",&resp); conta...
C
#ifndef OPCODES_H #define OPCODES_H #include <stdio.h> #include <stdlib.h> #include <string.h> enum opcodes { HALT=-1, PUSH, POP, ADD, SUB, MUL, DIV, LOAD, STORE, JMP, JMP_EQ, }; int *program = NULL; int max = 0; int pc = 0; inline int nextOp(int *op) { if (pc < 0 || ...
C
#include<stdio.h> #include<stdlib.h> void main(void) { int **snail; int i = 0, j =0; int n; int count = 0; printf("사이즈를 입력하세요 : "); scanf("%d",&n); snail = malloc(sizeof(int *) * n); for(i = 0; i <= n; i++){ snail[i] = malloc(sizeof(int *) * n); } i = 0; while(j < n){ snail[i][j] = ++count; j...
C
#include <stdlib.h> #include <string.h> #include "assert.h" #include "except.h" #include "arena.h" #define T Arena_T const Except_T Arena_NewFailed = {"Arena Creation Failed"}; const Except_T Arena_Failed = {"Arena Allocation Failed"}; <macros 71> //<types 67> struct T { T prev; char *avail;...
C
/************************************************************************* > File Name: pipea.c > Author: > Mail: > Created Time: 2017年09月11日 星期一 22时13分19秒 ************************************************************************/ #include<stdio.h> #include<stdlib.h> #include<unistd.h> #include<fcntl.h> int mai...
C
/*1. Store information of a student using structure and dynamic memory allocation Information to be stored: Roll number Name Address Mark 1 Mark 2 Mark 3 */ #include<stdio.h> #include<stdlib.h> struct student { int roll, mark1, mark2, mark3; char name[30], address[150]; }; int main() { int i; struct st...
C
#include <stdint.h> #include <stddef.h> #include <string.h> #include "unicode.h" int utf8_last_size(const char *str) { int len = 0; char *pos = strchr(str, '\0'); while (pos > str) { --pos; ++len; if ((*pos & 0xc0) != 0x80) { return len; } } return 0; } size_t utf8_chsize(uint32_t ch) { if (ch < 0x80) ...
C
#include "hough.h" #include "window.h" #include "frame.h" #include "stdio.h" #include <opencv/cv.h> int templateMatch(struct window *window, int frame, int diam, CvMat *tmpl) { // Init struct frame *fr = get_frame(window->frames, frame); // printf("Guess is (%d, %d), diameter is %d\n", window->guess.x, ...
C
// A noter : cet implémentation N'EST PAS la même que celle de la fonction disponible sur vos ordi // Ceci étant dit, on doit transformer une chaine de char en int, si jamais sont présents // des char qui représentent des chiffre à partir d'un moment précis. // Si vous êtes en piscine, rappelez-vous : on est dans la ta...
C
int main() { int n, i, pos; const int MAX = 200; unsigned an[MAX]={0}; an[0] = 1; cin >> n; if(n==0) cout << an[0]; else { while(n--) { for(i=0;i<MAX;i++) an[i] = an[i] * 2; for(i=0;i<MAX;i++) if(an[i]>9) { an[i+1]+=an[i]/10; an[i] = an[i] % 10 ; } } ...
C
#include "board.h" #include "io.h" #include <stdlib.h> #include <memory.h> void init_genrand(unsigned long s); unsigned long genrand_int32(void); static inline uint min(uint a, uint b) { return (a < b) ? a : b; } static inline uint max(uint a, uint b) { return (a > b) ? a : b; } void reset_to_boundary(board_t *bo...
C
#include <stdio.h> #include <stdarg.h> #include <stdlib.h> #include <string.h> #include "common.h" int delta( CASA tab1[8][8], CASA tab2[8][8]) { int diferentes = 0; FORVN(L, 8) FORVN(C, 8) { CASA fst = tab1[L][C]; CASA snd = tab2[L][C]; if(fst != snd) { if( (vazia(fst) && snd == BRANCA) || ...
C
void convert_double(double *number) { double fraction; *number = *number / (double)100; fraction = *number - (int)*number; fraction /= 0.6; *number = (int)*number + fraction; }
C
// // main.c // exe1 // // Created by НУРИЯ on 9/8/20. // Copyright © 2020 НУРИЯ. All rights reserved. // Nuriya Umirbekova exe1 #define _XOPEN_SOURCE 600 #include <stdio.h> #include <sys/types.h> #include <stdlib.h> int main() { int n=10; pid_t pid=fork(); for (int i=0; i<=n; ++i){ if (pid...
C
#include "LCD.h" #include "wiringPi.h" #include "LCD-RBPI.h" struct lcd_io * io; BYTE lcd_ioinit( void * iodata ) { int i = 0; BYTE iomode = 4; io= (struct lcd_io *)iodata; // Check if control signals have their pins defined if( io->rspin == 0 || io->epin == 0) return 0; pinMode (io->rspin...
C
#include <stdio.h> int main() { int n; float avg; scanf("%d", &n); int num, sum = 0,i; for(i = 0; i < n; i++) { scanf("%d", &num); sum += num; } avg = (float)sum / n; printf("Sum: %d\n", sum); printf("Avg: %.2f\n", avg); return 0; }
C
#include<stdio.h> typedef struct student{ int rno; char nm[15]; }stu; stu a[10]; //hash table void init(){ for(int i=0;i<10;i++) a[i].rno=0; } int hash(int no){ return no%10; } void insert(){ int i=0,j=0,no; printf("\nRoll No :"); scanf("%d",&no); i=hash(no); if(a[i].rno==...
C
/* ** EPITECH PROJECT, 2018 ** CPool_2018 ** File description: ** Maxence Carpentier */ #include "my.h" #include <stdlib.h> char *my_revnumber(char *str) { int i2 = my_strlen(str) - 1; char c; for (int i = 1; i < i2; i++) { c = str[i]; str[i] = str[i2]; str[i2] = c; i2--; ...
C
#include <stdio.h> #include <stdlib.h> #include <stdint.h> // int8_t, etc., intmax_t , uintmax_t, #include <inttypes.h> // uint8_t, ..., uintmax_t i = UINTMAX_MAX; // this type always exists #include <stddef.h> // offsetof(type, member-designator) #include <stdio.h> // remove, int rename(const char *old, const char ...
C
#include <stdio.h> #include <stdlib.h> float get_pi(int N){ //Monte Carlo method of calculating pi the argument is the number of samples to use. int pi=0,n=0; float x,y; while(n<N){ x=((float)rand())/((float)RAND_MAX); y=((float)rand())/((float)RAND_MAX); ++n; if(x*x+y*y<=1.0){ ++pi; ...
C
/* 루트가 0인 이진트리가 주어질 때, 이를 전위순회, 중위순회, 후위순회한 결과를 각각 출력하는 프로그램을 작성하시오. 아래 그림은 이진트리의 예제와, 이 이진트리를 전위순회, 중위순회, 후위순회 한 결과를 나타낸다. 입력 첫 번째 줄에 트리의 노드 개수 n이 주어진다. ( 1 ≤ n ≤ 100 ) 두 번째 줄부터 트리의 정보가 주어진다. 각 줄은 3개의 숫자 a, b, c로 이루어지며, 그 의미는 노드 a의 왼쪽 자식노드가 b, 오른쪽 자식노드가 c라는 뜻이다. 자식노드가 존재하지 않을 경우에는 -1이 주어진다. 출력 첫 번째 줄에 전위순회, 두 번...
C
#include <stdio.h> int main(void) { int x; printf("x = "); scanf("%d", &x); printf("the value of (3x^5 + 2x^4 - 5x^3 - x^2 + 7x - 6) = %d\n", ((((((((((3 * x) + 2) * x) - 5) * x) - 1) * x) + 7) * x) - (6))); return 0; }
C
//#include<stdio.h> //int main() //{ //// printf("\\" "\"Diptendu Karmakar\"\" "); // printf("\%cdiptendu karmakar\%c%c",'"','"','"'); // return 0; //} //#include <stdio.h> //int main() //{ // printf("%c%c%s%c%c",'\\','"',"your_name\\",'"','"'); // return 0; //} //#include <stdio.h> //int main() //{ // print...
C
#include "bsp.h" #ifdef KEY_ANFULAI static key_t s_tbtn[KEY_COUNT]; static key_fifo_t s_tkey; /* FIFO ,ṹ */ /* GPIOPIN */ static const x_gpio_t s_gpio_list[HARD_KEY_NUM] = { {KEY1_PORT, KEY1_PIN, 0}, /* K1 */ {KEY2_PORT, KEY2_PIN, 0}, /* K2 */ }; /* ***************************************************************...
C
/* ** EPITECH PROJECT, 2017 ** bootstrap my _ls ** File description: ** create list */ #include "my.h" #include "header_LS.h" #include <stdio.h> int comparaison(linked_list_t *buffer, linked_list_t *list); linked_list_t *search_greater(linked_list_t *list) { linked_list_t *buffer; buffer = list; list = list->nex...
C
/* ** EPITECH PROJECT, 2020 ** cpday09 ** File description: ** my.h */ #include <stdbool.h> #include <stddef.h> #include <stdarg.h> #include <stdbool.h> #ifndef MY_H #define MY_H #define CTOI(x) ((x) - '0') #define ITOC(x) ((x) + '0') #define GETBIG(x, y) (((x) < (y)) ? (y) : (x)) #define GETLOW(x, y) (((x) < (y)) ?...
C
#include <icone.h> #include <stdio.h> #include <math.h> #include <dobble-config.h> #include <stdlib.h> #define MAX_SPEED 5 int estDansIcone(Icone I, Vect2 centreCarte, Vect2 posClic){ int dedans=0; // Si la distance entre posClic et centreCarte est inférieure au rayon de la carte, c'est qu'on a cliqué dedans if (...
C
#include <stdio.h> #include <stdarg.h> #include <string.h> #include <pb-tools/api.h> #include <pb-tools/wire.h> #include <pb-tools/usb.h> #include <pb-tools/socket.h> #include "tool.h" int pb_debug(struct pb_context *ctx, int level, const char *fmt, ...) { (void) ctx; va_list args; if (pb_get_verbosity() ...
C
/* Generic 7-segment 4-digit LED display driver. Takes a whole 16-line GPIO bank. */ /* COM0-7 are MSD to LSD. SEG 7 is DP, 6-0 is a to g. */ #include <stdbool.h> #include <libopencm3/stm32/gpio.h> #include <libopencm3/stm32/rcc.h> #include "disp.h" /* #define DISP_GPIO_BANK GPIOA #define DISP_PIN_COM0 9 #def...
C
#include<stdio.h> void square (int *x, int *y) { *x = (*x) * --(*y); } int main ( ) { int number = 30; square(&number, &number); printf("%d",number); return 0; }
C
#include <unistd.h> #include <string.h> #include <stdlib.h> typedef struct s_fd { int write; int read; int flag; } t_fd; int ft_strlen(char *str) { int i = 0; while (str[i]) i++; return (i); } int ft_d_strlen(char **av) { int i = 0; while (av[i]) i++; return (i); } void ft_error(char *str) { write(...
C
#include <stdio.h> /* THIS CODE IS MY OWN WORK, IT WAS WRITTEN WITHOUT CONSULTING A TUTOR OR CODE WRITTEN BY OTHER STUDENTS - Derek Liu */ #include <stdlib.h> #include <sys/shm.h> #include <sys/msg.h> #include <string.h> #include <signal.h> #include <unistd.h> #include <stdbool.h> #include "computer.h" int messageQ...
C
/* * Serial_Interrupt.c * * Created: 25.04.2020 10:29:20 * Author : Denis Dengler, Maximilian Kürschner, David Schader * Description: Using serial pins for echo function */ /* includes */ #include "serial.h" /* function implementations */ void echo(){ usart_send(usart_receive()); } int main( void ) { usart...
C
#include "proj.h" extern Block* head; void READ_CURRENT_VALUE(int dataID, char* val){ // reading from the in memory cell storage // head is the linked list which is story cell data Block* temp = head ; while(temp != NULL){ if(temp->rec->dataID == dataID){ strcpy(val,temp->rec->dataVal); return; } temp...
C
int main() { int size = sizeof(all_tests)/sizeof(test_data); printf("Running %d tests:\n", size); printf("=====================\n\n"); int pass_count = 0; pid_t f1= fork(); pid_t f2 = -1; pid_t f3 = -1; if (f1!= 0){ f2 = fork(); if(f2!=0){ f3= fork(); ...
C
#include "pwm16.h" void pwm16_init() { /* Notes: Power Reduction TC1 bit in Power reduction Register needs to be cleared (set to 0) for TC1 module to work. TCNT1 */ /* PB1 ~ pin 9 on arduino uno */ DDRB = _BV(PB1) | _BV(PB2); ICR1 = 0xFFFF; TCNT1 = 0; /* TC1 Control Register A */ TCCR1A |= _BV(COM1A1) | _BV...
C
#include <stdio.h> #include <stdlib.h> int V, E; typedef struct edge{ int u, v, w; } edge; int find(int* parent, int i){ if (parent[i] != i) parent[i] = find(parent, parent[i]); return parent[i]; } void Union(int* parent, int* rank, int x, int y){ int xroot = find(parent, x); int yroot ...
C
#include <stdio.h> // prototype takes two pointers void swap(int*, int*); int main(void) { int num1 = 5; int num2 = 4; // pass address of variables swap(&num1, &num2); printf("%d - %d\n", num1, num2); return 0; } // function that takes two pointers void swap(int *a, int *b) { int tmp =...
C
#include <stdio.h> int main(void) { //define array a int a[] = { 1,2,3,4,5 }; int* p = a; //int형 포인터 변수 p에 배열 a의 시작 주소를 넣어줌 int i; //for문과 배열식 표현으로 a 출력 for (i = 0; i <= sizeof(a)/sizeof(int)-1; i++) printf("%d ", a[i]); printf("\n"); //while문과 포인터식 표현으로 a 출력 while (p<=a+sizeof(a)/sizeof(int)-1) { ...
C
#include <stdio.h> #include <string.h> #include <limits.h> #define MAX_SIZE 510 int matrix[MAX_SIZE][MAX_SIZE]; int distance[MAX_SIZE]; int paths[MAX_SIZE]; int inset[MAX_SIZE]; void Dijkstra(int start, int nodes) { for (int i = 1; i <= nodes; ++i) { distance[i] = -1; paths[i] = 0; inset[...
C
#ifndef __AUDIO_CLOCK_H__ #define __AUDIO_CLOCK_H__ #include <app/audio/audio_if.h> /*! file @brief Audio DSP Clock configuration ** */ #if TRAPSET_WAKE_ON_AUDIO /** * \brief Configures audio-DSP clock in different operation modes. * Application can configure audio-DSP clock in below operation modes: ...
C
#include <GL/gl.h> #include <GL/glut.h> #include <stdarg.h> #include <stdio.h> #include "Text.h" /* WRITING */ int len(char* string){ int l = 0; while(string[l] != '\0') l++; return l; } String str(char* string){ String cString; int i, l = len(string); cString.value = (char*)malloc(sizeof(c...
C
#include "myselect.h" /*Precondition: program starts *Postcondition: term caps are initiated */ char *get_term_cap(char* cap) { char *str; static char area[2048]; if(!(str=(char *)tgetstr(cap, (char**)(&area)))) { my_str("Error getting term cap"); my_char('\n'); exit(1); } return s...
C
#include <stdio.h> #include <malloc.h> typedef struct cell { //单链表结点结构体定义 int x; struct cell *next; } List; List *build(void) { //新建单链表,并将建好的单链表首结点地址返回 List *head, *tmp, *p; head = tmp = p = NULL; int n; //输入 scanf("%d", &n); getchar(); if (n == 0) return head; //头节点 ...
C
#include "Tenure.h" #include <iostream> using namespace std; Tenure::Tenure() { rank = ' '; YearOfExp = 0; } Tenure::Tenure(string name, string email, long facultyId, char r, int Exp ): CompSci(name, email, facultyId) { rank = r; YearOfExp = Exp; } void Tenure::getInfo(char r, int Exp) { } void Tenure::setInf...
C
#include<stdio.h> #include<string.h> #define SIZE 100 void toggleString(char *str); int main(void) { char str[SIZE]; int i; scanf("%[^\n]s", str); toggleString(str); return 0; } void toggleString(char * str) { int length=strlen(str),i; for(i=0;i<length;i++) { if(str[i]>='a' && str[i]<='z') ...
C
#ifndef PIQUE_KMERHASH #define PIQUE_KMERHASH #include "kmer.h" typedef struct kmerset_t_ kmerset_t; kmerset_t* kmerset_alloc(); void kmerset_free(kmerset_t*); size_t kmerset_size(const kmerset_t* H); void kmerset_add(kmerset_t* H, kmer_t x); /* Return the (one-based) index of the kmer in the set. * * Zero is ...
C
#include "my_display.h" void MY_DISPLAY_GPIO_Init() { GPIO_InitTypeDef GPIO_InitStruct_B; GPIO_InitTypeDef GPIO_InitStruct_C; GPIO_InitTypeDef GPIO_InitStruct_D; /* GPIO Ports Clock Enable */ __GPIOD_CLK_ENABLE(); /*For pins PD10/11/13/14: Display-RS,E,DB6,DB7 */ __GPIOC_CLK_ENABLE(); /*For pin...
C
#include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <iostream> #include <unistd.h> #include <linux/input.h> //#include <time.h> #include <sys/time.h> #include <math.h> #define PI M_PI//3.141592653589793 //3.141593 #define MIN(a,b) \ ({ __typeof__ (a) _a = (a); \ __typeof__ (b) _b = (b); \ ...
C
#include "mess_treat.h" int stoi(char* buff, int buff_size) { if (buff_size > 5) return -1; int res = 0, i; for(i=0; i<buff_size; i++){ if (buff[i] > 47 && buff[i]<58) { res = res * 10 + ( buff[i] - '0' ); } else { printf("contain: %c\n", buff[i]); return -1; } } return res; } ...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> struct inputValue { char name[4]; char orbit[4]; int hand; }; int calculateRows(FILE* file) { char name[4]; char orbiter[4]; int count = 0; while(fscanf(file, "%c%c%c)%c%c%c\n",&name[0], &name[1], &name[2], &orbiter[0], &orbiter[1], &orbiter[2])>0) {...
C
/* Collector.c - A simple garbage collector. * Copyright (C) 2011 Rob King <jking@deadpixi.com> * * This file is part of DPGC. * * DPGC is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either vers...
C
/* * File: Programa_principal.c * Author: Wels * * Created on 20 de marzo de 2020, 05:14 PM */ #include "xc.h" #include <stdint.h> #include <stdio.h> #include "Configuracion.h" #include <libpic30.h> #include "LCD_Libreria.h" #include "ADC_Libreria.h" #include "Interrupcion_Libreria.h" uint16_t valor_adc = 0; ...
C
#include <stdio.h> #include <stdlib.h> #include "lists.h" /** *pop_listint - this function will print the value of the head and remove it *@head: the pointer to the current head *Return: returns the current value of the head before removing it */ int pop_listint(listint_t **head) { listint_t *temp = *head; int va...
C
#include "eval.h" lval* lval_eval_sexpr(lenv* e, lval* v){ // evaluate children for (int i = 0; i < v-> count; i++) { v -> cell[i] = lval_eval(e, v -> cell[i]); } // error checking for (int i = 0; i < v-> count; i++) { if(v -> cell[i] -> type == LVAL_ERR){ return lval_take(v, i); } } // empty e...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <fcntl.h> #include "dbAccess.h" #include "../../database/src/db.h" static struct flock fl = {.l_start = 0, .l_whence = SEEK_SET, .l_len = 0}; List_Movies get_movies(){ int fd; List_Movies list; FILE *file = fopen(MOVIES_PATH, "rb+"); if( file ...
C
#include <stdio.h> #include <stdlib.h> #include "Funciones.h" #define T 20 int main() { char nombre[T]; char apellido[T]; char apellidoNombre[T+T]; pedirCadena("NOMBRE",nombre, T); pedirCadena("APELLIDO",apellido, T); formatearCadena(apellidoNombre, nombre, apellido); pri...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #define N 10 /* */ int main() { int a[]={1,1,1,2,3,3,3,3,4,5}; /* a N */ int i,j,max,current,count; /* */ srand(time(NULL)); /* */ for(i = 0; i < N; i++){ printf(" %d", a[i]); } printf(";\n"); max = 0; for(i = 0; i < N; i++){ ...
C
#include <stdio.h> void main (){ float folhas = 0; float valor = 0.25; printf("Quantas folhas voce quer xerox? "); scanf("%f", &folhas); float res = folhas * valor; float resDesconto = folhas * (valor - 0.05); if(folhas < 100){ printf("Voce me deve %.2f\n", res); }else i...
C
/*͂Ă邤NǂׂvOł*/ #include<stdio.h> int main(void) { int a; printf("͂Ă:"); scanf("%d",&a); if(a%4==0 && (a%100!=0 || a%400==0)){ printf("͂͂邤NłB"); } else{ printf("͂͂邤Nł͂܂B"); } return(0); }
C
#include<stdio.h> #include<string.h> int main() { char str1[100],str2[100]; int len1, len2, max, min, carry, i, sum=0, count=0,result[100]; printf("Enter your first number:\n"); scanf(" %s",str1); printf("Enter your second number:\n"); scanf(" %s",str2); len1=strlen(str1); len2=strlen(str2); ma...
C
#include "common.h" #include "constants.h" #include "context-helpers.h" #include "objectMemory-objects.h" #include "objectMemory-smallIntegers.h" // optimization: replaced with macros #ifndef OPTIMIZED_MACROS OP fetchContextSender(OP context) { return fetchNamedPointer(context, METHODCONTEXT_SENDER); } OP fetchCon...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <ctype.h> #include <string.h> #define MAX 512 int main(int argc, char *argv[]) { if (argc < 3) { fprintf(stderr, "Za malo argumentow. Uzyj:\n%s <plik zrodlowy> <plik docelowy>\n", argv[0]); exit(1); } ...
C
#include <stdio.h> void reverse(char s[]); int main(void) { char s[] = "hello"; reverse(s); printf("%s\n", s); reverse(s); printf("%s\n", s); return 0; } void reverse(char s[]) { static int i, j; char tmp; if (i == 0) { while (s[i] != '\0') ++i; --i; } if (i > j) { tmp = s[j]; s[j++] = s[i];...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <omp.h> double initialCondition(double x, double y); void writeheader(int N, int end); void writerow(int N, double rawdata[]); void printArray(double **array, int local_N, int N); int main(int argc, char *argv[]) { int comm_sz = 1; int my_rank = 0; ...
C
#include <stdio.h> int main() { printf("Pleas enter any number --> \n"); scanf("%d",&num ) } int palindrome(int arr[], int n) { int flag = 0; for (int i = 0; i <= n / 2 && n != 0; i++) { if (arr[i] != arr[n - i - 1]) { flag = 1; break; } } ...
C
#ifndef KMER_PACKER_H #define KMER_PACKER_H typedef struct KmerPacker_struct{ unsigned char *packed_buffer; char *unpacked_buffer; unsigned char *scratch_pack_buffer; int kmer_size; int packed_buffer_size; }KmerPacker; KmerPacker *newKmerPacker(int kmersize); void freeKmerPacker(KmerPacker *packer); char *...
C
#include <stddef.h> #include <stdlib.h> #include <stdio.h> #include <hidapi/hidapi.h> int main(int argc, char *argv[]) { int rc = 0; if ((rc = hid_init())) { fprintf(stderr, "hid_init: %d\n", rc); goto done; } struct hid_device_info *hid_devs = hid_enumerate(0x0d28, 0x0204); if (!hid_devs) { fprintf(stderr...
C
#include<stdio.h> int main(){ long long int i,a,b,c,n,t,j; scanf("%lld",&t); for(j=0;j<t;j++){ a=0; b=1; scanf("%lld",&n); for(i=0;i<=60;i++){ if(i==n) break; c=a+b; a=b; b=c;} printf("Fib(%lld) = %lld\n",n,a);}}
C
/* ****************************************************************** */ /* _____ _ __ */ /* By: Sergey Nikolaev / ___// | / / */ /* Сontacts: sn.prog@yandex.ru \__ \/ |/ / */ /* ...
C
/**************************************************************************** Copyright (c) 2005 - 2015 Qualcomm Technologies International, Ltd. FILE NAME leds_rom_manager.c DESCRIPTION an leds_rom manager for leds display NOTES */ #include <stdlib.h> #include <print.h> #include "leds_manager.h" #include "l...
C
#include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> #include <string.h> #include <errno.h> struct addrinfo * createAddressInfo(const char* address, const char* port) { printf("Creating address info for %s:%s\n", address, port); struct addrinfo *addr; in...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_abs.c :+: :+: :+: ...
C
// Created by David Zashkolny on 02.05.2020. // 3 course, comp math // Taras Shevchenko National University of Kyiv // email: davendiy@gmail.com // #ifndef COMBINATORICAL_OPTIMIZATIONAL_MINHEAP_H #define COMBINATORICAL_OPTIMIZATIONAL_MINHEAP_H #include <stdlib.h> #include <stdio.h> #include <limits.h> #define HEAP_I...
C
/* Author: Thomas Royston * Partner(s) Name (if applicable): * Lab Section: 022 * Assignment: Lab #14 Exercise #2 * Exercise Description: [optional - include for your own benefit] * * I acknowledge all content contained herein, excluding template or example * code, is my own original work. * * Demo Link: h...
C
#include <stdio.h> int max(int a,int b ,int c){ if(a>b) if(a>c) return a; else return c; else if(b>c) return b; else return c; } int main() { int a,b,c; scanf("%d%d%d",&a,&b,&c); int s = a + b + c - 2*max(a,b,c); printf("%d",s); }
C
#include<linux/init.h> #include<linux/module.h> #include<linux/moduleparam.h> #include<linux/printk.h> #include<linux/device.h> #include<asm/uaccess.h> #include<linux/sched.h> #include<linux/slab.h> #include<linux/fs.h> /* For the character driver support */ #include<linux/semaphore.h> #include<linux/mutex.h> #define ...
C
#include <stdio.h> #include <memory.h> enum { WIN, TOTAL }; int main() { int n, k, p1, p2, i, len1, len2, player1, player2; long total, table[102][2]; char s1[16], s2[16], *t1, *t2; float res; // 가위바위보 테이블; memset(table, 0, sizeof(table)); while ( scanf("%d %d", &n, &k)==2 ) { // many i...
C
#include "holberton.h" #include <stdio.h> /** * palindrome_check - helper function for is_palindrome * * @l: length of string * @i: counter for palindrome * @s: string to check * Return: returns itself if incomplete, or 1 for palindrome, 0 for not */ int palindrome_check(char *s, int l, int i) { if (s[i] == s[...
C
#include <math.h> #include <stdio.h> double func1(double x){ double y; y = x - 1.2*exp(-x); return y; } double func1_d(double x){ double y; y = 1 + 1.2*exp(-x); return y; } double func2(double x){ double y; y = x * sin(x) + log(x); return y; } double func2_d(double x){ double y; y = sin(x) + x...
C
#include "ffinternal.h" #include "ffdatatype.h" int ffdatatype_size(ffdatatype_h datatype, size_t * size){ size_t unitsize; switch (datatype){ case FFINT32: unitsize = sizeof(int32_t); break; case FFINT64: unitsize = sizeof(int64_t); break; ...
C
#include <stdio.h> #define MAX_SIZE 1000000 long int sizes[MAX_SIZE]; int counts[MAX_SIZE]; long int check_for_size(long int); int main() { long int fileid, size; float timest; long int count = 0; long int temp; for (temp = 0; temp < MAX_SIZE; temp++) { sizes[temp] = -1; counts[temp] = -1; } ...