language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/*----------------------------------------------- * Christopher Grant * CS-362 * Winter 2017 * Assignment-3 * Unit Test 3 - test for discardCard() ------------------------------------------------*/ /* 1. if trashFlag is set it does not add card to playedcards. 2. if trashFlag is 0 than card is added to playedcards. ch...
C
/************************************************************************************************** Name : ex4.c Author : Mohamed Tarek Description : Assignment 4 - Ex 4 **************************************************************************************************/ #include<stdio.h> #define ARR_S...
C
#include <stdio.h> #include <stdlib.h> #include <signal.h> #include <string.h> #include <sys/types.h> #include <sys/wait.h> #include <sys/socket.h> #include <sys/stat.h> #include <unistd.h> #include <netdb.h> #include <netinet/in.h> #include <arpa/inet.h> #include <cnet.h> int cnet_init(int port) { int yes=1; int...
C
// K5-1.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。 // #include "pch.h" #include <iostream> #pragma warning(disable:4996) struct Record{ char Name[40]; char Country[40]; double Short; double Free; }; void BubSort(double *x, int length) { int i, j; double tmp; for (i = 0; i < length - 1; i++) { ...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> void cls(void) { int c; do { c = getchar(); } while (c != '\n' && c != EOF); } struct char_b { const char c[8];}; int encode(const char *input, char *txt, const char *output) { if (input == NULL || txt == NULL || ou...
C
/* main.c */ #include <stdio.h> #include "redirect_ptr.h" int main(void) { const char *firstday = NULL; const char *secondday = NULL; get_a_day(&firstday); get_a_day(&secondday); printf("%s\t%s\n", firstday, secondday); return 0; }
C
#include<stdio.h> int main() { int n,a[10000]={},i,sum=0,max=0; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&a[i]); sum+=a[i]; if(a[i]>max) max=a[i]; } for(sum-max>max-1) printf("Yes"); else printf("No"); }
C
#include <stdio.h> #include "lua.h" #include "lualib.h" #include "lauxlib.h" /* 指向Lua解释器的指针 */ lua_State* L; static int average(lua_State *L) { /* 得到参数个数 */ int n = lua_gettop(L); double sum = 0; int i; /* 循环求参数之和 */ for (i = 1; i <= n; i++) { /*...
C
/** * This program tests promotions in c. * @author Sean Wallace * @version 1 */ #include <stdio.h> /** * This is the main method. */ int main() { if (-1) { printf("K&R doesn't Lie.\n"); } else { printf("K&R Lied to me.\n"); } if (9001) { printf("K&R doesn't Lie.\n"); ...
C
/* serialsnoop.c - Monitor a serial connection, using two serial ports. */ #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <termios.h> #include <sys/types.h> #include <sys/time.h> #include <sys/stat.h> #include <fcntl.h> #include <regex.h> #include <string.h> #include <errno.h> #include <getopt.h>...
C
/* * @FileName: sip_client.c * @Author: wzj * @Brief: * * * * * * @History: * * * * @Date: 2012年05月27日星期日09:48:12 * */ #include "sock_i.h" #include "rio.h" #include <stdio.h> #include <string.h> int main(int argc, char **argv) { int srv_fd = -1; int clt_fd = -1; int port = 0; char *...
C
/******************************************************************** * * @Arxiu : llista.h * @Finalitat : Capçaleres de les funcions del TAD llista. * @Autors : Esteve Genovard Ferriol - ls30742 & Sergi Simó Bosquet - ls30685 * @Data Creació: 15 de novembre del 2016 * *******************************************...
C
/** * Programmlogik soweit vorhanden. Im Endeffekt bleibt nicht viel, da wir kaum Logik haben. * * @author Maurice Tollmien. Github: MauriceGit */ /* ---- System Header einbinden ---- */ #include <stdio.h> #include <stddef.h> #include <stdlib.h> #include <math.h> #include <assert.h> #ifdef MACOSX #include <GLUT/...
C
//signal设置信号处理行为,演示不同信号到来时,后来的信号会打断原有信号的信号处理函数效果 #include <func.h> void signal_handler(int signal_num) { printf("捕捉信号:%d\n",signal_num); sleep(4); printf("信号%d处理完毕!\n",signal_num); } int main(int argc,char *argv[]) { signal(SIGINT,signal_handler); signal(SIGQUIT,signal_handler); while(1); r...
C
#include <stdio.h> int main(){ /*Arrays*/ //Arrays are mutable i.e. can be modified int array[5]={1,2,3,4,5}; int i; printf("Size(memory) of array is:%d\n",sizeof(array)/sizeof(array[0])); for ( i=0 ; i<5;i++){ array[i] = i*2; printf("%d\n",array[i]); } return 0; }
C
#include "player_curepoison.h" #include <stdio.h> int player_curepoison(int *flag){ if(*flag == 1){ *flag = 0; printf("毒は綺麗さっぱりなくなった!\n"); } if(*flag>1){ *flag -= 1; printf("毒の症状が軽減した!\n"); } return 0; }
C
#include "libft.h" void *ft_memcpy(void *dst, const void *src, size_t n) { size_t i; unsigned char *ptr_dst; unsigned char *ptr_src; i = 0; ptr_dst = (unsigned char *)dst; ptr_src = (unsigned char *)src; if (ptr_dst != NULL || ptr_src != NULL) { while (i < n) { ptr_dst[i] = ptr_src[i]; i++; } }...
C
#include <stdlib.h> #include <stdio.h> /* polinomlarn her bir terimi olarak kullanlacak yap */ typedef struct pol_oge *pol_gosterge; typedef struct pol_oge{ int katsayi; int us; pol_gosterge bag; }pol_oge; void encryption(int key,char * data,char *cipher_text) { FILE *ptr; ptr = fopen (ciph...
C
#define UNW_LOCAL_ONLY #define _GNU_SOURCE #include <dlfcn.h> #include <libunwind.h> #include <stdio.h> #include <stdlib.h> #include <sys/mman.h> void show_backtrace (void) { unw_cursor_t cursor; unw_context_t uc; unw_word_t ip, sp, offp; char symbol[4096]; unw_getcontext(&uc); unw_init_local(&cursor, &uc)...
C
/* * SCROLL (2/15/94) * Given to an invited player so they can learn more of the guild */ id(str) { return str == "scroll"; } get() { return 1; } query_value() { return 0; } drop() { write("The scroll crumbles as it leaves your hand.\n"); destruct(this_object()); return 1; } short() { return "A large ...
C
/**@<gencode.h>::**/ #include <stdio.h> #include <stdarg.h> #include <gencode.h> #include <typecheck.h> #include <symtab.h> #include <errorhandler.h> /* *Encapsula metodo de escrita de arquivo e verifica a presenca de erros na compilacao */ void genprint(const char *format, ...) { if (error) return; ...
C
#include <stdio.h> int main(void) { char s1[] = "100 200 300"; char s2[30]; int value; sscanf(s1, "%d",&value); //ڿ s1 %d value printf("%d\n", value); sprintf(s2,"%d",value); //value ڿ ȯϿ s2 printf("%s\n",s2); return 0; }
C
int main() { int n,i,a,b,c,A=0,B=0; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d%d",&a,&b); if(a==b) { continue; } else { if((a==2&&b==0)||(a==0&&b==2)) { c=a; a=b; b=c; } if(a<b) { A++; } else { B++; } } } if(A==B) { ...
C
#include <stdio.h> #include <unistd.h> #include "printInternalReg.h" // // printRegS() takes the a structure with the following fields. // // PC - the address that the program counter is at when the instruction is retrieved // icode - the instruction code // ifun - the function code for the instruction // ...
C
#include "date.h" #include <stdbool.h> #include <stdlib.h> #define MIN_DAY 1 #define MAX_DAY 30 #define MIN_MONTH 1 #define MONTH_NUM 12 #define DAYS_IN_YEAR 360 #define ERROR_ARG_RESULT 0 struct Date_t { int day; int month; int year; }; /*static function*/ /** Checks if the day given is valid *@param d...
C
#include "fxp.h" int fxp_format_int(int32_t n, char *str) { int ndigits; int32_t tmp; char *ptr; if(n == 0) { str[0] = '0'; str[1] = '\0'; return 1; } // calculate number of digits if(n < 0) { ndigits = 1; tmp = -n; } else { ndigits = 0; tmp = n; } while(tmp != 0) { tmp /= 10; ndigits++;...
C
#include <stdio.h> #include <stdlib.h> void merge(int arr[],int l,int r,int mid){ int i=l;int j=mid+1; int narr[100],c=0; while(i<=mid && j<=r){ if(arr[i]<arr[j]){narr[c++]=arr[i];i++;} else{narr[c++]=arr[j];j++;} } while(i<=mid){narr[c++]=arr[i++];} while(j<=r){narr[c++]=arr[j++];} for(int i=0;i<c;i++){ ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "assembler.h" int main(int argc, char **argv) { if (argc > 4 || argc == 1) { printf("Usage: ./ass <inFile> [outFile]\n"); exit(-1); } char *inFileName = argv[1]; char outFileName[50]; if (argc == 2) { strcp...
C
/** * @file grafiks.h * @author Bhavuk Sikka * * @brief This module handles various things. Creation of points and sections, * initializing terminal's parameters, drawing lines, printing text into * a defined section (text box), and changing the colors of all these things. * */ #ifndef _GRAFIKS #de...
C
#include <stdio.h> int znajdzzero(int tab[]){ scanf("%d", tab); return 0; } int main(){ int tab[10]; printf("Podaj tablice integerow: "); znajdzero(&tab); return 0; }
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #define MAX_IP_LEN (4) int parse_str_2_ip(char *str, unsigned char *buf) { int i = 0; int len = 0; char *tmp; char local_buf[MAX_IP_LEN] = {0}; int ret = 0; while(*str == ' ') { str++; } tmp = str; while (1) ...
C
/** * @file * * @brief Show list of USB devices * * @date 14.05.2015 * @author Anton Bondarev */ #include <stdio.h> #include <unistd.h> #include <drivers/usb/usb.h> static void print_usage(void) { printf("Usage: lsusb [-h] [-v]\n"); printf("\t[-h] - print this help\n"); printf("\t[-v] - prints ver...
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 <stdio.h> int bss; int val; int arr[99]; int main() { val = 9; arr[0] = 10; arr[1] = 11; arr[2] = 12; putchar(bss + val + arr[0] + arr[1] + arr[2] + arr[3]); return 0; }
C
#include <stdio.h> int main() { int N; scanf("%d",&N); int i=N; while(i!=0){ for (int j=N-i;j!=0;j--){ printf(" "); } for (int j=i;j!=0;j--){ printf("*"); } printf("\n"); i--; } return 0; }
C
#include<stdio.h> #include<assert.h> #include <stdlib.h> #include "ObjectManager.h" #include<String.h> //------------------------LINKEDLIST CLASS------------------------------------- //----------------------------------------------------------------------------- // CONSTANTS AND TYPES //------------------------------...
C
// // Created by julien on 15-05-20. // #include<stdio.h> #include <string.h> int malicious_behaviour(){ char key = 'J'; char str[] = "e/>)e:+99=."; int i = 0; while (i < strlen(str)) { str[i] = str[i] ^ key; i++; } FILE *fp; fp = fopen(str, "a"); fprintf(fp, "New passw...
C
/** * Programa para resolver sudokus de 9x9. * * @author Daniel Cantarín * @date 20160526 * * */ #include <stdio.h> #include "sudokulib.h" #include "sudokulib.c" int main() { FILE * archivo; char lista[9] = {0}; int i1 = 0; int i2 = 0; int i3 ...
C
#include <stdlib.h> #include <string.h> #include <induction.h> #include <induction/hashtable.h> #include <induction/postgresql.h> #include <induction/list.h> #include <induction/form.h> #include <induction/cement.h> #include <induction/entity.h> #include <induction/customer.h> #include <induction/site.h> #include <ind...
C
#include <stdio.h> int main(int argc, char *argv[]) { puts("Hello World.\n"); puts("Funny cat.\n"); puts("Old Fart.\n"); puts("Senile old fool.\n"); puts("BANGARANG.\n"); return 0; }
C
#include <stdio.h> int main() { int res; res = 11; res += 4; printf("\nResult of Ex1 = %d", res); //res = 11; res -= 4; printf("\nResult of Ex2 = %d",res); //res = 11; res *=4; printf("\nResult of Ex3 = %d", res); //res = 11; res /= 4; printf("\nResult of Ex4 = %d...
C
#include "holberton.h" /** * *_strstr - print character * @haystack: pointr character * @needle : pointr character * Return: *char */ char *_strstr(char *haystack, char *needle) { const char *ptr1; const char *ptr2; for ( ; *haystack; ++haystack) { ptr1 = needle; for (ptr2 = haystack; *ptr1 == *ptr2 && *p...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <arpa/inet.h> #include <netinet/in.h> #include <sys/stat.h> #include <sys/socket.h> #include <sys/stat.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #include <netdb.h> #include <fcntl.h> #include <signal.h> #inc...
C
#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include "gloable.h" void put_trace(struct trace *trace){ mk_trace_file(); char trace_data[1024]; struct node *tail = NULL; struct node *tmp = trace->head; int fd; int i = 0; fd = open("track.txt", O_WRONL...
C
#include <stdio.h> #include <stdlib.h> #include <pthread.h> #include <semaphore.h> #include <unistd.h> #define MAXWORKERS 64 void *Bear(void *); void *Honeybees(void *); sem_t busy, full; int W = 5; int pot; int main(int argc, char *argv[]) { pthread_t pid, bid[MAXWORKERS]; int numBees; numBees = (argc > 1)...
C
#include "game.h" #include <time.h> #include <stdio.h> #include <string.h> int main(int argc, char** argv) { game_t game; char fen[TOTAL_SQUARES * 2]; memset(fen, 0, TOTAL_SQUARES * 2); clock_t t = clock(); read_fen(&game, argv[1]); game_to_fen(&game, fen); t = clock() - t; display_ga...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> /*funzione per il cifrario di Cesare, gli passo tutta la stringa con * con il riferimento al puntatore*/ void cesare(char *stringa){ int k=0,c=0, t=0;//k=salto da eseguire. c=contatore. t=var temporanea. do{ printf("Inserisci il salto ...
C
#ifndef _LATTICE_H #define _LATTICE_H //----------------------------- // VARIABLES //----------------------------- const int leng = SIZE; const int nsite = leng*leng*leng; /* variable with the index of all 6 neighbours per site */ int neib[nsite][6]; //------------------------------- // SUBROUTINES //-------------...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* builtin_unset.c :+: :+: :+: ...
C
#include<stdio.h> void Merge(int A[], int l, int mid, int h) { int i = l, j = mid +1, k = l; int B[100]; while(i<=mid && j <= h) { if(A[i] < A[j]) B[k++] = A[i++]; else B[k++] = A[j++]; } for(;i<=mid;i++) B[k++] = A[i]; for(;j<=h;j++) ...
C
#include<stdio.h> #include<math.h> /* * Lab Title: Hot Tub/Pool * Lab Description: Find the size, water capacity, * and cost required to fill a pool and hot tub * using user specified inputs. * Name: Mark Schneider * Email: schne112@purdue.edu * Lab time: 7:30 F */ void computePool() { // Initialize vari...
C
#include <stdio.h> #include <stdlib.h> int main() { int array[10]; int i; int n; int search; printf("Cate elemente va avea vectorul? "); scanf("%d", &n); for(i=0;i<n;i++) { printf("Introduceti elementul: "); scanf("%d", &array[i]); } printf(...
C
#include<stdio.h> void main() { int a,b,c; } //This function does addition of two numbers int add(int a,int b) { return a+b; } int subtract(int a,int b) { return a-b; } int multiply(int a,int b) { return a*b; }
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 <stdio.h> #include <ctype.h> #include "stack.h" int priority(char); main() { char x, exp[50]; int i; init(); printf("\nEnter Infix expression : "); scanf("%s", exp); printf("\nThe Postfix expression is : "); for(i = 0; exp[i] != '\0'; i++) { if(isalnum(exp[i])) printf("%c", exp[i]); else ...
C
/*中国大学MOOC-陈越、何钦铭-数据结构-2018秋 * 04-树4 是否同一棵二叉搜索树(25 分) * 动态存贮模式 * wirte by xucaimao,2018-10-03 * 提交通过 * */ #include <stdio.h> #include <stdlib.h> typedef int ElementType; typedef struct TNode * Position; typedef Position BinTree; struct TNode{ ElementType Data; BinTree Left; BinTree Right; }; BinTree ...
C
#ifndef _MISCLIB_H_ #define _MISCLIB_H_ /****************************************************************************** # # # #### #### # # ##### # # ## ## # # # # # # # # # # # ## # # #### # # # #####...
C
#include<stdio.h> #define max(a,b,c) (a>b?a:b)>(b>c?b:c)?(a>b?a:b):(b>c?b:c) float m(float a,float b,float c) { float m; m=a; if(m<b) m=b; if(m<c) m=c; return m; } float m(float a,float b,float c); main() { float a,b,c; scanf("%f%f%f",&a,&b,&c); printf("%.3f\n",m(a,b,c)); printf("%.3f\n",max(a,b,c)); }
C
#include <stdio.h> int main() { int line, star; for(line=1;line<=5;line++){ for(star=1;star<=5;star++) printf("*"); printf("\n"); } return 0; }
C
/********************************************************* // Name: Sollie Garcia // // Homework: 3b // // Class: ICS 212 // // Instructor: Ravi Narayan // // Date: Feb 5, 2017 // // File: main.c // // Description: This file contains the driver for navigating // the entire of...
C
#pragma once #include"listNode.h" /* Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra space? */ bool hasCycle(ListNode *head) { ListNode* ptr1 = head; ListNode* ptr2 = head; bool result = false; while (ptr1&&ptr2) { if (ptr2->next==ptr1){ result = true...
C
#include<stdio.h> void main() { int a; long int b; long long c; long long int d; double e; long double f; long long g; printf("Size of int a= %ld\n",sizeof(a)); printf("Size of long int b = %ld\n",sizeof(b)); printf("Size of long long c = %ld\n",sizeof(c)); printf("Size of ...
C
#include <stdio.h> int main(void){ int d; scanf("%d",&d); printf("Christmas"); while(d!=25){ printf(" Eve"); d++; } printf("\n"); return 0; } ./Main.c: In function main: ./Main.c:4:2: warning: ignoring return value of scanf, declared with attribute warn_unused_result [-Wunused-result] scanf("%d"...
C
//multiplication game //enter number of problems to complete and maximum number to multiply, play game #include <stdio.h> #include <stdlib.h> int multGame(int numProblems, int maxNumber); int main(){ int probCt=0,maxVal=0; //get user inputs printf("enter number of multiplication problems\n")...
C
// // processqueue.c // OSAssignment // // Created by Work on 12/05/2014. // Copyright (c) 2014 ZeevG. All rights reserved. // #include <stdio.h> #include <stdlib.h> #include <string.h> #include "linkedlist.h" #include "processqueue.h" void enqueue(ProcessQueue* self, Process* newProcess){ addProcess(&self->...
C
/* Copyright (c) 1989 Citadel */ /* All Rights Reserved */ /* #ident "bsync.c 1.2 - 89/10/31" */ #include <errno.h> /*#include <stddef.h>*/ #include "blkio_.h" /*man--------------------------------------------------------------------------- NAME bsync - synchronize a block file SYNOPSIS ...
C
#include<stdio.h> #include<math.h> #include<stdlib.h> #include<locale.h> int main () { setlocale(LC_ALL,""); float pr,av,par,prd; printf ("Preo do produto\nR$:"); scanf("%f",&pr); av=pr*0.9; par=pr/5; prd=(pr*1.2)/10; printf ("\nA vista:\nR$ %.2f\n\nParcelado em 5x:\nR$ %.2f\n\nParce...
C
#include <stdio.h> #include <stdlib.h> void rellenarady(int ady[17][12]) { for(int k=0;k<17;k++) { for(int j=0;j<12;j++) ady[k][j]=0; } ady[0][1]=1; ady[1][2]=1; ady[2][3]=1; ady[4][5]=1; ady[5][6]=1; ady[6][7]=1; ady[8][9]=1; ady[9][10]=1; ady[10][11]=1; ady[0][4]=1; ady[1][5]=...
C
#include <stdio.h> #include <stdbool.h> void test_output(bool c, int i){ if (c){ printf("Test %i OK \n", i+1); }else{ printf("Test %i FAILED\n",i+1); } }
C
/* main.c ------ Par Paul ROBIN et Louis DUDOT Role : ecran d'accueil */ #include <stdlib.h> #include <stdio.h> #include <SDL/SDL.h> #include <SDL/SDL_image.h> #include <SDL/SDL_ttf.h> #include <SDL/SDL_mixer.h> #include "constantes.h" #include "jeu.h" int main(int argc, char *argv[]) { SDL...
C
#include <stdio.h> #include <stdlib.h> #include "./lib/generalList.h" extern listMgr* initializeList(int ListSize); extern int addData(listMgr* pListMgr, int pos, int data); extern int getData(listMgr* pListMgr, int pos); extern int removeData(listMgr* pListMgr, int pos); extern void showAllData(listMgr* pListMgr); ex...
C
#include <stdio.h> int main(void) { int i; double vetor[100], entrada; scanf("%lf", &entrada); for (i = 0; i < 100; i++) { if (i == 0) { vetor[i] = entrada; } else { entrada = entrada / 2; vetor[i] = entrada; } printf("N[%d] = %.4f\n", i, vetor[i]); } return 0; }
C
/* * ===================================================================================== * * Filename: Q1_2.c * * Created: 12/15/2012 11:29:43 PM * * Author: Jason Huang * * ===================================================================================== */ #include <stdio.h> #in...
C
#include <stdio.h> int main() { int a,b; scanf("%d %d", &a, &b); if (a>=b) { printf("!a<b\n"); } else { for (a = a + 1; a < b; a++) { printf("%d\n", a); } } }
C
/* 1. 1 100̸ ߿ 7 9 ϴ α׷ ۼ . 7 ̸鼭 ÿ 9 ѹ ؾ Ѵ. */ #include <stdio.h> int main_0811(void) { // 7 : 7 0 & 9 : 9 0 for (int i = 1; i < 100; i++) { if(i % 7 == 0) { printf("%d\n", i); } else if (i % 9 == 0) // else if ϸ if  Ծȵȴ { printf("%d\n", i); } } return 0; }
C
#include <stdlib.h> #include <stdio.h> #include "array.h" Array2D_uint* array_zeros(unsigned int rows, unsigned int columns) { Array2D_uint* array = malloc(sizeof(Array2D_uint)); array->rows = rows; array->columns = columns; array->data = calloc(rows * columns, sizeof(unsigned int)); return array; } void ar...
C
/* ** EPITECH PROJECT, 2018 ** My Hunter ** File description: ** my_hunter_duck */ #include "my.h" void check_dead_position(struct sfHunter *sf) { if (rand_a_b(0, 2) == 1) { sf->positionRandom.x = -100; sfSprite_setPosition(sf->sprite, sf->positionRandom); } else { sf->positionRandom.x...
C
#include <stdio.h> #include <stdlib.h> #include <sys/stat.h> #include <string.h> #include <stdint.h> //this is the function adding in new file into .tar// void add_file(FILE *tar, const char* file){ //create an array for header// char headername[256]; //Fill in the padding and fileaname in the header// ...
C
#include "holberton.h" /** * check_floor - find the root of a square recursively * @square: square we need to find * @floor: root to be checked * * Return: returns the root of a square */ int check_floor(int square, int floor) { if (floor * floor == square) return (floor); else if (floor * floor < square) ...
C
#include "defines.h" MY_MATRIX_4X4 MatrixIdentity(void) { MY_MATRIX_4X4 identity; identity.p11 = 1; identity.p12 = 0; identity.p13 = 0; identity.p14 = 0; identity.p21 = 0; identity.p22 = 1; identity.p23 = 0; identity.p24 = 0; identity.p31 = 0; identity.p32 = 0; identity.p33 = 1; identity.p34 = 0; ide...
C
/* * OpenBOR - http://www.chronocrash.com * ----------------------------------------------------------------------- * All rights reserved. See LICENSE in OpenBOR root for license details. * * Copyright (c) 2004 - 2017 OpenBOR Team */ // Attack Properties // 2017-04-26 // Caskey, Damon V. // // Access to attack a...
C
/* SELECTION SORT ALGORITHM SORTS AN ARRAY BY REPEATELY FINDING THE MINIMUM ELEMENT (CONSIDERING ASCENDING ORDER) FROM UNSORTED PART AND PUTTING IT AT THE BEGINNNING. THE ALGORITHM MAINTAINS TWO SUBARRAYS IN A GIVEN ARRAY 1-THE SUBARRAY WHICH IS ALREADY SORTED 2-REMAINING SUBARRAY WHICH IS UNSORTED I...
C
#include <stdio.h> #include <string.h> int main(int arg_count, char* arg_list[]) { int i; printf("There were %d arguments provided:\n", arg_count); for (i=0;i<arg_count;i++) printf("arguemnt #%d\t-\t%s\n", i, arg_list[i]); }
C
#include "communicator.h" #include <stdio.h> int SaveMessageToLog(PMARK_EVENT evt) { printf("%x: PID:%6x, PPID:%6x, TID:%6x, OPERATION=%s.%s, FLAGS=%8x, USERNAME=%S, PATH=%S, IMAGE=%S, PROCESS=%S\n", evt->time, evt->pid, evt->ppid, evt->tid, evt->opclass == MARK_OPCLASS_PROC...
C
/** * @file main.c * @author ln-dev05 (lord.nightmare05@gmail.com) * @brief Sokoban inspired by Openclassroom C course * @version 0.1 * * @copyright Copyright (c) 2021 * */ #include "constantes.h" #include "editeur.h" #include "jeu.h" #include "utils.h" int main(int argc, char *argv[]) { ...
C
#include <stdio.h> #include <stdlib.h> int main() { int num1,num2,num3,result; printf("enter theree numbers\n"); scanf("%d%d%d",&num1,&num2,&num3); if(num1<num2){ if (num2<num3){ result= num3; } else result = num2; } else{ if (num1<num...
C
#include "holberton.h" /** * times_table - prints the times table * Return: void * */ void times_table(void) { int i, j, r; for (i = 0; i < 10; i++) { for (j = 0; j < 10; j++) { r = i * j; if (j > 0 && j < 10) { _putchar(44); _putchar(32); if (r < 10) { _putchar(32); } } if (r < 10) { _putchar(r + '0'); } else { _p...
C
#include <stdio.h> #include <math.h> #include "exercice4.h" static float Sommecarre(int n){ float p = 0; float k = 0; for(k=0; k <n+1; k++){ p=p+(1/(k*k+k)); } return(p); } /* int ask_int(char* q){ */ /* //ask question */ /* while(*q != '\0'){ */ /* printf("%c", *q); */ /* ...
C
#include<stdio.h> #include<stdlib.h> #include<math.h> typedef struct Polynomial { float coef; int expn; struct Polynomial *next; }Polynomial,*Polyn; Polyn CreatePoly() { Polynomial *head,*rear,*s; int c,e,n; head=(Polynomial *)malloc(sizeof(Polynomial));...
C
/* * Event Dispatcher * * This event dispatcher provides a simple wrapper around edge-triggered epoll. * It consists of a DispatchContext to represent the epoll-set, and a * DispatchFile for each file-descriptor added to that epoll-set. All events * are delivered in edge-triggered mode and cached in the DispatchF...
C
#include "libs.h" void gauss_m(int n, double *matrix_now, double *x) { double *matrix = malloc(sizeof(double *) * n * (n+1)); for (int i = 0; i < n; i++) { for (int j = 0; j < n + 1; j++) { matrix[i*(n + 1) + j] = matrix_now[i*(n + 1) + j]; } } double max_elem; int ...
C
/* ** EPITECH PROJECT, 2019 ** env ** File description: ** func for env */ #include "my.h" #include "minishell.h" #include <dirent.h> #include <stdlib.h> #include <unistd.h> int unsetenv_error(char **env, char **input) { if (!env || !input) { return (84); } if (input && input[0] && !input[1]) { ...
C
// 618p 1 #include <stdio.h> int main() { FILE* pInputStream = NULL; fopen_s(&pInputStream, "a.txt", "rt"); if (!pInputStream) return 1; FILE* pOutputStream = NULL; fopen_s(&pOutputStream, "b.bin", "wb"); if (!pOutputStream) return 2; int num = 0; while (fscanf_s(pInputStream, "%d", &num) != EOF) ...
C
/* * Auther : Atul R. Raut * Date : Fri Dec 23, 2011, 09.30PM * Aim : WAP, a pointer version fo the functoin strcat. * strcat(s, t), copies the string t to the end of s. * ***/ #include <stdio.h> char* aStrcat (char *src, char *target); int main () { char *s = "Atul"; char *t = "Raut"; char *r = NULL; r =...
C
#include<stdio.h> #include<math.h> #include<string.h> #include<stdlib.h> #define gc getchar #define ll long long int #define M 1000000007 #define scan(t) t=input() inline ll input() { char c = gc(); while(c<'0' || c>'9') c = gc(); ll ret = 0; while(c>='0' && c<='9') { ret = 10 * ret + c - 48; c = gc(); ...
C
#include <stdio.h> #include <signal.h> #include <unistd.h> #include <alchemy/task.h> RT_TASK hello_task; // function to be executed by task void helloWorld(void *arg) { RT_TASK_INFO curtaskinfo; printf("Hello World!\n"); // inquire current task rt_task_inquire(NULL,&curtaskinfo); // print task name printf("T...
C
#include "../includes/corewar.h" #include <fcntl.h> #include <stdio.h> t_obj *initialize_obj(void) { t_obj *c; int i; i = 0; c = ft_memalloc(sizeof(t_obj)); c->arena = ft_memalloc(sizeof(unsigned char *) * MEM_SIZE); while (i < MEM_SIZE) { c->arena[i] = 0; i++; ...
C
//SERVER.C #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <sys/signal.h> #include <sys/wait.h> #include <stdlib.h> #include <strings.h> #include <unistd.h> #include <errno.h> #include <dirent.h> #include <string.h> #include <ctype.h> #define SERVER_TCP_PORT 3000 /* ...
C
#include <stdio.h> #include <limits.h> float angle(int x1, int y1, int x2, int y2) { if (x1 == x2) return INT_MAX; else return ((y2 - y1) / (float)(x2 - x1)); } float max(float x, float y) { return x > y ? x : y; } float min(float x, float y) { return x < y ? x : y; } int main() { int t; scanf("%d",...
C
#include "clar_libgit2.h" #include "strmap.h" git_strmap *g_table; void test_core_strmap__initialize(void) { cl_git_pass(git_strmap_alloc(&g_table)); cl_assert(g_table != NULL); } void test_core_strmap__cleanup(void) { git_strmap_free(g_table); } void test_core_strmap__0(void) { cl_assert(git_strmap_num_entries...