language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include<stdio.h> int main(void){ int n; scanf("%d", &n); int data[n]; for(int i = 0; i < n; i++){ scanf("%d", &data[i]); } for(int i = 0; i < n; i++){ if(data[i] % 2 == 0 && (data[i] % 3 != 0 && data[i] % 5 != 0)){ printf("DENIED\n"); return 0; ...
C
#include <wiringPi.h> #include <stdio.h> #define HallPin 0 #define LedPin 1 int main(void) { if(wiringPiSetup() == -1){ //when initialize wiring failed,print messageto screen printf("setup wiringPi failed !"); return 1; } pinMode(HallPin, INPUT); pinMode(LedPin, OUTPUT); while(1){ ...
C
#include <string.h> #include <stdlib.h> #include <stdio.h> #include <sys/time.h> #include "api.h" #define LINE_SIZE 10240 int main(int argc, char *argv[]) { int size; char string[LINE_SIZE+1]; int cnt_line; int i; char* block = NULL; cqdb_t* db = NULL; struct timeval t1,t2;...
C
#include <stdio.h> #include <stdlib.h> //Insertion and deletion in Binary Search Tree struct Node { struct Node* left; int data; struct Node* right; }; struct Node* NewNode(int data) { struct Node* temp = (struct Node*)malloc(sizeof(struct Node)); temp->left = NULL; temp->data = data; temp->right = NULL; retu...
C
#include <stdio.h> #include <math.h> int main(int argc, char * argv[]) { printf("hello world\n"); double a, b; int n; while((n=scanf("%lf%*c", &a))>0) { printf("a=%lf\n",a); if (a<0)break; b = sqrt(a); printf("b=%lf\n",b); } return 0; }
C
#include "game.h" void decode(struct player *owner, char message[]) { int point, i, j, k, l, m, x, y; char buffer[20]; bzero(buffer, 20); if(message[0] == 'L'){ point = 1; // Nickname owner->nick_length = atoi(&message[point]); point = 3; for(i = 0; i < owner->nick_length; i++){ owner->nick[i] = ...
C
#include <stdio.h> gcd(int a,int b){ if (b==0) return a; return gcd(b, a%b); } main(a,b,c) { scanf("%d%d",&a,&b); c = gcd(a=b-a,b); printf("%d %d", a/c,b/c); }
C
/* Author: Joe Rogers <joe@cromulence.co> Copyright (c) 2015 Cromulence LLC 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, c...
C
#include <stdio.h> int main() { int x,y,z; for (x=0;x<=19;x++) for (y=0;y<=33;y++) { z=100-x-y; if(5.0*x+3.0*y+z/3.0==100) printf("x=%d,y=%d,z=%d\n",x,y,z); } }
C
#include "../hdr/hd.h" int rotation(char *str1, char *str2) { if(strlen(str1) != strlen(str2)) //condition to check if both strings of equal length. { return 0; //if different lengths returns false. } int count = strlen(str2); //finding ...
C
#include <stdio.h> ///////////////////////////////////////////////////////// // 침식 함수 ///////////////////////////////////////////////////////// void erosion(int** map, int i, int j) { int color = map[i][j]; //침식하는 색 저장 map[i][j] = 0; //침식점 0으로 변환 if (map[i + 1][j] == color) { //하 침식 erosion(map, i + 1, j); ...
C
#include <stdio.h> #include <string.h> int main(int argc, char *argv[]) { char name[10]; char cmd[20]; strcpy(cmd, "ls -la"); strcpy(name, argv[1]); printf("%s\n", cmd); return 0; }
C
#include <alloca.h> #include <alsa/asoundlib.h> typedef union { int i; unsigned int ui; float f; const void *v; } Arg; #include "volume.h" static const char alsachannel[] = "Master"; static const char alsacard[] = "default"; snd_mixer_t *handle; snd_mixer_selem_id_t *sid; snd_mixer_elem_t *getelem(const char *...
C
#include<stdio.h> #include<math.h> #include<stdlib.h> #include<stdbool.h> int snt(int n){ if(n < 2){ return 1; } int i; for(i = 2;i <= sqrt(n);i++){ if(n % i == 0){ return 1; } }return 0; } void enqueue(int a, int queue[], int *back, int *j){ (*j)++; queu...
C
#include<stdio.h> #include <unistd.h> int main() { int piperesult,fd[2]; pid_t id; unsigned char buffer[128]; piperesult=pipe(fd);//int pipe(int pipefd[2]); if(piperesult==-1) { perror("piperesult"); } else if(piperesult==0) { id=fork();//pid_t fork(void); if(id==-1) { perror("id"); ...
C
#include <stdio.h> #include <string.h> int main(int argc, char *argv[]) { int bits[8] = { 128, 64, 32, 16, 8, 4, 2, 1 }; printf("\n"); if (strcmp(argv[1], "-e")) { char text[128]; int bin = 0; for (int i = 1; i < argc; i++) { for (int c = 0; c <= 8; c++) { if (argv[i][c] == '1') { bin += bit...
C
/* * pthreads.c */ #include <stdio.h> #include <stdlib.h> #include <pthread.h> #include <unistd.h> #include <string.h> void *dostuff(void *); #ifndef NTHREADS #define NTHREADS 4 #endif pthread_mutex_t gary; int main(){ pthread_t tarry[NTHREADS]; int thread_ids[NTHREADS] = {0}; int status = 0; i...
C
#include <stdio.h> #include <stdlib.h> int main() { int a[10] = {1,2,3,4,5,6,7,8,9,10}, b[10] = {5,6,7,8,9,10,14,33,44,66}, c[10]; int i = 0, j = 0, k = 0; while (i<=9&&k<=9) { if (a[i] == b[k]) { c[j] = a[i]; i++; j++; k++; } else { if (a[i] > b[k]) { k++; } else { i++; } } ...
C
#include <stdio.h> #include "markdown.h" static Paragraph * mkd_h1(Paragraph *p) { Paragraph *found; while ( p ) { if ( p->typ == HDR && p->hnumber == 1 ) return p; if ( p->down && (found = mkd_h1(p->down)) ) return found; p = p->next; } return 0; } char * mkd_h1_title(Document *do...
C
#include <stdio.h> int main() { int n,m,i; char s[65000]; FILE *fp; fp=fopen("part1.txt","r"); if(fp==NULL) { printf("Error"); exit(1); } for(i=0;i<10000;i++) { s[i]=fgetc(fp); if(feof(fp)){ printf("\nSelect your choice\n");...
C
/*Faa um programa que leia um nmero N e calcule o somatrio a seguir:*/ #include <stdio.h> int main(){ int i, n, soma; printf("Digite o valor de n: "); scanf("%d",&n); for (i; i<=n; i++) { soma= soma + (i *i); } printf("Valor do somatorio = %d \n",soma); return 0; }
C
//Written by Bailey Ivancic //Used for Assignment 1 //Different variations of bounding boxes contained in here #include <stdio.h> #include "captcha.h" //used for boundedPixels (normal bounding box) void boundingBox(int height, int width, int pixels[height][width], int *startRow, int *startColumn, in...
C
#pragma once #include "../../Domain/Medicine/Medicine.h" #include "../../Repository/MedicineRepository/MedicineRepository.h" typedef struct { MedicineRepository* repository; } MedicineService; /** * Functia creaza un medicineService si returneaza un pointer catre heap * Dealocarea memoriei se face prin apelare...
C
/* * config.h -- Serveur Polyweb: gestion des options de configuration * * Copyright © 2013 Erick Gallesio - Polytech'Nice-Sophia <eg@unice.fr> * * Author: Erick Gallesio [eg@unice.fr] * Creation date: 26-Apr-2013 19:04 (eg) * Last file update: 2-Jun-2013 15:34 (eg) */ #ifndef POLYWEB_OPTIONS_H #...
C
#include "functions.h" void defaultOr(char * vector1, char * vector2, char * resultVector, long long length) { for (long long count = 0; count < length; count++) { resultVector[count] = vector1[count] | vector2[count]; } } void asmOr(char * vector1, char * vector2, char * resultVector, long long ...
C
/* $Copyright: $ * Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989, 1990 * Sequent Computer Systems, Inc. All rights reserved. * * This software is furnished under a license and may be used * only in accordance with the terms of that license and with the * inclusion of the above copyright notice. This sof...
C
#include <stdio.h> /*Faça um programa para calcular e mostrar o salário reajustado de um funcionário. O percentual de aumento encontra-se na tabela a seguir.*/ int main(){ float salatual; printf("Qual o seu salario atual?\n"); scanf("%f%*c",&salatual); ...
C
#include "jdm.h" /* there are three main calls in 'main()': 1. to 'sel_qstn()': choose the questions 2. to 'ask_usr()': ask them to the user 3. to 'upd_stat()': update the data at the end the game*/ int main( int argc, char *argv[] ) { struct res_s *p_res; FILE *stat_str, *str_cont; /* in order to read from...
C
/* Copyright (C) 2007, 2008 Sean D'Epagnier <sean@depagnier.com> * * 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 3 of the License, or (at your option) any later version. ...
C
#include <stdio.h> #include "Configuration.h" #include "SimpleCUnit.h" #include "Subheap.h" #include "MemoryManagerSubheap.h" void test_init() { char subheapsCount = 4; int variablesSize[4] = {1, 2, 3, 4}; int variablesCount[4] = {1, 1, 1, 1}; assertTrue("Should first time init correctly", 0 == init(variab...
C
#include "swap.h" // Calls the code for each permutation // The four variables have to be in descending order // Zeroes do not get swapped #define permutations_of_four(p1, p2, p3, p4, code) {\ if (p3 != 0) {\ /* startswith p1 */ \ swap(p3, p4, tmp)\ code\ swap(p2, p4, tmp)\ code\ swap(p3, p4, tmp)\ code...
C
/*-------------------------------------------------------------------- * TITLE: M2 Hardware Definition * AUTHOR: Astro * DATE CREATED: 2017/11/4 * FILENAME: time.h * PROJECT: M2Library * COPYRIGHT: Camel Microelectronics, Ltd. * DESCRIPTION: *--------------------------------------------------------------------*...
C
#include <stdlib.h> #include <stdio.h> typedef struct node { int value; struct node* next; } node_t; node_t* flipLinkedList (node_t* node); node_t* findMiddleOfLinkedList (node_t* node); int findLoopInLinkedList (node_t* node); node_t* findCommonNode (node_t* nodeOne, node_t* nodeTwo); void printLinkedList (node_t...
C
#include<stdio.h> int main() { int year; scanf("%d",&year); if(year%4==0) { if(year%100==0) { if(year%400==0) { printf("its a leap year"); } else { printf("its not a leap year"); } } printf("it is a leap year"); } else { printf("it...
C
/* * Exercise 4.2 * * Extend atof to handle scientific notation of the form * 123.45e-6 * where a floating-point number may be followed by e or E * and an optionally signed exponent. * */ #include <stdio.h> #include <string.h> #include <ctype.h> #include <stdlib.h> #define MAXLINE 1000 double atof2 (ch...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> long double f(long double x) { // return (sin(pow(x, 2)) * exp(x / 3)) / sqrt(pow(x, 2) + 4); return sin(x) * pow(x, 3); } long double df_direita(long double x, long double h) { return (f(x + h) - f(x)) / h; } long double df_centrada(long double x, long dou...
C
#include "process.h" void WriteToHistory(BalanceHistory * history, BalanceState * balance, timestamp_t time) { balance->s_time = time; balance->s_balance += balance->s_balance_pending_in; balance->s_balance_pending_in = 0; history->s_history_len++; history->s_history[(int)history->s_history_len - 1] = *balance; ...
C
#include<stdio.h> #include<conio.h> add(int,int); add(int a,int b) { int c; c=a+b; return (c); } void main() { int x,y,s; scanf("%d%d",&x,&y); s=add(x,y); printf("%d",s); getch(); }
C
#include<stdio.h> #include<conio.h> #include<string.h> #include<math.h> int Armstrong(int); int main() { int num,x,armnum; printf("Enter the no u want to check as armstrong"); scanf("%d",&num); armnum=Armstrong(num); if(armnum==1) { printf("It's an Armstrong number"); } else { printf("It's not an armstro...
C
#ifndef Encyclopedie_h #define Encyclopedie_h #include <stdio.h> #include <string.h> #include <stdlib.h> #define TAILLE_ID 12 //----------------------------- //Nom de la structure : EcyclopedieSt // struct EncyclopedieSt { unsigned long identifiant; //identifiant de l'article char *titre; //pointeur qui poin...
C
#include <stdio.h> #include <stdlib.h> int user_count(); int main() { printf("The number of users is %d", user_count()); } int user_count() { return 0; }
C
#include <stdio.h> void doPrint(int (*p)[4]); void doChage(int (*arr)[4], int (*brr)[4] ); void main(){ int arr[4][4] = { {1,2,3,4}, {5,6,7,8}, {9,10,11,12}, {13,14,15,16} }; int brr[4][4]; printf("========arr==========\n"); doPrint(arr); doChage(arr,brr); ...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <assert.h> #define NAME_MAX 11 #define SEX_MAX 5 #define TEL_MAX 12 #define ADDR_MAX 21 #define DEFAULT_SIZE 3 enum//˵Ϊһö { EXIT, ADD, DEL, SEARCH, MODIFY, SHOW, EMPTY, SORT }; typedef struct person_info { int number;//Ϊÿϵ˷һ char name[NAME...
C
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> // #define setsize 256 typedef struct { char * name; int age; double weight; double height; char * content; } person; person scanReports(person p); void printReports(person p); int main(void) { /* 경찰서 조서 작성 이름, 나이, 몸무게, 키, 죄명 *...
C
#include <stdio.h> #include <stdlib.h> #include<string.h> char *sInsert( char *d, const char *s, int p, int n) { if(p>strlen(d)) return d; memmove(d+p+strlen (s), d+p, strlen(d)-p+1); strncpy(d+p,s,strlen(s)); return d; } int main() { char sir1[20], sir2[20]; int n,p; printf("Introducet...
C
/* * ex16_06.c * Modification of the listing 16.17 so that it uses an array of struct names * elements instead of an array of double. * Created by gres.cher on 08/26/19. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #define NUM 40 #define SIZE 25 typedef struct { char first[NUM]; ...
C
#include<unistd.h> #include<stdlib.h> #include<stdio.h> #include<sys/socket.h> #include<arpa/inet.h> #include<string.h> void errorHandling(const char* message); int main(int argc, char* argv[]) { if(argc != 3){ printf("Usage: %s <ip> <port> \n", argv[0]); exit(1); } int sockClient = socke...
C
#include <OpenGL/gl.h> #include <OpenGl/glu.h> #include <GLUT/glut.h> #include <stdio.h> #include <stdlib.h> #include <math.h> float X1, Y1, X2, Y2; void dda() { double dx = (X2 - X1); double dy = (Y2 - Y1); double iteration; float xInc, yInc, x = X1, y = Y1; iteration = (fabs(dx) > fabs(dy)) ? (fabs(dx)) ...
C
#include <stdio.h> #include <math.h> #include <stdlib.h> int main(){ int N = 0; scanf("%d",&N); for(int i = 0;i < N;i++){ char car[4] = {}; int num = 0; int rtn = 0; for(int j = 0;j < 3;j++){ scanf(" %c",&car[j]); rtn += (car[j] - 65) * pow( 26 , 2-j ); // rtn-=(car[j]-48); } scanf(" %d",&num...
C
////////////////////////////////////////////////////////////////////////////////////// //Joseph Moggridge. computational physics excersise 1 problem 1. // // // //recieves input from the user about a quadratic equation. ...
C
#include<stdio.h> #include<math.h> int main() { int t; int m,n,i=0,c=0; long long int j; int temp1,temp2; long long a[1000000000],b[1000000000]; scanf("%d",&t); while(t!=0) { // int m,n,i=0,c=0,j; // int temp1,temp2; // long long a[1000000000],b[1000000000]; scanf("%d",&n); for(j=0;j<n;j++) { ...
C
#include "main.h" MAT_TYPE get_type(FILE *file){ char *type_str; type_str = readline(file); MAT_TYPE type = MAT_NONE; switch(strlen(type_str)){ case 3: if(strncmp("int", type_str, 3*sizeof(char)) == 0) type = MAT_INT; else{ fprintf(stderr, "unknown type: %s provided in input file\n", type_str); exit(...
C
/* * Developed by: * Jacob Gidley, Team Leader * Daniel Leo, Monitor * Mary Slaven, Recorder */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string.h> #include <dirent.h> #include <unistd.h> #include <sys/stat.h> #include <errno.h> /* Name: isDir Parameter(s): 0: char * - A Pointer to the Dire...
C
/********************************** **Author: Mike Mann **Descrition: Generates a random key. ** File Encryption and Decryption project that uses a randomly generated key for OS 344. ************************************/ #include <stdio.h> #include <stdlib.h> #include <time.h> int main (int argc, cha...
C
#include <queue.h> #include <memutils.h> void init_queue(struct queue* q, void * buf, int max_count, int data_size) { q->max_count = max_count; q->data_size = data_size; q->array = buf; q->put = q->get = 0; q->last_op = QUEUE_LAST_GET; } unsigned char put_queue(struct queue* q, const void* data) { if (is_queue_...
C
#include "myhead.h" TYPE_DATA Definite_integral_cos(TYPE_DATA a, TYPE_DATA b) { TYPE_DATA s = 0, x = a; int i; for (i = 1; i < N + 1; i++) //i0ʼ1ʼûκӰ { //Ⱥ˳⣬ȡε߸߻ұߵĸ߶ x = (x + (b - a) / N); s = s + cos(pow(x, 2)) * ((b - a) / N);//ֵĺcos(x^2)д } return s; } TYPE_DATA Definite_integral_sin(TYPE_DATA ...
C
#include<stdio.h> /*Programa que solicita 4 numeros y dice que numero es mayor entre 4 numeros*/ int main (){ int num1, num2, num3, num4; printf("\nIngresa cuatro numeros y te dire cual es el mayor\n"); printf("\nIngrese un numero1 entero \n"); //Pedimos un numero1 entero scanf("%d",&num1); printf("Ingrese...
C
#ifndef __MURON_H #define __MURON_H #if MR_MODE_RGBA #define MR_CHANNELS r, g, b, a #define MR_RGB_MASK 0xffffff #elif MR_MODE_ARGB #define MR_CHANNELS a, r, g, b #define MR_RGB_MASK 0xffffff00 #elif MR_MODE_ABGR #define MR_CHANNELS a, b, g, r #define MR_RGB_MASK 0xffffff00 #else #define MR_CHANNELS b, g, r, a #define...
C
#include <stdio.h> #include <linux/input.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <time.h> #include <unistd.h> #define DEV_PATH "/dev/input/event20" //difference is possible #define L 1 #define R 2 #define U 3 #define D 4 int main() { int event_file = 0; ...
C
#include <string.h> #include <stdio.h> typedef struct Transition { char* init_state; char* combo_state; char* final_state; } *transition; transition new_transition(char* is,char* cs, char* fs) { transition tor = (transition) malloc(sizeof(struct Transition)); tor->init_state = is; tor->combo_...
C
int ex5(long a, long b){ int dl = a > 0; int al = b <= 0; if(dl != al) goto DONE; long c = b - 2; return c; DONE: c = a + 5; return c; } int ex5(long a, long b){ if((a>0) && (b<=0)) { return b-2; } return a+5; }
C
#include<stdio.h> int main() { int a,s,d; while(scanf("%d%d%d", &a, &s, &d)) { if (a==0 && s==0 && d ==0) break; int max; if(a>s && a>d) max = a; else if(s>a && s>d) max = s; else max = d; if( a*a+s*s+d*d-max*max == max*max) printf("right\n"); ...
C
#include "common.h" static double min (double a, double b) { return a > b ? b : a; } static double max (double a, double b) { return a > b ? a : b; } static double polygon_area (POINT2D * polygon, int size) { int i; double area = 0; if( size < 3 ) return 0.0; for( i = 0; i < size-1; i++ ) { ...
C
#include "points.h" double pt_distance(const Pointer a, const Pointer b) { Point *pa, *pb; double dx, dy; pa = (Point*) a; pb = (Point*) b; dx = (pa->x - pb->x); dy = (pa->y - pb->y); return dx * dx + dy * dy; } void pt_centroid(const Pointer *objs, const int *clusters, size_t num_objs, int cluster, ...
C
#include <stdio.h> int puissance (int i,int n) { if(n==0) return 1; if(n==1) return i; else return i*puissance(i,n-1); } int megaPower(int x,int y) { if (y==0) return 1; else return puissance(x,megaPower(x,y-1)); }
C
#include "ManagerEvent.h" typedef struct EventReg_S EventReg_T; typedef unsigned char UInt8_T; struct EventReg_S { void * object; EventCallback_T callback; }; void ManagerEvent_Init(ManagerEvent_T * man) { ArrayList_Init(&man->event_reg, sizeof(EventReg_T), 0); } void ManagerEvent_Destroy(...
C
#include "serial.h" #include "uart.h" /* fd : 0 是串口1 fd : 2 是串口3 */ void uart_test() { /* 初始化串口 */ uart_init1(115200); uart_init3(9600); uint8_t buf[10]; for (uint8_t i =0; i < 10; i++) { buf[i] = i; } /* 发送数据 */ write(0, buf, sizeof(buf)); while(1) { /* ...
C
#include <stdio.h> float even_sum(int number){ int sum=0,k=0; while(number!=0){ if((number%10)%2==0){ sum+=number%10; k++; } number/=10; } return sum/k; } int main(){ printf("%.2f\n", even_sum(123456)); return 0; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_other8.c :+: :+: :+: ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strs_to_tab.c :+: :+: :+: ...
C
/* * xv24to8.c - contains the 24-to-8-bit Conv24to8() procedure * and the 8-to-24-bit Conv8to24() procedure * * The Conv24to8 procedure takes a pointer to a 24-bit image (loaded * previously). The image will be a w * h * 3 byte array of * bytes. The image will be arranged with 3 bytes per pixel ...
C
/* * Copyright (c) 2015, * National Instruments Corporation. * All rights reserved. */ #include <stdio.h> #include <stdlib.h> #include "MyRio.h" #define MEM_WIDTH 10 #define MEM_DEPTH 5 #define MEM_ITER (int)memory[MEM_WIDTH+1] #define MEM_VAL memory[MEM_WIDTH+2] void initializeMemory(double**); void freeTheMemor...
C
/** * @brief * `man fopen' * Opening a file in append mode (a as the first character of mode) * causes all subsequent write operations to this stream to occur at * end-of-file, as if preceded the call: * fseek(stream, 0, SEEK_END); * * Use "r+b" mode and fallback to "w+b" if it fails. * ...
C
#include<stdlib.h> #include "monty.h" /** * free_stack - free a double linked list * @head: the header of the list */ void free_stack(stack_t *head) { stack_t *tmp_node; while (head) { tmp_node = head->next; free(head); head = tmp_node; } }
C
#include<stdio.h> int main(void) { int n = 10; int a = n; int i; int count = 0; for (i=1;i<=n;i++) { while ( 0<a ) { a--; count++; } } printf("%d", count); return 0; }
C
#include "holberton.h" /** * print_most_numbers - function checks for lowercase character * Return: returns successfully a 0 upon completion */ void print_most_numbers(void) { char x = '0'; for (x = '0'; x <= '9'; x++) { if (x <= '9' && x != '2' && x != '4') _putchar(x); } _putchar('\n'); }
C
#include <stdio.h> #define N 10 #define MAX 100.0 int main(void) { double x[N], y[N]; double bin = MAX / N; double a = -0.02, b = 2, c = 0; int i; double xb[2] = { 65.0,85.0 }; double yb[2] = { 30.0,50.0 }; for (i = 0; i < N; i++) { x[i] = bin * i; } for (i = 0; i < N; i++) { y[i] = a * x[i] * x[i] + b ...
C
#include "bus.h" #include "error.h" #include <stdint.h> #include "memory.h" #include "bit.h" /** * @brief Plug a component into the bus * * @param bus bus to plug into * @param c component to plug into bus * @param start address from where to plug (included) * @param end address until where to plug (included) *...
C
#include <stdio.h> #include <stdbool.h> #include <stdlib.h> #include <signal.h> #include <unistd.h> #include <string.h> static bool forward = true; void changeDirection() { forward = !forward; } // CTRL + C void reactSIGINT(int signal) { printf("\n\nReceived SIGINT -> end of the programme\n\n"); exit(0); }...
C
#include <stdio.h> #include <string.h> char *ft_strncat(char *dest, char *src, unsigned int nb); int main(void) { char a[] = "o pior "; char b[] = "vai piorar\n"; printf ("%s\n", strncat(a, b, 7)); char c[] = "o pior "; printf ("%s\n", ft_strncat(c, b, 7)); return (0); }
C
#include "standardscale.h" //mean_center(&data[floor], ceiling, mean); void mean_center(double *data, size_t datasize, double clustermean) { size_t i = 0; while (i < datasize) { data[i] = data[i] - clustermean; i++; } } double zscore(double val, double std, double *clustermean) { return (v...
C
#include<stdio.h> #include<stdlib.h> char str[] = "OAISDJF;ALSKJDF;ALSKDJFLASKDJF;ALSKDJF;LASKJDF;LASKDJFASLKDFJ"; int foo() { fprintf(stdout,"hello\n"); return(0); } int func2() { printf("hello\n"); printf(str); foo(); exit(0); } int func3() { func2(); func3(); return(0); } int main( i...
C
/****************************************************************************** * File: loops.c * * Author: Jonathan Gai * Created: 02/19/20 * prints a bar graph *****************************************************************************/ #include <stdio.h> int ma...
C
#define _CRT_SECURE_NO_WARNINGS #include<stdlib.h> #include<stdio.h> #include<Windows.h> #include<winddi.h> #include<time.h> #include<process.h> #include <string.h> void ֵ() { //typedef int FALSE=0,TRUE=1 BOOL bool = FALSE;//0 //unsigned short WORD word = 123; //unsigned char ...
C
#include <stdint.h> #define FD_SETSIZE (1024) typedef struct { unsigned long fds_bits[FD_SETSIZE / (8 * sizeof(long))]; } fd_set; #define FD_ZERO(set) \ do { \ unsigned int __i; ...
C
#include<stdio.h> #include<string.h> int main(int argc, char * argv[]) { printf("%d\n", argc); for(int i=0;i<argc;i++) { printf("%s\n", argv[i]); for(int j=0;j<strlen(argv[i]);j++) { printf("%c ", argv[i][j]); } printf("\n"); } }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* write_line.c :+: :+: :+: ...
C
#include<stdio.h> int main(){ unsigned long long array[10000],i,k,j,term,n; scanf("%llu",&term); for(i=0;i<term;i++){ for(j=0;j<=5;j++){ scanf("%llu",&array[j]); } scanf("%llu",&n); for(j=6;j<=n;j++){ arr...
C
// Alumno1: Padial Vázquez, Aarón // Alumno 2: Ocaña Valenzuela, Juan /* * File: utilidades.h * Author: acid * * Created on 15 de febrero de 2019, 11:07 */ #ifndef UTILIDADES_H #define UTILIDADES_H /** * @brief lee el vector y devuelve el numero de componentes en util_array * @param array vector de entreda...
C
#include "common.h" #include <stdio.h> const double physics_step = 1 / 60.0; const double network_step = 1 / 10.0; int timer = 0; void translate_world(world_state_t* world) { for (int i = 0; i < MAX_PLAYERS; i++) { if (!is_player_connected(world, i)) continue; world->players[i].p...
C
// AtCoder Beginner Contest 006 A // [URL] https://atcoder.jp/contests/abc006/tasks/abc006_1 // [compiler] C (GCC 5.4.1) // #include <stdio.h> int main (void) { /* variables for main process */ int N; // STEP.01 // read the target number scanf( "%d", &N ); // STEP.02 // output wheter `N` is the multiple...
C
#include <stdio.h> char *izbaci_viska_razmake(char *s){ char *kraj=s, *restart=s, *pocetak=s; int brojac=0; while(*s != '\0') { if(*s == ' ') { if(brojac == 0) { kraj = s; pocetak = s; while(*kraj == ' ') kraj++; while(*pocetak++ = *kraj++); } else { kr...
C
#include"mystring.h" #include<string.h> #include<stdio.h> #include<malloc.h> #include<stdlib.h> int substr(const char *string1, const char *string2) { int str2 = strlen(string2); int str1 = strlen(string1); int i,j; int result=-1; if (str2>str1) printf("string too large\n"); for (i=0; i<str...
C
#define betaTree_cxx #include "betaTree.h" #include <TH2.h> #include <TStyle.h> #include <TCanvas.h> void betaTree::Loop() { // In a ROOT session, you can do: // root> .L betaTree.C // root> betaTree t // root> t.GetEntry(12); // Fill t data members with entry number 12 // root> t.Show(); /...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* coordone.c :+: :+: :+: ...
C
#ifndef TILL_EOS_H_INCLUDED # define TILL_EOS_H_INCLUDED # include <stdbool.h> // bool /** * Follows characters until we reach end of a string. * * End of string may be end of buffer or unquoted '"'. */ static inline unsigned int till_eos(char const*const s, unsigned int i, const unsigned int m, char*restrict ds...
C
#include "lists.h" /** * insert_nodeint_at_index - inserts a new node at a given position * @head: double pointer * @idx: index of the list where the new node should be added * @n: data of the new node * Return: the address of the new node */ listint_t *insert_nodeint_at_index(listint_t **head, unsigned int idx,...
C
#include <stdio.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <stdlib.h> #include <limits.h> #include <errno.h> #include "libbbgen.h" int main(int argc, char *argv[]) { char srcfn[PATH_MAX]; char destfn[PATH_MAX]; char *p; struct stat st; unsi...
C
#include <stdio.h> #include "list.h" void mkatom(void **x, void *cl) { char **str = (char **) x; FILE *fp = cl; fprintf(fp, "%s ", *str); fprintf(fp, "\n"); } int main() { List_T p1 = List_list("Atom", "Mem", "Arena", "List", NULL); List_map(p1, mkatom, stderr); List_T p...
C
#include <stdio.h> #include <stdlib.h> int fibr (int); int main () { int n,t; printf ("Enter position of terms:"); scanf ("%d",&n); for (int i=0;i <=n;i++) { t=fibr (i); printf ("%d\t",t); } return 0; } int fibr (int num) { if (num <=1) return num; return fibr...