language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include "holberton.h" /** * *_strchr - locates a character * @s: character s * @c: character c * * Description: this function locates a character in a string * Return: it returns a char */ char *_strchr(char *s, char c) { int i = 0, j; while (s[i]) { i++; } for (j = 0; j <= i; j++) { if (s[j] == c) { s...
C
/*! * * @file : common.c * * project : PROG1970 - System Programming - Assignment #3 * * @author : Brendan Rushing & Conor MacPherson * * @date : 2018-07-12 * * @brief : Hoochamacallit System - Common code used for all 3 programs in Hoochamacallit System: * - Functions, Include files, Const...
C
#include "imp_exp.h" #include <stdlib.h> #include <stdio.h> img import_1(char* f, int* plig, int* pcol) { int i,j; //Indices pixel** I; FILE *fichier; fichier = fopen(f,"r"); // Ouverture du fichier if (fichier==NULL) printf("Erreur ouverture image\n"); else { int lecture; int color; char stri[3]; fg...
C
#include<stdio.h> void main() { int char ch; int n; clrscr(); void main(){ printf("Print 1 to 5 again and again"); while(1){ for(n=1;n<=5;n++) printf("\n%d",n); ch=getch(); if(ch=='Q') exit(0) } getch(); }
C
#include<stdio.h> #define MIN 0 void main6() { int num1, num2; printf(" Է : "); scanf_s("%d %d", &num1, &num2); #ifdef ADD printf("%d + %d = %d\n", num1, num2, num1+num2); #endif #ifdef MIN printf("%d - %d = %d\n", num1, num2, num1 - num2); #endif }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* room_management.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> typedef TYPEELT tMatrix[NLINE][NCOL]; void printMatrix(tMatrix a) { int line, col; for (line = 0; line < NLINE; line++) { for (col = 0; col < NCOL; col++) printf("%08f ", a[line][col]); printf("\n"); } printf("\n"); } void cleanMatrix(tMatrix...
C
/* ** EPITECH PROJECT, 2020 ** PSU_minishell2_2019 ** File description: ** utils3 */ #include <minishell.h> #include <my_printf.h> #include <my_tools.h> bool loop_cpy(char *s, char **t, int **k, char q) { int i = *k[0], j = *k[1]; if (j > 0 && (*t)[j - 1] != ' ') j++, (*t) = my_strncdup2((*t), " ", m...
C
#include<stdio.h> int main (void) { int case_no = 0; int n; while(scanf("%d", &n) == 1 && n) { int h[n], i, avg = 0; for(i = 0; i < n; i++) { scanf("%d", &h[i]); avg += h[i]; } avg /= n; int moves = 0; for...
C
#include <stdio.h> #include <stdint.h> int main(void) { for (size_t i = 0; i < SIZE_MAX; ++i) printf("%zu\n", i); }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_printf_utils2.c :+: :+: :+: ...
C
#include<stdio.h> #include<math.h> void main() { int a,b,c,d,e; float distance; printf("enter the first coordinate"); scanf("%d%d",&a,&b); printf("enter the values of constant of cx+dy+e=0"); scanf("%d%d%d",&c,&d,&e); distance=(c*a+b*d+e)/sqrt(c*c+d*d); printf("%f",distance); }
C
#include "holberton.h" #include <stdlib.h> #include <stdio.h> /** * *string_nconcat - Ceate array. * @s1: string 1. * @s2: string 2. * @n: Number. * Return: char. */ char *string_nconcat(char *s1, char *s2, unsigned int n) { char *concat; unsigned int ts1, ts2, tconc, tconc2, T2 = 0; if (s1 == NULL) { s1...
C
#include <stdlib.h> #include <stdio.h> #include <time.h> //#define VERB int main(int argc, char **argv) { int n = (int) atoi(argv[1]), k = (int) atoi(argv[2]), r, nr; char cmd[50]; sprintf(cmd, "mkdir data"); system("rm -rf data"); system(cmd); // Run command in cmd from the same process srand(time(NULL))...
C
#include <stdio.h> int max(int x,int y){ return x>y? x:y; } int main() { int n,i,j; scanf("%d", &n); int arr[n]; for(i=0; i<n; i++){ scanf("%d", &arr[i]); } int all_max=arr[0], curr_max=arr[0]; //initial int templ,tempr,a_i,l=0,r=0; //initial templ=0,tempr=0; for(i=1;i<n;...
C
#include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <pthread.h> #include <semaphore.h> #include <string.h> #include <errno.h> #define N_TIMES 5 #define MAX 128 #define TAM_BUF 10 char* get_from_circular_buf(); void set_in_circular_buf(char*); sem_t s_prod, s_bufleft, s_mutex; // semaforos int posi=...
C
#define FLASH_KEY1 ((uint32_t)0x45670123) #define FLASH_KEY2 ((uint32_t)0xCDEF89AB) uint8_t Hi_Flash_IsReady(void) { return !(FLASH->SR & FLASH_SR_BSY); } void Hi_Flash_EraseAllPages(void) { FLASH->CR |= FLASH_CR_MER; FLASH->CR |= FLASH_CR_STRT; while(!Hi_Flash_IsReady()) {} FLASH->CR &= FLASH_CR_MER...
C
/* * To run server, first compile the program then run this command in the terminal: * ./server [PORT] * */ #include <stdio.h> // Input & output #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <pthread.h> #d...
C
#include <stdlib.h> #include "wayland.h" int wl_hash_insert(struct wl_hash *hash, struct wl_object *object) { struct wl_object **objects; uint32_t alloc; if (hash->count == hash->alloc) { if (hash->alloc == 0) alloc = 16; else alloc = hash->alloc * 2; objects = realloc(hash->objects, alloc * sizeof *ob...
C
#include<stdio.h> #include<math.h> int main() { int m,n; scanf("%d %d\n",&m,&n); int i,j,a[100],b[100],count=0; for(i=0;i<m;i++) { scanf("%d",&a[i]); } for(j=0;j<n;j++) { scanf("%d",&b[j]); } for(j=0;j<n;j++) { for(i=0;i<m;i++) { ...
C
/* ============================================================================ Name : mmn21.c Author : Amir Dror Version : Copyright : Amir Dror Description : find path in adjacency tree ============================================================================ */ #include <stdio.h> #defi...
C
#include <stdlib.h> #include <stdio.h> #include <time.h> int main(){ srand(time(NULL)); int szam; float kosar = 0; FILE *input; input = fopen("100szam.txt","r"); while(!feof(input)) { fscanf(input,"%d\n",&szam); kosar += szam; } printf("Kosar tartalma: %f\nAtlag: %f\n",kosar, kosar/100); fclose(inp...
C
#include<stdio.h> #include<signal.h> void handle_sigint(int sig) { printf("Caught signal %d\n", sig); } int main() { signal(SIGINT, handle_sigint); while (1){ printf("Hello......\n"); sleep(1); } return 0; } /* Hello...... Hello...... Hello...... Hello...... Hello...... Hello.........
C
#include <stdio.h> #define INDENT_SPACING 3 static unsigned int indent=0; void indentPlus () { indent++; } void indentMinus () { if (indent > 0) indent--; } void makeIndent (FILE *fp) { fprintf (fp, "%*s", indent*INDENT_SPACING, ""); } void newLine (FILE *fp) { fputc ('\n', fp); } void openBloc...
C
#include "i2cEeprom.h" #include "iic.h" list_t eepromFrames; void eeprom_init(void) { list_init(&eepromFrames); // Prepare the list } void eeprom_update(void) { // Check there are frames to send if (list_hasData(&eepromFrames) == False) return; // Check the I2C module is free // TODO: Su...
C
#include "tokenizer.h" void PrintCommands (CommandList* list) { if(list->tail == NULL) { return; } commandnode* ptr = list->tail->next; //delete a linked list commandnode* tmp; tmp = ptr; int count = list->count; if(ptr == NULL) { puts(list->tail->command-...
C
/* Copyright Statement: * */ #include <stdint.h> /*slim version for uart logging*/ void uart_init_boot_phase(void) { /*enable PDN*/ *(volatile uint32_t*)0xA0210320 = 0x100000; *(volatile uint32_t *)0xA00C0058 = 0x016C; /* set DLM/DLL for buardrate */ *(volatile uint32_t *)0xA00C0008 = 0x0001;...
C
#include <errno.h> #include <stdio.h> // #include <string.h> /* This program will work fine on x86 architecture, but will crash on x86_64 architecture. Let us see what was wrong with code. Carefully go through the program, deliberately I haven’t included prototype of “strerror()” function. This function returns “poi...
C
#include <stdint.h> #define FALSE 0 #define TRUE 1 /******************************************************************************/ /* MIPS memory layout */ /**************************...
C
/*==============================================================*/ /* program: freetree.h */ /* purpose: generating all free trees */ /* input : n -- number of nodes */ /* m -- max degree ...
C
#include "libft.h" char *ft_strdup(const char *s) { char *dest; int i; if (dest = (char*)malloc(sizeof(char)*strlen(s) == NULL)) return (NULL); i = 0; while (src[i] != '\0') { dest[i] = src[i]; i++; } dest[i] = '\0'; return (dest); }
C
#ifndef STAKABLE_COIN_H #define STAKABLE_COIN_H #include <uint256.h> #include <primitives/transaction.h> struct StakableCoin { const CTransaction* tx; unsigned outputIndex; uint256 blockHashOfFirstConfirmation; StakableCoin( ): tx(nullptr) , outputIndex(0u) , blockHashOfFirstCon...
C
#include<stdio.h> #include<math.h> int main() { float i,S=0; for(i=0;i<=19;i++) { S=S+(((2*i)+1)/(pow(2,i))); } printf("%.2f\n",S); return 0; }
C
#include <stdlib.h> #include <stdio.h> #include <errno.h> #pragma pack(push,2) #include <dos/dos.h> #include <proto/dos.h> #pragma pack(pop) int truncate(const char *path, off_t length) { int retval; BPTR fd = Open((CONST_STRPTR)path, MODE_OLDFILE); if(fd != 0) { retval = (SetFileSize(fd, length, OFFSET_BEGI...
C
#include <gtk/gtk.h> int main(int argc, char *argv[]) { GtkWidget *window; GtkWidget *table; GtkWidget *label1; GtkWidget *label2; GtkWidget *label3; GtkWidget *entry1; GtkWidget *entry2; GtkWidget *entry3; gtk_init(&argc, &argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL)...
C
/*Angelis Marios-Kasidakis Theodoros*/ /*Prime number recognition*/ #include <stdio.h> #include <stdlib.h> #include <pthread.h> #include <unistd.h> #include <string.h> #include <error.h> #include <sched.h> #include <fcntl.h> struct T { pthread_t id; int iret; int job_flag; /*If job_flag==1,threa...
C
#include<stdio.h> #include<conio.h> void main() { int s=1,a,n; printf("Enter the number:\t"); scanf("%d",&n); for(a=1;a<=n;a++) { s=s*a; } printf("The factorial of a given number =\t%d",s); getch(); }
C
#include <conio.h> int main() { int a[1000], i, n, sum = 0; printf("Enter size of the array : "); scanf("%d", &n); printf("Enter elements in array : "); for (i = 0; i < n; i++) { scanf("%d", &a[i]); } for (i = 0; i < n; i++) { sum += a[i]; } printf("sum o...
C
#include <stdbool.h> #include "aux_macros.h" #include "pokemon.h" static bool testCombo() { bool result = true; Pokemon pikachu = pokemonCreate("Pikachu", TYPE_ELECTRIC, 20, 4); TEST_DIFFERENT(result, pikachu, NULL); Pokemon pikachu_copy = pokemonCopy(pikachu); TEST_DIFFERENT(result, pikachu_copy,...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> struct figura{ int fig; float *T; }; float pole(struct figura F){ int wybor; if(F.fig==2){ printf("Wybierz figure: Trojkat 0, Rownoleglobok 1\n"); scanf("%i", &wybor); if(wybor==0){ return (F.T[...
C
/* John Stachurski, March 2012 A collection of functions for working with the AR1 model defined by X' = beta + alpha x + s Z where Z ~ N(0,1) */ #include <stdio.h> #include <math.h> #include <time.h> #include <gsl/gsl_rng.h> #include <gsl/gsl_randist.h> #include <gsl/gsl_fit.h> #include "utilities.h" in...
C
/* You're given a number N. Print the first N lines of the below-given pattern. * ** *** **** ***** Input: First-line will contain the number N. Output: Print the first N lines of the given pattern. Constraints 1≤N≤200 Sample Input 1: 4 Sample Output 1: * ** *** **** Sample Input 2: 2 Sample Output 2:...
C
/* int ft_strcmp(char *s1, char *s2) { while (*s1 && *s2 && *s1 == *s2) { s1++; s2++; } return (*s1 - *s2); } */ #include <stdio.h> int ft_strcmp(char *s1, char *s2) { return ((*s1 && *s2 && *s1 == *s2) ? ft_strcmp(++s1, ++s2) : (*s1 - *s2)); } int main() { printf("%d", ft_strcmp("abcde", "abcd")); prin...
C
/* * main.c * * Created on: 11 mar. 2021 * Author: JFSR00 */ #include <stdio.h> #include <stdlib.h> #include <string.h> void * copiar_bloque_memoria(void * destino, void * origen, unsigned int longitud); int main(int argc, char *argv[]){ int orig[20], dest[20]; //char t; /* Desactivar el buffer de st...
C
/* ** base.c for bistro in /home/carle_s/depot/bistro/bistro2 ** ** Made by Carle Sacha ** Login <carle_s@epitech.net> ** ** Started on Fri Oct 31 10:45:07 2014 Carle Sacha ** Last update Fri Oct 31 21:48:10 2014 Carle Sacha */ #include <stdlib.h> #include "./include/struct.h" int valbase(char c, char *base) { ...
C
#include <jni.h> #include "file.h" struct DIR_NODE { char *path; size_t size; }; JNIEXPORT void JNICALL Java_psycho_euphoria_file_Native_renameMp3File(JNIEnv *env, jobject thiz, jstring path) { const char *f = (*env)->GetStringUTFChars(env, path, NULL); RenameMp3File(f); (*env)->ReleaseStringChar...
C
/* misc.h * maths Macros * 6/21/99 */ #ifndef __GNUC__ /* Use the C* extensions: >? (MAX) and <? (MIN) operators */ #ifndef MAX #define MAX(x, y) ((x) >? (y)) #endif #ifndef MIN #define MIN(x, y) ((x) <? (y)) #endif #ifndef ABS #define ABS(x) ((x) >? (-(x))) #endif #ifndef ROUND #define ROUND(a) ( (int) {a > 0 ?...
C
// Emrehan ILHAN 13011021 - Algoritma Analizi 2. dev #include <stdio.h> #include <time.h> #include <stdlib.h> #include <conio.h> #include <string.h> #define TESTSIZE 95 #define HASHSIZE 267569 #define DICTIONARYSIZE 133780 #define CHANGE 2 #define DELETE 1 #define INSERT 1 #define HASHWORD 50 #define MINRESULT 4 ...
C
/* Hash routine. * Copyright (C) 1998 Kunihiro Ishiguro * * This file is part of GNU Zebra. * * GNU Zebra 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, or (at your * option) any lat...
C
#include <stdio.h> #include <string.h> int a[100],b[100]; void transp(int *mas, int *ans, int k) { int j; int p=0, q=k;//q=strlen(mas); for (j=0; j<strlen(mas); j++) if (mas[j]>k) { ans[q]=mas[j]; q--; } else { ans[p]=mas[j]; p++; } ans[strlen(mas)]=0; } int main(void) { int i,n; for (i=...
C
#include "flash.h" #include "stm32f10x.h" #define DEBUG_NAME "flash" #define DEBUG_LEVEL 3 #include "debug.h" /* Private typedef -----------------------------------------------------------*/ typedef enum {FAILED = 0, PASSED = !FAILED} TestStatus; /* Private define ----------------------------------------------------...
C
#include <sys/types.h> #include <sys/stat.h> #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <errno.h> #include <unistd.h> #include <syslog.h> #include <string.h> //Time Library #include <time.h> int main() { pid_t pid, sid; pid = fork(); if (pid < 0) { exit(EXIT_FAILURE); } if (pi...
C
/* ** EPITECH PROJECT, 2019 ** Pushswap ** File description: ** [Pushswap - Simple Linked List File] */ #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <math.h> #include "include/my.h" #include "include/my_list.h" void push_simple_list(linked_list_b **head, linked_list_b *elem) { if (*head == ...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <errno.h> #include <pthread.h> #include <semaphore.h> void* thread_func(void* arg); typedef struct thread_data { int in; int out; } thread_data_t; static sem_t count_sem; int quit = 0; int main(int argc, char** argv) { p...
C
/* * File: huffman_encoding.c * Author: d|kargatzis * * Created on February */ #include <stdio.h> #include <stdlib.h> #include "huffman_encoding.h" #include "encoding.h" void write_bitstream(huff_tree tree, int *diff_array){ FILE *output; int i,num=0; output = fopen(file_output, "w"); if(output == NUL...
C
#include <stdio.h> #include <stdlib.h> int main(int argc, char const *argv[]) { int ia=3; float fa=2.6; int ib=ia+fa; float fb=ia+fa; printf("int: %d\n", ib); printf ("float: %f\n", fb); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include "matriz.h" struct matriz{ int ** mat; int linhas, colunas; }; void erroInicializacao() { printf("Erro ao alocar memória\n"); exit(1); } Matriz* inicializaMatriz(int nlinhas, int ncolunas) { Matriz *m = (Matriz *) malloc(sizeof(Matriz)); if(!m) ...
C
#include "STM32L1xx.h" /* Microcontroller information */ /* Define global variables */ int counter1; int counter2; int direction; /*---------------------------------------------------*/ /* Initialize GPIO pins used in the program */ /*---------------------------------------------------*/ void PinSetup () {...
C
#include<stdio.h> int fact(int); int main() { int num,f; scanf("%d",&num); f=fact(num); printf("\nFactorial of %d is: %d",num,f); return 0; } int fact(int n){ if(n==1) return 1; else return(n*fact(n-1)); }
C
#include "Globals.h" void printWord(struct word W) { int i; printf("Word:\n"); for (i = 1 << 11; i > 0; i >>= 1) { if (W.instructionBinary & i) printf("1"); else printf("0"); } printf("\n"); } void InsertExtern(char *name, int address) { struct extLabel* cntPtr = headExternList; while (cntPtr->next)...
C
#include <std.h> #include <new_exp_table.h> inherit OBJECT; int TAR; string *unlocked_to, *recorded; string MYQUEST = "%^BOLD%^%^WHITE%^Achieved: %^BOLD%^%^CYAN%^Expanded The "+ "Cube of %^CYAN%^I%^WHITE%^nf%^CYAN%^"+ "i%^WHITE%^n%^CYAN%^i%^WHITE%^t%^CYAN%^e %^WHITE%^Kn%^CYAN%^"+ ...
C
/* Author: Dishank Goel * Date written: 21st August 2020 * * mv.c implements the `mv` command in UNIX without any options * mv either renames the file to a new file, or moves a file or directory into another directory * Usage: ./mv SOURCE DESTINATION * or: mv SOURCE(s) DIRECTORY */ #include <stdio.h> ...
C
// // Project: KTRW // Author: Brandon Azad <bazad@google.com> // // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LI...
C
#include "animator_component.h" void AnimatorBehaviour(struct Component *selfComponent, struct Game *game) { struct AnimatorComponent *animatorComponent = (struct AnimatorComponent*)selfComponent->data; if (animatorComponent->currentAnimation.frames <= 1) //if an asshole has created an animation spritesheet w...
C
/** \file sumup_loop_up.C \mainpage The sumup_loop plotting routine. \brief A flexible plotting program. The program defines a set of objects (functions, struct-s, map-s, vectors etc) to be used in the construction of the event loop in the `main` function. These objects basically define the information about the input...
C
#include <stdio.h> int main (void) { int x, *p; x = 100; p = &x; // Linha corrigida; printf("O valor de p: %d.\n", *p); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include "include/hialgo.h" #include "include/test.h" int IntCmp(const void *a, const void *b) { return *(int*)a - *(int*)b; } void BsearchTest(void) { TEST_FUNC_BEGIN(); int a[] = { 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 }; int num = sizeof(a) / sizeof(a[0]); ...
C
#include <stdio.h> int main() { float a,b; printf("donner l'hauteur' \n"); scanf ("%f",&a); printf("donner la base \n"); scanf ("%f",&b); float c=(a*b)/2; printf ("l'aire du triangle est %f\n",c); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include "images.h" double* matrix; unsigned char ascii_gray[] = {32,46,59,42,115,116,73,40,106,117,86,119,98,82,103,64}; double * mat_double_gray; // matrix of double gray double * mat_resize; // resized matrix double * h_bright; // bright min & max double...
C
#include "pharovm/pharo.h" #include "pharovm/parameters/parameters.h" #include "pharovm/debug.h" #include "pharovm/pathUtilities.h" #include <assert.h> typedef VMErrorCode (*vm_parameter_process_function)(const char *argument, VMParameters* params); typedef struct VMParameterSpec_ { const char *name; bool hasArgume...
C
#include<stdio.h> #include<math.h> #include<stdlib.h> int main(void) { int op = 0, a = 0, b = 0, temporary = 0, min = 0, max = 0, power = 0; double var = 0.0, def = 0.0, pi = 3.14159; printf("enter integer a:\n"); scanf("%i", &a); printf("enter integer b:\n"); scanf("%i", &b); printf("enter operation code...
C
/* * Add container to existing handler */ int wizToolkit_Add_Container(WIZTOOLKIT_INOUT wizToolkitHandler *handler, WIZTOOLKIT_IN wizToolkitObjectContainer *container, WIZTOOLKIT_OUT long * containerId) { long counter; unsigned char foundHole = 0; #ifdef _DEBUG printf("wizToolkit_Add_Container(%p, %p, %p...
C
#include <stdio.h> int main () { int n[5]; int i; n[0]=200; n[1]=250; n[2]=350; n[3]=100; n[4]=300; for(i=0; i<5; i++) { printf("element ke-%d=%d\n", i, n[i]); } return 0; }
C
#include <stdio.h> int fakt(int n) { int f; fot(i=1;1<=n; i++) f*=i; return f; } int main() { int n=5; printf("%d faktorilis %d\n", n, fakt(n)); }
C
int main() { int k,a,n,i; double x[100][1000],sum1,sum2,pj,s; scanf("%d",&k); for(a=0;a<k;a++){ sum1=0;pj=0; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%lf",&x[a][i]); sum1+=x[a][i];} pj=(double)sum1/n; sum2 = 0; fo...
C
#include "analyse.h" //int sign; //int sign_x; //int sign_y; /** * @brief analyse * @param K210/OPEN MV/ݮɵ * @retval OPEN MV ֱ x=160 y=120ĵΪ(80,60) */ void analyse(u8 data) { //printf("%s",data); static u8 RxBuffer[10]; static u8 state = 0; /*ͨŸʽ 0xAA data0 data1 data2 checkout 0x54*/ /*checkout=(data...
C
//pascal triangle #include <stdio.h> //#include <conio.h> int fact(int n) { int i,r=1; for(i=n;i>0;i--) { r+=r*n; } return r; } int main() { int i,k,j,num=4,space=4; for(i=0;i<num;i++) { for(k=space;k>0;k--) { printf(" "); } space--; for(j=0;j<=i;j++) { ...
C
/* * char_count_update.c * * Created on: Nov 17, 2019 * Author: SURAJ THITE & Atharv Desai */ #include "char_count_update.h" uint8_t char_count[256]; /******************************************************************************************************* * Function Name:uint8_t* character_count(uint8_t *...
C
// // Created by plaut on 3/31/2017. // #include "darray.h" #include <stdlib.h> struct DArray { void **array; //an array of void pointers int capacity; //total number of slots int size; //number of filled slots void (*display)(FILE ...
C
#include <stdio.h> #include <stdlib.h> #include "listaEncadeada.h" int main() { Lista* lista1 = create(); add(lista1, 6); add(lista1, 1); add(lista1, 7); add(lista1, 2); add(lista1, 5); imprimirLista(lista1); printf ("Elemento 2 esta na posicao: %d\n\n", find(lista1, 2)); pop(lista1, 6); imprimirLista(lista1...
C
#define _CRT_SECURE_NO_WARNINGS 1 //#include<stdio.h> //int nums(int x[3][3]) //{ // int b[3][3]; // int i, j; // int m=0, n=0; // for (i = 0; i < 3; i++) // { // for (j = 0; j < 3; j++) // { // b[m][n] = x[i][j]; // m++; // } // n++; // } // return b[m][n]; //} //int main() //{ // int a[3][3] = { {1,2,3},{1,2,...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #define LEN 40 int main(int argc , char * argv[]) { FILE *in, *out; //ָFILEָ int ch; char name[LEN]; //ļ int count = 0; // if(argc < 2) //argcûcmdõַС1ʼ { fprintf(stderr, "Usage: %s filename\n", argv[0]); exit(EXIT_FAILURE); } // if((in = fopen...
C
#include "monty.h" /** * _stack - function that sets the format of the data to a stack (LIFO). * @h: pointer to the head of the stack * @times: Number of the current line. * Return: Nothing it is a void function. */ void _stack(stack_t **h, unsigned int times) { (void)h; (void)times; tools.mode = STACK; } /** ...
C
#include "mmu.h" #include <stdlib.h> #include <stdio.h> #include "request.h" #include "inter_alg.h" #include "process.h" /** * vetor que marca, para cada quadro de página, se ele está atualmente atrelado a alguma página virtual, * isto é, se ele está sendo usado. * Utiliza a mesma tag PRESENT ou NOT_PRESENT para i...
C
// CEF C API example // Project website: https://github.com/cztomczak/cefcapi #pragma once #include <unistd.h> #include "include/capi/cef_base_capi.h" // Set to 1 to check if add_ref() and release() // are called and to track the total number of calls. // add_ref will be printed as "+", release as "-". #define DEBUG...
C
#include "suffixtrie.h" struct nodo * insere(char *str, struct nodo *raiz) { struct nodo *new; if(*(str)!='\0') { if(raiz==NULL || raiz->caractere != *(str) ) { if(raiz == NULL || raiz->caractere > *(str) ) //Se não existe o caractere no nivel { //cria um novo nodo com o caractere no nivel ...
C
#include <stdio.h> #include <math.h> #include <x86intrin.h> #include <mpfr.h> float cr_rsqrt (float x) { mpfr_t t; float y; mpfr_init2 (t, 24); mpfr_set_flt (t, x, MPFR_RNDN); mpfr_rec_sqrt (t, t, MPFR_RNDN); y = mpfr_get_flt (t, MPFR_RNDN); mpfr_clear (t); return y; } float rsqrt (float x) { float y; _mm_s...
C
// To compile this file: // $ gcc -o filename filename.c -lnfc #ifdef HAVE_CONFIG_H # include "config.h" #endif // HAVE_CONFIG_H #include <err.h> #include <nfc/nfc.h> #include <fcntl.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #defi...
C
#include <stdio.h> int main (void) { int cases, temp, match, count, diff; scanf("%d", &cases); for (int i = 0; i < cases; i++) { scanf("%d", &count); // Declaring for initial values temp = 1000005, diff = 0; while (count--) { scanf("%d", &match); // Only replaces diff if new difference is more ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include "defPiece.h" #include "fct.h" #include "deplacement.h" #define clrscr() printf("\033[H\033[2J") #define couleur(param1, param2) printf("\033[%s;%sm", param1, param2) #define couleur1(param) printf("\033[%sm", param) void viderBuffe...
C
#include<stdio.h> #include<stdlib.h> #include"my_list.h" my_bool listIsNullOrEmpty(myList** ppMyList) { return !ppMyList || !*ppMyList || !(*ppMyList)->header || !(*ppMyList)->size; } my_bool listIsNull(myList** ppMyList) { return !ppMyList || !*ppMyList ; } my_bool listIsEmpty(myList** ppMyList) { retur...
C
// Alexander Baekey // CDA 5106 // Machine Problem 2 //libs #include<stdlib.h> #include<stdio.h> #include<stdbool.h> #include<math.h> #include<string.h> //global counters & flags //old un-needed int *countArr; int B, M2, M1, N, K; int count; int *bimodPT; int bisize; int *PT; int gsize; int *gbh; int binsum = ...
C
/* No.10250 ȣ ȣ Ģ ã ϴ */ #include <stdio.h> int main() { int testCnt; //testCase int fCnt, rCnt, num; // , , ° մ int floor, room; int count = 0; scanf("%d", &testCnt); while (count++ < testCnt) { scanf("%d %d %d", &fCnt, &rCnt, &num); floor = (num % fCnt == 0) ? fCnt : num % fCnt; room = (num%fCn...
C
#include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <unistd.h> #include <string.h> #define MAX_PROCESSES 9 #define PIPE_PATH_IND 1 #define ROW_IND 2 #define FILE_PATH_IND 3 #define N_IND 4 int main(int argc, char *argv[]) { if(argc != 5){ perror("Wrong number of arguments"); exit(2)...
C
#include <stdio.h> #include<math.h> int num_reader(){ int count = 1000; int sum = 0; while(count != -999){ sum = sum + count; count = count -1; if (count == -999){ break;} } printf("sum is %d \n" ,sum); }
C
#include <unistd.h> int ft_strlen(char *str) { int i = 0; i = 0; while (str[i]) i++; return (i); } int is_tab(char c) { return (c == '\t' || c == ' '); } void print_reverse(char *str) { int first; int end; int curr;
C
// // Created by wmurphy on 9/15/2019. // #include "Search.h" int linear_search(double n, double* array) { int i = 0; int_func_ptr len = get_array_length_; while (i < len(array) && *(array + i) != n) { i++; } if (i < len(array)) { return i; } else { return -1; } ...
C
#include <ctype.h> #include <stdio.h> #include <sys/isofs.h> #include <sys/sys.h> void isofs_dump_file_id(directory_record_t rec) { char *s = ((char *) rec) + sizeof(struct directory_record); if (s[0] == 0) { printf("."); return; } if (s[0] == 1) { printf(".."); return;...
C
#include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <stdlib.h> int main(void) { pid_t return_val; int x = 100; return_val = fork(); if (return_val > 0) { printf("Parent process\n"); printf("Process id: %d\n", getpid()); printf("x = %d\n", x); printf("Process id of shell: %d\n", getppid()...
C
#ifndef _delay_accurate_h #define _delay_accurate_h /* Delay loop with single cycle accuracy. The actual delay is __cycles + k cycles, with k being about 10. Does the single cycle fixup using a skip instruction combined with a single word NOP which needs two cycles to execute (adiw 0). We need to fix 0-3 cycles ...