language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include "holberton.h" /** *add - addition *@x: the integer received *@y: the integer received *Return: x */ int add(int x, int y) { int m = x + y; return (m); }
C
#include "expr_assert.h" #include "linkedList.h" void test_create_a_linkedList_which_will_contains_head_and_tail () { LinkedList list; list = createList(); assertEqual(list.head, 0x0); assertEqual(list.tail, 0x0); assertEqual(list.count, 0); } void test_create_node_should_create_a_node_for_a_int_type_data () { ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> void main() { int nums[] = {-2,1,-3,4,-1,2,1,-5,4}; int ret = maxSubArray(nums,sizeof(nums)/sizeof(nums[0])); printf("%d \n",ret); }
C
/*Write a function that accepts the name of an array (of type double), and two indices i, j and finds the sum of the elements of the array between indices i and j (inclusive), assuming that i ≤ j. Test it by calling them in main().*/ #include <stdio.h> void array(unsigned i, unsigned j); //Main function to t...
C
#include<stdio.h> #include<stdlib.h> typedef struct node { int data; struct node* left; struct node* right; }treenode; treenode* newNode(int data) { struct node* node = (struct node*)malloc(sizeof(struct node)); node->data = data; node->left = NULL; node->right = NULL; ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* sub_funk.c :+: :+: :+: ...
C
#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) #define _CRT_SECURE_NO_WARNINGS #pragma warning(disable:4996) #pragma warning(disable:6031) #endif #include <stdio.h> #include <stdlib.h> //contains functions for memory allocation, control of the program execution process, type conversion, etc. int main() {...
C
#include "main.h" // No borrar size_t posicion_pico(int v[], size_t ini, size_t fin) { // Completar if (ini >= fin) return ini; if (fin - ini == 1) { if (v[ini] > v[fin]) return ini; return fin; } size_t medio = ini + (fin - ini) / 2; size_t izq = posicion_pico(v, ini, medio); ...
C
/* * Copyright (c) 2013 Erick Daniel Corona <edcoronag@gmail.com> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the Software), to deal in the Software without * restriction, including without limitation the rights to ...
C
#ifndef VLIQ_H_ #define VLIQ_H_ #include <math.h> #include <string.h> typedef float vec_t; typedef vec_t vec2_t[2]; typedef vec_t vec3_t[3]; #define vec2_copy(dest, src) { memcpy(dest, src, sizeof(vec2_t)); } #define vec3_copy(dest, src) { memcpy(dest, src, sizeof(vec3_t)); } #define vec2_zero(v) { memset(v, 0, si...
C
/* * tokenizer.c * Josh Matthews & Katie Poskaitis */ #include <stdio.h> #include <stdlib.h> #include <string.h> /* * Tokenizer type. You need to fill in the type as part of your implementation. */ typedef struct TokenizerT_ { char *tokens; int index; int len_tokens; } TokenizerT; /* * findSpecia...
C
/* ** intersect_plane.c for bsraytracer1 in /home/antonin.rapini/ModulesTek1/GraphicalProgramming/bsraytracer1/src ** ** Made by Antonin Rapini ** Login <antonin.rapini@epitech.net> ** ** Started on Wed Feb 8 15:47:59 2017 Antonin Rapini ** Last update Thu Jun 1 01:47:06 2017 Antonin Rapini */ #include <math.h>...
C
//sphere object functions and struct #include "sphere.h" //initialise a sphere struct in pointer s. //Returns initialised sphere as well. sphere *init_sphere(sphere *s, vec3 loc, vec3 col, double rad, int spec, double refl) { s->colour = col; s->location = loc; s->radius = rad; s->specular = spec; ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "funcoes.h" enum erro { semErro = 1, erro = 0, listaCheia = 2, listaVazia = 3 }; lista *novaLista() { lista *l = (lista *)malloc(sizeof(lista)); l->tamanho = 0; l->inicio = NULL; return l; } void leString(char entrada[]...
C
/* ************************************************************************** */ /* LE - / */ /* / */ /* font.c .:: .:/ . .:: ...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <sys/types.h> #include <sys/wait.h> #include <sys/stat.h> #include <fcntl.h> #include "socket.h" struct server_sock { int sock_fd; char buf[BUF_SIZE]; ...
C
/* ** my_power_rec.c for my_power_rec.c in /home/hervet_g//work/piscine/Jour_05 ** ** Made by geoffrey hervet ** Login <hervet_g@epitech.net> ** ** Started on Fri Oct 8 16:41:22 2010 geoffrey hervet ** Last update Mon Oct 11 21:34:15 2010 geoffrey hervet */ int my_power_rec(int nb, int power) { if (power <= 0)...
C
#include <stdio.h> #include <stdlib.h> void mergeB(int *nums1, int m, int *nums2, int n) { while(m > 0 && n > 0){ if(nums1[m -1] > nums2[n-1]){ nums1[m+n-1] = nums1[m -1]; m--; } else{ nums1[m+n-1] = nums2[n-1]; n--; } } while(n > 0){ nums1[m+n -1] = nums2[n-1]; n--; } while(m > 0){ ...
C
#include "stdio.h" #include "math.h" #include "functions.c" #define N 1000 // number of vertices #define EPS 4. / N #define ANG_EPS 0.001 #define BINS_EPS 0.00001 #define INF 1E18 /*Структура Вектор с основными операциями: сложение, вычитание, умножение на число, вычисления длины, вычисление направляющего вектора, ма...
C
#include <stdio.h> #include <string.h> /* int a,md; int expmod(int x,int n) { if(n==0)return 1; int t=expmod(x,n/2); t=(t*t)%md; if(n&1)t*=x,t%=md; return t; } int main() { int ans=0,rmax; for(a=3;a<=1000;++a) { md=a*a; rmax=a&1?(expmod(a-1,a/2)+expmod(a+1,a/2))%md:(expmod(a-1,a-1)+expmod(a+1,a-1))%md; an...
C
#pragma once #include <stdlib.h> #include <stdio.h> //Structs to be put in the list put this at //the head of the structure. typedef struct dlist_head{ struct dlist_head *next; struct dlist_head *prev; }dlist_head_t; //This represents a list as a whole. typedef struct dlist{ dlist_head_t *head; int len...
C
#include <stdio.h> #include <stdlib.h> main() { int a[5],i; void input(int[]); input(a); for(i=0;i<5;i++) { printf("\n\n\t\t a[%d] = %d", i,a[i]); } printf("\n\n\t\t address of a = %u", a); printf("\n\n\t\t address of a = %u", &a[0]); getch(); } void input(int a[]) { int i;...
C
//P388 LOOKUPCHAIN(m,p,i,j) if m[i,j] < INFINITY return m[i,j] if i==j m[i,j]=0 else{for k=i to j-1{ q=LOOKUPCHAIN(m,p,i,k)+LOOKUPCHAIN(m,p,k+1,j)+p //made some change if q<m[i,j] m[i,j]=q}} return m[i,j]
C
void scanome(char nome[],int n) { int i = 0,espaco = 0; char tecla; while (i < n) { fflush(stdin); tecla = getch(); if (i == 0) { // primeira letra em maiusculo if (tecla >= 'a' && tecla <= 'z' && espaco == 0) { nome[i] = tecla - 32; printf("%c", nome[i]); i++; f...
C
#include<stdio.h> void main() { char str[200],vow[]="aeiouAEIOU"; int i,j,count=0; printf("Enter a string\n"); gets(str); for(i=0;str[i];i++) { for(j=0;vow[j];j++) { if(str[i]==vow[j]) { count++; break; } ...
C
#ifndef TYPES_H #define TYPES_H #include "stdint.h" typedef struct point { int16_t x; int16_t y; } Point; typedef struct rect { int16_t x; int16_t y; int16_t w; int16_t h; } Rect; /* a buffer is a rectangle (usually with 0,0 origin) */ typedef struct buffer { int16_t x; int16_t y; int1...
C
#ifndef HELPERS #define HELPERS /* Create String of User Input Size */ char *inputString(FILE* fp, size_t size){ char *str; int ch; size_t len = 0; str = realloc(NULL, sizeof(char)*size); if(!str)return str; while(EOF!=(ch=fgetc(fp)) && ch != '\n'){ str[len++]=ch; if(len==size){...
C
#include <stdio.h> int seq(int n){ if(n<3) return n; return seq(n-1) + seq(n-2) + seq(n-3); } int main(){ int n = 5; printf("%d\n", seq(n)); }
C
#include "vector.h" void do_nothing(void *v){ } vector_t *vector_dot_prod(vector_t *v1, vector_t *v2, void *(*foo)(void *, void *)){ if( v1->size != v2->size){ return NULL;} vector_t *v3 = vector_init(VECTOR_VARIABLE_SIZE, v1->size); int i; for(i=0;i<v1->size;i++){ vector_soft_put(v3,foo(vector_get(v1,i),vect...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <errno.h> #include "projadd_functions.h" #include "projadd_error_msg.h" #include "project_file_check.h" #include "projadd_structure.h" void projadd_fn(projadd_options *projadd) { FILE* proj_file_ptr; // Variable to store pointer to the project fi...
C
/* File: schema.h */ //need to include the structs for the bme 280, and sunlight grove sensor// /* External Library */ #include <stdint.h> #ifndef SCHEMA_H #define SCHEMA_H /* Schema for Weatherbox Packets */ typedef struct { uint16_t schema; uint16_t address; // Address of Arduino uint32_t uptime_ms;...
C
#include "map.h" #include "file.h" #include <errno.h> #include <stdio.h> #include <string.h> int(load_map)(uint16_t mapNumber, map_t* map) { char filePath[55], auxString[55]; int32_t num = 0; uint16_t curLine = 0, curCol = 0; strcpy(filePath, "/home/lcom/labs/minixop/data/maps/map"); sprintf(auxSt...
C
// // find-element-count-one-in-n.c // algorithm // // Created by Kai on 2019/8/21. // Copyright © 2019 kai. All rights reserved. // #include "find-element-count-one-in-n.h" #include <stdlib.h> #include <stdbool.h> /** 记录元素的值和次数 */ struct Element { int val; int times; }; typedef struct Element Element; ...
C
#include<stdio.h> #include<math.h> float myatof(char *p) { int i,cnt=0,j,temp1=0; float res; for(i=0;p[i];i++) { if(p[i]=='.') break; temp1=temp1*10+p[i]-48; } for(j=i+1;p[j];j++) { temp1=temp1*10+p[j]-48; cnt++; } res=temp1*pow(10,-cnt); return res; } main() { char a[100]; float f; puts("ente...
C
#include "common.h" MatrixStack *MatrixStack_Create(GLsizei size) { MatrixStack *stack; stack = (MatrixStack *) malloc(sizeof(MatrixStack)); if (stack == NULL) return NULL; stack->mat = (mat4 *) malloc(size * sizeof(mat4)); if (stack->mat == NULL) { free(stack); return ...
C
#include<stdio.h> int main() { int i; int a[20] = {10,2,3,1,15,5}; /* To print the number of elements greater than 5 in the array */ for(i=0;i<6;i++){ if(a[i]>5){ printf("%d\n",a[i]); } } }
C
/* * ===================================================================================== * * Filename: ex3.c * * Description: 练习3, 同样找前K个大数,但是数权值会不断更新,因此每更新一次前K大数集合也会跟着变动 * 想了好久没想出来。搜了一下网上都是一个版本,对整个数组建映射二分堆 * 这个方法感觉不是很靠谱,首先是空间问题,其次每一次查询都要pop出k个再塞进k个也很蛋疼(如果是只对k个建堆的话就...
C
#include <stdio.h> #include <ncurses.h> #include "print.c" #include <stdlib.h> #include <string.h> #include "list.c" #include <pthread.h> #include <math.h> #include "sendmidi.c" // shell io void setUp(); void initWindow(); void handleKey(char input); int quit(); // midi io void *midiThread(); // internal io void ...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<sys/types.h> #include<sys/socket.h> #include<unistd.h> #include<linux/in.h> #include<errno.h> #define PORT 8888 int main(int argc, char **argv) { int s; struct sockaddr_in server_addr; int err; s = socket(AF_INET, SOCK_STREAM, 0); if (s < 0) { ...
C
/* * Main CAN interface. Provides methods for initializing the CAN protocol stack as well as sending CAN traffic over. * Implemented from PIC18FXXKXX datasheet, so could work for other chips too (assuming xc.h is included in your main file prior to this one) * * File: can.h * Author: pojd * * Created on Octo...
C
/* A program to read 10 numbers from a file using fscanf*/ #include<stdio.h> void main() { FILE *fp; int n,i; fp=fopen("testNum","r"); printf("Ten numbers are \n"); for(i=1;i<=10;i++) { fscanf(fp,"%d",&n); printf("%d\n",n); } fclose(fp); }
C
/* ilib_io.c Ihsoh 2013-2-17 */ #include "ilib.h" uchar GetControlKeys(void) { asm MOV AH, 2; asm INT 16H; } void PrintString(const char * String) { while(*String != '\0') { char Char = *(String++); if(Char == '\r') CR(); else if(Char == '\n') LF(); else PrintChar(Char); } } ...
C
#include <stdlib.h> #include <stdio.h> #include <dirent.h> #include <errno.h> #include <sys/stat.h> #include <string.h> #include "hblk_crypto.h" /** * ec_save - saves an existing EC key pair on the disk * @key: points to the EC key pair to be saved on disk * @folder: path to the folder in which to save the keys *...
C
/* URI Online Judge | 1173 Preenchimento de Vetor I Adaptado por Neilor Tonin, URI Brasil Timelimit: 1 Leia um valor e faa um programa que coloque o valor lido na primeira posio de um vetor N[10]. Em cada posio subsequente, coloque o dobro do valor da posio anterior. Por exemplo, se o valor lido for 1, os valores...
C
#include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/mman.h> #include <sys/wait.h> #include <unistd.h> #define N_PROCESSOS 10 unsigned int fibo(unsigned int N) { if (N<2) return 1; else return fibo(N-1) + fibo(N-2); } int main() { pid_t filho[N_PROCESSOS]; const unsigned int N = 40; ...
C
/*-- Appears at night and moves around a certain point. Reacts to thrown objects. @title Firefly @author Marky @version 0.1.0 --*/ #strict 2 static const gFirefly_Min_Temperature = 10; local attraction_object; protected func Initialize() { SetAction("Fly"); SetPhase(Random(6)); var light_olour = RGBa(220, 255...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* allocation.c :+: :+: :+: ...
C
#ifndef WASMVM_DATATYPES_LIST_DEF #define WASMVM_DATATYPES_LIST_DEF #include <stddef.h> typedef struct list_p_ * list_p; typedef struct listNode_ * list_iterator; void free_list_p(list_p thisList); int list_removeAt(list_p thisList, size_t index); list_iterator list_head(list_p thisList); list_iterator list_iterator...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<assert.h> #include<malloc.h> #include<io.h> #pragma warning(disable:4996) int CodeCount(char* p); int WordCount(char* p); int main(int argc, char* argv[]) { char bet; FILE* f; // if (argc < 3 || argc>3) { printf("1."); ...
C
#include <stdio.h> #include <string.h> int main(){ FILE *f; int count = 0,i; f = fopen("file.txt","r"); while((i = fgetc(f)) != EOF) count++; fclose(f); printf("number of byte : %d\n",count-1); count = strlen("testing is fun"); printf("number of byte : %d\n",count); }
C
#include <stdio.h> #include <stdlib.h> int a[10002000]; int compare(const void*a,const void *b) { return (*(int*)a-*(int*)b); } int main() { int n,k,i=1; scanf("%d",&n); while(n--) { scanf("%d",&a[i]); i++; } i--; scanf("%d",&k); int j;int hold;int cout; qsort(a,i+1,sizeof(a[1]),compare); int k1=1,qwe...
C
#include "typedef.h" void output(int **array) { for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { printf("%3d", array[i][j]); } printf("\n"); } }
C
#include <stdio.h> #include <check.h> #include "dethread.h" #include "constant.h" #include "rngod.h" struct rngod *cnst; static void constant_init(void) { cnst = rngod_constant_add_default(); } static void constant_shutdown(void) { rng_free(cnst); } START_TEST(test_constant_returns_seven) { ck_assert_uint_eq(7,...
C
#include "../include/interpolation.h" #include "stdio.h" #include "stdlib.h" // EXAMPLE 1 INPUT POINTS AND FACETS // +++++++++++++++++++++++++++++++++++++++++++++++++ // // *(0,6) // // // * (3,4) // // // * (1,3) // // * (4,2) // // ...
C
/********************************** * \file : RIS.h * \author : Cory W. Hodge * \brief auto generated file ************************************/ #ifndef _RIS_h_ #define _RIS_h_ //! \brief Enumerations for this Register #include "SYSCTL_RIS_enums.h" // Base Address for this Register #define SYSCTL_RIS_BASE_ADDR 0...
C
#include "common.h" void u64array_init(u64array * arr){ arr->n = 0; arr->size = 20; arr->data = malloc(sizeof(uint64_t) * arr->size); arr->biggest = 0; } void u64array_get(u64array * arr, unsigned long int idx, uint64_t * ret){ *ret = arr->data[idx]; } void u64array_push_back(u64array * ...
C
#include <avr/io.h> #include <avr/interrupt.h> #include <stdbool.h> #include <util/delay.h> int main (void) { /** * We will be using OCR1A as our PWM output which is the * same pin as PD6. */ DDRD |= _BV(PD6); /** * There are quite a number of PWM modes available but for the * sake of simplicity we'll j...
C
/** @file oyranos_string.c * * Oyranos is an open source Color Management System * * @par Copyright: * 2004-2014 (C) Kai-Uwe Behrmann * * @brief pure string handling functions * @internal * @author Kai-Uwe Behrmann <ku.b@gmx.de> * @par License: * new BSD <http://www.opensour...
C
/* ============================================================================ Name : Assignment.c Author : Zhong Ming Tan Version : Copyright : Zhong Ming Tan @ 2018 Description : Hello World in C, Ansi-style ============================================================================ */ #i...
C
#include <stdio.h> #include <stdlib.h> typedef struct no no; struct no{ char data; no* next; }; void imprimirLista(no* no){ while(no != NULL){ printf("%c", no->data); no = no->next; } printf("\n"); } no* inserirFim(no* lista, char data){ no* novo = (no*) malloc(sizeof(no)); ...
C
#include<stdio.h> int main(int argc, char const *argv[]) { unsigned int counter = 1; //initialization while (counter <= 10) { printf("%u\n", counter); counter++; } return 0; }
C
#include<stdio.h> /* * Desafio E * Horsemeet Gym - 101954G */ int main(){ int a, b, c, d; scanf("%d %d",&a, &b); scanf("%d %d",&c,&d); if((a+b)%2==(c+d)%2){ printf("black\n"); }else{ printf("white\n"); } }
C
#include "trojmian.h" //definicja -> funkcja, ktra wczytuje dane od uytkownika void readTrojmian(struct Trojmian* t){ printf("Podaj wspolczynnik a: "); scanf("%f", &(t->a)); printf("Podaj wspolczynnik b: "); scanf("%f", &(t->b)); printf("Podaj wspolczynnik c: "); scanf("%f", &(t->c)); } //d...
C
#include <stdio.h> #include <stdbool.h> #include <stdlib.h> #define MaxSize 10000 #define NegInfinity -65536 typedef int ElementType; typedef struct HNode *Heap; struct HNode{ int Capacity; int CurrentSize; ElementType *Data; }; /* 堆相关的操作函数 */ ElementType DeleteMinHeap( Heap H ); void InsertMinHeap( H...
C
#include <stdio.h> #include <stdlib.h> // Defining unsigned char as "uc" to help save space typedef unsigned char uc; /////////////////////////////////////////////////////////////////////////////// // When setting up a struct, you must set up the template globally, and must // always terminate with a ";". This is no...
C
/*****************************************************************/ /* UNE TABLE DES SYMBOLES POUR MULOT */ /* */ /* I.U.T. de Nice - Departement Informatique - L. Brenac */ /* ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <fcntl.h> #include <time.h> #include <sys/stat.h> #include <sys/types.h> #include "apikey.h" extern char* optarg; int main(int argc, char **argv){ char utilisateur[512]; u_int32_t taille=1000; u_int32_t annee=2015; int c; int error = 0; strcp...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* print_start.c :+: :+: :+: ...
C
#include<stdio.h> int main() { int i,n,temp1=0,temp2=0,nt; printf("enter n\n"); scanf("%d",&n); printf("fibonacci series for n numbers\n"); for(i=1;i<=n;i++) { if (i<=1) nt=i; else { nt=temp1+temp2; temp1=temp2; temp2=nt; } printf("fibonacci seri...
C
#include <stdio.h> void main() { int m,k; scanf("%d",&m); int a[m]; for(i=0;i<m;k++) scanf("%d",&a[k]); for(k=0;i<m;k++) { if(a[k]==k) printf("%d",a[k]); } }
C
// program of fibonacci series up to n number of terms #include<stdio.h> #include<conio.h> void main() { int i,n,t1=0,t2=1,nextTerm; printf("enter the number of terms: "); scanf("%d",&n); printf("fibonacci series: "); for (i=1;i<=n;++i) { printf("%d, ",t1); nextTerm=t1+t2; ...
C
/* * chip8.h - CHIP8 Interpreter Core * * Mike Mallin, 2020 */ #ifndef __CHIP8_H__ #define __CHIP8_H__ #include "chip8_utils.h" /** * @brief Initializes the interpreter core */ void chip8_init(void); /** * @brief Loads a program into the interpreter * * @param[in] The path to the file */ voi...
C
#include <stdio.h> #include <stdlib.h> struct node_struct { struct node_struct *link; int data; struct node_struct *rlink; }; int main(int argc, char const *argv[]){ struct node_struct* head; head = (struct node_struct*)malloc(sizeof(struct node_struct)); head -> link = NULL; //指向null h...
C
#include <stdio.h> #include <stdlib.h> #include <cblas.h> int main(int argc, char *argv[]) { if (argc < 6) { printf("Usage: [M] [K] [N] [output A] [output B] [output Answer] [seed]\n"); exit(1); } if (argc == 8) { srand(atoi(argv[7])); } int A_dims[] = {atoi(argv[1]), atoi(argv[2])}; int B_dims[] = {atoi...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_param_to_tab.c :+: :+: :+: ...
C
#include <stdio.h> #include <math.h> int main(void) { double a,b,c,s,transfer,area; printf("Enter the length of the three edges of the triangle: \n"); scanf("%lf%lf%lf",&a,&b,&c); s = (a + b + c) / 2; transfer = s * (s - a) * (s - b) * (s - c); area = sqrt(transfer); printf("Area of the triangle is: %.2f\n",area...
C
#include<stdio.h> #define _CRT_SECURE_NO_WARNINGS #include<ctype.h> #include<stdbool.h> #define STOP '.' int main() { char c; int n_chars = 0; int n_lines = 0; int n_words = 0; bool word_flag = false; bool line_flag = false; printf("Enter text : \n"); while((c = getchar()) != STOP) { ...
C
// compiler.h // By Ben Anderson // October 2018 // A JIT compiler records linear traces through hot loops in the bytecode and // turns them into SSA form IR. If this doesn't make any sense to you, go do // some pre-reading (the Wikipedia page on tracing JIT compilers and SSA IR is // a good place to start). // // ...
C
/*code for server portion of server-client setup*/ /*communication occurs overs TCP*/ #include <stdio.h> /* for printf() and fprintf() */ #include <sys/socket.h> /* for socket(), bind(), and connect() */ #include <arpa/inet.h> /* for sockaddr_in and inet_ntoa() */ #include <stdlib.h> /* for atoi() and exit()...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <strings.h> #include <mBgModel.h> #include <montage.h> #define MAXSTR 256 extern char *optarg; extern int optind, opterr; extern int getopt(int argc, char *const *argv, const char *options); int debugCheck(char *debugStr); i...
C
/* Partner 1 Name & E-mail: Dishon Jordan djord007@ucr.edu * Partner 2 Name & E-mail: Travis Nasser tnass001@ucr.edu * Lab Section: 025 * Assignment: Lab 5 Exercise 1 * Exercise Description: * * (From an earlier lab) A car has a fuel-level sensor that sets PA3..PA0 to a value between 0 (empty) and 15 (full). ...
C
// // Exercise 1-13 // #include <stdio.h> #define MAX_WORD_LEN 20 #define MAX_HIST_COLS 20 main() { int wordLenghts[MAX_WORD_LEN]; int c, charCount; charCount = 0; int i; for (i = 0; i < MAX_WORD_LEN; ++i) wordLenghts[i] = 0; while ((c = getchar()) != EOF) { if (c == '...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct{ char nome[20]; }Cliente; typedef struct{ char nome[20]; float preco; }Produto; void preencheCliente(Cliente* cliente, int c){ for(int i = 0; i<c; i++){ printf("\nDigite o Nome do cliente numero %d: ", i+1); fflush(stdin); scanf("%s"...
C
/* ** EPITECH PROJECT, 2018 ** MY_COMPUTE_SQUARE_ROOT ** File description: ** Returns the square root (whole number) of the number. */ int my_compute_square_root(int b) { return (0); }
C
#include <stdlib.h> #include <stdio.h> #include "numbQ.h" #include "../../Z/MUL_ZZ_Z/MUL_ZZ_Z.h" #include "../../N/MUL_NN_N/MUL_NN_N.h" #include "MUL_QQ_Q.h" /* multiplicationNumbQ Функция умножает два рациональных числа Параметры: 1) a - первое число 2) b - второе число Функция возвращает результат типа - NUMBQ...
C
#include <stdio.h> int main(void) { int arr[]={1,2,3,4,5,6,7,8,9,10,0}; int sum1=0; int count1=0; int sum2=0; int count2=0; int i=0; while(arr[i]!=0) { if(arr[i]%2) { sum1+=arr[i]; count1++; } else { sum2+=arr[i]; count2++; } i++; } printf("count1=%d,sum1=%d,count2=%d,sum2=%d\n",c...
C
#include "monty.h" /** * monty_push - pushes an element to the stack. * @top_ptr: idk. * @line_n: idk. */ void monty_push(stack_t **top_ptr, unsigned int line_n) { /* temporal, esto en realidad viene en la variable externa */ stack_t *new_node, *top = *top_ptr; if (!ex.data.value) { fprintf(stderr, "L%u: us...
C
/* ** EPITECH PROJECT, 2017 ** CPool_Day05_2017 ** File description: ** square root */ int my_compute_square_root(int nb) { int stock = nb; if (nb < 0) return (0); while (stock > 0) { if (stock * stock == nb) return (stock); else stock--; } return (stock); }
C
#include <string.h> #include <ctype.h> #include <stdio.h> #include <math.h> #include <stdbool.h> #include <stdlib.h> #include "mysql.h" #define HEX_LEN 16 #define B64U_LEN 11 bool is_hex(char *s, int len) { for (int i = 0; i < len; i++) { if (!isxdigit(s[i])) { return 0; } } ...
C
/** Elliptic filter. Reference: (https://en.wikipedia.org/wiki/Elliptic_filter) @file elliptic.c @author @email @date */ #include "elliptic.h" /* * Elliptic filter * * Params: * Pointer to output array * Pointers to filter coefficient arrays * Filter gain * Padding...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* delete_links.c :+: :+: :+: ...
C
//#define Print_Bytes(Title, Bytes) (printf("\t%-17s\t0x%02X 0x%02X\n", Title, (Bytes & 0xff), ((Bytes >> 8) & 0xff))); typedef unsigned char byte; typedef unsigned short doublebyte; typedef unsigned long quadbyte; int Print_uchar(char *Title, unsigned char buffer); //1 Byte int Print_ushort(char *Title, unsigned shor...
C
#include "apue.h" #include <stropts.h> #include <sys/stat.h> static void set_noecho(int); /* at the end of this file */ int main(void) { int fdm, noecho, nread; pid_t pid; char slave_name[20]; /* apue picks this size? */ char buf[BUFSIZ]; /* struct termios orig_termios; */ /* struct winsize size; */ /* if (...
C
#include <stdio.h> void ImprimeMenu(char *menuOpc[], size_t length) { for (int i = 0; i < length; i++) printf("%i - %s\n", i + 1, menuOpc[i]); } int main(void) { char *opcSalgados[] = { "Pastel", "Mini pizza", "Coxinha", "Pao de queijo", "Pao de frango com queijo", "Pao de carne" }; ImprimeMenu(opcSalgados, ...
C
#include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <sys/mman.h> #include <errno.h> #include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> #include <string.h> #include <assert.h> #include <ctype.h> #include "bootsect.h" #include "bpb.h" #include "direntry.h" #include "fat.h" #include "dos.h" ...
C
/* HEADER */ #include "push_swap.h" int push_swap(t_list *p_list_a, int trace, int *nbr) { t_list *p_list_b; p_list_b = list_new("B"); if (trace == 1) { ft_putchar('\n'); ft_putstr("\e[1;36mSTART \e[1;33m"); } list_displayBTglobal(trace, p_list_a, p_list_b); while (1) { if ((list_trie_a(p_list_a) == ...
C
#include<stdio.h> #define MSG "I'm special" int main(void) { char ar[] = MSG; const char *pt = MSG; printf("address of \"I'm special\": %p\n","I'm special"); printf(" address ar: %p\n",ar); printf(" address pt: %p\n",pt); printf(" address of MSG: %p\n",MSG); printf("ad...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* fractals_2.c :+: :+: :+: ...
C
/** 485ͨš λ 1.ѯŵ״̬λлظ 2.ÿλлظ յ󣨴Ҫظ 1.λ֤λҪظ 2.λָƺţλҪظ 3.λ֪֤ʧܵλ޻ظ 4.ָ֤ͨλ֪λλҪظ 5.λûź룬Ҫ޸롣λظ޸Ľ */ #include "myTty.h" #include "Serial485.h" #include "doParse.h" #include "pthread.h" #define BytesPerFrame 11 //һ֡11ֽ #define DECODE_ERROR_HEAD_UNEXPECT 1 //b[0] != 0xBB #define DECODE...
C
//Pedro Henrique Zago Costa - Estrutura de Dados I - 2020// #include <locale.h> #define TRUE 1 #define FALSE 0 int sucess = 0; // "sucess" verificar o sucesso da funo "SubString_String()" // struct strdim{ // Estrutura de Dado String Dinmica // char c; struct strdim *prox; }; struct Descr...