language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
// This is the global flag inspected by both the semaphore task and event polling task to turn on the on board yellow led. uint16_t event_poll_flag = 0; // initialize adc void adc_init() { // AREF = AVcc ADMUX = (1<<REFS0); // ADC Enable and prescaler of 128; 16 MHz/128 = 125kHz ADCSRA = (1<<...
C
// 5.Write a program which accept accept range from user and display all numbers in // between that range in reverse order. // Input : 23 35 // Output : 35 34 33 32 31 30 29 28 27 26 25 24 23 // Input : 10 18 // Output : 18 17 16 15 14 13 12 11 10 // Input : 10 10 // Output : 10 // Input : -10 2 // Output : 2 ...
C
/* Filename : ShmOS.C ** Author : Anung Barlianto/1292000058 ** fork()-nya di sini ** Revision history: ** 1996.12.06 Finished! Semaphre and Shared memory removal. ** 1996.12.06 Pengembangan berikutnya.. coba hapus sem dan shm. ** 1996.11.30 Shared Memory version finished!. ** Actually shm is much easier and shorter....
C
#include <stdio.h> int main() { int count = 0; int array[500] = { '\n' }; scanf("%d", &count); for (int i = 1; i <= count; i++) { scanf("%d", &array[i]); } for (int j = count; j >= 1; j--) { printf("%d ", array[j]); } // printf("\n"); return 0; }
C
/* ********************************************************************************************************* * * ģ : SPI(ͨ) * ļ : BSP_SPI_HW.h * : V1.1 * ˵ : SPIߵײṩSPIáշݡ豸SPI֧֡ * v1.1ʹٺõĿ * * ********************************************************************************************************* */ #inc...
C
/* solitaire.c */ /* * The Solitaire encryption algorithm programmed in C. * solitaire encryption system by Bruce Schneier * based on a deck of cards * See <http://www.counterpane.com/solitaire.html> for details. * programming by Lloyd Miller, Sept 2000 */ /* * This program is free software; you can ...
C
#include <stdio.h> //Calculo dp permetro da circunferncia int main() { float C; float raio; printf("informe o valor do raio: "); scanf("%f", &raio); C = 2 * 3.14 * raio; printf("perimetro da circunferencia do raio informado eh: %0.2f ", C); return 0; }
C
/* * ===================================================================================== * * Filename: mydup2.c * * Description: * * Version: 1.0 * Created: 2013年01月06日 02时10分26秒 * Revision: none * Compiler: gcc * * Author: YOUR NAME (), * Organizatio...
C
/* * Samantha Foley * * Project 4: Dining Philosophers (Common header) * */ #include <stdio.h> #include <stdlib.h> #include <time.h> #include <unistd.h> #include <errno.h> #include <pthread.h> #include "semaphore_support.h" /***************************** * Defines *****************************/ #define TRUE 0...
C
// // main.c // PARTIBREJKERI_C // // Created by Borna on 30/04/2020. // Copyright © 2020 hr.fer.majstorovic.borna. All rights reserved. // #include <stdio.h> #include <pthread.h> #include <unistd.h> #include <stdlib.h> #include <sys/shm.h> #include <sys/types.h> #include <sys/wait.h> #include <time.h> #include <s...
C
/* Copyright (C) 2015-2016 Autotalks Ltd. */ #include <stdio.h> #include <assert.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> #include <sys/stat.h> #include <tx_api.h> #include <atlk/sdk.h> #include <atlk/gnss.h> #include <atlk/gnss_teseo.h> #include <craton/fs.h> /* CRATON ThreadX Teseo FW Update...
C
#include <stdio.h> int main() { int qtdAlunos = 5; int qtdNotas = 4; const char *nome[qtdAlunos]; int nota[qtdAlunos][qtdNotas]; float media[qtdAlunos]; float maior = 0; int quemTemAMaior = 0; for(int i = 0; i < qtdAlunos; i++){ printf("Informe a primeira letra do nome do aluno %d: ", i); scanf("%s", no...
C
/* Author : Chaitaly Kundu Date : 20th June, 2021 */ /* Enter a decimal number. Convert it in binary */ #include<stdio.h> #include<math.h> int binary_to_decimal(int B) { //code here int i=0, num=0, d ; while(B>0) { d = B % 10; num = num + (d * pow(2,i++)); B = B/10; } ...
C
#include <stdio.h> void swap(int *, int *); int main(void) { int a = 10; int b = 20; swap(&a, &b); printf("a:%d b:%d", a, b); return 0; } void swap(int *a, int *b) { int temp = *a; *a = *b; *b = temp; }
C
/* ** EPITECH PROJECT, 2021 ** ftp ** File description: ** cd */ #include "server.h" status_t cwd(client_t *client, char *param) { client->path = param; ftpsend( client->controlSocket, "250", "Requested file action okay, completed."); return OK; } status_t cdup(client_t *client, char *param) { ...
C
/* * pc_comms.c * * Created on: 28 Aug 2021 * Author: Pradeepa */ #include <stdio.h> #include "pc_comms.h" #include "usart.h" static uint8_t recieve_buffer[20]; static uint8_t star_count = 0; uint8_t next_read_size = 1; uint8_t reading_time = 0; static event_cb device_event_cb; uint8_t pc_comms_yy = 0; ...
C
#include<stdio.h> #include<stdlib.h> void main() { int *v1; float *v2; TAluno *v3; . . . v1 = (int*) malloc(10*sizeof(int)); //vetor de inteiros de tamanho 10 v2 = (float*) malloc(20*sizeof(float)); //vetor de floats de tamanho 20 v3 = (TAluno*) malloc(30*sizeof(TAluno)); }
C
/* Programa: ForkDigits.c Objetivo: Crear un proceso hijo que realizara el programa digits.c lee dos nmeros enteros a y b (0 <= a <= b <= 100000). Posteriormente, el programa crear un proceso hijo quien ejecutar el cdigo del programa digits.c (ver archivo con definici...
C
#include<stdio.h> #include<stdlib.h> #include <ws2tcpip.h> #include <winsock2.h> #define DATA "Hello World Socket" int main(int argc, char *argv[]){ int sock; struct sockaddr_in server; struct hostent *hp; char buff[1024]; /*CREATE SOCKET*/ sock = socket(AF_INET, SOCK_STREAM, 0); if(sock<0){ perror("Faile...
C
#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> //ݹ鷽ʽʵִӡһÿһλ.1234ӡ1 2 3 4 //int Print(int i) //{ // if (i < 10) // return (i % 10); // return Print(i / 10); //} //void Print(int i) //{ // if (i > 9) // { // Print(i / 10); // } // printf("%d ", i % 10); // //} // //int main() //{ // int i = 0; // scanf("%d", ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> #define WORD_SIZE 20 #define BUF_SIZE 80 #define LETTER_COUNT 26 typedef struct _Dict { char freq[LETTER_COUNT]; char orig_str[WORD_SIZE + 1]; int count_rep; struct _Dict *next; } Dict; typedef struct ...
C
// #include <stdio.h> int main() { int arr[10] = {5,6,8,4,2,3,7,1,9,10}; int temp; for (int i = 0; i < 9; i++) { int j = i; while (j >= 0 && arr[j] > arr[j + 1]) { temp = arr[j]; arr[j] = arr[j+1]; arr[j+1] = temp; j--; } } for (int i = 0; i < 10; i++) { printf("%d ", arr[i]); } return 0; ...
C
#include<stdio.h> #include<conio.h> void main() { int a,p,r,n,t,b,c; printf("\n enter the value"); scanf("\n %d%d%d%d",&p,&r,&n,&t); b=(1+(r/n)); c=n*t; a=p*(pow(b,c)); printf("\n compound intrest %d",a); }
C
/** * CS2106 AY 20/21 Semester 1 - Lab 3 * * This file contains declarations. You should only modify the entry_controller_t struct, * as the method signatures will be needed to compile with the runner. */ #ifndef __CS2106_ENTRY_CONTROLLER_H_ #define __CS2106_ENTRY_CONTROLLER_H_ #include <semaphore.h> #define ENT...
C
#include <stdio.h> #include <stdlib.h> /** * main - prints number of arguments passed into it. * @argc: integer * @argv: pointer to an array * Return: int **/ int main(int argc, char **argv __attribute__((unused))) { printf("%i\n", argc - 1); return (0); }
C
///first question sorting. automatic a b and c additions. #include<stdio.h> #include<stdlib.h> #include<time.h> char text[10000];//For a more flexible approach I could make these arrays dynamically at load-time int answers[300]; int ansamount[300]; int startpoint[300]; int end; int convert(char a) { swit...
C
#include "filesys/inode.h" #include "filesys/ifile.h" #include "filesys/tools.h" static void empty_it(){ return; } void usage(){ printf("Utilisation: mkfile\n"); printf("\n"); printf("Retourne et affiche l'inoeud du fichier créé.\n"); printf("\n"); printf("Exemple:\n"); printf("\t$mkfile\n...
C
#include "csr_load_matrix.h" #include "../../fcl_file.h" #include "../../fcl_logging.h" #include <stdio.h> #include <string.h> #include <stdlib.h> #include <errno.h> #include <ctype.h> /** * @brief Read line from input. * * @param[in] input * @param[out] line * @param[out] max_line_len * @return */ char* readli...
C
#include"..\header\header.h" #include"..\header\function.h" extern char* loginID; //ѡ void chooseLoginOrReg(){ char choice; char inputs[10]; while(1){ puts("ѡ[1-3]"); gets(inputs); if(strlen(inputs) > 1){ puts("ѡ񲻺Ϸ"); continue; } choice = inputs[0]; if(choice == '1' || choice == '2'|| choice ...
C
/* -*- coding: iso-latin-1-unix; -*- */ /* DECLARO QUE SOU O UNICO AUTOR E RESPONSAVEL POR ESTE PROGRAMA. // TODAS AS PARTES DO PROGRAMA, EXCETO AS QUE FORAM FORNECIDAS // PELO PROFESSOR OU COPIADAS DO LIVRO OU DAS BIBLIOTECAS DE // SEDGEWICK OU ROBERTS, FORAM DESENVOLVIDAS POR MIM. DECLARO // TAMBEM QUE SOU RESPONSAV...
C
/* ------------------------------------------------------------------------ phase2.c University of Arizona Computer Science 452 ------------------------------------------------------------------------ */ #include <usloss.h> #include <usyscall.h> #include <phase1.h> #include <phase2.h> #include <stdio.h> ...
C
#include <stdlib.h> #include "../headers/BinaryTree.h" #include "../headers/Node.h" /************************************************************* * CREATE AVL TREE * @author Lucas Bittencourt * * Creates the AVL Tree by receiving its root Node. * * @param root is the Node that will serve as the root * @return the A...
C
#define _CRT_SECURE_NO_WARNINGS 1 #include <stdio.h> #include <string.h> void ReplaceSpace(char str[], int length) { if (str == NULL || length <= 0) { return; } int LenSpace = 0; //ո񳤶 int i = 0; while (str[i] != '\0') { if (str[i] == ' ') { ++LenSpace; } i++; } //滻ַij int NewLength = length + L...
C
#include<stdio.h> int main() { FILE *f; int i,j; char a[100],b; f=fopen("abc.txt","w"); printf("Enter the text you want to input in the file:\n"); scanf("%[^\n]%*c",a); fprintf(f,"%s\n",a); fclose(f); printf("\nPress \"Enter\" key to input data directly to the file or Press \"E\" to exit:"); b=getchar(); if...
C
#include <stdio.h> #include<string.h> int main(void) { char str[100]; int len,i; scanf("%s",str); len=strlen(str); for(i=0;i<len;i++) { if(i<len-1) { printf("%c",str[i]); } else { printf("%c.",str[i]); } } return 0; }
C
#include<stdio.h> main () { float x,y; printf ("Please enter the coordinates of a point(x,y)\n"); scanf("%f,%f",&x,&y); if(x>0) { if(y>0) printf("1"); if(y<0) printf("4"); } if(x<0) { if(y>0) printf("2"); if(y<0) printf("3"); } if(x=0) printf("5"); if(y=0) printf("5"); }
C
#include "angle.h" Angle create_angle(double angle) { Angle ret = {.angle = angle, .tg = tan(angle), .sin = sin(angle), .cos = cos(angle)}; return ret; }
C
#include "holberton.h" /** *set_bit - function that sets the value of a bit to 1 at a given index. *@n: *n pointer numbers *@index: index * *Description: function that sets the value of a bit to 1 at a given index. *section header: Section description *Return: 1 for works, -1 if error */ int set_bit(unsigned ...
C
#include <assert.h> #include <string.h> #include <stdio.h> #include "comm/objective.h" int main(void) { obj_t *obj = obj_create(); assert(!obj_active(obj)); assert(obj_remaining(obj) == 0); char *cmds1[] = {"hej", "hejsan"}; assert(!obj_set_mission(obj, sizeof(cmds1)/sizeof(*cmds1), cmds1)); ...
C
// // main.c // recursive // // Created by mac on 16/4/11. // Copyright © 2016年 mac. All rights reserved. // #include <stdio.h> int getFactorial(int n){ if (n<=1) { return 1; } return getFactorial(n-1) * n; } int getSum(int m){ if (m>=100) { return 100; } return getS...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strsplit.c :+: :+: :+: ...
C
int countSegments(char* s) { char *p = s; int cnt = 0; if (*p != '\0' && *p == 0) return 0; while (*p != '\0') { if (*p != ' ' && (*(p+1) == ' ' || *(p+1) == '\0')) { cnt++; } p++; } return cnt; }
C
/* * Ejercicio 15 de TP Procesos */ #include <stdio.h> #include <stdlib.h> #include <sys/types.h> // Define pid_t #include <unistd.h> // Define fork, getpid y getppid int main(void) { int err; err = execl ("/bin/ls", "ls", "-l", (char *)NULL); //err = execl("/otro_directorio/ls", "ls", "-...
C
/* ** EPITECH PROJECT, 2020 ** find_sol.c ** File description: ** runner */ #include "my_runner.h" int find_sol(game_t *game) { game->map = move_beginning(game->map); while (game->map->next) { if ((game->mario->pos.x + 130 > (game->map->element)->pos.x && game->mario->pos.x < ((game->map->elem...
C
main() { int a=10,b=20; if(a=b) printf("a and b are equal"); else printf("a and b are not equal"); }
C
#include "minimath.h" #include <math.h> #include <string.h> #define Y_PI (3.14159265358979323846f) vec4 *vec4_zero(vec4 *dst) { dst->x = dst->y = dst->z = dst->w = 0.0f; return dst; } vec4 *vec4_copy(vec4 *dst, const vec4 *src) { memcpy(dst->components, src->components, sizeof(dst->components)); retur...
C
#include <stdio.h> #include <string.h> #include <conio.h> void demomembers(); void inputname(); void myacc(); void balance(); struct info { char name[50]; int accnum, accbal; }bank[50]; int total = 4, flag = 0; int main() { if(flag != 1) { demomembers(); flag = 1; } system(...
C
/* ** my_cos.c for my_cos.c in /home/han_d/Dropbox/EPITECH PROJET/Raytracer/RT_MULTISPOT ** ** Made by han_d ** Login <han_d@epitech.net> ** ** Started on Sat Jun 7 22:53:16 2014 han_d ** Last update Sun Jun 8 21:57:29 2014 kauch_j */ #include <stdlib.h> #include <math.h> #include "pauvray.h" #include "rotate.h...
C
#include <stdio.h> #include <string.h> #include <ctype.h> #include <stdlib.h> #define Round(x) ( (int)( x + (abs(x) / x) * .5)) typedef struct person { char name[30]; int age; union { struct { char school[30]; } Child; struct { char school[30]; double GPA; } collegeStudent; struct adu...
C
#include <string.h> #include <stdlib.h> #include <stdio.h> #include <Windows.h> #include "lab1.h" COORD CurrPos; HANDLE consHndlr; //TOURNIQUETS FUNCTIONS GO HERE struct turn_s { int passStud; int passTeach; int passStuff; }; struct turnSystem_s { int size; turn_t * thyTurns; }; turnSystem_t * turn_new(int siz...
C
// // Codec.c // // // Created by Benjamin Fernandez on 16/12/2017. // #include "Codec.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> void menu(){ printf("\n1/ Encrypt a file"); printf("\n2/ Decrypt a file"); printf("\n3/ Quitter"); } void emptyBuffer(){ ffl...
C
#include "parse.h" /*-------- * create ---------*/ grammar_table *grammar_table_create() { grammar_table *grammars = (grammar_table *) malloc(sizeof(grammar_table)); grammars->symbol = NULL; grammars->first = NULL; grammars->last = NULL; grammars->len = 0; return grammars; } grammar_symbol...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { int n, i, *p, sum; printf("Please input the n:\n"); scanf("%d", &n); if ((p = (int *) malloc (n, sizeof(int))) == NULL){ printf("Not able to allocate memory.\n"); exit(1); } printf("Please input the %d i...
C
//find number of characters in string using dma #include<stdio.h> #include<conio.h> int count(char *string) { int i,count; for(i=0;*(i+string)!=NULL;++i) { count++; } return count; } void main() { char *ptr; int i; ptr=(char*)malloc(sizeof(char)); if(ptr==NULL) { printf("memory not allo...
C
#include <stdio.h> #include <math.h> #define NUMBER 600851475143 int isPrime(int test) { int i=0; int calculateTo=( (int) sqrt(test) ); for(i = 3; i <= calculateTo; i+=2) { if(test % i == 0) { return 0; } } return 1; } int main() { ...
C
#include<stdio.h> #include<string.h> int main() { char c1[105],c2[105]; int i; scanf("%s",c1); scanf("%s",c2); for(i=0;i<strlen(c1);i++){ if(c1[i]==c2[i]) printf("0"); else printf("1"); } printf("\n"); return 0; }
C
/* * Created by Ricardo Rodrigues on 18/10/2017. */ #include <stdlib.h> #include <memory.h> #include <stdio.h> #include <string.h> #include "Course.h" Course* Course_new(const char name[50], unsigned int id) { Course* course = malloc(sizeof(Course)); course->id = id; strcpy(course->name, name); cour...
C
#include <stdio.h> #include <time.h> #include <math.h> #include <stdlib.h> #include "utils.h" void subtract_timespec(struct timespec *result, const struct timespec *a, const struct timespec *b) { if ((a->tv_sec < b->tv_sec) || ((a->tv_sec == b->tv_sec) && (a->tv_nsec <= b->tv_nsec))) { /* TIME1 <= TI...
C
#include <pthread.h> #include <stdio.h> pthread_mutex_t x, y; void *jack(void *dontcare) { while (1) { pthread_mutex_lock(&x); pthread_mutex_lock(&y); printf("jack!\n"); pthread_mutex_unlock(&x); pthread_mutex_unlock(&y); } return NULL; } void *jill(void *dontc...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> int i,j,k; char nome[7][10]; char nomeMaior[10]; char nomeMenor[10]; float media[7]; float maior = 0; float menor = 0; int menores6 = 0; float mediaAlunos = 0; float acumulador = 0; int calculoMaior() { for(k = 0; k <...
C
/* * File: main.c * Author: zh99998 * * Created on 2014年3月9日, 上午9:18 */ #include <stdio.h> #include <stdbool.h> //bool #include <assert.h> //assert #include <string.h> //memset, memcpy #include <math.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/mman.h> #include <iconv.h> #include <opencc/opencc....
C
#ifndef STACK_H #define STACK_H #include <stdlib.h> /** * Struct for Node. */ typedef struct Node { void * _data; // pointer to anything struct Node * _next; } Node; /** * Struct for stack. */ typedef struct Stack { Node * _top; size_t _elementSize; // we need that for memcpy } Stack; /** * Create...
C
/* JTSK-320112 a1_p2.c Zihan Qi z.qi@jacobs-university.de */ #include <stdio.h> #define DET_BIT(C) (C&1) int main(){ unsigned char c; scanf("%c",&c); printf("The decimal representation is: %d\n",c); printf("The least significant bit is: %d\n",DET_BIT(c)); return 0; }
C
/** @file * Funkcje potrzebne do implementacji funkcji addRoad. * * @author Sebastian Miller * @date 28.04.2019 */ #ifndef DROGI_ADD_ROAD_H #define DROGI_ADD_ROAD_H #include "map.h" #include <stdlib.h> /** @brief Główna część funkcji addRoad * Funkcja wywoływana w funkcji addRoad, gdy w podanyc...
C
#include <stdio.h> #include <stdlib.h> int main(int argc, char** args) { unsigned int n, mask, a[16], at[16]; scanf("%x",&n); for (int i = 0;i < 16;i++){ a[i] = 0; at[i] = 0; } mask = 1; for (int i = 0;i < 16;i++){ if ((mask & n) != 0) { a[15-i] = 1; } mask *= 2; } /* for (int i = 0;i < 4;i++){ f...
C
#include <stdio.h> #include <unistd.h> #include <sys/types.h> int main(void) { pid_t pid1, pid2, pid3; /* process id */ // printf("just one process before the fork()\n"); pid1 = fork(); // pid2 = fork(); // pid3 = fork(); if(pid1 == 0) { sleep(2); printf("Process1 ID %d\n", getpid()); } else { pid...
C
#include "candidate.h" #include "types.h" struct candidate *alocateCandidates(int numberCan){ struct candidate *candidates = NULL; candidates = (Candidate*)malloc(numberCan * sizeof(Candidate)); for (int i = 0; i < numberCan; i++) { candidates[i].id = -1; candidates[i].n = numberCan; candidates[i]...
C
#include <stdio.h> #include <stdlib.h> int* newArray(int size) { int* ret = NULL; int* auxInt; if(size>0) { auxInt = malloc(sizeof(int)*size); if(auxInt != NULL) { ret = auxInt; } } return ret; } int initArray(int* arrayInt,int limite,int valor) { ...
C
/* * Function: float Vfunc(int which, float *v1, float *v2, float *vresult, float scalar) * A Jack-of-all-trades vector function. * Input variables: * which: chooses the vector function to compute * v1,v2: input vectors: float v1[3], v2[3] * vresult: output vector, float vresult[3] * scalar:...
C
/********************************************/ /* Trampoline functions */ /* Use these to call functions in other */ /* banks. */ /* 2015 - Danny Lousberg */ /********************************************/ #include "bankswitch.h" extern unsigned int _data; extern unsigned int _data_end; // We c...
C
/* Para ello, el programa deber dar la opcin de cambiar la clave cuando lo desee el usuario */ #include <18F4520.h> #use delay(clock=8000000) #use fast_io(B) #include "LCDeasy.c" #include "KBD2.c" //Control del teclado matricial #INT_RB char tecla; int8 i,j,a,c,Salida; const int Intro[]={50,52,49,48}; i...
C
/* ** EPITECH PROJECT, 2020 ** PSU_42sh_2019 ** File description: ** pipe.c */ #include <sys/wait.h> #include "common.h" #include "exec.h" static void redirect(int oldfd, int newfd) { if (oldfd != newfd) { if (dup2(oldfd, newfd) != -1) close(oldfd); else exit(84); } } ...
C
#include<stdio.h> #include<stdlib.h> struct data { struct data * prev; int cylinder; struct data * next; }; int size,start,maxC; void sort(struct data*); void add(struct data**, int value); struct data* insert(struct data **,int); void delete(struct data **,struct data *); struct data* copy(struct data *...
C
#include<conio.h> #include<stdio.h> #include<stdlib.h> #include<string.h> typedef struct { int * matrix; int sizemax; } Graph; Graph createGraph(int sizemax); void addEdge(Graph graph, int v1, int v2); int adjacent(Graph graph, int v1, int v2); int getAdjacentVertices(Graph graph, int vertex, int* output); void dro...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_sort_dictionary.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include "ArrayList.h" typedef struct{ long int dni; int turno; int atendido;//0 si no se lo atendio, 1 si esta atendido int tramite;//si es 0 es regular, si es 1 es urgente int uso; }Cliente; /** \brief Comprueba si se ...
C
#include <stdio.h> #include <string.h> typedef struct{ char nome[30]; char endereco[50]; char matricula[10]; char curso[30]; }tAluno; tAluno gAlunos[100]; unsigned int ConsultaAlunos(char *curso){ int i, cont=0; for(i=0; curso[i] != '\0'; i++){ if(strcmp(curso, gAlunos[i].curso) == 0){ ++cont; } ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdint.h> #include <sys/mman.h> #include <fcntl.h> #include <errno.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #define BUF_SIZE 64 #define PS_PL_ADDR 0x0000 #define PS_PL_VALUE 0x0001 #define PL_PS_ADDR ...
C
#include <unistd.h> #include <unistd.h> #include <stdlib.h> void ft_putchar(char c) { write(1,&c,1); } void ft_putstr(char *str) { while(*str) { ft_putchar(*str++); } } int ft_strlen(char *str) { int len = 0; while (str[len++]){;} return (--len); } int ft_wdmatch(char *s1, char *s2) { int len_s1 = ft_strlen(s...
C
#include "Shell.h" void running(){ char *input; scanf("%s",input); struct Command a = parse(input); printf("parse finished\n"); switch (a.sequence) { case 0: return 0; break; case 1: info(); break; default: break; } } void info(){ cha...
C
/* @(#)indino.c 1.1 */ indino(tovax,fdo,fsize,size,num,blk) int tovax,fdo,num; long fsize,blk; long *size; { /* * This recursive subroutine converts the inode indirect blocks * by swapping the two words on longs. */ /* * tovax = 1 if converting to a vax format * fdo = output file descriptor * n...
C
#include<stdio.h> int main(void) { int x; scanf("%d",&x); //double amount; int amount; amount = x * 2 * 1 * 2; printf("%d",amount); return 0; }
C
#pragma once #include <inttypes.h> #include <stdint.h> #ifdef __cplusplus extern "C" { #endif /* Exact integral types */ // Signed typedef int8_t vic_int8_t; typedef int16_t vic_int16_t; typedef int32_t vic_int32_t; typedef int64_t vic_int64_t; // Unsigned typedef uint8_t vic_uint8_t; typedef uint16_t vic_uint16_t;...
C
/* ** inventaire.c for in /home/querat_g/tmp/PSU_2015_zappy/src/server ** ** Made by querat_g ** Login <querat_g@epitech.net> ** ** Started on Sun Jun 26 14:45:36 2016 querat_g ** Last update Sun Jun 26 14:45:36 2016 querat_g */ #include <stdbool.h> #include <stdlib.h> #include <string.h> #include "server.h" #incl...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <pthread.h> struct sockaddr_in addr; int success = 0; int failed = 0; int failed_conn = 0; char request[] = "GET / HTTP/1.1\r\nHost: 127.0.0.1:8080\r\n\r\n"...
C
#include <stdio.h> #include <stdlib.h> int main() { int a, b; a = 0; b = a++ * 2 + 1; printf("After postincrement\n"); printf("A: %d\n", a); printf("B: %d\n", b); printf("\n"); a = 0; b = ++a * 2 + 1; printf("After preincrement\n"); printf("A: %d\n", a); printf("B: ...
C
#include "adj_list.c" int main() { al_graph *graph = al_graph_create(18, true); al_graph_insert_edge(graph, 0, 2); al_graph_insert_edge(graph, 0, 14); al_graph_insert_edge(graph, 1, 4); al_graph_insert_edge(graph, 1, 5); al_graph_insert_edge(graph, 2, 1); al_graph_insert_edge(graph, 2, 5); ...
C
/* * @file : myStack.h * @author : Marcelo Fernandez * @date : 25/06/2021 * @brief : declaración de funciones y estructura para mi stack y sus nodos, tarea 1 ELO320 */ #define NLEN 30 typedef struct NODO { char nombre[NLEN]; char apellido[NLEN]; int nota; struct NODO* previous; stru...
C
#include"link.h" #pragma warning(disable:4996) Contact sta; void menu(void) { printf("**************************************\n"); printf("***********1.ϵ***************\n"); printf("***********2.ɾָϵ***********\n"); printf("***********3.ָϵ***********\n"); printf("***********4.޸ָϵ***********\n"); printf("***********...
C
// to execute // gcc midpointellipse.c -lgraph -o a // ./a // enter point a and b #include<graphics.h> #include<stdio.h> int main() { double a,b; printf("enter a and b"); scanf("%lf%lf",&a,&b); int gd=DETECT,gm; initgraph(&gd,&gm,NULL); double x=0,y=b; double fx=0,fy=2*(a*a*b); double p=(b*b)-(a*a*b)+(...
C
#include <stdio.h> #include <stdlib.h> int compare(const void *a, const void *b); int main(void) { int a[100] = {0, 2, 3, 4, 5, 0, 1, 1}; qsort(&a[50], 50, sizeof(a[0]), compare); return 0; } int compare(const void *a, const void *b) { if(*((int*) a) < *((int*) b)) return -1; el...
C
#include <stdio.h> #include <conio.h> #include <stdlib.h> int main() { FILE *fp; char name[20]; int age,salary; char another = 'y'; fp = fopen("d:/data/employee.exe","w"); if(fp==NULL){ printf("cannot open file"); exit(1); } while(another=='y'){ printf("ente...
C
#include<stdio.h> int main() { char dig_word[][10]={"zero","one","two","three","four","five","six","seven","eight","nine"}; char ten_word[][10]={"zero","ten","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"}; int n,flag=0; scanf("%d",&n); if(n > 100 && n%100 > 0) flag = 1; ...
C
#include<stdlib.h> #include<stdio.h> #include<graphics.h> void ff4(int x, int y, int oc, int nc){ if(getpixel(x,y) == oc){ putpixel(x,y,nc); ff4(x, y+1, oc, nc); ff4(x-1, y, oc, nc); ff4(x, y-1, oc, nc); ff4(x+1, y, oc, nc); } return; } void ff8(int x, int y, int oc...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> int main() { int rock = 1, scissors = 2, paper = 3; int computer, me; int draw = 0, win = 0; srand((int)time(NULL)); computer = rand() % 3 + 1; while (1) { printf("r: 1, s: 2, p: 3 your choice: "); scanf("%d\n", &...
C
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include "h264_stream.h" h264_stream_t *h264_stream_new(uint8_t *data, int size) { h264_stream_t *s = malloc(sizeof(h264_stream_t)); s->data = data; s->size = size; s->bit_pos = 7; s->byte_pos = 0; return s; } h264_stream_t *h264_stre...
C
#include <utility.h> #include <userint.h> #include <ansi_c.h> #include "util.h" #include "list.h" #include "listu.h" #define TRUE 1 #define FALSE 0 struct listStruct listG; void list_Init (listPtr list); nodePtr list_GetNode (listType list, int i); int list_FindItem (listType list, void *item); int list_A...
C
#include <stdio.h> #include <stdlib.h> int main(void){ char * ascii; ascii = "ab"; printf("%d\n", ascii); ascii = "ac"; printf("%d\n", ascii); return 0; }
C
#include<stdio.h> #include<sys/types.h> #include<unistd.h> #include<fcntl.h> #include<sys/wait.h> int index = 0; void StartSignal(int n) { printf("Process %d catch signal %d \n",getpid(),n); index++; } int main() { int a1, a2; double e2 = 0, pi = 0, f, qw; char argum[10]; int fd1[2], fd2[2];...
C
// ̾ #ifdef _WIN32 #pragma warning(disable:4996) // c io #pragma warning(disable:6031) // ȯ #pragma warning(disable:4018) // unsigned int ȯ #endif #include <cstdio> int to_num(char c) { if (c < 'S') return (c - 'A') / 3 + 2; else if (c == 'S') return 7; else if (c < 'W') return 8; else return 9; } in...