language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#ifndef NTRU_RAND_H #define NTRU_RAND_H #include "types.h" #ifdef WIN32 /** * @brief CryptGenRandom-based RNG * * Fills an array with random data from CryptGenRandom(). * * @param rand_data output parameter; the random data is written to this array * @param len the number of elements to write to rand_data * @...
C
/* * +++ NAME +++ * * DASIN Double precision arc sine * * +++ INDEX +++ * * DASIN * machine independent routines * trigonometric functions * math libraries * * +++ DESCRIPTION +++ * * Returns double precision arc sine of double precision * floating point argument. * * +++ USAGE +++ * * double...
C
#include<stdio.h> #include<math.h> int main (void) { double deposit=0.0; double rate=0; double interest=0; double percent=0; int years=0; int totalMonths=0; double balance=0; printf("Please enter the amount of your savings account deposit: "); scanf(" %lf",&deposit); printf("You entered ...
C
#include <stdio.h> int main() { FILE *zrodlo; FILE *cel; if((zrodlo=fopen("zadanie5zrodlo.txt","w"))==NULL) //zrodlo > stworz + napisz tekst > zamknij { printf("Blad pliku ZRODLO (W)"); return -1; } fprintf(zrodlo,"%s","ciekawe\njak\nduzo\nczasu\nmi\nzostalo"); fclose(zrodlo); if((cel=fopen("zada...
C
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward d...
C
#include <stdlib.h> #include <stdio.h> typedef struct node *treePointer; typedef struct node { char data; treePointer leftChild, rightChild; } node; treePointer createNode(char newData) //ο node { treePointer newNode = (treePointer)malloc(sizeof(node)); newNode->leftChild = NULL; newNode->rightChild = NULL; n...
C
#include <stdio.h> int main() { char n; printf("\nEnter any character: "); scanf("%c", &n); printf("\nascii value of %c = %d\n", n, n); return 0; }
C
#include<stdio.h> int main() { int a,*p; printf("Enter a value = "); scanf("%d",&a); p = &a; if(*p % 2 == 0) printf("\neven"); else printf("\nodd"); }
C
#include <inttypes.h> #include <stdint.h> #include <stdio.h> #include <string.h> #include "dlfn.h" #include "float.h" #include "functor.h" #include "hash.h" #include "rdtsc.h" #include "stats.h" #define MAX_FUNC 128 static size_t result[MAX_SYMBOLS]; static uint64_t hash_result[MAX_FUNC]; static Functor_t apply_func...
C
#ifndef VARIABLE_H #define VARIABLE_H #include "std_lib_facilities.h" struct Variable { string name; double value; Variable(string name, double val) : name{name}, value{val} {} }; struct Table_variables { vector<Variable> variables{}; Table_variables() {} double define_variable(str...
C
#include <stdio.h> #include <fcntl.h> #include <termios.h> #include <unistd.h> #include <errno.h> #include "time_utils.h" const char* device_name = "/dev/balmerSDIO0"; int main(void) { int fd;/*File Descriptor*/ printf("SDIO Port Read\n"); fd = open(device_name,O_RDWR); if(fd == -1) printf(" Error! in...
C
#include "monitor/watchpoint.h" #include "monitor/expr.h" #include<stdlib.h> #define NR_WP 32 static WP wp_pool[NR_WP] = {}; static WP *head = NULL, *free_ = NULL; void init_wp_pool() { int i; for (i = 0; i < NR_WP; i ++) { wp_pool[i].NO = i; wp_pool[i].next = &wp_pool[i + 1]; } wp_pool[NR_WP - 1].nex...
C
#include <stdio.h> #include <string.h> #include "pass_list.h" #include "pragma.h" /******************************************************************************/ /** * Handles a pragma of 'instrumente' plugin which can be: * - #pragma instrumente foo * - #pragma instrumente (fct_0, fct_1, fct_2, ...) * It s...
C
#include "tommath_private.h" #ifdef S_MP_GET_BIT_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ /* Get bit at position b and return true if the bit is 1, false if it is 0 */ bool s_mp_get_bit(const mp_int *a, int b) { mp_digit bit; int limb = b / ...
C
#include "sort.h" #include "deck.h" #include <stdio.h> /** * co - function to order some cards * @c: The deck * * Return: int */ int co(char c) { int idc; idc = (int)c; if (c == 'A') idc = idc - 16; if (c == '1') idc = idc + 9; if (c == 'K') idc = idc + 10; return (idc); } /** * sort_deck - functio...
C
/* * App utility functions: * * Platform: Neutral * * Version: 3.35 2002/12/23 First release. * Version: 3.36 2002/12/30 Fixed crash if key does not exist. * Version: 3.41 2003/03/18 Fixed a typo. * Version: 3.43 2003/04/25 Now deletes all cursors when deinitialised. * Version: 3.50 20...
C
// Assuming you have been able to compile, run and understand the Hello World program // we will now introduce some of the basic features of the C++ language //*************************************************** // Conor Henderson, Univ of Alabama, August 2011 //*************************************************** #i...
C
#ifndef FNV_H #define FNV_H #include <stdlib.h> #include <stdio.h> typedef unsigned long long u64; #define FNVP64 ((u64)0x00000100000001b3) #define FNVO64 ((u64)0xcbf29ce484222325) u64 fnv64c(u64 input) { unsigned int i; u64 hash = FNVO64; for(i = 0; i < 8; i++) { hash ^= input & 0xff; hash *= FNVP64; inpu...
C
/* Authors: Jani Heinikoski, Vili Huusko Last modified (date): 22.04.2021 Sources: */ #include <stdio.h> #include <stdint.h> #include <stdlib.h> FILE* open_file(char* file_name) { FILE* f = fopen(file_name, "rb"); if (!f) { fprintf(stderr, "my-zip: couldn't open file\n"); exit(1); } retur...
C
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward d...
C
#include "OMminimum.h" #include "OMerrordef.h" #include "PWminimum.h" #include "PWerror.h" #include "PWapi/clsid.h" /* ABSTRACT This function outputs the active classid given the objid and it's object space number. If the objid is invalid, PW_K_NullClass is returned. */ PWclassid omClassidFromObjid ( PWobjid...
C
/***************************************** * File Name : main.C * Purpose : * Creation Date : 23-10-2014 20-12-2008 * Last Modified : Tue 04 Nov 2014 04:02:15 PM CET * Created By : Mihai Constantin constant.mihai@googlemail.com ******************************************/ /* *http://stackoverflow.com/questions/...
C
/* * DIO.c * * Created: 09/09/2018 10:21:18 PM * Author: Ramy Badr */ #include "DIO.h" ////////////////////////////////////////////////////////////////////////////////// // Port Direction ////////////////////////////////////////////////////////////////////////////////// U8 DIO_PortDi...
C
/** * History: * ================================================================ * 2017-5-2 qing.zou created * */ #ifndef VPK_QUEUES_H #define VPK_QUEUES_H #include "vpk_typedef.h" TIMA_BEGIN_DELS struct vpk_tqueue; typedef struct vpk_tqueue vpk_tqueue; /** * Initializes a TQueue object. *...
C
#include <stdio.h> #include <string.h> #include <dlfcn.h> __attribute__((constructor())) void do_pre() { printf("main constructor\n"); } int main(int argc, char **argv) { void (*print)(); int (*add)(int, int); void *handle; printf("i am in\n"); if (argc < 2) return -1; handle = dlopen(argv[1], RTLD_LAZY...
C
// // affichage.c // Vocabulle 2.0 // // Created by Lulu on 13/07/2018. // Copyright © 2018 Lulu. All rights reserved. // #include "affichage.h" void premierMessage(void) { char *V [HAUTEUR_LETTRE] = { "* * ", " * * ", " * * ", " * * ", " * ...
C
//====================================================================== // e01_aux.c / JAS // To be executed with e01.c //---------------------------------------------------------------------- #include <stdio.h> #include <stdlib.h> #include <unistd.h> int main(int argc, char *argv[]) { int i, n; n = atoi(argv[1]); for...
C
#include <stdio.h> int main() { //Exercicio 6 //r == 1 (SIM) repete a operacao //r == 0 (NAO) finaliza a operacao int r=1; //enquanto r e 1, repete a operacao while(r == 1) { int n; int f=1; //pergunta o numero printf("Digite un numero: "); scanf("%d",&n); //calcula o fato...
C
#include <stdio.h> int ex5() { int ent; int ent2; int ent3; scanf("%d %d %d",&ent,&ent2,&ent3); if(ent<=ent2 && ent2<=ent3){ printf("%d %d %d\n",ent,ent2,ent3); } else if(ent<=ent3 && ent3<=ent2){ printf("%d %d %d\n",ent,ent3,ent2); } else if(ent2<=ent && ent<=ent3){ printf("%d %d %d\n",en...
C
/* * vm.c * part of Atto :: https://github.com/deveah/atto */ #include <assert.h> #include <stdlib.h> #include <string.h> #include <stdio.h> #include "vm.h" struct atto_vm_state *atto_allocate_vm_state(void) { struct atto_vm_state *vm = (struct atto_vm_state *)malloc(sizeof(struct atto_vm_state)); assert(...
C
/* * Filename: testcreateMask.c * Author: Huize Shi * Userid: cs30xapo * Description: This function test the createMask function * Date: May 1st, 2016 * Source of help: none */ #include "test.h" /* For TEST() macro and stdio.h */ #include <stdlib.h> /* For rand() function prototype */ #include <limits...
C
#include<iostream> #include<memory> #include<stdlib.h> using namespace std; struct Node { int data; Node *left; Node *right; }; Node *allocateNode(int data) { Node *temp = new Node; temp->data = data; temp->left = NULL; temp->right = NULL; return temp; } int heigh...
C
#include <string.h> #include <stdlib.h> #include <math.h> // Only used for debug mode #include "../gbRenderer/gbRenderer_sys.h" #include "../gbUtils/gbUtils.h" #include "Collision_sys.h" #include "CollisionDynamicRect_type.h" #include "CollisionStaticRect_type.h" #include "../global_state.h" static Position *dynami...
C
#include <stdio.h> #include <string.h> #include <ctype.h> void interschimbaLitere(char* sir) { if (strlen(sir) % 2) return; // daca nu are numar par de litere nu face interschimbarile(ar ramane o litera ce nu are cu ce sa se schimbe) for (int i = 0; i < strlen(sir); i += 2) { char temp = sir[i]; ...
C
#include <check.h> #include "num_dcmp.h" START_TEST(decompose) { struct num_dcmp nd; nd = nd_decompose(0U); ck_assert(nd.head == NULL); nd = nd_decompose(1U); ck_assert(nd.head == NULL); nd = nd_decompose(2U); ck_assert(nd.head != NULL); ck_assert(nd.head->power == 1); ck_ass...
C
#include "internal_dgraph.h" #include <errno.h> #include <stdlib.h> void **dgraph_retrive_node(dgraph_t graph, int n, int *is_new) { size_t old_size = graph->nodes; dgraph_node_t node = dgraph_internal_place_node(graph, n, NULL, 1); if (is_new) *is_new = graph->nodes - old_size; if (node) return &node->conten...
C
/* ** EPITECH PROJECT, 2020 ** NWP_myteams_2019 ** File description: ** broadcast */ #include "response.h" #include "logging_client.h" #include "libparse.h" int broadcast_log(client_t *client) { char **array; const char *end_ptr; if (strstr(client->receive_command, "LOGGEDIN")) { array = parse_ar...
C
#include <stdio.h> int main() { int year, month, days; while (1) { printf("请输入一个年份和月份:\n"); scanf("%d%d", &year, &month); switch (month) { case 1: days = 31; break; case 2: if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) days = 29; else days = 28; break; case 3: days ...
C
#ifndef JOUEUR_H_INCLUDED #define JOUEUR_H_INCLUDED #include <string.h> #include <stdlib.h> #include <stdio.h> #include <time.h> #include "piece/piece.h" #include "toolbox/tools.h" #include "mainHeader.h" #include "coup.h" /* Ce fichier contiendra la structure et les dfinitions des fonctions ncessaires au fonctionne...
C
#include <stdio.h> int main() { printf("in linux ...\n"); int l_char=sizeof(char); printf("char ----> %d\n",l_char); int l_int=sizeof(int); printf("int ----> %d\n",l_int); int l_short=sizeof(short); ...
C
/* server is up and running because of my rookieness on C. all the structures are well thought 'in my opinion' my code needed to checked manually. my server and clients are compiling however I couldn't manage to receive starting parameters from user I think which is caused by my client_handler() function. If I had ma...
C
#include <stdio.h> #include <conio.h> int main() { float s; float c; printf("enter total amount of sales:"); scanf("%f", &s); if (s < 5000) { c = s * 1 / 100; printf("total commission amount is %f", c); } else if (s > 5000 && s < 8000) { c...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "LinkedList.h" static Node* getNode(LinkedList* this, int nodeIndex);//consigue la dir de memoria del nodo. recibe la dir de memoria del primer elemento y el indice, devuelve la dir de memoria del indice static int addNode(LinkedList* this, int ...
C
#include "include/Vector2.h" float Vec2Magnitude(Vector2* vector2){ return sqrt((vector2->x * vector2->x) + (vector2->y * vector2->y)); } Vector2 Vec2Create(float x, float y){ Vector2 ret; ret.x = x; ret.y = y; return ret; } Vector2* Vec2Allocate(float x, float y){ Vector2* ret = (Vecto...
C
#include <stdio.h> #include <math.h> #include "vector.h" #include "constants.h" #include "orientation.h" // EulerOrientation creation void euler_set(EulerOrientation * eo, double a, double b, double c) { eo->alpha = a; eo->beta = b; eo->gamma = c; } EulerOrientation euler_make(double a, double b, d...
C
#include <stdio.h> #include <stdlib.h> #include "buyer.h" // ---------------------------------------- Lista circular simplemente enlazada de compras // inicializar lista circular de compras BuyersList* initBuyersList(int count, int cartCount) { BuyersList* list = (BuyersList*)malloc(sizeof(BuyersList)); list->root...
C
#include <math.h> float toradiansf(float x) { return (float) x * (M_PI / 180.0); } #ifdef BUILD_TEST int main() { toradiansf(12.5); return 0; } #endif
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strsplit_with.c :+: :+: :+: ...
C
/* * rc_servo.c * * Created: 05/02/2017 17:32:18 * Author: Emile */ #include "rc_servo.h" #include <asf.h> #define RC_SERVO_TIMER TCD0 #define RC_SERVO_PORT PORTC #define PERIOD (500 * 30) #define MINIMUM (500 * 0.9) #define RANGE (125 * 2.5) typedef enum { STATE_LOW, STAT...
C
#include <stdio.h> int max(int a, int b); int main(int argc, char const *argv[]) { int a = 3; int b = 5; printf("the max number is: %d\n", max(a, b)); }
C
#include <stdio.h> #include <stdlib.h> #include <conio.h> #include <string.h> #include <math.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ struct Student{ char Ime[100]; int OcjA; int OcjB; int OcjC; int OcjD; }; int q = 0; int main() { struct Stu...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int getal = 0; printf("Verkoop van 28 april 2010\n"); printf("Geef het aantal bonnetjes: "); scanf("%d", &getal); double tmp = 0; double som = 0; for (int i = 0; i < getal; ++i) { printf("Geef het bedrag van bon...
C
#ifndef DICO_INSTRUCT_H #define DICO_INSTRUCT_H #include <stdio.h> #include <stdlib.h> #include <string.h> #include "Utils.h" typedef struct { unsigned int func:6, sa:5, rd:5, rt:5, rs:5, opcode:6; } R; typedef struct { unsigned int immediate:16, rt:5, rs:5, opcode:6; } I; typedef struct { uns...
C
#ifndef __KERN_PROC_H__ #define __KERN_PROC_H__ #include <types.h> #include <spinlock.h> #include <frame.h> #include <arch/context.h> #include <arch/local.h> /* == SCHEDULE CLASS INTERFACE ============================== */ typedef struct sched_node_s *sched_node_t; typedef struct sched_node_s { struct sched_cl...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* read_flags.c :+: :+: :+: ...
C
/* functions for manipulating the environment */ /* written by Eric R. Smith and placed in the public domain */ #include <stddef.h> #include <string.h> #include <stdlib.h> #include <errno.h> int putenv(const char *strng) { size_t idx; const char **var; const char *name; size_t len = strlen(strng); ...
C
#include "hw4.h" #include <stdio.h> #include <string.h> #include <stdlib.h> //#include "hw4.tab.h" extern int courseLine; extern int classLine; extern int meetingLine; char* copy(char* string){ char* cloned; cloned = (char*)malloc(sizeof(char)*strlen(string)); return strcpy(cloned, string);} void ...
C
/** * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. * * SPDX-License-Identifier: BSD-3-Clause */ // Sweep through all 7-bit I2C addresses, to see if any slaves are present on // the I2C bus. Print out a table that looks like this: // // I2C Bus Scan // 0 1 2 3 4 5 6 7 8 9 A B C D E F // 0 // 1 ...
C
//number 3 //but 9 //3,6,12,15,21... #include<stdio.h> void main() { int n; printf("Enter a number : "); scanf("%d",&n); //18==>18%3==>0, 18%9==>0 if(n%3 == 0) { if(n%9!=0) { printf("%d is a mutiple of 3 but not multiple of 9",n); } else { ...
C
#include "prefix.h" #include <stdio.h> #include <stdlib.h> // Cycles through prefixes until opcode is found, returns opcode index int find_opcode(struct x86_instr * inst){ if(inst == NULL){ printf("%s: %s\n", __func__, "inst == NULL"); return -1; } int i = 0; int opcode_flag = 0; // tur...
C
#include<stdio.h> #include<conio.h> void main() { int n1,n2,add,sub,mul,div; clrscr(); printf("Enter number 1:\n"); scanf("%d",&n1); printf("Enter number 2:\n"); scanf("%d",&n2); add=n1+n2; printf("Add = %d",add); sub=n1-n2; printf("Sub = %d",sub); mul=n1*...
C
int factorial(int n){ int f = 1; int i; for(i = 0 ; i < n ; i++){ f = f * i; } return f; }
C
// // HW5_Functions.h // HW5 // // Created by morgan mcmahon on 11/25/16. // Copyright © 2016 morgan mcmahon. All rights reserved. // #ifndef HW5_Functions_h #define HW5_Functions_h #define stringLength 30 /* ---------- Enum Gate Primitive Methods ---------- */ // These the enumeated verilog primitives enum ga...
C
#include <stdio.h> #include <unistd.h> #include <signal.h> int main(void) { sigset_t set; sigemptyset(&set); sigaddset(&set, SIGINT); sigaddset(&set, SIGQUIT); if (sigprocmask(SIG_BLOCK, &set, NULL) < 0) { perror("sigprocmask"); return 1; } puts("Blocking signal"); ...
C
/* Copyright (C) 2016 Thomas Kaulen 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 program is distributed in the hope th...
C
#include "../h/const.h" #include "../h/types.h" #include "../e/initial.e" #include "../e/pcb.e" #include "/usr/local/include/umps2/umps/libumps.e" /*********************************************************************** * This module implements Kaya's process scheduler and deadlock * detector * * It also is the ...
C
/* ** my_putstr_err.c for my_putstr_err.c in /home/cheval_8/rendu/PSU_2015_minishell2/lib/src ** ** Made by Chevalier Nicolas ** Login <cheval_8@epitech.net> ** ** Started on Sun Apr 10 03:43:45 2016 Chevalier Nicolas ** Last update Sun Apr 10 03:47:09 2016 Chevalier Nicolas */ #include "lib.h" void my_putstr_err(...
C
/* Esimerkki VIRHEELLISEST srand-funktion kytst. */ #include <stdio.h> #include <stdlib.h> #include <time.h> int main(void) { int i; for (i = 1; i < 50; ++i) { srand(time(0)); printf("%i\n", rand()); } return 0; }
C
/* ** right_op.c for 42sh in /home/toozs-_c/Prog_tests/fourty_two_tests/sources ** ** Made by cristopher toozs-hobson ** Login <toozs-_c@epitech.net> ** ** Started on Sat Apr 25 16:09:43 2015 cristopher toozs-hobson ** Last update Sun May 17 12:38:53 2015 cristopher toozs-hobson */ #include <sys/types.h> #include...
C
#ifndef DOCUMENT_H #define DOCUMENT_H #include <stdbool.h> #include <X11/Xft/Xft.h> #define MAX_UTF8_CHAR_LENGTH 6 typedef struct { short x; short width; char utf8[MAX_UTF8_CHAR_LENGTH + 1]; size_t length; } Character; typedef struct { short x; short width; Character *chars; size_t n...
C
/* * main.c */ #include "../fonctionsC.h" #include <stdio.h> int Liste_Choix[3] = {0,0,0}; unsigned int TabIntNoS[2] = {0,0}; signed int TabIntS[2] = {0,0}; int TabInt[2] = {0,0}; float TabFloat[2] = {0,0}; double TabDouble[2] = {0,0}; unsigned long TabLongNoS[2] = {0,0}; int TabDonnees[8] = {0,0,0,0,0,0,0,0}; s...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> //Tipos de barramento do emulador typedef unsigned char b_1bit; typedef unsigned char b_8bits; typedef unsigned int b_32bits; typedef unsigned long int b_64bits; //Numero de variaveis do programa que está sendo executado static int numvar = 0; //ALU typedef ...
C
#ifndef GLOBAL_H #define GLOBAL_H //ͷļҪõֽṹ typedef struct table//ӽṹ { int id;//ӱ int capacity;// int state;//״ֵ̬Ϊ0ʾУ1ʾˣorder.cchangetablestate_infilecalculate.cĽβֱֻļ޸ֵ struct table *next;//ı׼һָһڵָ } Table; typedef Table *tableptr;//ο˿αTable* typedefһ£ʹ typedef struct menu//˵ṹ { int id;//˵ı ch...
C
#include<stdio.h> #include<stdlib.h> #define ull unsigned long long int #define MOD 1000000007 ull fpow(int a,int n) { if(n==0) return 1; if(n==1) return a; else { ull temp=fpow(a,n/2); if(n%2) return (((temp*temp)%MOD)*a)%MOD; else return (temp*temp)%MOD; } } int main() { int t,n,m,k,i; ull va...
C
/* Pingpong sends a message back and forth between two tasks. * Pingpong requires a working subscription scheme, which we * don't have yet. Pingpong also requires support for * multiple instances of tasks, which we don't have either. * IOW, we need to do some work before pingpong is up and running. */ #include <st...
C
#include "open_n_create_fs_file.h" //----------------------------------------------------------------------------// void* create_fs_file(int* ret_fd, char* path, size_t inodes_cnt, size_t blocks_cnt) { int fd = open(path, O_RDWR | O_CREAT, 0666); if (fd == -1) ...
C
#include <sys/types.h> #include <dirent.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> #include <time.h> #include <fcntl.h> #include <unistd.h> #include <syslog.h> #define BUF_SIZE 1024 void copy(const char *fromPath, const char *toPath){ syslog(LOG_INFO, "Zaczeto kopiowanie z %s...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* get_next_line_utils.c :+: :+: :+: ...
C
/* ** EPITECH PROJECT, 2020 ** 42sh ** File description: ** double quot file */ #include "parsing/input/double_quote.h" char *double_quote(char *separators, char **arr, int i) { char *str = NULL; str = malloc(sizeof(char) * (strlen(arr[i]))); str = cpy_dquote(str, arr[i]); str = re_modify_str(str, se...
C
# include<stdio.h> # include<stdlib.h> # include"matrixmath.h" # include"helper.h" # include"image.h" # include"ppm.h" image imgcreate(int m, int n) { image temp = (image)malloc(sizeof(struct Image)); temp->red = matcreate(m, n); temp->green = matcreate(m, n); temp->blue = matcreate(m, n); return ...
C
/*++ Copyright (c) 1997 Microsoft Corporation Module Name: parsearg.c Abstract: Argument Handling Author: MikeTs Environment: Any Revision History: --*/ #include "pch.h" VOID ParseProgramInfo( PUCHAR ProgramName, PPROGINFO ProgramInfo ) /*...
C
// Answers within 10^-5 of the true value will be accepted as correct. // if it's 10^-5, it should use double !!!!!!! /** * Note: The returned array must be malloced, assume caller calls free(). */ double* sampleStats(int* count, int countSize, int* returnSize) { long sum = 0; int num = 0; int min_value ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_move.c :+: :+: :+: ...
C
#include <stdio.h> #include <conio.h> int reverse() { int n,rem,rvrno=0; printf("Enter a number with 3 or more digits "); scanf("%d",&n); while(n!=0){ rem=n%10; rvrno=rvrno*10+rem; n/=10; } return(rvrno); } void main() { int reverse(void); int rev; rev=reverse(); printf("Reversed Number is %...
C
#include <stdbool.h> #include <stdio.h> #include <stdlib.h> int main() { int number = 0; int numberToFind = 101; bool foundNumber = false; while (true) { if (foundNumber) return printf("Found it"); if (number == 100 && !foundNumber) { printf("Number not found"); break; }; if (numb...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.c :+: :+: :+: ...
C
#include<stdio.h> #include<stdlib.h> #include<time.h> #define tam 25 int campo[10][10], op[10][10], countbombas[100]; pthread_mutex_t mutex_bomba[25]; pthread_t gerando[25]; int verificaBomba(int linha, int coluna, int comparado) { int z; for(z=0; z<tam; z++) { if(op[linha][coluna] == comparado) ...
C
#include <p18cxxx.h> #include <delays.h> #define HIGH 1 #define LOW 0 #define CS PORTBbits.RB5 #define DATA_bit PORTBbits.RB6 #define SERCLK PORTBbits.RB7 #define delay_us Delay10TCYx // function declarations void ssrOut(unsigned char); void pulseCS(void); void init_MAX7219(void); void writeM...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main_de_test.c :+: :+: :+: ...
C
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> void anagram(char *arr){ char *ptr = arr; int length = 0; char save = *ptr; while(save != '\0'){ save = *(++ptr); length++; } if(length%2 == 1){ printf("-1\n"); return; } ptr = arr; char *ptr2 = arr; ptr2+=length/2; int dis...
C
#include "monty.h" /** * free_stack - Free stack * @head: stack to free */ void free_stack(stack_t *head) { stack_t *save; while (head != NULL) { save = head; head = head->next; free(save); } } /** * add_stack - add to stack * @head: stack * @n: line * Return: 1 if ok */ int add_stack(stack_t **head,...
C
#include "PCF8574.h" // Required for PCF8574 PCF8574 pcf4; String buttonColor[5] = {"red", "green", "blue", "pink", "none"}; bool eventButton[5] = {false, false, false, false, false}; void initButtonPanel(){ pcf4.begin(0x24); for(byte i = 0; i < 4; i++){ pcf4.pinMode(i, INPUT_PULLUP); } pcf4.pinMode...
C
#include <stdlib.h> #include <string.h> #include "lists.h" /** * sum_listint - check the code . * @head: list * Return: Always . */ int sum_listint(listint_t *head) { listint_t *tmp; int sum = 0; if (!head) return (0); tmp = head; while (tmp) { sum += tmp->n; tmp = tmp->next; } return (sum); }
C
/* Escriba un programa que lea dos enteros y que determine e imprima si el primero es mltiplo del segundo. [Pista: Utilice el operador mdulo.] */ #include<stdio.h> int main(){ int p, s; printf("Escriba 2 numeros: "); scanf("%d%d", &p, &s); if (p%s==0){ printf("%d es multiplo de %d", p, s); } if (p%s==1){...
C
#include<sys/types.h> #include<sys/stat.h> #include<fcntl.h> #include<unistd.h> #include<stdio.h> int main(void) { int fd, len; char buf[20]; if ((fd = open("tempfile", O_RDWR | O_CREAT | O_TRUNC, 0666)) == -1) { printf("open error\n"); return 1; } unlink("tempfile"); if(write(fd, "Ho...
C
/*This is a function for sorting an array useing merge.c * *Author: Eric *Time: 2011.01.08 */ #include <stdio.h> #include "main.h" #include "merge.h" /*Sort array a, from a[begin] to a[upend-1]*/ void sort(int *a, int begin, int upend) { int n = upend - begin; /*the number to be sorted*/ /*The f...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/select.h> #include <fcntl.h> #include <errno.h> #include "potato.h" void make_fifos(char *fifos_name[], int index) { if ((mkfifo(fifos_name[index], FILE_MODE) < 0) && (errno != EEXIST)) { perror("mkfifo() error"); ...
C
#include <hidef.h> /* common defines and macros */ #include "derivative.h" /* derivative-specific definitions */ #include <stdio.h> #include <termio.h> #include <stdlib.h> //float asciiToFloat(byte* line); #define FreqClockA 2000000 // Value on Reset (PWMPRCLK = 0x00) //assigns values to the PWM registers...
C
#include <stdio.h> int main(void) { freopen("/var/log/kern.log", "r", stdin); freopen("user.out", "w", stdout); char s[100]; while (gets(s) != EOF) { printf("%s", s); } return 0; }
C
#include "holberton.h" /** * _getenv - retrieves env variable that matches input string * @input: input string * @environ: local environmental variables * Return: string of env variable */ char *_getenv(char *input, char **environ) { register int i = 0; char *tok, *right; while (environ[i]) { tok = strtok(...