language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include "unpipc.h" int main(int argc, char **argv) { int fd; long ivals[4], ovals[4]; door_arg_t arg; struct stat stat; struct door_info info; if (argc != 2) err_quit("usage: client1 <pathname>"); fd = Open(argv[1], O_RDWR); Fstat(fd, &stat); printf("pid = %ld, fmt = %lx\n", (long) getpid(), (long)...
C
#include <stdio.h> #include <string.h> void main () { int n; scanf("%d", &n); int i; int k; for(i = 0; i <= n; i++) { for(k = 0; k < n - i; k++) { printf(" "); } for(k = 0; k < 2*i - 1;k++) { printf("*"); } printf(...
C
#include <stdio.h> #include <stdlib.h> #include "size.h" #include "read.h" #include "search.h" /// \author Binh Nguyen Duc /// \brief Module contains all tests for procedures/functions /// which are from libraries size.c, read.c and search.c /// \details function test including file existance, read_size and execute ...
C
/* * complex.c * * Ramiro Jordan * ECE 231 - Fall 2012 * Date: January 16, 2012 * */ #include "complex.h" //#include "complex-functions.c" //argc is the number of arguments, and argv is the array containing those arguments int main(int argc, char *argv[]) { // declaring area for variables int here; int amoun...
C
/* Marcelo Yuichi Matsuda Nishimaki 8127079 */ /*bibliotecas utilizadas */ #include <stdio.h> #include <math.h> /*definir Pi */ #define M_PI 3.14159265358979323846 /* calculo de d1 */ double x1(double St,double K, double r, double sigma, double T) { double d; d = (log(St/K)+(r+(pow(sigma,2))/2)...
C
/* * File: BinarySearch.h * Author: Will * * Created on November 11, 2014, 10:07 AM */ #ifndef BINARYSEARCH_H #define BINARYSEARCH_H int search(int A[], unsigned int L, int target, bool sorted); //int A[] is the array to be searched //int L is the size of the array //int target is the integer to ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* fdf_verbose_1.c :+: :+: :+: ...
C
/* gd -I ../dlist slist.c slist_test.c ../dlist/dlist.c */ #include <stdio.h> /*printf */ #include <stdlib.h> /* exit */ #include <string.h> /* strcmp */ #include "slist.h" /* forward decleration */ void Printlist(sort_iter_t iter, sortList_t *list) ; int IsBefore(const void *, const void *,const void * param); sort...
C
#include <errno.h> #include <stdio.h> #include <strings.h> #include <string.h> #include <stdlib.h> #include "network.h" static void initNetwork(Network *this); Network createNetwork() { Network this; initNetwork(&this); this.free = freeNetwork; puts("Network created"); return this; } static void initNetwo...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include "Menu.h" #include "Book.h" #include "FileIo.h" int printMenu() { int select = -1; printf(" ================================================\n"); printf(" | α׷ |\n"); printf(" | 1. Է |\n"...
C
#include <stdio.h> #include <string.h> int main () { char *str; char *str1 = "nothing"; //char *saveptr; //char *foo, *bar; //char key[] = { ' ', '\n', '\t', 0 }; char key[] = { '>' }; char key1[] = { ' ' }; // char str[] ="-ls>out.txt"; // char * pch; // printf ("Splitting string \"%s\" into tokens...
C
#include "fw_logs.h" // create / destroy // =================================================================== static FiloCircArr logs_table; int fw_logs_init(void){ fcr_init(&logs_table); VPRINT2(KERN_INFO LOGS_TAG "init [num of logs: %d]\n", fw_logs_getNumOfEntries()); return RETVAL_OK; } int fw_...
C
#include "remo.h" //help page static int Remo_Test_Help( int ac, char *av[]) { printf("Try ./remo [OPTION] for more information.\n"); return 0; } static REMO_TEST_LIST_s RemoTestCmdListHead = { .Name = "help", .Handler = Remo_Test_Help, .Func = "Show man page", .pNext = N...
C
/*This file is a part of Library-Management Library-Management is a 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. This p...
C
#include <stdio.h> #include <unistd.h> #include <stdlib.h> int main(int argc, char **argv) { int pid; int pipe1[2]; int pipe2[2]; int x; if (pipe(pipe1) < 0) { perror("pipe not create"); exit(EXIT_FAILURE); } if (pipe(pipe2) < 0) { perror("pipe not cre...
C
#include "normal_distribution.h" void init_normal_distribution(struct NormalDistribution *nd, const double *max_y, const double *width) { nd->max_y = *max_y; nd->width = *width; } void compute_normal_distribution_y(const struct NormalDistribution *nd, const double *x, double *delta) { *delta = nd->max_y *...
C
// // Created by winxos on 2016-11-20. // #include "stack.h" #include <malloc.h> PSTACK create_stack(int n) { PSTACK s = (PSTACK) malloc(sizeof(STACK)); s->BUF = (DATA_TYPE *) malloc(sizeof(DATA_TYPE) * n); s->max_len = n; s->ptop = 0; return s; } int is_empty(PSTACK s) { return (s->ptop == ...
C
/**-------------------------------------------------------------------------------- * * pgreshape -- Embed the new column according to the desired position in any table * in the postgresql database. * * Copyright (c) 2019, Rafael Garcia Sagastume * *--------------------------------------------------------...
C
#include <math.h> #include "vars.h" void iteration(FLOAT *u_future, FLOAT *u_present, FLOAT *u_past, int n_puntos, FLOAT r){ int i; for(i=1;i<(n_puntos-1);i++){ u_future[i] = (2.0*(1.0-r*r))*u_present[i] - u_past[i] + (r*r)*(u_present[i+1] + u_present[i-1]); } u_future[0] = (2.0*(1.0-r*r))*u_prese...
C
// Importation des librairies #include <stdio.h> #include <stdlib.h> #include <time.h> #include <string.h> #include <termios.h> #include <unistd.h> #include <sys/ioctl.h> // Importation des programmes annexes #include "getch.c" #include "affiDyn.c" #include "menustats.c" #include "writestats.c" #include "termsaver1.c"...
C
#include <stdio.h> void sum1(void); int main() { sum1(); return 0; } void sum1() //takes nothing returns nothing { int i, a, s = 0; printf("enter the value of a:"); scanf("%d", &a); for (i = 1; i <= a; i++) s = i + s; printf("sum is %d", s); }
C
#include <stdio.h> #include <stdlib.h> int main(void){ char **aPtr; int len = 1; // Start with 1 string aPtr = malloc(sizeof(char*) * len); // Do not cast malloc in C scanf("%s",aPtr[0]); printf("%s \n",aPtr[0]); // This should work now. }
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <signal.h> #define N 6 /* broj razina proriteta */ int OZNAKA_CEKANJA[N]; int PRIORITET[N]; int TEKUCI_PRIORITET; int sig[]={SIGUSR1, SIGUSR2, SIGCHLD, SIGABRT, SIGINT}; void zabrani_prekidanje(){ int i; for(i=0; i<N; i++) sighold(sig[i]); } ...
C
#include <stdio.h> /* Exercise 4-14. * * Define a macro swap(t,x,y) that interchanges two arguments of type t. * (Block structure will help.) */ #define swap(t, x, y) { t temp = x; x = y; y = temp; } int main(int argc, char* argv[]) { int x = 10, y = -10; printf("Before swap:\t x = %d and y = %d\n", x, y...
C
#include "uart_server.h" #include "common.h" #include <sys/types.h> #include <sys/socket.h> #include <stdio.h> #include <netinet/in.h> #include <unistd.h> struct uart_server_mgr g_serviceMgr; int uart_service_init() { int i; g_serviceMgr.serial_fd = -1; g_serviceMgr.server_socket = -1; for( i=0; i...
C
/* ** load_game_basic.c for in /home/Quentss/Work/graphic/tekadventure/src ** ** Made by Quentin AMARAL ** Login <Quentss@epitech.net> ** ** Started on Sun May 28 19:04:58 2017 Quentin AMARAL ** Last update Sun May 28 19:04:59 2017 Quentin AMARAL */ #include <unistd.h> #include <stdio.h> #include <stdlib.h> #inc...
C
/************************************************************************* > File Name: mkdir.c > Author: > Mail: > Created Time: Tue 21 Jul 2015 07:52:57 PM CST ************************************************************************/ #include<stdio.h> #include<sys/types.h> #include<sys/stat.h> #include<errno....
C
#include <stdio.h> #include "../graph.c" void printGraph(struct graph* currentGraph) { for (int v = 0; v < currentGraph->verticesCount; ++v) { struct node *currentNode = currentGraph->adjacencyList[v].head; printf("Adjacency list of vertex %d\n head", v); while (currentNode) { ...
C
#include "ZynqPSGpioDriver.h" #include "GpioDriverPrivate.h" #include <stdlib.h> typedef struct ZynqPSGpioDriverStruct { GpioDriverStruct base; uint32_t address; } ZynqPSGpioDriverStruct; static void init(GpioDriver super) { ZynqPSGpioDriver self = (ZynqPSGpioDriver) super; // Init whatever clo...
C
/** * Note: The returned array must be malloced, assume caller calls free(). */ static char g_map[10][4] = { "", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz", }; int g_num[10] = {0,0,3,3,3,3,3,4,3,4}; void DFS(char *dig, char **res, int *ans, int depth, int ...
C
/* ** generate.c for sudoku in /home/brout_m/RENDU/CPE/sudoki-bi/generate ** ** Made by marc brout ** Login <brout_m@epitech.net> ** ** Started on Sat Feb 27 12:10:44 2016 marc brout ** Last update Sun Feb 28 13:08:31 2016 marc brout */ #include <time.h> #include <stdlib.h> #include <stdio.h> #include "generate.h" ...
C
#ifndef GTHREAD_DISPENSER #define GTHREAD_DISPENSER GTHREAD_DISPENSER #include<pthread.h> #include<semaphore.h> #include<stdlib.h>//malloc et al. #include"gmp.h" /* * we clean the 'source_row' column using the source row */ struct row_pair { size_t source_row; size_t target_row; }; /* * stuff conserning the syn...
C
// Deskripsi: Modifikasi ADT Mesin Karakter dan ADT Mesin Kata V1 untuk membaca data lawan dari file eksternal #ifndef __BASESTATS_H__ #define __BASESTATS_H__ #include "../Boolean/boolean.h" #define NMaxNAMA 21 #define NMaxDESC 200 #define MaxElBST 40 typedef char NAMA[NMaxNAMA]; typedef struct { NAMA N; int BH...
C
/*-----------------------------------------------------------------------* * filename - fread.c * * function(s) * fread - reads data from a stream * _fgetn - reads data from a stream *-----------------------------------------------------------------------*/ /* * C/C++ Run Time Libra...
C
#include <stdio.h> #include <stdlib.h> /** * Return an array of arrays of size *returnSize. * The sizes of the arrays are returned as *returnColumnSizes array. * Note: Both returned array and *returnColumnSizes array must be malloced, assume caller calls free(). */ int** generateMatrix(int n, int* returnSize, int...
C
#include<stdio.h> #include<conio.h> #define sq(x) x=90 void main() { int y=0; printf("y=%d",y); sq(y); printf("\ny=%d",y); }
C
#include <stdlib.h> #include <stdio.h> #include <string.h> //this code is for Caesar cipher // char rotate(const char in, char pivot, int offset) { return pivot + (in - pivot + offset) % 26; } void some_function(const char *in, char *outbuf, int offset) { int i; char *out = outbuf; for (; *in; ++in, +...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* selection.c :+: :+: :+: ...
C
/******************************************* * File Name : elf_link_map.c * Purpose : * Creation Date : 02-09-2016 * Last Modified : Fri 09 Sep 2016 10:55:40 AM CST * Created By : Mark Tseng **********************************************/ #include <stdio.h> #include <stddef.h> #include <stdint.h> #include <stdlib.h>...
C
#include "MemoryTable.h" khash_t (intptrhashtable) *MemoryTable_hash(struct MemoryTable *self) { if (!self->htable) self->htable = kh_init(intptrhashtable); return self->htable; } void MemoryTable_init(struct MemoryTable *self) { self->htable = NULL; } intptr_t MemoryTable_size(struct...
C
/*--------------------------------------------------------------------------------*/ /* */ /*Maxime Escourbiac 30/09/2009 */ /*ZZ1 ...
C
#include "computing.h" #include <stdio.h> #include <string.h> int sort(char* k1, char* k2) // function for decisions move for two words { // int x = 0; // init var for enumeration symbol in the words while (tolower(k1[x]) == tolower(k2[x]) // && x < strlen(k2...
C
#include <stdio.h> #include <stdlib.h> #include <tgmath.h> // foi preciso incluir esta biblioteca que faz com que a funo raiz quadrada seja calculada pelo codigo /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main (int argc, char *argv[]) { int opcao; float n...
C
/* ** EPITECH PROJECT, 2019 ** my_strcat.c ** File description: ** string cat */ #include "my.h" #include <stdarg.h> char *my_strmasscat(int nbr_str, char const *str, ...) { va_list list; char *cat = NULL; char *new_str = NULL; va_start(list, str); cat = my_strdup(str); for (int i = 1; i < nb...
C
/** * \file type.h * \author The C Team - Baptiste * \version 1.0 * \date 17 Janvier 2018 * \brief Type definition of a ptree * */ #ifndef __TYPE_H #define __TYPE_H enum TCode { TY_UNDEFINED, TY_UNIT, TY_BOOL, TY_INT, TY_FLOAT, TY_FUN, TY_TUPLE, TY_ARRAY, ...
C
#include <stdio.h> #include<conio.h> void factorial(int n); int main () { int n; printf ("Enter the number you want factorial of : \n"); scanf ("%d",&n); factorial(n); return 0; } void factorial(int n) { long b=1; for(int i = 1; i <=n; i++) { b=b*i; } printf("factorial is %ld",b); }
C
#include <immintrin.h> #include <smmintrin.h> #include <stdio.h> #include <stdlib.h> #include <xmmintrin.h> int main() { int M, N; scanf("%d %d", &M, &N); float* A = aligned_alloc(32 * 8, sizeof(int) * M * N); float* B = aligned_alloc(32 * 8, sizeof(int) * M * N); for (int i = 0; i < M; ++i) { ...
C
#ifndef SELECTIONSORT_H_INCLUDED #define SELECTIONSORT_H_INCLUDED void selectionSort(int *array, int size) { for (int u = 0; u < size; u++) { int min = array[u]; int index = u; // tim phan tu nho nhat va index cua no trong array for (int i = u; i < size; i++) { if (array[i] <= min) { ...
C
#include<stdio.h> #include<stdlib.h> Node* removeNodes(Node* listHead, int x) { SinglyLinkedListNode* head = listHead; while(listHead!= NULL && listHead->data > x) { listHead = listHead->next; } SinglyLinkedListNode *prev = listHead; head = listHead; listHead = listHead->...
C
#include "ocnet_time.h" #include <stdio.h> #include <string.h> #include <time.h> #include <stdint.h> #include <sys/time.h> #include <inttypes.h> static uint64_t __now(void) { struct timeval tv; gettimeofday(&tv, NULL); return tv.tv_sec * 1000 + (tv.tv_usec / 1000); } static uint64_t __now_str(char *buf,...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> // a struct for planet data struct planet { char name[30]; float size; }; void writep() //to write data in file { FILE *file; file=fopen("planets.txt", "a+"); if (file == NULL) { printf( "\nError opened file\n"); exit (1); }...
C
#include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <unistd.h> #include <string.h> int main(int argc, char *argv[]) { int network_socket; // recv(network_socket, &server_response, sizeof(server_response), 0); // print out the server's response ...
C
/* compile with gcc -o msHOT msGCHOT.c streecGCHOT.c rand1.c -lm */ /*same as ms.c but with mutliple crossover and geneconv hotspots addition */ /***** ms.c ************************************************ * * Generates samples of gametes ( theta given or fixed number * of segregating sites.) * Usage i...
C
//btw this looks interesting //ask interviewer to give you any preorder traversal #include <stdio.h> //consider 10 5 1 7 40 50 #define max 20 //btw i think this is EXACTLY same as constructing a BST from given input...DSF assignment 5 like! int pre[max]={10,5,1,7,40,50}; //int hash[256]={0}; int i=0,n=6,m...
C
#include<iostream> #include<vector> #include<string> #include<algorithm> #include<cmath> using namespace std; int minDistance_1(string word1, string word2) { int m = word1.size(), n = word2.size(); vector<vector<int> > dp(m + 1, vector<int> (n + 1, 0)); for(int i = 1;i <= m;i++) dp[i][0] = i; for(int ...
C
/* * $Id: page.c,v 1.3 2002/09/04 20:53:04 jan Exp $ * * Copyright (c) 2002 Jan Algermissen * See the file "COPYING" for copying permission. * */ #include "page.h" #include <tmtrace.h> #include <assert.h> /* * "____" is in bytes 0-3 in order to visualize page boundaries when * looking at the file with od */ ...
C
#include <stdio.h> #include <string.h> #include <ctype.h> int main() { int m; scanf("%d\n",&m); int str[m]; for(int i=m-1;i>=0;i--) { scanf("%d",&str[i]); } printf("%d",str[0]); for(int j=1;j<m;j++) { printf(" %d",str[j]); } return 0; }
C
#define _GNU_SOURCE #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <assert.h> #define FNAME "test-zfs-futimens.txt" int main() { struct stat st1; struct stat st2; unlink(FNAME); int fd = creat(FNAME, 0600); asse...
C
#include "semantic.h" #include "symbol.h" #include "temp.h" #include "parser.h" #include <stdio.h> int yysemanticerrs = 0; static char err_msg [126]; static const char* error_text[] = { "NO declarado", "ya declarado" }; static const char* op_text[] = { "ADD", "SUB", "MUL", "DIV", "NEG" }...
C
int add(int a, int b){ return a+b; } int main() { int x = 10; int y = 5; return add(x, y); }
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 "unistd.h" #include "sys/types.h" #include "sys/wait.h" #include "sys/stat.h" #include "fcntl.h" #include "signal.h" #include "stdio.h" #include "errno.h" #include "string.h" #include "stdlib.h" #include "shell.h" char *remove_extra_spaces(char *command){ char *str1,*saveptr1,*token; char *a = (char *)mal...
C
#include <stdlib.h> #include <stdio.h> #include <dirent.h> #include <fcntl.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #define max(a,b) (a>b?a:b) #define min(a,b) (a<b?a:b) int try_readdir() { DIR *dirp = opendir("."); while(1){ struct dirent *entry = readdir(d...
C
#include<stdio.h> #include<stdlib.h> // used to include malloc(),free() struct NODE //STRUCTURE DEFINITION { int KEY; // varible to hold the value struct NODE * NEXT; // pointer to point next node }; struct NODE *SP=NULL; // initally ...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> #include <mpi.h> #include <time.h> #define MAX(x, y) (((x) > (y)) ? (x) : (y)) /* * @author Connie Shi cs3313@nyu.edu * Parallel Computing Lab 1 * * Given a set of n equations with n unknowns (x1 to xn), program * will calculate the v...
C
#include <stdio.h> #include<stdlib.h> #include<malloc.h> struct node { int data; struct node *link; }; struct node *first=NULL; void insert_front() { int item; struct node *p, *temp; p=(struct node *) malloc (sizeof(struct node)); printf("enter the element to be inserted\n"); scanf("%d",&item)...
C
/*============================================================================= * Author: Pablo Morzán * Date: 2021/08/15 * Version: 1.0 *===========================================================================*/ /*=====[Inclusions of function dependencies]=================================*/ #include "leds.h" ...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> //fork #include <sys/wait.h> //waitpid #include <errno.h> #include <string.h> int main() { printf("\nVarázs-Lak Kft\n"); int status; char str[80]; pid_t child; pid_t parent = getpid(); char ** args[20]; int going = 1; ...
C
#include<stdio.h> #include<math.h> int main() { int i,j,k,t,n,x,in,a[100000]; double l_n; scanf("%d",&t); for(i=1;i<=t;i++) { scanf("%d",&n); if(n==1||n==0) { printf("Case %d:\n",i); continue; } j=0; for(k=2;k*k<...
C
/* scheduler.c * Simple program that simultaneusly run ping and pong * (print A/B 1000 times each simultaneusly) */ #include "syscall.h" #define SCHEDULER_INS "***Scheduler program | Simultaneusly Ping and Pong***\n" #define SCHEDULER_INS_LEN 54 #define PING "./test/ping" #define PONG "./test/pong" int main() { ...
C
#ifndef _COORD_H_ #define _COORD_H_ #include <cmath> int periodic_dist_sq(int x1, int y1, int x2, int y2){ int dx = abs(x1 - x2); int dy = abs(y1 - y2); if(dx > FIELD/2) dx = abs(dx - FIELD); if(dy > FIELD/2) dy = abs(dy - FIELD); return dx*dx + dy*dy; } double periodic_dist_sq(double x1, double y1, dou...
C
#include "kernel.h" #include "debug.h" #include "string.h" #include "driver/hal.h" #define NR_DEV 64 static Device dev_pool[NR_DEV]; static ListHead free_list, devices; void init_hal(void) { int i = 0; list_init(&free_list); for (i = 0; i < NR_DEV; i ++) { list_add_before(&free_list, &dev_pool[i].list); } li...
C
/************************************************************************* > File Name: p8.c > Author: > Mail: > Created Time: Mon 23 Dec 2019 12:14:08 PM UTC ************************************************************************/ #include<stdio.h> double power(double n, int p); #define MINU '*' int main(void...
C
#include <conio.h> #include <stdlib.h> #include <stdio.h> #include <locale.h> int main() { setlocale(LC_ALL, "Portuguese"); float hx, hf, h; printf("\n\nDigite o nmero de horas extras: "); scanf("%f", &hx); printf("Digite o nmero de horas faltadas: "); scanf("%f", &hf); h = hx - (hf*2/3); printf("Se...
C
#include "sh21.h" int get_len_line(char *str, int y) { int i; int count; int len; if (!str) return (-1); i = -1; count = 0; len = 0; while (str[++i] != '\0') { if (count == y) { while (str[i] != '\0' && str[i] != '\n') { ++len; ++i; } return (len); } if (str[i] == '\n') +...
C
/*管脚和变量定义*/ const int buttonPin = 2; // 定义开关按键输入针脚号常量 数字端口2 const int ledPin = 13; // 开关状态显示指示灯 数字端口13 bool ledState = HIGH; // 状态标志 bool output_flag = false; // 油门输出标志 int buttonState; // 开关按键状态 int lastButtonState = HIGH; // 上次开关状态 long lastDebounceTime = 0; // 时间记录 long ...
C
#include "pse.h" void hashToString(char *output, const unsigned char *hash) { char buffer[3]; char hex_hash[HASH_HEX_SIZE] = {0}; for(int i = 0; i < HASH_SIZE; i++) { memset(buffer, 0, sizeof(buffer)); sprintf(buffer,"%02x", hash[i]); strcat(hex_hash, buffer); } strcpy(output,hex_hash); ou...
C
/* Author: This file provides three functions called: collatzWhile, collatzRecursive, and collatzGoto. each function takes exactly one input, n, and returns the same thing: the number of steps it takes to get from n to 1 following the Collatz process. The Collatz process is defined as follows: 1. Given n 2. If n is d...
C
#include<stdio.h> int main() { int arr[5],b[6]; int i,j,k,c; for(i=0; i<5; i++){ scanf("%d",&arr[i]); } for(i=0;i<5;i++) { c =arr[i]+arr[i+1]; } printf("%d ",c); return 0; }
C
#include "list.h" #include "debug.h" private inline bool_t is_head(list_elem * elem) { return elem != nullptr && elem->prev == nullptr && elem->next != nullptr; } private inline bool_t is_tail(list_elem * elem) { return elem != nullptr && elem->prev != nullptr && elem->nex...
C
#include "ft_printf.h" void ft_convert_ldbl_to_fraction(union u_ldbl *un) { int border; border = 64; if (ft_get_exponent(un->dbl) > 16382) un->bytes[4] = 16382; while (border > 0) { if (un->bytes[3] & (1 << 15)) break ; ft_union_ldbl_bitmove_right(un, 1); un->bytes[4] -= 1; --border; } }
C
/////////////////////////////////////////////////////////// // main.c // Main method for snake game. // Author: Sarp Misoglu // 12/5/2017 /////////////////////////////////////////////////////////// #include <stdio.h> #include <stdlib.h> #include <pthread.h> #include "../EasyPIO.h" #include "../board_operations.h" #in...
C
#include<stdio.h> #include<stdlib.h> int main() { int **a,total_class; printf("Enter the number of total class: "); scanf("%d",&total_class); int ara[total_class]; // Allocate memory for total class.. a=malloc(total_class*sizeof(int)); // Allocate memory for total student.. for(int i=0;...
C
#include "Board_I2C.h" #include "APP_SoftTimer.h" void I2C_Init(void) { GPIO_InitTypeDef GPIO_InitStruct; RCC_APB2PeriphClockCmd( I2C_GPIOCLK, ENABLE); GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Pin = I2C_SDAPin | I2C_SCLPin ; GPIO_Init(I...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_lstadd.c :+: :+: :+: ...
C
#include "holberton.h" /** * rev_string - reverse a string * @s: string to reverse * Description: reverses the string * Return: nothing **/ void rev_string(char *s) { int i = 0; int j = 0; char c[1000]; while (s[i] != '\0') { i++; } for (; i > 0 ; i--) { c[j] = s[i - 1]; j++; } while (i < j) { s[i] = c[i]; i++; ...
C
#include <stdio.h> #include <stdlib.h> void soru1() { int kan; int yas; int test1; printf("*** X Hastaligi Teshis Programi *** \n"); printf("Kan Basinci = "); scanf("%d",&kan); printf("Yas ="); scanf("%d",&yas); printf("Test 1 ="); scanf("%d",&test1); if(kan...
C
#define NUMERO_ITEMS 7 #define OPCOES_MENU 4 #define LISTAS 6 #define MAX_PESSOA 50 #define MAX_NUM_ID 13 #define MAX_CONTACTO 40 #define MAX_NOME_ESPECTACULO 50 #define MAX_DESC_ESPECTACULO 50 #define MAX_NOME_SALA 40 #define MAX_DESC_SALA 50 #define ORDEM_LISTA_ESPECTACULO 0 #define ORDEM_LISTA_SALA 1 #de...
C
#include "svg.h" #include "lista.h" #include <stdio.h> void iniciaSvg(char arq[]){ FILE *arqout; arqout = fopen(arq, "w"); if (arqout == NULL){ printf("Nao foi possivel Abrir o arquivo svg"); exit(1); } fprintf(arqout, "<svg>"); fclose(arqout); } void finalizaSv...
C
/* ** EPITECH PROJECT, 2021 ** Zappy ** File description: ** look around and get map commands */ #include "zappy_server.h" #include "commands.h" #include <stdlib.h> void looknorth(client_t *client, server_t *server, char *response, position_t *position) { if (position->n == 0) { position->x = client->po...
C
#include <stdio.h> void main (void) { int a = 10, b, i; char bits[33]; bits[32] = '\0'; for (i = 0; 31 - i != -1; i ++) { a = a >> 1; if (a % 2 == 0) { bits[31 - i] = 48; } else { bits[31 - i] = 49; } } printf("%s", bits); }
C
/******************************************************************************* * The Elm Mail System - $Revision: 5.1 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor ******************************************************************************/ ...
C
#include <stdio.h> #include <string.h> #define max 100 int main() { int n,j,k,i,tam; char c,str[max]; scanf("%c",&c); scanf("%s",str); while ( (c != '0' ) || (str[0] != '0') ) { tam = strlen(str); for(j=0;j<tam;j++) { if( str[j] == c ) { for(k=j;k<tam;k++) { str[k]...
C
#include<stdio.h> char *a_strcpy(char *,char *); main() { char a[15]="manoharreddy"; char b[20]; a_strcpy(a,b); } char *a_strcpy(char *a,char *b) { int i; for(i=0;a[i]!='\0';i++) { b[i]=a[i]; } printf("%s\n",b); }
C
#include<stdio.h> int main() { int i, n, k,max=0; for(i=1; i<=100; i++) { scanf("%d", &n); if(max<n) { max=n; k=i; } } printf("%d\n%d\n", max,k); return 0; }
C
#include <stdio.h> void sum(int a,int b) { int sum = a + b; printf("%d \n", sum); } int main() { int a, b, ret; printf("Enter a: "); ret = scanf("%d", &a); if (0 != ret) { printf("Enter b: "); ret = scanf("%d", &b); if (0 != ret) sum(a,b); } else printf("Invalid input"); r...
C
#include <stdio.h> #include <stdlib.h> struct BTreeNode { int val; struct BTreeNode* left; struct BTreeNode* right; }; void preorder(struct BTreeNode* root) { if(root==NULL) return; printf("%d,",root->val); if(root->left) preorder(root->left); if(root->right) preorder(root->right); } void mirroTree(...
C
#include <unistd.h> #include <stdio.h> #include <math.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/wait.h> #define F_TYPE float //тип вещественного числа #define MAX_FORMAT_L 80 //длина строки формата #define MAX_LINE 256 //длина строки #define e 0.00001 //точность void Equatio...
C
#include <stdio.h> int x,queue[100]; int t=-1,n,fun,i; void insert(); void delete(); void display(); int main() { printf("Enter the size of queue: "); scanf("%d",&n); printf("Function:\n 1.Insert\n 2.delete\n 4.display\n 5.stop\n"); do { printf("Enter the option: "); scanf(...
C
/* Student Name: Logan Christopher Student NetID: clc1085 Compiler Used: GCC, MacOSX Program Description: This program will generate random numbers within a user-specified range and output the unioned character buffer to a user-specified out-file as well as the console. */ #include <stdio.h> #include <stdlib.h> #...