language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include <stdlib.h> #include "funciones.h" #define TAM 50 int main() { char seguir='s'; int cantidad; ePelicula* peliculas; peliculas = newArrayPeliculas(TAM); if(peliculas == NULL) { printf("No se pudo conseguir memoria en peliculas\n"); exit(1); } ...
C
//NAME: Kevin Zhang //EMAIL: kevin.zhang.13499@gmail.com //ID: 104939334 #include "stdio.h" #include <pthread.h> #include <time.h> #include <getopt.h> #include <stdlib.h> #include <string.h> int numThreads = 1; int numIterations = 1; char lock = 'n'; //no lock int opt_yield = 0; pthread_mutex_t mutex; int spin_flag =...
C
// Created by Jaymo Aymer on 15/03/2021. #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <pthread.h> #include "routine.h" #include "pthreadCreateErrorHandler.h" #include "pthreadJoinErrorHandler.h" int main(int argc, char* argv[]) { // pthread_t vars pthread_t threadOne, threadTwo; /...
C
/***************************************************** Author:Dona Siby Title :Program to determine the youngest of three. Date :22/05/2021 ******************************************************/ #include<stdio.h> int main(){ int age1,age2,age3; //First student printf("\nEnter the age of first student : "...
C
#include <stdio.h> int main() { /* doesn't compile - ex. 2-2 */ int i = 0; for (; i < lim - 1; ++i) { c = getchar(); if (c == '\n') break; if (c == EOF) break; s[i] = c; } return 0; }
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> // =========================================================================== // =========================== DEFINICJA LIST ================================ // =========================================================================== ...
C
#include<iostream> #include<algorithm> using namespace std; int main(){ double x1,x2,y1,y2; double x3,x4,y3,y4; double m1,n1; double m2,n2; cin>>x1>>y1>>x2>>y2; cin>>x3>>y3>>x4>>y4; m1 = max(min(x1,x2),min(x3,x4)); n1 = max(min(y1,y2),min(y3,y4)); m2 = min(max(x1,x2),max(x3,x4)); ...
C
#include"misc.h" // rm extract; gcc -O4 extract.c -o extract; ./extract craigslist-apa-data-bc-html-othermeta.csv // note: should delete the html and otherAttributes folders before (re)running // // the program can use append mode for writing files, to catch records with same ID: // see line: int duplicates = 0; // to ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* as_store3.c :+: :+: :+: ...
C
/* GRR20190374 Tiago Henrique Conte Projeto de processamento de áudio Programa de mixagem de arquivos WAV */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "wav.h" #include "linhaDeComando.h" int main(int argc, char **argv){ FILE *input = NULL, *output = NULL; int inputPos[MAX_IN...
C
#include <stdio.h> int //.1. count_ones(unsigned v) { int ones = 0; while (v > 0) { v &= v - 1; ones++; } return ones; } //.2. int main() { unsigned values[] = { 123, 32, 255 }; for (int i = 0; i < sizeof(values)/sizeof(values[0]); i++) { unsigned v = values[i]; printf("# of ones in...
C
/************************************************************************* > File Name: echo_concurIO_client.c > Author: xjhznick > Mail: xjhznick@gmail.com > Created Time: 2015年03月25日 星期三 16时50分55秒 > Description:通过多进程分割客户端的I/O 在功能复杂的程序中,可以简化收发数据的处理逻辑; 可以提高频繁交换数据的程序性能,这在网速较慢的环境中尤其明显 ************************...
C
/* * Hash_DeleteTable.c -- * * Source code for the Hash_DeleteTable library procedure. * * Copyright 1988 Regents of the University of California * Permission to use, copy, modify, and distribute this * software and its documentation for any purpose and without * fee is hereby granted, provided that the above ...
C
#if !defined(ADDINFOMASTER_H_INCLUDE_) #define ADDINFOMASTER_H_INCLUDE_ #include "memstack.h" /* Fichero que maneja el addinfo master de las keywords de CTRL_SA Dependencias: MemStack - Almacenamiento en memoria de toda la estrutura */ struct ADDINFO_KEYWORD { struct ADDINFO_KEYWORD* next; char *val; char ke...
C
/** * \file vccrypt_stream_start_decryption.c * * Generic decryption start method for a stream cipher. * * \copyright 2018 Velo Payments, Inc. All rights reserved. */ #include <cbmc/model_assert.h> #include <vccrypt/stream_cipher.h> #include <vpr/parameters.h> /** * \brief Algorithm-specific start for the str...
C
#include<stdio.h> #include<sys/stat.h> #include<unistd.h> #include<fcntl.h> #include<sys/types.h> int main() { int queue[20],n,head; int i,j,k,dist=0,maximum,diff; float avgerage; printf("==============Developed by Jatin==========\n"); printf("Enter the maxi...
C
//#include <stdlib.h> #include <stdio.h> #include "pithread.h" void* func1(void *arg){ int i = 0; printf("Index initialized with 0\n"); for (; i < 10; i++){ printf("thread 1 with index %d\n\n", i); if (i % 5 == 0) piyield(); } return 0; } void* func2(void* arg){ int i = 0; for (; i < 10; i++){ pri...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> struct filme{ int codigo; char titulo[100]; int ano; int quantidade; char genero[10]; };typedef struct filme Filme; int nFilmes(); void carregarAcervo(Filme* filmes); void carregar(Filme* filmes, Filme* f, int n); Filme busc...
C
/* * Delta programming language */ #include "delta/delta.h" #include <math.h> #include <string.h> // from base_convert.c char* base_convert(char* in, int base1, int base2); /** * @category modules/core/math * * @brief Hexadecimal to decimal. * @syntax string hexdoc ( int hex_string ) * * Returns the deci...
C
#include "RGB.h" //PB9(RGB_DATA),PB8(RGB_CLK) void RGB_PIN_Init(void) { RCC->APB2ENR |=0x01<<3; GPIOB->CRH &=~(0xFF<<0); GPIOB->CRH |=(0x11<<0); RGB_Control(0,0,0); } u32 Color_DATA(u8 r,u8 g,u8 b) { u32 RGB_COLOR=0; RGB_COLOR |=0x03<<30; RGB_COLOR |=((~(b)&0xc0)>>6)<<28; RGB_COLOR |=((~(g)&0xc0)>>6)<<26; ...
C
#include <stdlib.h> // Contains declarations information #include <stdio.h> // I/O function #include <sys/types.h> // Defines data types #include <sys/socket.h> // Define the type socklen_t #include <netinet/in.h> // Contains definitions for the internet protocol family #include <string.h> // String func...
C
/* * Copyright (c) 2011, Courtney Cavin * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * - Redistributions of source code must retain the above copyright notice, * this list of con...
C
// PTIME - Prime Time #include <math.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { unsigned int in; scanf("%u", &in); bool *sieve = (bool *)malloc(sizeof(bool) * (in + 1)); memset(sieve, true, sizeof(bool) * (in + 1)); unsigned int *fraction = (...
C
#include <stdio.h> void imprimeVetor(int* vetor, int tamanho){ for(int i = 0; i < tamanho; i++) printf("%d | ", vetor[i] * 2); } int main(){ int vetor[] = {1, 2, 3, 4, 5}; int tamanho = (int)(sizeof(vetor)/sizeof(vetor[0])); imprimeVetor(vetor, tamanho); return 0; }
C
#include <stdio.h> void cadastra_cliente() { printf("--->[1] Cadastrar cliente\n\n"); } void procura_cliente() { printf("--->[2] Procurar cliente\n\n"); } void insere_pedido() { printf("--->[3] Inserir pedido\n\n"); } int escolhe_opcao() { int opcao; printf("[1] Cadastrar cliente\n" "[2] Procurar clien...
C
#include <errno.h> #include <fcntl.h> #include <sys/socket.h> #include <stdio.h> #include <netdb.h> #include <string.h> #include <unistd.h> #include "networking.h" #define SERVER_ADDRESS "127.0.0.1" #define PORT_NUMBER 5358 int socket_fd; int connectToServer() { // create TCP (NON-BLOCKING) socket socket_fd...
C
#include <sys/select.h> #include <stdio.h> #include <netdb.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <string.h> #include <ctype.h> #include "node.h" int main(int argc, char **argv){ //Create the contact information table and 128 node_details *: int i=0; routing_table...
C
#include "holberton.h" /** * _strcmp - compare two strings. * @s1: string * @s2: string * Return: int */ int _strcmp(char *s1, char *s2) { while (*s1 && (*s1 == *s2)) { s1++; s2++; } return (*(const unsigned char *)s1 - *(const unsigned char *)s2); }
C
#include <stdio.h> int main() { // void print_ints(int [], int); // int numbers[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, // length = sizeof(numbers) / sizeof (int); char *create_arr(); char *create_arr2(); char *p = create_arr(); create_arr2(); putchar(p[0]); // print_ints(numbers, l...
C
#include<stdio.h> int main() { int n; //no of segments scanf("%d",&n); int start[n], end[n]; //2 array to store the start and end points of segments int i,j; //counting variables int m; //to store the min number of pts. //input segments for(i=0;i<n;i++) scanf("%d %d",&start[i], &end...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* otool_process_files.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <string.h> #define MAX 20 void GameTitle(){ printf("\n-----------------------"); printf("\n| |"); printf("\n| HANGMAN |"); printf("\n| |"); printf("\n-----------------------"); } //...
C
#ifndef _GET_FRAME_H_ #define _GET_FRAME_H_ #include "utils.h" //read video file int CapVideo(const char* video_file) { VideoCapture cap(video_file); // open the default camera if (!cap.isOpened()) // check if we succeeded return -1; Mat edges; namedWindow("edges", 1); int count = 0; while (true){ M...
C
#include "3-calc.h" #include <stdio.h> /** *op_add - sum a and b *@a: n1 *@b: n2 *Return: the sum of a and b **/ int op_add(int a, int b) { return (a + b); } /** *op_sub - subtraction to a and b *@a: n1 *@b: n2 *Return: the difference of a and b **/ int op_sub(int a, int b) { return (a - b); } /** *op_mul ...
C
#include "util.h" #include <stdio.h> #include <string.h> #include<stdbool.h> #define MaxSize 100 #define INF 32767 #define MaxV 100 typedef struct { int x, y; //int in; }node; typedef struct queue { int front, rear; node data[10000]; }queue; void Init(queue *q) { q->front = q->rear = -1; } void push(queue *q, n...
C
#include <stdio.h> int main() { int B[2][3]={{1,2,3},{4,5,6}}; for(int i=0;i<2;i++) { for(int j=0;j<3;j++) { printf("B[%d][%d]: %p\n",i,j,&B[i][j]); } } printf("B[0]: %p\n", B[0]); printf("B[1]: %p\n", B[1]); printf("B[0][4]: %d\n",B[0][3]); // printf...
C
/* leins, 24.03.2018 */ #include <stdio.h> #include <stdlib.h> #include "left_square.h" #include "square_gauss.h" #include "source.h" #define A -20 // #define B 20 #define EPS 0.000001 // int main(void) { printf("function: (2 - x^2)*cos(x) + 2*x*sin(x)\n"); printf("Left squares method\n"); printf("I of %...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> struct No { int valor; struct No* esquerda; struct No* direita; }; int Altura(struct No* h) { if(h == NULL){ return 0; } else { int altura_esquerda = Altura(h->esquerda); int altura_direita = Altura(h->direita); if(altura_esqueda < altura_dire...
C
#include "MovementDirectory-12E.c"; void blueLeft(int delayer) { wait1Msec(delayer*1000); move(127); // move forward for 3 secs wait1Msec(3000); move(40); // move slower for 2 secs Outspeed(87); // start the outtake wait1Msec(2000); move(0); // stop wait1Msec(500); // wait half a second move(-100); // move b...
C
#include<stdio.h> int main(){ unsigned int n=0; scanf("%u",&n); while(n>0){ printf("%u\n",n*(n+1)*(2*n+1)/6); scanf("%u",&n); } return 0; }
C
#include<stdio.h> void main() { int a=5,b=10,c; c=a+b; scanf("%d",&c); if(c%2==0) { printf("it is even number"); } else { printf("it is odd number"); } }
C
#include <stdio.h> /* A) The following statement should print the character 'c'. printf(%s\n", 'c'); Correction: printf("%c\n", 'c'); B) The following statement should print 9.375%. printf("%.3f%", 9.375); Correction: printf("%.3f\%", 9.375); C) The following statement should print the first c...
C
#include "queue_utils.h" void queueInit(struct Queue *q, int size) { q->size = size; q->in = q->out = 0; } int queuePut(struct Queue *q, int e) { if (q->in == ((q->out - 1 + q->size) % q->size)) { // Kolejka pełna return -1; } q->items[q->in] = e; q->in = (q->in + 1) % q->...
C
#include "timer.h" #include "motor.h" #include "main.h" #include <stdlib.h> extern motor_ctrl motor1; extern motor_ctrl motor2; /************************************************ Purpose: initalize timers to generate PWM or produce update events at specific time periods Inputs: TIMx:the hardware timer to configure, AR...
C
#include <malloc.h> #include <stdlib.h> struct A { int array[10]; int x; }; int main(int argc, char *argv[]) { struct A *a = (char *)malloc(sizeof(struct A)); if (a == NULL) return (0); int index = atoi(argv[0]); //if (index > 10) //return (0); a->array[index] = 0; return 0; }
C
#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> #include<string.h> #include<stdlib.h> <<<<<<< HEAD ǵݹ int main() { int fir = 1; int sec = 1; int next = 0; int n = 0; printf("input the number:"); scanf("%d", &n); if (n <= 2) printf("the number is %d\n", fir); else { for (int i = 2; i < n; i++) { n...
C
#include "garbler.h" #include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <netdb.h> #include <unistd.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <fcntl.h> #include <ctype.h> #include <sys/socket.h> #include <netinet/in.h> #inclu...
C
#include <stdlib.h> #include "lista.h" struct lista{ int info; struct lista* prox; }; Lista* criar_lista(){ return NULL; } Lista* inserir_list(Lista* l, int i){ Lista* novo = (Lista*)malloc(sizeof(Lista)); novo->info =i; novo->prox = l; return novo; } void imprimir_lista(Lista* l){ Lista* p; for(p =...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* list_utils3.c :+: :+: :+: ...
C
#include "stdio.h" int main () { char ch[100],last; int i; scanf("%s",ch); for(i=0;i<=99;i++) { if(ch[i]=='\0') { printf("%c",ch[i-1]); break; } } }
C
/* Continúa agregando funciones al ejercicio anterior que permitan: a) Calcular y emitir la suma de sus elementos. b) Calcular y emitir el mínimo del vector. c) Calcular y emitir el promedio de los valores del vector d) Emitir los valores de aquellos que superaron ese promedio. e) Emitir los valores del vector que son ...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<signal.h> #include<sys/types.h> #include<sys/wait.h> #include<unistd.h> #include<ctype.h> int status = 1; int exitf(void){ return 0; } char **splitf(char *argv){ int index =0; const char s[10] = " \t\r\n\a"; char **line = malloc(sizeof(ch...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_SYMBOLS 256 #define MAX_LEN 256 struct tnode { struct tnode* left; /*used when in tree*/ struct tnode*right; /*used when in tree*/ int isleaf; unsigned char symbol; }; /*global variables*/ struct tnode* root = NULL; /*tree of s...
C
#include "blacksmithing.h" t_piece *piece_create(char type, char x, char y) { t_piece *piece; char *types; types = "1234RBKQ"; if (!ft_strchr(types, (int)type)) return (NULL); piece = (t_piece *)ft_memalloc(sizeof(t_piece)); if (piece) { piece->layer = FIRST_LAYER; piece->type = type; piece->location =...
C
#include "main.h" /** * clear_bit - at a particular index change bit to 1 * @n: value to be converted * @m: counts bits * * Return: formated n */ unsigned int flip_bits(unsigned long int n, unsigned long int m) { n ^= (1 << m); return ((unsigned int)n); }
C
#include <stdio.h> int main() { int entrada, saida; while (scanf("%d", &entrada) != EOF){ saida = entrada - 1; printf("%d\n", saida); } return 0; }
C
#include "mysocket.h" #include "serverio.h" int main(int argc, char *argv[]) { int socket_fd, new_socket_fd, file_fd; in_port_t server_port; struct sockaddr_in server_addr, client_addr; socklen_t client_addr_len; size_t block_size; char pathname[MAX_FILE_NAME_SIZE]; pid_t k; char c...
C
#ifdef _DEBUG #undef _DEBUG #include <python3.5/Python.h> #define _DEBUG #else #include <python3.5/Python.h> #endif #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <string.h> #include <unistd.h> #include <sys/ioctl.h> #include <sys/types.h> #define IOCTL_MAGIC_NUMBER 'j' #define IOCT...
C
/* * * Compilation Instruction: * gcc commandline_parser.c -o commandline_parser * ./commandline_parser * */ #include <assert.h> #include <unistd.h> #include <sys/types.h> #include <stdlib.h> #include <stdio.h> #include <assert.h> #include <string.h> #include <wait.h> #include <inttypes.h> #include "Queue.h" #in...
C
/* * timers.c * * Created on: 07-Sep-2020 * Author: Chirayu Thakur */ #include "timers.h" //extern int rollover; /* * Function name: void initLETIMER0() * * Description: Initialize LETIMER0 peripheral * . * Parameters: None * * Silab API's Used: CMU_ClockEnable(CMU_Clock_TypeDef clock, bool enabl...
C
//======================================================================== // Binary Search Tree //======================================================================== #include <stdio.h> #include <stdlib.h> //------------------------------------------------------------------------ // Types: node_t //-------------...
C
struct b_number* clone( int copy, struct b_number* orig ){ struct b_number* new; new = (struct b_number*) calloc( 1, sizeof(struct b_number)); new->block_list = (uint32_t*) malloc(sizeof(uint32_t) * orig->size ); new->size = orig->size; if( copy ) memcpy( new->block_list, orig->block_list...
C
// Alexandra Qin // aq263 // // HW3 Sender #include <stdio.h> /* for printf() and fprintf() */ #include <sys/socket.h> /* for socket(), connect(), sendto(), and recvfrom() */ #include <arpa/inet.h> /* for sockaddr_in and inet_addr() */ #include <stdlib.h> /* for atoi() and exit() */ #include <string.h> /...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <stdbool.h> #include <math.h> #include <pthread.h> #define TOL 0.001 typedef struct cplx{ double real; double imag; int root; int iteration; }cplx; static long int numb_degree; static long int numb_pixel; static long int nu...
C
//Initializes LCD for character display, 8-bits 2 lines //Works for Hitachi HD44780 and Tinharp/ Shenzhen Eone 1602A //Author :Israel N Gbati //Date : 5/05/16 //Location : Shimoda Village Yokohama Japan #include "TM4C123.h" // Device header #include "LCD_init.h" void LCD_init(void) { ...
C
#include <stdio.h> #include <stdlib.h> #include "eyebot.h" //Starting at a random position, drive straight until the robot is close to a wall. distFromWall specifies how close the robot should get to the wall void reachWall(int distFromWall) { //Have robot drive straight to start off with VWSetSpeed(200,0); ...
C
/* * file.h * * Created on: Jan 9, 2014 * Author: avi */ #ifndef FILE_H_ #define FILE_H_ #include <stdio.h> #include <stdlib.h> #define MAX_CHAR_IN_LINE 81 #endif /* FILE_H_ */ /** * This function get file patch and try to open it, if the file * is opened it return a pointer to the file, else output ...
C
#include <stdarg.h> #include <stdio.h> /** * printf("format string", formatter_values...) * * %[flags][width][.precision]specifier * * Format characters: * %c --> character * %s --> string * %u --> unsigned integer * %x --> hexadecimal * %d, %i --> decimal integer * %f --> ...
C
#include <stdio.h> #include <string.h> #include <ctype.h> int main() { int count = 0; char string[500] = {}; printf("Enter the string: "); fgets(string, 500, stdin); for (int i = 0; string[i] != 0; i++) { if (isupper(string[i])) { printf("\n"); count++;...
C
#include <stdio.h> #include <stdlib.h> /*2. Chiedere all'utente di inserire 3 frasi, e salvarle in un array di stringhe. Chiedere poi all'utente quale delle 3 frasi stampare, quindi stampare la frase desiderata.*/ #define DIM1I 3 #define DIM2S 20 int main() { char strings[DIM1I][DIM2S+1] = {}; int i, nInput;...
C
#include<stdio.h> void main() { int sub1,sub2,sub3,sub4,sub5,total,grand_total,division; float percentage; printf("\nenter the marks for PHYSICS out of 100 : "); scanf("%d", &sub1); printf("enter the marks for CHEMISTRY out of 100 : "); scanf("%d", &sub2); printf("enter the marks for BIOL...
C
/* ** EPITECH PROJECT, 2020 ** my_getnbr.c ** File description: ** my_getnbr */ int my_strlen(char const *str); int get_nbr_check(char const *str) { int neg = 0; for (int i = 0; str[i] == '-' || str[i] == '+'; i++) if (str[i] == '-') neg++; return (neg); } int my_getnbr(char const *s...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* fun_512.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> void insertatbegin(); void reverse(); void display(); void insertatlast(); // void delete_ok(); struct node { int data; struct node *next; }; struct node *start = NULL; int main() { int choice; while (1) { printf("\n\n** Main menu ...
C
/* Program 7.4 : Compare */ #include <stdio.h> void CommaWrite(long int n); void ZeroWrite(int m); void main(void) { long int first, second; scanf("%li%li", &first, &second); if (first > second) { CommaWrite(first); CommaWrite(second); } else { CommaWrite(second); CommaWrite(first); } } void CommaWrite(...
C
#include <stdio.h> int main() { int sum=0, tmp=1; while( tmp != 0){ scanf("%d", &tmp); sum += tmp; }printf("%d", sum); return 0; }
C
#include <assert.h> #include <string.h> #include <sys/types.h> #include <unistd.h> void *my_malloc(size_t size); void *my_malloc(size_t size) { void *p = sbrk(0); /* srbk syscall returns a pointer to the current top of the heap. * srbk(0) returns a pointer to the current top of the heap, increments ...
C
#include <stdio.h> int main() { int d,m,y; printf("Nhap ngay, thang, nam can in ra: "); //scanf("%2d/%2d/%2d",&d,&m,&y); //%2d ke ca nhap so co 4 5 chu so cung chi lay 2 so dau. scanf("%d/%d/%d",&d,&m,&y); printf("Hom nay la ngay: %02d/%02d/%02d.\n",d,m,y%100); //%2d nay so nhap vao co 4 5 chu so cung hien ca 4...
C
#include<stdio.h> #include<conio.h> #include<string.h> void main() { char s[100]; int l,i,count=0; scanf("%s",s); l=strlen(s); for(i=0;i<l;i++) { if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u'||s[i]=='A'||s[i]=='E'||s[i]=='I'||s[i]=='O'||s[i]=='U') count++; else continue; } if(count>0) pri...
C
#include "holberton.h" /** * _puts_recursion - This function prints a string * @s: The string to print * Return: Nothing */ void _puts_recursion(char *s) { int a = 0; if (s[a] == '\0') { _putchar('\n'); } if (s[a] != '\0') { _putchar(s[a]); a++; _puts_recursion(&(s[a])); } }
C
#include <stdio.h> int x,y,z; void f(int *a,int b){ *a=2; b=2; z=b; } int main() { x=y=1; f(&x,y); printf("%d\n%d\n%d",x,y,z); return 0; }
C
//Nathalia Lorena Cardoso - 14/0156909 Lude Yuri Ribeiro - 15/0137770 #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> FILE *arq; int **matrizArquivo,caracter, dadosArq[2], somaValores, linhaCentral,colunaCentral, valorDecimal; char cha[1]; void buscarDadosArq(char *nomeArquivo,int *dados...
C
#include <stdio.h> /** * main - prints the numbers from 1 to 100 * Return: always 0 */ int main(void) { int h; char fizz[] = "Fizz"; char buzz[] = "Buzz"; char fibu[] = "FizzBuzz"; for (h = 1; h <= 100; h++) { if (h % 3 == 0 && h % 5 != 0) printf(" %s", fizz); else if (h % 5 == 0 && h % 3 != 0) p...
C
#include <stdio.h> void do_something(int x) { printf("%d\n",x); x--; if(x>0) do_something(x); } int main() { int x=10; do_something(x); return 0; }
C
#include<stdio.h> void main() { int a[10][10],i,j,r,c,sum=0; printf("input elements in the matrix :\n "); for(i=0;i<3;i++) { for(j=0;j<3;j++) { printf("element- [%d],[%d] : \n"); scanf("%d",&a[i],[j]); } } printf(" \n the matrix is :\n"); for(r=0;r<3;r++) { printf("\n"); for(c=0;c<3;c++) printf("%d"\t,a[r][c]); } print...
C
#include<stdlib.h> #include<stdio.h> typedef struct node { int key; int value; struct node * next; } node; typedef struct hash_table { int table_size; int count; node ** table; } hash_table; hash_table * create(int table_size) { hash_table * hashTable= malloc(sizeof(hash_table)); has...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "filebasics.h" // Mikael Nenonen k90390 // 2017-08-03 int print_file(const char *filename) { FILE *f = fopen(filename, "r"); if (!f) return -1; int length = 0; while(1) { char string[1000] = ""; if(fgets(string, 1000, f) == NULL)...
C
#include<stdio.h> int main() { char line[80],ctr; int i,c,end=0,character =0,words=0,lines=0; printf("Press enter to return\n"); while(end==0) { //read a line c=0; while((ctr=getchar())!='\n') line[c++]=ctr; line[c]='\0'; //counting the line if(line[0]=='\0') break; else ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_print_l.c :+: :+: :+: ...
C
/* x_mem.c - x_mem */ #include <avr-Xinu.h> #include <mem.h> #include <avr/io.h> extern char *_etext; extern char *__bss_start, *__bss_end; extern char *__data_start, *__data_end; extern char *_end; /* *------------------------------------------------------------------------ * x_mem - (command mem) print memo...
C
//Supermercado //Archivos de cabecera #include<stdio.h> //Prototipo de funciones void compra(float *, char *); void descuento(float *, float *, char *); void mostrarResul(float *); //Funcin principal void main(){ float com,des; char bol; compra(&com, &bol); descuento(&des, &com, &bol); mostrarRes...
C
#include <stdio.h> #include <string.h> int main() { char source[] = "Arcangel.Andres"; char target[20]; int sourcesize, targetsize; int i; sourcesize = strlen(source); /* Se completa el array target con el caracter a */ for (i = 0; i < 20; i++) { if (i < sourcesize) { target[i] = source[i]; } else...
C
#include "doors.h" #include "secure.h" #include "doors_www.h" #include "esp32/rom/crc.h" #include "cJSON.h" #define DOORS_CONFIG 1 #include "doors_config.h" static const char * TAG = "DOORS_CONFIG"; #define BUTTON_CONNECTIONS 0x1F #define RELAY_CONNECTIONS 0xFF // Check if the gpio is valid and not already in use...
C
#ifndef list_h #define list_h #define LIST_ADD_ITEM(list, item) \ item->prev = NULL; \ item->next = list; \ if(item->next) item->next->prev = item; \ list = item; #define LIST_REMOVE_ITEM(list, item) \ if(item == list) list=item->next; \ if(item->prev) item->prev->next = item->next; \ if(item->next) item->next...
C
// // countWays.c // BoilerPlate // // Created by Nikhil Jagdale on 5/5/16. // Copyright © 2016 Nikhil Jagdale. All rights reserved. // #include "countWays.h" static int countWays(uint8_t n){ uint8_t numWays[n+1]; numWays[0] = 0; numWays[1] = 1; numWays[2] = 2; numWays[3] = 4; ...
C
/* 441. Arranging Coins You have a total of n coins that you want to form in a staircase shape, where every k-th row must have exactly k coins. Given n, find the total number of full staircase rows that can be formed. n is a non-negative integer and fits within the range of a 32-bit signed integer. Example 1: n...
C
/* engler, 140e: sorta cleaned up test code from 14-vm. */ #include "rpi.h" #include "rpi-constants.h" #include "rpi-interrupts.h" #include "mmu.h" static const unsigned OneMB = 1024 * 1024 ; // for today, just crash and burn if we get a fault. void data_abort_vector(unsigned lr) { unsigned fault_addr; // b...
C
#include <unistd.h> void ft_putstr(char *c) { int i; i = 0; while (c[i]) { write(1, &c[i], 1); i++; } } int count_repear(char c) { int res; if (('a' <= c) && (c <= 'z')) { res = c - 'a' + 1; } if ('A' <= c && c <= 'Z') { res = c - 'A' + 1; } return (res); } int main(int argc, char **argv)...
C
/* File: ContFramePool.C Author: Date : */ /*--------------------------------------------------------------------------*/ /* POSSIBLE IMPLEMENTATION ----------------------- The class SimpleFramePool in file "simple_frame_pool.H/C" describes an incomplete vanilla implementation of a frame pool that allo...
C
#include <stdio.h> #include <stdlib.h> int main() { int N,K,i,*X,E=100; scanf("%d %d",&N,&K); X = (int*)malloc(N*sizeof(int)); for(i=0;i<N;i++){ scanf("%d",&X[i]); } for(i=0;i<N;i+=K){ if(X[i]==1){ E = E-3; } else{ ...