language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h> #define BUFSIZE 1024 char buf[BUFSIZE]; int main(int argc, char **argv) { int ret = -1; FILE *bin = 0; FILE *out = 0; char *name = 0; if (argc != 4) goto cleanup; out = fopen(argv[1], "w"); if (!out) goto cle...
C
#include <stdio.h> #include <stdlib.h> int pedirOpcionesMenu(char texto[]); int main() { int opcion; char seguir = 's'; do { opcion = pedirOpcionesMenu("1. suma \n 2. Baja \n 3. restar: \n 4. Informes: \n 5. Salir: \n Elija una opcion: \n"); switch(opcion) { ...
C
#include <stdio.h> #include <stdlib.h> #include "Employee.h" #include "parser.h" #include "controller.h" #include "input.h" #include "LinkedList.h" int main() { int opcion= 0; int flag=0; LinkedList* listaEmpleados = ll_newLinkedList(); opcion=menu(); do{ switch(opcion) ...
C
/********************************************************************* Thanks to Adafruit for their GFX and SSD1306 libraries *********************************************************************/ #include "Adafruit_GFX.h" #include "Adafruit_SSD1306.h" Adafruit_SSD1306 display(-1); #define FONT_SIZE 4 #def...
C
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> void cutSticks(int * stick, int count){ //printf("started cutSticks\n"); int min = - 1; int i = 0; while(i < count){ if((stick[i] < min) || (min < 0)){ min = stick[i]; } i++; } int sticks_left = count; int cuts = 0; int new_m...
C
#include <stdio.h> extern void print_all(int n, char **s); int main(int argc, char **argv) { printf("hello world!\n"); print_all(argc,argv); return 0; }
C
#include <stdio.h> #include <stdlib.h> int main(void){ int i = 0; char str[256]; int Character = getchar(); while(Character != EOF){ while(Character != '\n'){ str[i] = Character; i++; Character = getchar(); } int j = i - 1; while(j >= 0){ printf...
C
/* System-wide header files. */ #include <string.h> #include <stdio.h> #include <stdlib.h> #include "wHeapUtil.h" #include "wHeap.h" #define TRUE 1 #define FALSE 0 #define HEAPSIZE 3 #define FILENAME 2 int insertRecord(FILE *inFile, File* heapFile, int pageSize) { int i,endOfFile = FALSE; /* EndOfFile = last line...
C
#include<stdio.h> int main() { int a[10][10],i,j,n,m; float avg,sum=0; scanf("%d",&n); for(i=0;i<n;i++) { for(j=0;j<n;j++) { scanf("%d",&a[i][j]); } } for(i=0;i<n;i++) { for(j=0;j<n;j++) { sum=sum+a[i][j]; } } m=n*n; avg=sum/m; printf("%f",avg); return 0; }
C
#include "population.h" //creates a new population of genes and stores them in head_population void createPop(){ //initialize headpointer head_population=(popptr)malloc(sizeof(struct population)); head_population->n=0; popptr h1=head_population; //create genes for(int i=0;i<NO_POP;i++){ ...
C
/* * File: main.c * Author: Igor de Souza Rosler * * Created on 3 de Abril de 2019, 10:50 */ #include <stdio.h> #include <stdlib.h> typedef struct grafo { int eh_ponderado; // Indica se o grafo é ou não ponderado int grau_max; // Indica o grau máximo que cada vértice pode possuir int num_vertices;...
C
/*************************************/ /* Author : AHMED ASHRY */ /* DATE : 17 AUG 19 */ /* VERSION : 001 */ /*************************************/ /* HEADER FILE GUARDIAN */ #ifndef STD_TYPES_H_ #define STD_TYPES_H_ /* Defined Data Types */ /*type of unsigned 8 b...
C
/* ** EPITECH PROJECT, 2018 ** str_to_tab ** File description: ** str_to_tab */ #include "n4s.h" static int num_word(char *str, char charact) { int i = 0; int nb = 0; while (str[i] != '\0') { while (str[i] == charact || str[i] == '\t') i++; if (str[i] != '\0') nb++...
C
#include <stdio.h> void f(int a,int b) { if(a>b) return; if(a%2==1) { printf("%d ",a); } f(++a,b); } int main() { int n,k; scanf("%d %d",&n,&k); f(n,k); }
C
#pragma once #define s_buffer 256 #define b_buffer 1024 bool fly_gra = false; // fly/gravety = false // Default makes flying / no gravity imposible bool onc_wallz = false; // makes it so you cannot go pass the broder +256x and -256x void readInput(string in) { if (in == ".spawn") { x = 1; z = 1; cout << "You ...
C
#include <linux/types.h> #include <pthread.h> #include "test_util.h" void * threadWork(void * p); void testPutRemoveOne(){ putval(1,5); removval(1); printf("%s\n","...testPutRemoveOne successful!" ); } void testNoObject(uint8_t key){ uint8_t *val; ssize_t ret; ret = hashtable_get(key,(void** )&val); if(ret !...
C
#include "user_info.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <pwd.h> #include <unistd.h> /** * Gets the username */ void get_user() { uid_t uid = geteuid(); struct passwd *pw = getpwuid(uid); if (pw) { strcpy(USERNAME, pw->pw_name); } } /** * Gets the hostname of the system *...
C
// mah.c ... generate multi-attribute hash values #include <stdio.h> #include <stdlib.h> #include "bits.h" #include "chvec.h" #include "tuple.h" void exitUsage(char *); // main ... process args and run simulation int main(int argc, char **argv) { char *cv, *tup; ChVec chvec; // collect argv values ...
C
#include<stdio.h> #include<conio.h> #include<stdlib.h> #include<unistd.h> #include<pthread.h> # define BUFFER_SIZE 8 int produceCount = 0; int consumeCount = 0; int buffer_array[BUFFER_SIZE]; pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; void* producer (void* arg) { int itemProd = 0; int i = 0; while (1) {...
C
/* * rs232_buffer.c * * Created on: 5 . 2017 . * Author: dmsvo */ #include "rs232_buffer.h" /* ASCII. 16. * , , * , . * , , (, , ) . */ char digToChar(int num, char base) { /* , */ char dig = num % base; if ((dig >= 0) && (dig <= 9)) { return N...
C
/***************************************************************************/ /* This module provides all the necessary resources to represent polygons. */ /* This includes displaying polygons and repreenting verticies. */ /***************************************************************************/ #ifndef ...
C
#include "position.h" int position_equal(char *a, char *b) { return a[0] == b[0] && a[1] == b[1]; } int position_valid(char *position) { return position[0] != '-' && position[1] != '-'; } void position_copy(char *src, char *dst) { dst[0] = src[0]; dst[1] = src[1]; } int position_to_x(char file) { ...
C
/* 04. Escreva uma função que receba um vetor de inteiros e retorne o maior elemento e o menor elemento. Observe que a função deve retornar ao local da chamada os dois valores (não imprimir ao usuário). Portanto, você precisará usar passagem de parâmetro por referência. */ #include<stdio.h> void busca(int v[], in...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <locale.h> typedef struct dataNode { char dataRef[10]; int codReg; char informante[30]; char desc[30]; float qttProd; }DataNode; typedef struct node { DataNode *data; struct node* next; }Node; typedef struct list { Node *h...
C
#include<iostream> #include<stack> #include<stdlib.h> using namespace std; struct Point { int x,y; } Point p0; Point nextToTop(stack<Point> &S) { Point p=S.top(); S.pop(); Point r=S.top(); S.push(p); return r; } int swap(Point &p1, Point &p2) { Point temp = p1; p1 = p2; p2 = temp;...
C
#include <string.h> /* * store c througout unsigned char s[n] */ void * Memset(void *s, int c, size_t n) { const unsigned char uc = c; unsigned char *su; for (su = s; 0 < n; --n) *su = uc; return (s); }
C
void ft_swap_char(char *a, char *b) { char c; c = *a; *a = *b; *b = c; }
C
#include <crisp/env.h> #include <crisp/gc.h> #include <crisp/list.h> void cr_env_free_binds(cr_env * env){ cr_map * map = env->binds; for(int i = 0; i < map->capacity; i++){ cr_list * bucket = map->buckets[i]; if(bucket){ for(cr_node * node = bucket->head; node; node = node->next){ cr_entry *...
C
#include <stdio.h> /** * main - Entry point * * Return: void (Success) */ int main(void) { int g; for (g = 1; g <= 100; g++) { if ((g % 3 == 0) && (g % 5 == 0)) { printf("FizzBuzz"); } else if (g % 3 == 0) { printf("Fizz"); } else if (g % 5 == 0) { printf("Buzz"); } else { printf("%i", g); } if (g != 100) { print...
C
#include <stdlib.h> #include <stdio.h> struct clientData { unsigned int numeroConto; char cognome[35]; char nome[35]; double saldo; }; typedef struct clientData ClientData; int main(void){ FILE *cfPtr; char insert = 'i'; int count = 0; if ((cfPtr = fopen("accounts.dat", "rb+")) == NUL...
C
void lud_base(float *a, int size) { int i,j,k; float sum; for (i=0; i<size; i++){ for (j=i; j<size; j++){ sum=a[i*size+j]; for (k=0; k<i; k++) sum -= a[i*size+k]*a[k*size+j]; a[i*size+j]=sum; } for (j=i+1;j<size; j++){ sum=a...
C
#include "mod.h" //޸Ľڵģ void mod(Book* head) { system("cls"); //Ϊգʼ޸ if (head) { Book* p; //ָ int id1, id2, inventory1; //num1鼮޸Ϣ,num2޸ char name1[50], author1[20]; float price1; printf("Ҫ޸ĵͼţ"); //Ҫ޸ĵͼ scanf_s("%d", &id1); p = head->next; while (p != NULL) { if (p->id == id1) { //жǷҵ鼮 pri...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* rush01 :+: :+: :+: ...
C
#include "stdio.h" #include "stdlib.h" #include "string.h" #define MIN(x,y) (((x)<(y)) ? (x) : (y)) void* my_realloc(void* ptr, size_t new) { if (ptr == NULL) { return malloc(new); } if (new == 0) { free(ptr); } void* newPtr = malloc(new); size_t current = ((size_t*)ptr)[-1]; memcpy(ptr, newPtr, MIN((i...
C
#include "holberton.h" /** * _strpbrk - return pointer to byte in s that matches a byte in accept * @s: string to search * @accept: target matches * Return: pointer to index of string at first occurence */ char *_strpbrk(char *s, char *accept) { int i; while (*s) { for (i = 0; accept[i]; i++) { if (*...
C
#include<stdio.h> #include<string.h> int main(){ int i = 1, False = 0, targetTrue = 1; char target[1000003] = {}, temp[1000003] = {}, input[4]; fgets(target+1, 500003, stdin); while(fgets(input, 4, stdin) != NULL){ if(input[0] == '\\'){ if(target[i-1] != temp[i-1]){ ...
C
//fgetc(), getchar(), fputc(), putc(), putchar(), ungetc() //getwc(), fgetwc(), getwchar(), putwc(), fputwc(), putwchar(), ungetwc() #include <stdio.h> int getc(FILE* fp); FILE* inputs[16]; int i = 0; do { int nextchar = getc(inputs[i++]); } while(i < 16); for(int i = 0; i < 16; i++){ int nextchar = getc(input[i...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <math.h> typedef struct { int heap_size; int max_size; int *nodo; }heap; int kN(int dim) { int k, low; low = 0.5*dim; k = low + rand()%(dim - low); return k; } int kLog_N(int dim) { double l = ...
C
#include <stdio.h> #include <sys/socket.h> //For Sockets #include <stdlib.h> #include <netinet/in.h> //For the AF_INET (Address Family) #include <string.h> #include <netdb.h> #define MSG_BUF 1024 int main(int argc, char* argv[]){ struct sockaddr_in serv_addr; int fd; char buffer[MSG_BUF]; //domain name struct ...
C
#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { char *filename; if( argc > 1 ) { filename = argv[1]; } else { fprintf(stderr,"Filename argument required\n"); exit(1); } printf("The filename is %s\n",filename); return(0); }
C
#include <stdio.h> #include <stdlib.h> #include "object.h" #include "list.h" #include "string_util.h" DECLARE_OBJECT(Integer, int); void printInt(int x) { printf("%d", x); } int main() { Scope scope = newScope(); Integer p = newInteger(scope); *objectRawPtr(p) = 100; ListInt lst = newListInt(scope,...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_conv_char.c :+: :+: :+: ...
C
#define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/wait.h> #include <sys/types.h> #include <sys/mman.h> #include <sys/sysinfo.h> #include <sched.h> #include <semaphore.h> #include "util.h" sem_t mutex; void fileToArray(char *filename, double *f, int array_size) { FILE *file...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* utilities.c :+: :+: :+: ...
C
#include <stdio.h> int main(void){ long long n; int d[] = { 1, 2, 3, 4, 5, 6 }; int tmp; scanf( "%lld", &n ); for( int i=0; i<n%30; ++i ){ tmp = d[i%5]; d[i%5] = d[i%5+1]; d[i%5+1] = tmp; } for( int i=0; i < 6; ++i ){ printf("%d",d[i]); } printf("\n"); }
C
/* unicode.h - Header file for Unicode library. Copyright (C) 1999, 2000 Tom Tromey The Gnome Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (a...
C
#include<stdio.h> #include<math.h> //Input seconds, output ??Hours ??minutes ??seconds, // void main() { long input_seconds; long output_hours, output_minutes,output_seconds; printf("Input the Total seconds that will be converted to HH:MM:SS \n"); scanf("%d",&input_seconds); output_hours = input_seconds / 3...
C
/* * app.c * * Created on: 3 févr. 2020 * Author: eleve */ #include "app.h" #include "square.h" Uint32 _AppAnimateCallBack(Uint32 interval, void*pParam); void _AppCreateSquare(int x, int y); void _AppMouseButtonUp(SDL_Event*pEvent); enum APP_STATUS { ST_ALL_CLEARED = 0x00000000, ST_ALL_SETTED = 0xF...
C
/** * @file game.c * @author Adam Sinclair * @created Tues March 27 2018 * @purpose Entry point for Dog Gone Wild **/ #include "game.h" #include "debug.h" void animationDone(char* animation) { return; } void setupAnimations(AnimatedSprite* as) { int frameCount = 4; Vector2 left_location = {0, 60}; ...
C
#include "common.h" #include <string.h> static int setbootcounter_emmc(unsigned char val); static int setbootcounter_nvram(unsigned char val); int gethwcode() { static int hw_code = -1; // return cached value if already called if (hw_code != -1) return hw_code; int hc = -1; char cmdline[MAXPATHLENGT...
C
static struct rico_physics *make_physics(struct vec3 min_size) { struct rico_physics *phys = calloc(1, sizeof(struct rico_physics)); phys->min_size = min_size; return phys; } static void free_physics(struct rico_physics *phys) { free(phys); phys = NULL; } static void update_physics(struct rico_phys...
C
#include <stdio.h> //Inventory of Phone Tech Specs owned by //CMSC11 students v2.0 //includes new structure for student owner struct phone{//forward referencing structure int phoneID; char brandName[10]; float price; char phoneOS[10]; struct student *owner; }; struct student{ int...
C
/** * _strspn - compute length of matching contiguous bytes * @s: string to calculate substring length from * @accept: string containing bytes to match * Return: length of matching contiguous bytes */ unsigned int _strspn(char *s, char *accept) { unsigned int count = 0, match = 0, i; while (*s) { for (i = 0;...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include <string.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <arpa/inet.h> #include <sys/wait.h> #include <signal.h> #define MYPORT "9999" #define BACKLOG 10 void sigchld_handler(int...
C
/* write a program to count number of zero and one's bit in a given number */ #include<stdio.h> int countZeroBits(int no); int countOneBits(int no); int main(){ int no; printf("Enter the number:\n"); scanf("%d",&no); printf("Count of Zero bits is:%d\n",countZeroBits(no)); printf("Count of One bits is:%d\n",coun...
C
#include<stdio.h> double exchange (int n, double expenses[]); double mean( int n, double numbers[]); int main(){ int numberOfStudents; while( scanf("%d", &numberOfStudents) ){ if(numberOfStudents == 0 ){ break; } double expenses[numberOfStudents]; for(int i = 0; i < numberOfStudents; i++){ scanf("%lf", &expe...
C
/* HTTP Request Parser Parses HTTP requests into appropriate data structs Synax to be parsed is defines as EXPECTED_FORMAT where [x] and [y] are double and [z] is an integer trueFalse.h contains defines to emulate boolean variables, and must be included with this file By: Jumail Mund...
C
/* * upb - a minimalist implementation of protocol buffers. * * Copyright (c) 2011 Google Inc. See LICENSE for details. * Author: Josh Haberman <jhaberman@gmail.com> * * A simple example that demonstrates creating a standard message object * and parsing into it, using a dynamic reflection-based approach. * * ...
C
#include <stdio.h> int main() {int a[100],b[100],i,j,n,k=0,l=0,m,z=0; printf ("Introduceti dimensiunea vectorului: "); scanf ("%d",&n); printf ("Introduceti valorile vectorului: \n"); for (i=0;i<n;i++) scanf ("%d",&a[i]); printf ("Vectorul: \n"); for (i=0;i<n;i++) printf ("a[%d]=...
C
#include "../headers/find_first_group.h" #include "../headers/sort.h" #include "../headers/neh.h" #include "../headers/nearest_neighbor.h" #include "../headers/calculate_tardiness.h" #include <stdlib.h> /*! Cette macro retourne le maximum entre @c x et @c y. */ #define MAX(x,y) ( (x) >= (y) ? (x) : (y) ) /*! Un ...
C
#include "zbaselib_queue.h" #define QUEUE_RETURN_VAL_IF_NULL(queue, val) \ if(queue == NULL || queue->list == NULL) \ { \ return val; \ } struct _zbaselib_queue { zbaselib_list* list; }; zbaselib_queue* zbaselib_queue_create(destroy_data_func ddfunc) { zbaselib_queue* thiz = (zbaselib_queue*)ma...
C
// // main.c // ExampleC // // Created by Matthew Lu on 6/06/2014. // Copyright (c) 2014 Matthew Lu. All rights reserved. // #include <stdio.h> #define MAXLINE 1000 // maximum input line size int myGetline(char line[], int maxline); void copy(char to[], char from[]); //print longest input line int main(int a...
C
// // Created by 唐艺峰 on 2017/12/11. // #include "expr4.h" void traversalCurDir(char *dirName) { DIR *curDir = opendir(dirName); chdir(dirName); struct dirent *each; long fileSize = 0; long long maxSize = 0; while ((each = readdir(curDir)) != 0) { if (each->d_name[0] == '.') { ...
C
#include "argparser.h" SpecNode *argParser(int argc, char **argv) { SpecNode *specifications = initSpecNode(); if (argc > 6) { errorReport("TOO MANY ARGUMENTS"); } int opt; while ((opt = getopt(argc, argv, "-:p:m:")) != -1) { switch (opt) { case 'p': ...
C
#include<stdio.h> #include<stdlib.h> typedef struct linkList{ int num; struct linkList *next; }LINKLIST; //生成链表 LINKLIST *createLinklist() { LINKLIST *h=(LINKLIST *)malloc(sizeof(LINKLIST)); h->next=NULL; return h; } //插入数据 void insertData(LINKLIST *h,int data) { LINKLIST *p=(LINKLIST *)malloc(sizeof(LINKLIST)...
C
#include <stdio.h> #include <stdbool.h> int main () { int last_char, current_char; bool single_comment; bool multi_comment; last_char = 'a'; while ((current_char = getchar()) != EOF) { if (current_char == '\n') single_comment = false; else if ((current_char == '/' && l...
C
/* ============================================================================ Name : coordinador.c Author : Los Simuladores Version : Alpha Copyright : Todos los derechos reservados Description : Proceso Coordinador ============================================================================ ...
C
#ifndef STATE_H #define STATE_H #include "card.h" // State contains information about the last change that occured in the game. // State either describes a play, a discard, or the start of a new round. // The fields player and card are not relevant if the action is NewRound. enum Action { Play, Discard, NewRound }; ...
C
/************************************************************ * Filename: part1a-mandelbrot.c * Student name: Wang, Michelle Yih-chyan * Student no.: 3035124441 * Date: Nov 2, 2017 * version: 1.1 * Development platform: Course VM * Compilation: gcc part1b-Mandelbrot.c l SDL2 -lm ****************************************...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "cliente.h" #include "pedido.h" #include "residuos.h" #include "utn_strings.h" int ped_initPedido(Pedido* pPedido,int len) { int i; if(pPedido!=NULL && len>0) { for(i=0; i<len;i++) { pPedido[i].idPedido=i+1; ...
C
#include <stdio.h> #include <stdlib.h> #include <sys/file.h> #include <unistd.h> int main() { int file = open("neptunkod.txt",O_RDWR); //int pufferbe olvassuk be a txt-t if (file > 0) //ellenőrizzük a beolvasás sikerességét { printf("sikeres beolvasas\n\n"); } else { printf("h...
C
#include <stdio.h> unsigned long int factorial(int); int fibonacci(int); int print_odds(int); int print_numbers(int, int, int); int print_evens(int); int multiplication_table(int, int); int sum_of_n_numbers(int, int); int product_of_n_numbers(int, int); int print_odd_numbers(int,int); int print_nth_number(int, int ,in...
C
#include<stdio.h> #include<stdlib.h> int main() { int x, y; int temp_x, temp_y; int n; int i; if (n < 2) { for (i = 0; i < n; i++) { scanf("%d %d", &x, &y); } printf("-1"); }else if(n == 3 || n == 4) { for (i = 0; i < n; i++) { scanf("%d %...
C
#include<stdio.h> #define m 5 int s[m-1],top=-1; int pop() { int d; if (top==-1) { printf("Underflow"); } else { d=s[top]; top=top-1; } return d; } void push(int a) { if(top==m-1) { printf("Overflow"); } else { top=top+1; s[top]=a; } } int palin() { int n,i,f; printf("Enter the number of ele...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* type_x.c :+: :+: :+: ...
C
#include <stdio.h> #include <string.h> int main(){ int i; for(i=0;i<3 && i< 10;i++) { printf("%i",i); } if(i==3) { printf("es el mismo"); } return 0; } void Directorio(EXT_ENTRADA_DIR *directorio, EXT_BLQ_INODOS *inodos){ //COMANDO dir //Se iterara sobre los directorios usados o borrados hasta llegar a uno vaci...
C
#include<pthread.h> #include<stdio.h> int ticketcount = 10; pthread_mutex_t lock; //互斥锁 pthread_cond_t cond; //条件变量 void* salewinds1(void* args) { while(1) { pthread_mutex_lock(&lock); //因为要访问全局的共享变量ticketcount,所以就要加锁 if(ticketcount > 0) //如果有票 { printf("windows1 start sale ticket!the ticket...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> void change(char* text) { int i=0,n=strlen(text); for(;i<n;i++) { switch(text[i]) { case 'a': case 'b': case 'c': case 'A': case 'B': case 'C': text[i]='X'; bre...
C
/*============================================================================= The LLL-Reduction Algorithm Authors ------- * Grady Williams (gradyrw@gmail.com) * Chris Swierczewski (cswiercz@gmail.com) =============================================================================*/ #include <stdlib.h> #include <st...
C
/* Ryan Sprowles fork_and_exec.c - forks the program and uses the execvp fucntion to fork off the current function and then execute using the fork instead of the master */ #include "fork_and_exec.h" void fork_and_exec(char **args, char fullcmd []) { int pid, status; int i; /* * Get a ...
C
//problema 2 //Determina si un cuerpo esta en reposo o no #include<stdio.h> #define TAM 50 int suma_terminos (int n,int p[]) { int i,s=0; for(i=0;i<p[n];i++){ s+=p[i]; } return s; } int vectores (int n,int a[],int b[],int c[]) { int x,y,z; x=suma_terminos(n,a); y=suma_terminos(n,b); z=suma_terminos(n,c)...
C
#include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h> #include <libgen.h> #include "answer05.h" #define TRUE 1 #define FALSE 0 #define BITS_PER_PIXEL 8 /* typedef struct ImageHeader_st { uint32_t magic_number; // Should be ECE264_IMAGE_MAGIC_NUMBER uint32_t width; // [width x heig...
C
#include <stdio.h> #include <stdlib.h> #define MAX_TREE_HT 50 struct Node { char item; int freq; struct Node *left, *right; }; struct Heap { int size; int capacity; struct Node **array; }; struct Node *init(char item, int freq) { struct Node *n = (struct Node *)malloc(sizeof(struct Node)...
C
#include "stm32f4xx.h" #include <string.h> #include<stdio.h> void printAnd(const int a) { char Msg[100]; char *ptr; sprintf(Msg,"\n____AND FUNCTION__________"); ptr = Msg ; while(*ptr != '\0') { ITM_SendChar(*ptr); ++ptr; } sprintf(Msg, "%x", a); ptr = Msg ; } voi...
C
#include <stdio.h> #include <string.h> int main() { char a[100]; int length; printf("Enter a string to calculate it's length: \n"); scanf(" %s", a); length = strlen(a); printf("The length of the string is %d. \n", length); return 0; }
C
#include <stdio.h> #include <string.h> #include <sds.h> sds matrix_show(int **matrix, int matrixSize, int *matrixColSize) { sds str = sdsnew("["); for (int i = 0; i < matrixSize; ++i) { str = sdscat(str, "["); for (int j = 0; j < *(matrixColSize + i); ++j) { if (j == 0) { str = sdscatprintf(...
C
/* See LICENSE file for copyright and license details. */ #include "common.h" #ifndef TEST void * libsimple_rawmemrchr_inv(const void *s_, int c_, size_t n) { char *s = *(char **)(void *)&s_, c = (char)c_; while (s[--n] == c); return &s[n]; } #else #include "test.h" int main(void) { assert(!strcmpnul(libsimple...
C
#include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <sys/wait.h> #define MSIZE 128 int main(){ char inBuffer[MSIZE]; int p[2], nbytes, pid; if (pipe(p) < 0) { perror("Pipe error"); exit(1); } pid = fork(); if (pid < 0) exit(2); //Child beler a pipe-ba if (pid == 0) { printf("Child...
C
#ifndef __DEQUE_H__ #define __DEQUE_H__ // std #include "stdio.h" #include "stdlib.h" // sys #include "pthread.h" // local #include "product.h" #include "utilities.h" #include "semaphore.h" typedef struct product_deque_t { pthread_mutex_t mutex; sem_t full, empty; product_t *products; unsigned size, max_siz...
C
/* * Copyright (c) 2019-2022, Arm Limited. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * */ #include "crt_impl_private.h" void *memcpy(void *dest, const void *src, size_t n) { union composite_addr_t p_dst, p_src; p_dst.uint_addr = (uintptr_t)dest; p_src.uint_addr = (uintptr_t)src;...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> main() { int v1,v2,v3,v; printf("digite o primeiro valor\n"); scanf("%d",&v1); printf("digite o segundo valor\n"); scanf("%d",&v2); printf("digite o terceiro valor\n"); scanf("%d",&v3); if(v1>=v2){ if(v3>v2) v=v1+v3; else v=v1+v2; printf("%d\n",v);...
C
/* * Copyright (C) 2017 - 2020 Christoph Muellner * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 2 * of the License, or (at your option) any later version. * * This pro...
C
#include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h> #include "config.h" #include "my_msgq.h" int main(int argc, char *argv[]) { printf("Compile time:%s %s\n", COMPILE_DATE, COMPILE_TIME); printf("GCC version:%s\n", GCC_VERSION); printf("--------Git--------\n%s\n",GIT_ALL); my...
C
#include <gtk/gtk.h> #include <string.h> #include <ctype.h> #include<stdlib.h> #include<time.h> int loadAllHints(); char *strupr(char *str); void genAlert(char message[]); void on_btn_rehint_clicked(); void on_btn_main_menu_clicked(); GtkWidget *window; GtkWidget *g_lbl_hint; GtkWidget *g_btn_submit; GtkWidget *g_l...
C
/* ================================================================== * Universidade Federal de Sao Carlos - UFSCar, Sorocaba Disciplina: Estruturas de Dados 1 Prof. Tiago A. Almeida Exercício 04 - Ultima Carta Instrucoes ---------- Este arquivo contem o codigo que auxiliara no desenvolvimento do exercicio....
C
/* ** pointer.c for pointer in /home/lnanaay/projets/PSU_2016_my_printf ** ** Made by Nathan Lebon ** Login <lnanaay@epitech.net> ** ** Started on Fri Nov 11 16:16:13 2016 Nathan Lebon ** Last update Fri Nov 18 12:47:14 2016 Nathan Lebon */ #include <stdarg.h> #include "my.h" void convert_long(unsigned long nb...
C
#include <stdio.h> #include <stdlib.h> /**Função que recebe uma sopa de letras a e um array b de coordenadas e escreve em s os caracteres das coordenadas.*/ void descobrir(char **a, int b[], int N, char s[]){ int i, j = 0; int tam = N/2; int e, d; for (i=0; i < tam; i++){ e = b[j]-1; d = b[j+1]-1; s[i] = a[e][d]; ...
C
#include "stdio.h" /***********第2题***********/ void practice2() { int Ascii = 0; printf("please enter the Value of ASCII:"); scanf("%d",&Ascii); printf("\nyour enter value is:%d",Ascii); printf("\nthe character:%c.\n",(char)Ascii); getchar(); } /************第3题**************/ void practice3() ...
C
#include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/time.h> #include <sys/wait.h> #include <string.h> #include <signal.h> #include <fcntl.h> #include <time.h> int main(){ int pid; if((pid = fork()) < 0){ printf("fork fail\n"); } ...
C
/*Faça um algoritmo que receba uma data no formato DDMMAAAA e escreva qual a estação do ano correspondente (Primavera, Verão, Outono, Inverno). Outono Mar a maio 2019 - 18:58h Inverno Jun a agosto2019 - 12:54h Primavera Set a novemb 2019 - 04:50h Verão Dez a fevereiro 2019 - 01:19h*/ #include <stdio.h> #include <...