language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/* ** free.c for in /home/teyssa_r/rendu/PSU_2013_42sh/src/bonus ** ** Made by teyssa_r teyssa_r ** Login <teyssa_r@epitech.net> ** ** Started on Sun Sep 28 18:50:23 2014 teyssa_r teyssa_r ** Last update Thu Oct 2 22:18:44 2014 chenev_d chenev_d */ #include <stdlib.h> #include <unistd.h> #include "bonus.h" voi...
C
#include <stdio.h> #include <stdlib.h> /* Ej4 TP3 -El siguiente programa calcula cuantos dias transcurrieron desde una fecha inicial y final elegidas por el usuario. -Las fechas pueden ser cargadas en 2 tipos de formato Formato 1: dd/mm/aa Formato 2: dd/mm/aaaa Grupo 3 Matias Gasparri Francisco Ledesma Dimas Bosch ...
C
/* * main.c * * Created on: Jul 12, 2020 * Author: jonmckay */ #include <stdio.h> #include <stdint.h> int main(void) { uint64_t totalIncome; double tempIncome; uint64_t tax; printf("Enter your total income:"); scanf("%lf", &tempIncome); totalIncome = (uint64_t) tempIncome; if(totalIncome <= 9525)...
C
#include "std.h" #include "App.h" void main() { Init(); Run(); /* char arr[MAX]; int i; int idx = 0; printf("Tell me about charactor!"); for(i=0; i<10; i++) { printf("%d\t", arr[i]); } printf("\n"); */ }
C
/** ****************************************************************************** * @file mb_port.c * @author Derrick Wang * @brief modebus移植接口 ****************************************************************************** * @note * 该文件为modbus移植接口的实现,根据不同的MCU平台进行移植 *******************************...
C
#ifndef RADIX_PRIOR #define RADIX_PRIOR #include<stdbool.h> enum SortType {F_NAME, L_NAME, AGE}; typedef struct Record { char* fName; char* lName; int age; } Record; Record* newRecord(char fName[], char lName[], int age); void deleteRecord(Record* record); void printRecord(Record* record); void printRec...
C
//Gloria Oliva Olivares Ménez //Estructuras de Datos //Cola Dinámica //1CM6 #include <stdio.h> #include <stdlib.h> #include <string.h> struct dato{ char nombre[30]; int edad; float est; char sexo; }; struct nodo{ struct dato *Dato; struct nodo *sig; }; ...
C
#include<stdio.h> #include<stdlib.h> /* Faa uma funo que receba, por parmetro, a altura (alt) e o sexo de uma pessoa e retorna o seu peso ideal. Para homens, calcular o peso ideal usando a frmula peso ideal = 72.7 x alt - 58 e, para mulheres, peso ideal = 62.1 x alt - 44.7. Utilize esta funo no programa principal pa...
C
/****************************************************************/ /* */ /* Memory */ /* */ /* Description: Fonctions de manipulation de la...
C
#pragma once #include <stdbool.h> typedef struct Link { void* value; struct Link* next; } Link; typedef struct Stack { Link* first; int dataCount; } Stack; void InitStack(Stack* st); bool IsStackEmpty(Stack* st); void Push(Stack* st, void* val); void* Pop(Stack* st); void* Top(Stack* st);
C
#include <stdio.h> int main(int argc, char const *argv[]) { FILE *fp; char a='A'; fp=fopen("file1.txt","w"); if(!fp) printf("file not created\n" ); else printf("file created\n" ); putc('a',fp); fclose(fp); fp=fopen("file1.txt","r"); a=getc(fp); printf("%c\n",a ); fclose(fp); return 0; }
C
#ifndef __CONTACT_H__ #define __CONTACT_H__ #include<stdio.h> #include<string.h> #include<assert.h> #include<stdlib.h> #include<errno.h> enum Option { EXIT, ADD, DEL, SEARCH, MODIFY, SHOW, EMPTY, SORT, }; #define MAX 1000 #define MAX_NAME 20 #define SEX_MAX 5 #define TELE_MAX 12 #define ADDR_MAX 30 #define AEFA...
C
#include <stdio.h> #include <wchar.h> #include <wctype.h> #include <locale.h> void remove_white(wchar_t *to, const wchar_t *from){ int i = 0; int j = 0; for(; i < wcslen(from); i++){ if(!iswspace(from[i])) to[j++] = from[i]; } to[j] = '\0'; } void backwards(wchar_t *to, const wchar_...
C
#include "../inc/cool.h" char * lowercase(char * string) { int i = 0; while (string[i] != '\0'){ if (string[i] >= 65 && string[i] <= 90){ string[i] += 32; } i++; } return string; } char * put_backslash(char * string) { int i = 0; int length = 0; int pt; char * res; while(string[i...
C
// all functions that manages the page table for the process. #include "pagetable.h" #include <stdlib.h> int ptInit(int pageTableSize) { pageTable = (int *)malloc(pageTableSize * sizeof(int)); for (int i = 0; i < pageTableSize; i++) { pageTable[i] = -1; } printf("init done\n"); return 0;...
C
/* *-------------------------------------- * Program Name: CUBE * Author: De2290 aka kafirhamsaeiyya * License: GNU GPLv3 * Description: A simple cube timer for the TI84 Plus CE *-------------------------------------- */ /* Keep these headers */ #include <stdbool.h> #include <stddef.h> #include <stdint.h> #inclu...
C
/* * interrupts.c * * Note: By the default the FIQ interruptions will remain disabled. */ #include <debug.h> #include <stdbool.h> #include <stdio.h> #include <stdint.h> #include "../devices/bcm2835.h" #include "../devices/timer.h" #include "flags.h" #include "interrupt.h" #include "thread.h" /* Number of BCM2853...
C
#include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <sys/types.h> #include <netinet/in.h> #include <error.h> #include <strings.h> #include <unistd.h> #include <arpa/inet.h> #include <string.h> #include <signal.h> #include <errno.h> #include <fcntl.h> #include <sys/time.h> #include <sys/ioctl.h> #inc...
C
/**************** Elad Zohar ezohar pa2 ****************/ #include<stdlib.h> #include<stdio.h> #include"List.h" #ifndef _BIGINTEGER_H_INCLUDE_ #define _BIGINTEGER_H_INCLUDE_ // Exported type ------------------------------------------------------------- // BigInteger reference type typedef struct BigIn...
C
#include <stdio.h> /** *main- entry point *Return: 0 when success then quit */ int main(void) { unsigned long int pp = 1; unsigned long int p = 2; unsigned long int n = p + pp; int c = 4; printf("%lu, %lu, %lu, ", pp, p, n); do { pp = p; p = n; n = pp + p; printf("%lu, ", n); c++; } while (c <...
C
#include<stdio.h> #include<conio.h> void main(void) { int a[6],i,sum=0; clrscr(); printf(" Enter a 6-digit number:"); scanf("%d %d %d %d %d %d",&a[0],&a[1],&a[2],&a[3],&a[4],&a[5]); printf(" What you entered is:"); for(i=0; i<6; i++) printf("%d",a[i]); printf("\n The inverse is:"); for(i=5; i>=0; ...
C
#include<stdio.h> int main() { int L,B,H,c; printf("enter the volume of cuboid\n"); scanf("%d%d%d",&L,&B,&H); c=L*B*H; printf("%d",c); return 0; }
C
#include "helpers.h" #include <math.h> // Convert image to grayscale void grayscale(int height, int width, RGBTRIPLE image[height][width]) { int w; for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { w = ((image[i][j].rgbtGreen + image[i][j].rgbtBlue + image[i][...
C
/* ** my_show_wordtab.c for wordtab in /home/soumph_s ** ** Made by sirininh soumpholphakdy ** Login <soumph_s@epitech.net> ** ** Started on Mon May 4 15:15:06 2015 sirininh soumpholphakdy ** Last update Mon May 4 15:31:38 2015 sirininh soumpholphakdy */ #include <stdlib.h> int **my_show_wordtab(char **tab) { ...
C
#include <stdlib.h> #include <stdio.h> #include "fila.h" p_fila criarfila(){ p_fila f; f = malloc(sizeof(Fila)); if(f == NULL){ exit(1); } f->ini = f->fim = NULL; f->tam = 0; return f; } void enfileira(p_fila f, int x){ p_no novo; novo = malloc(sizeof(No)); if(novo == NULL){ exit(1); } ...
C
#include "include/types.h" #include "include/stdio.h" #include "include/errno.h" #include "include/string.h" #include "include/net/net.h" // negative hex skipped int hex_str_to_val(const char *str, unsigned long *val) { int len = 0; unsigned long tmp = 0; while (*str != '\0') { if (*str >= '0' && *str <= '9') { ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* parce_argc.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <ctype.h> int ahtoi(char ch) { int tmp; tmp = toupper(ch); tmp = (ch - '0'); if(tmp > 9) tmp = (tmp - 7); return tmp; } int main(void) { char ch; int i = 0; int j = 0; char state = 0; int rlen = 0; int radd = 0; ...
C
#include <stdio.h> #include <stdlib.h> struct bstNode { int val; struct bstNode *l; struct bstNode *r; }; typedef struct bstNode bstNode; int add_bst(bstNode **root, int val); int printTreeInOrder(bstNode *root); int printLevelOrder(bstNode *root); int add_bst(bstNode **root,int val) { if (root == N...
C
/* THIS FILE IS ONLY FOR TESTING */ #include "player.h" #include "game.h" #include "card.h" #include "deck.h" void testDeckInit() { //test if deal worked for (int i = 0; i < 52; i++ ) { printf("suit: %d, number: %d\n",deck[i].suit,deck[i].type); } } void testDeal() { //test if deal worked ...
C
/* Copyright (c) 2011 Dietger van Antwerpen (dietger@xs4all.nl) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, mod...
C
#include <stdio.h> // ü struct GameInfo { char* name; int year; int price; struct GameInfo* friendGame; // ü. ü ü }; typedef struct { char* name; int year; int price; struct GameInfo* friendGame; } GAME_INFO; // Ʒٿ int main_struct(void) { // ü struct GameInfo gameInfo1; gameInfo1.name = ""; gameInf...
C
#include "lists.h" #include <stdio.h> /** *pop_listint- deletes the head node of a listint_t linked list *@head: double pointer *Return: integer */ int pop_listint(listint_t **head) { listint_t *x, *y; int i; if (*head == NULL) { return (0); } x = *head; y = (*head)->next; i = (*head)->n; *head = y; free...
C
//ler um numero inteiro e imprimir seu quadrado #include<stdio.h> int main () { int numero; scanf("%d",&numero); printf("%d",numero*numero); return 0; }
C
/* * default.c * * Created on: Sep 2, 2014 * Author: chenbfeng2 */ #include <stdio.h> #include <string.h> int main(void) { //initial the array to store the inout text. char ipt[100]=""; //initial the quit instruction array char qt[]="quit"; int i=0; //the loop continue reading and prin...
C
/****************************************************************************** * @file server.cpp * @brief The server application for a simple chatroom that uses sockets for * communication. * @author Matt Anderson <mia2n4@mst.edu> * Matt Gualdoni <mjg6y5@mst.edu> * @version 0.1 ************************...
C
#ifndef PERCORR_H #define PERCORR_H #include "arv.h" //////////////////////////////////////// /* * Encontra o ancestral comum mais prximo "subindo" a rvore. */ No ancestralSimples(No a, No b) { while (a->nivel > b->nivel) a = a->pai; while (b->nivel > a->nivel) b = b->pai; while (a != b) { a = a->pai; b...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* here_document.c :+: :+: :+: ...
C
// // 1413_SortedArrayToBST.h // LeetCode // // Created by 郝源顺 on 2020/3/16. // Copyright © 2020 desezed. All rights reserved. // #ifndef _413_SortedArrayToBST_h #define _413_SortedArrayToBST_h #include <stdio.h> #include "Defines.h" //面试题 04.02. 最小高度树 //给定一个有序整数数组,元素各不相同且按升序排列,编写一个算法,创建一棵高度最小的二叉搜索树。 // //示例: //...
C
/* ***************************************** */ /* */ /* EP3 - MAC0438 - Programação Concorrente */ /* */ /* Bárbara de Castro Fernandes - 7577351 */ /* Taís Aparecida Pereira Pinheiro - 7580421 */ /* */ /* ***************************************** */ #include "monitor.h" int N...
C
#ifndef STACK_H #define STACK_H #include <stdlib.h> #include <stdbool.h> #include <string.h> typedef char byte; typedef struct { byte *data; byte *ptr; byte *end; size_t typeSize; } stack_t; stack_t *stackCreate ( size_t size, size_t typeSize ); void stackDestroy( stack_t *stack ...
C
#include <shuttlesock.h> #include <shuttlesock/buffer.h> #include <errno.h> void shuso_buffer_init(shuso_t *S, shuso_buffer_t *buf, shuso_buffer_memory_type_t mtype, void *allocator_data) { *buf = (shuso_buffer_t) { .first = NULL, .last = NULL, .memory_type = mtype, .allocator_data = allocator_data ...
C
#include <stdio.h> #include <cs50.h> #include <stdlib.h> #include <string.h> int main(void) { FILE *archivo; archivo = fopen ("datos.csv", "r"); for (int nL = 0; nL < 3; nL++) { char linea [40]; fgets (linea, 40, archivo); string nombres = strtok(linea, ","); string ap...
C
#include<stdio.h> #include<math.h> #include<stdbool.h> int M, B, tm, tb; bool go(int x, int t, int m, int b){ if (m == M && b == B) return true; if (m != M && t+abs(x-m)+abs(m-M) > tm || b != B && t+abs(x-b)+abs(b-B) > tb) return false; if (m != M) { if (go(M, t + abs(x-m)+abs(m-M), M, b)) ret...
C
#include "stm8s.h" #include "stm8s_gpio.h" uint32_t delay(uint32_t t) //объявление статической функции часла типа long переменной t для реализации работы функции delay { t=500; while(t--); return t; } static void delay1(uint32_t m) //объявление статической функции часла типа long переменной t для реализации...
C
#include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h> #define MAX 200 struct pixel { char arr[MAX]; }*Ptrpixel; int largura; int altura; Ptrpixel invertImagem(struct pixel vetor, int tamanho){ typedef struct pixel vetor_aux; int j = tamanho -1; for(int i = 0; i < j; i...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int sommeRed(int nombre); int nbAm(char nom[] , int lon); int main() { int i; int nombre; int nbAmour; char nom[50]; int lon; for(i = 0 ; i < 2 ; i++ ) { scanf("%s", nom); lon = strlen(nom); nomb...
C
#include<stdio.h> #include<stdlib.h> void swap(int *a,int *b) {int temp; temp=*a; *a=*b; *b=temp; } void main() {int n,i,j; float sw=0,st=0; printf("Enter the number of process:"); scanf("%d",&n); int *a=(int*)malloc(n*sizeof(int)); int *b=(int*)malloc(n*sizeof(int)); int *w=(int*)malloc(n*sizeof(int)); int *t=(int*)ma...
C
#include<stdio.h> #include<stdlib.h> #include<time.h> main(){ clock_t timer; timer=clock(); int i; for(i=0;i<10;i++){ printf("%d",i); } timer=clock()-timer; printf("\n\n%f milesegundo(s) de execucao\n\n",((float)timer)/(CLOCKS_PER_SEC/1000)); }
C
// SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/ioctl.h> #define V240P _IOW('a', 'a', int*) #define V360P _IOW('a', 'b', int*) #define V480P _IOW('a', 'c', int*) #define V72...
C
/* @JUDGE_ID: 17051CA 336 C++ */ #include<stdio.h> #include<stl.h> #include<slist> #include<map> #include<set> #include<vector> #include<iostream> #include<string> #include<queue> class graph{ public: vector<slist<int> > adj; vector<slist<int>::iterator> pos; graph(){} graph(int n){ resize(n); } v...
C
#include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <string.h> #include <math.h> #include "list.h" #include "display.h" #include "array.h" #include "graph.h" #include "picture.h" #define STRMAX 256 extern struct table_fill Tf_tab; extern struct display_tab D_tab; extern int update_ind; ...
C
#include <8052.h> #include "uart.h" void uart_init(){ SCON = 0x50; /* uart in mode 1 (8 bit), REN=1 */ T2CON &= 0xF0; /* EXEN2=0; TR2=0; C/T2#=0; CP/RL2#=0; */ T2CON |= 0x30; /* RCLK = 1; TCLK=1; */ TH2=0xFF; TL2=0xEC; RCAP2H=0xFF; RCAP2L=0xEC; /* 38400 Baud at 24.576MHz */ TR2 = 1; /* Timer 2 run */...
C
/* * Program represents a simple calculator. Its functions - addition, subtraction, * iteger division, real division, modulo, multiplication, N-th power, * factorial, sum of numbers, average of nubers, binomial coefficient and primality * test - are called by arguements in front of parameters. */ #include <stdio.h> i...
C
#include <stdio.h> #include <semaphore.h> #include <unistd.h> #include <stdlib.h> #include <sys/shm.h> #include <sys/types.h> #include <sys/wait.h> sem_t *KO; int *s1 = 0; sem_t *p1; sem_t *p2; sem_t *p3; sem_t *stol_prazan; void trgovac() { do { *s1 = rand()%(3-1+1) +1; //(s1, s2) = nasumice_odaberi_dva_razli...
C
/* * _EXECUTE_TEST_C_ * * HMCSIM MUTEX EXECUTION FUNCTIONS * * * rsp_payload[0] = data * rsp_payload[1] = success bit */ #include <stdio.h> #include <stdlib.h> #include <inttypes.h> #include <string.h> #include "hmc_sim.h" /* ------------------------------------------------- DATATYPES */ struct mylock{ int...
C
#include <stdio.h> #include <stdlib.h> # define TAM 5 // declarar un array de 5 enteros // cargarlo secuencialmente con numeros ingresados por el usuario // y mostrar solo los numeros pares // void mostrarPares(int vec[], int tam); void mostrarPares(int vec[], int tam); void cargarVector(int vec[], int tam); int m...
C
#include <stdlib.h> #include <stdio.h> #include "studente.h" int main(void) { struct studente *s1 = construct_studente("Giacomo"); struct studente *s2 = construct_studente("Elisa"); char *s; fa_esame(s1, 18); fa_esame(s1, 15); // non viene registrato fa_esame(s2, 30); fa_esame(s1, 25); fa_esame(s2, 2...
C
#include <stdio.h> #include <locale.h> int main() { int x,y,r; printf(" : "); scanf("%d",&x); printf(" : "); scanf("%d",&y); printf(" : "); scanf("%d",&r); if ((x>y)&&(x>r)) { printf("%d ", x); } else if ((y>x)&&(y>r)) { printf("%d ", y); } else if ((r>y)&&(r>x)) { printf("%d ...
C
#include<stdio.h> int main() { int arr[20],i,j,n,temp; printf("Enter the size of the array: \n"); scanf("%d",&n); printf("Enter %d elements in the array: \n",n); for(i=0;i<n;i++) { scanf("%d",&arr[i]); } printf("Elements after reversing: \n"); for(i=0;i<((i+n)/2);i++) ...
C
#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int i = 2; int result = i*i; printf("result = %d\n", result); result *= i; printf("result = %d\n", result); result *= (i+i); printf("result = %d\n", result); }
C
#include <stdlib.h> #include <errno.h> #include <omp.h> #include "mytest.h" /** * make the opencv image (ordered BGR) grayscale using R*0.30 G*0.59 B*0.11 * * @param ArrayIn An colour opencv image array (ordered BGB) * @param Ydim The height of the images * @param Xdim The width of ...
C
#include "debug.h" // M_ASSERT void show_memory(const void *start, const size_t size) { M_ASSERT(start != NULL, "Start pointer is NULL"); // buffer contains ASCII characters from this piece of memory unsigned char buffer[DEBUG_MEMORY_ROW_LENGTH + 1]; buffer[DEBUG_MEMORY_ROW_LENGTH] = '\0'; unsigned char *pointer...
C
/** * @file msg_interface.h * * @author Noah Ryan * * This file contains interface definitions for the Message module */ #ifndef __MSG_INTERFACE_H__ #define __MSG_INTERFACE_H__ #include "msg_definitions.h" /** * @brief msg_telemetry_message * * @author Noah Ryan * * This function sets up...
C
#include<stdio.h> int main(void) { int i; char s[10]; printf("enter the string:\n"); scanf("%s",&s); for(i=1;i<=5;i++) { printf("%s\n",s); } return 0; }
C
#include <punit.h> #include "cstrings.h" static void setup(void) { } static void teardown(void) { } /* * This is exactly the same matcher used in * module/subscriptions.c */ static int field_matcher(const char *list, const char *field) { const char *sep = "."; int match; char *p; match = stringli...
C
#include <stdio.h> int main(){ int num, *ptr; printf("Ingresa numero: "); scanf("%d", &num); ptr = &num; if(*ptr%2 == 0) { printf("Es par"); printf("%p\n", ptr); }else{ printf("Es impar\n"); } return 0; }
C
/*################################################################################# #---------------------------------------------------------------------------------# #EXERCICI 5 - Richardson: Marc Pascual i Solé - Universitat de Barcelona # #---------------------------------------------------------------------...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_list_remove_if.c :+: :+: :+: ...
C
/* * employee.h * * Created on: 15 may. 2021 * Author: julio */ #ifndef ARRAYEMPLOYEES_H_ #define ARRAYEMPLOYEES_H_ #define SIZE_NAME 51 typedef struct { int idEmployee; char name[SIZE_NAME]; char lastName[SIZE_NAME]; float salary; int sector; int isEmpty; }Employee; int emp_init(Em...
C
// Fighting Fantasy combat analysis // simulation of combat outcomes with simple Luck-based strategy (Luck never depletes, and is used on every successful attack round) // outputs a table of victory probabilities for different Skill differences (kdiff) and hero, opponent Staminas (shero, sopp) // these victory probabil...
C
#include <sys/mman.h> #include <pthread.h> #define N 5000 #define MAX_BB_LIST_SIZE 10 #define MAX_GB_LIST_SIZE 20 #define MAX_SB_LIST_SIZE 100 #define HASHMAP_SIZE 10000 typedef struct BucketStruct { void* ptr; size_t size; struct BucketStruct* next; struct BucketStruct* prev; pthread_t creatorT...
C
/** * @file huge_page.h * * Copyright (c) 2016 * All rights reserved. * * * @NETFPGA_LICENSE_HEADER_START@ * * Licensed to NetFPGA C.I.C. (NetFPGA) under one or more contributor * license agreements. See the NOTICE file distributed with this work for * additional information regarding copyright ownership. NetFPGA lic...
C
#include <webots/distance_sensor.h> #include <webots/gps.h> #include <webots/inertial_unit.h> #include <webots/motor.h> #include <webots/robot.h> #include <stdio.h> #define TIME_STEP 64 int main(int argc, char **argv) { wb_robot_init(); // GPS Sensor WbDeviceTag gps = wb_robot_get_device("GPS"); wb_gps_ena...
C
#include <stdio.h> #include <stdlib.h> void censor(char *str); int main() { char str[100] = "food fool fike five f"; censor(str); printf(str); return 0; } void censor(char *str) { for(;*str!='\0';) { if (*str == 'f') { if (*(str+1) != '\0' && *(str+2)!='\0' && *(str+1) == 'o' ...
C
#include <stdio.h> /* include information about standard library*/ int main() /* define a function named main that receive no argument value*/ { /* statement of main are enclosed in braces*/ printf("hello, World\n"); /* mains calls library function printf to print the sequence ofcharacter; \n represents the newline...
C
/** * @file gpio_test.c * @brief Quectel SC20 Module about gpio example. * * @note * * @copyright Copyright (c) 2009-2017 @ Quectel Wireless Solutions Co., Ltd. */ #include <stdio.h> #include <stdint.h> #include <string.h> #include <ql_gpio/ql_gpio.h> int main(int argc, char *argv[]) { char buf[64]; uint32...
C
#include <stdio.h> #ifdef _Cplusplus extern "C" { #endif int code(char *input, char *output); int decode(char *input, char *output); #ifdef _Cplusplus } #endif int main(int argc, char** argv) { if ( argc < 4 || (*argv[1] != '0' && *argv[1] != '1') ) { printf("Usage: ./main <0/1> <input> <output>\n0 - code\n...
C
#include <SDL2/SDL.h> #include <SDL2/SDL_image.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include "graphics.h" void *GFX_context = NULL; void LOOP_Start(); void LOOP_Tick(); void LOOP_OnError(const char *s); void *GFX_LoadBitmap(const char *location) { char *path = calloc(1 + ...
C
#include <stdio.h> int main() { typedef struct { int hora, minutos, segundos; } horario; typedef struct { int dia, mes, ano; } data; typedef struct { horario h; data d; } compromisso; return 0; }
C
#include <stdio.h> #include <string.h> char in[205]; char c; int isvowel(char c){ int r=0; if (c=='a') r=1; if (c=='e') r=1; if (c=='i') r=1; if (c=='o') r=1; if (c=='u') r=1; if (c=='y') r=1; return(r); } int syllables(int s,int l){ int vowel=0; ...
C
//flow meter using timer1 without prescalar and 5ms delay with issue of INT1 ACTIVATING FIRST RESOLVED IN ft2.c #define F_CPU 8000000UL #include<avr/io.h> #include<util/delay.h> #include<avr/interrupt.h> #include<string.h> #define LED PE6 #define LCD_Command_Dir DDRE #define LCD_Command_Port PORTE #define LCD_Data_Dir ...
C
#include "types.h" #include "stat.h" #include "user.h" #define PGSIZE 4096 #define INT_MAX 2147483647 #define USERTOP 0xA0000 void eprinf(void) { printf(1, "mprotect: failed to return -1\n"); printf(1, "TEST FAILED\n"); } int main(int argc, char *argv[]) { if (mprotect((void *)0, -1) == 0) { ep...
C
#include<stdio.h> int* count012(int size, int arr[], int *counts) { for(int i=0; i< size; i++) { if(arr[i] == 0) counts[0]++; else if(arr[i] == 1) counts[1]++; else if(arr[i] == 2) counts[2]++; } return counts; } void sort(int...
C
//PARAM: --enable ana.int.interval_set --enable ana.int.def_exc #include <goblint.h> int main(){ int top; // 2^33 long long x = 8589934592l; // 2^31 - 1 long long y = 2147483647; if(top) { x = x - 1; } long long z = x/y; if(z == 4){ // Should be reachable ...
C
#include <stdlib.h> #include <stdio.h> #include <dlfcn.h> //#include "func_calc.h" int menu(); int main(int argc, char* argv[]){ void* LIB_so; char* ERROR; int (*add)(int, int); int (*sub)(int, int); int (*mul)(int, int); float (*div)(float, float); //LIB_so = dlopen("/mnt/usbstorage...
C
/* Key to Ex 2.4 R.O. Gray */ #include <stdio.h> #include <math.h> int main() { double t,x,y; int i; t = 0.0; for(i=0;i<=10;i++) { x = 5.0 + 0.12*t*t; y = 0.02*pow(t,3.0); printf("t = %3.1f x = %f y = %f\n",t,x,y); t += 0.5; } return(0); }
C
#include "screen_engine.h" #include "sprites.h" static int F_screen; static uint16_t *Screen; #define SCREEN(x, y) Screen[(x) + SCREEN_X*(y)] void screen_init() { F_screen = open("/dev/fb0", O_RDWR); if(F_screen < 0) { fprintf(stderr, "Cannot open screen\n"); exit(-1); } Screen = mmap(NULL, SCREEN_SIZE*sizeof...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.c :+: :+: :+: ...
C
#include "HTU21D.h" #include <avr/io.h> void UART_Init() { UBRR1H = 0; UBRR1L = 103; UCSR1B |= (1<<TXEN1); UCSR1C |= (1<<UCSZ10) | (1<<UCSZ11); } void UART_PrintString(char* message) { for (int i = 0; i < strlen(message); i++) { while (!(UCSR1A & (1<<UDRE1))); UDR1 = message[i]; } } void UART_PrintFloat(f...
C
#include <fcntl.h> #include <unistd.h> #include <string.h> #include <stdio.h> #include "westfield-dmabuf.h" #include "westfield-util.h" void dmabuf_attributes_finish(struct dmabuf_attributes *attribs) { for (int i = 0; i < attribs->n_planes; ++i) { close(attribs->fd[i]); attribs->fd[i] = -1; } ...
C
#include <stdio.h> #define N 32 int main(void) { char nazwapliku[N]; /* bufor na nazw pliku */ FILE *fp; int c; printf("Podaj nazwe pliku (uwaga: mniej ni %d znaki):\n", N); scanf("%s", nazwapliku); if( (fp = fopen(nazwapliku,"r")) == NULL) /* czy dao si otworzy? */ { /* komunikat o bdzie wypi...
C
/* ****************************************************************************************************************************** * ****************************************************** 分析输出模块 ********************************************************** * ***************************************************************...
C
// program to generate all permutation of the given string #include <stdio.h> #include <string.h> #include <stdlib.h> //declare permutation and swap functions void permutation(char *,int,int); void swap(char *,char *); int main() { char *s; // dynamically creating string length s=(char*)malloc(sizeof(char...
C
#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<malloc.h> #include<string.h> #include<pthread.h> typedef struct blocky{ int size; char msg[60]; }; pthread_cond_t cond_var; pthread_mutex_t mutexlock; void* send(void*args){ struct blocky b; FILE* fp = fopen("D:\\nik1.bin", "rb+"); while (1){ printf("\n...
C
#include <lib/validar.h> #include <Listas/Generica/Lista.h> #include <Listas/Generica/Nodo.h> #include <stdlib.h> Lista * nuevaListaDoble (int tamanno) { int i = 0; Lista *lista = NULL; valTam (tamanno); lista = crearNodos (tamanno, 2, 0); Nodo *start = NULL; Nodo *next = NULL; for (i = tamanno - 1; i > ...
C
/* ** EPITECH PROJECT, 2020 ** fridge ** File description: ** init fridge */ #include "../include/fridge.h" int check_pizza(fridge *cool) { int tomato = 5; int dough = 1; int onion = 3; int olive = 8; int peppers = 8; int ham = 4; int cheese = 3; if (cool->food[0]->stock >= tomato && ...
C
#include <stdio.h> #include <string.h> /* Union it's a special datatype that's capable to store diferents data type in the same memory segment. You can define a Union with many member, but only one member can contain a value at any given time. Ex: data.integer = 10; data.floating = 3.14; strcpy(data.text, "waka")...
C
#include <stdio.h> int main(int argc, char *argv[]) { int i = 0; for (i = 0; i < argc; i++) { printf("arg %d: %s\n",i,argv[i]); } // let's make our own array of strings char*states[] = {"California","Oregon","Washington","Texas"}; int num_states= 4; for(i= 0;i<num_states;i++) { printf("state ...
C
#include <assert.h> /* Test of reduction on both parallel and loop directives (workers and vectors in gang-partitioned mode, int type with XOR). */ int main (int argc, char *argv[]) { int i, j, arr[32768], res = 0, hres = 0; for (i = 0; i < 32768; i++) arr[i] = i; #pragma acc parallel num_gangs(32) nu...