language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include <stdlib.h> #include <sys/time.h> #include <unistd.h> static unsigned long fib(unsigned int n); static unsigned long now_us(void); int main(int argc, char* argv[]) { pid_t pid = getpid(); printf("["); int count = 0; for (int j = 1; j < argc; ++j) { unsigned int n = a...
C
#include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <stdio_ext.h> #include <string.h> #include "wrappers.h" #define BUFFER_SIZE 16 #define TRUE 1 #define FALSE 0 /*------------------------------------------------...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* todelete.c :+: :+: :+: ...
C
#include <stdio.h> #include <string.h> #include <sys/socket.h> //socket #include <arpa/inet.h> //inet_addr #include <stdlib.h> int main(int argc, char** argv) { int skt_desc; int skt_desc1; struct sockaddr_in ser_addr; struct sockaddr_in ser_addr1; char se...
C
#include<stdio.h> void main() { int a[4],b,i,n; printf("Enter the Number"); scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&a[i]); } printf("Enter a Number to print: "); scanf("%d",&b); printf("the Number is : %d",a[b]); }
C
int fb(int a){ int f[10000]; f[1]=1; f[2]=2; int i; for(i=3;i<=a;i++){ f[i]=f[i-1]+f[i-2]; } return f[a]; } int main(){ int m; double sum=0; scanf("%d",&m); int i,n,k; for(i=0;i<m;i++){ scanf("%d",&n); for(k=1;k<=n;k++){ sum+=1.0*fb(k+1)/fb(k); } printf("%.3lf\n",sum); su...
C
#include <stdio.h> #include <stdlib.h> typedef int Data; struct Node { Data val; struct Node *left, *right; }; struct Node* tree_create_leaf (Data x) { struct Node* leaf = (struct Node*) malloc (sizeof (struct Node)); leaf->val = x; leaf->left = leaf->right = NULL; return leaf; } struct Node...
C
#include <stdlib.h> #include <stdint.h> #include <stdio.h> #include <ctype.h> #include <gber.h> static void hex_dumpf_r(FILE *f, const uint8_t *tmp, size_t len, size_t llen, unsigned int depth) { size_t i, j; size_t line; for(j = 0; j < len; j += line, tmp += line) { if ( j + llen > len ) { line = len - j;...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include "is_utf8.h" #define BUFSIZE 4096 int main(int ac, char **av) { char buffer[BUFSIZE]; int read_retval; size_t pos; if (ac != 2) { fprintf(stderr, "USAGE: %s STRING or - for stdin.\n", av[0]); r...
C
#include "Filter.h" #include "stdint.h" #include "stdlib.h" #define DFT_T float //Setting the default type of this Algorithm //函数名字 ABS(DFT_T NUM) //函数说明 取绝对值得函数 //参数 NUM :需要取绝对值的值 //返回值:NUM得绝对值 DFT_T ABS(DFT_T NUM) { if(NUM>=0) { return NUM; } else { return (0-NUM); } } //函数名字 RangeSecureInit(RgSe...
C
//for IR code optimization, read ICG.code file and process the file to generate the optimised IR #include <stdio.h> #include <stdlib.h> // void const_propagation_optim(FILE* ir_fp, FILE* op_fp){ // //currently does only one constant propagation // char* instrn_line = NULL; // char ch; // while(!feof(ir_fp)){ // ...
C
/* ** EPITECH PROJECT, 2020 ** my_compute_power_it.c ** File description: ** adrien.colombier@epitech.eu */ int my_compute_power_it(int nb, int p) { int res = nb; if (p < 0) return 0; if (p == 0) return 1; for (int i = 1; i < p; i++) res = res * nb; return res; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* compare_by_time.c :+: :+: :+: ...
C
#include <stdio.h> #include <cs50.h> int main(void) { int n; // repeat the question if input is not an integer do { n = get_int("Height: "); } // that is in between 1 to 8 while (n < 1 || n > 8); // increment # by the amount of n, printing each # in new line (number of column ...
C
// ex17 typedef enum { IDLE, /* !< Waiting for Initial starting conditions */ PARK, /* !< Parking */ RUN_ON_FLY, /* !< Transition State that allow Run_On_Fly looking */ RUN, /* !< Running in normal condition */ WAI...
C
#include <windows.h> #include <stdio.h> #include <stdlib.h> #include <stdint.h> #define THREAD_COUNT 8 #define MAX_COUNTER (1 * 1000) // Prawdopodobnie największa kolekcja zmiennych globalnych jaką stworzyłem // od wielu wielu lat. static volatile LONG g_spinlock; static int g_counter[THREAD_COUNT]; stati...
C
#include <stdio.h> #include <limits.h> // Number of vertices in the graph #define V 5 #define FALSE 0 int minDistance(int dist[], int sptSet[]) { int min_index; int min; min = INT_MAX; for (int v = 0; v < V; v++) { if (sptSet[v] == FALSE && dist[v] <= min) { min = dist[v]; mi...
C
#include <string.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include "client.h" /* @brief * envoi et reception de message * envoi et reception de nom du client * envoi de l'opération et reception du resultat * envoi de coule...
C
#include <ESP8266WiFi.h> #include <WiFiClient.h> WiFiServer server(80); WiFiClient client; bool wait4req = false; String req; void start(String ssid, String pass){ //for static IP //IPAddress local_IP(192,168,0,5); //IPAddress gateway(192,168,0,1); //IPAddress subnet(255,255,255,0); //conect to Access Poin...
C
#include<stdio.h> void main(){ int a=5; int b=10; int c=0; if(a<10) //false printf("10 is greater\n"); if(a &&b) //1 printf("Core2web\n"); //Core2web if(b && c) //0 printf("Biencaps\n"); //blank if(b || c) //1 printf("Amazon\n"); //Amazon }
C
#include<stdio.h> int main() { int i,sum,n; float m=100; scanf("%d",&n); sum=100; for(i=1;i<n;i++) { sum+=200/2; m=m/2; } printf("%d %.2f\n",sum,m); return 0; }
C
#include<stdio.h> int stack[100],top=-1 void push(stack[], int item) { } int main() { Stack my_stack; int item; push(&my_stack, 1); push(&my_stack, 2); push(&my_stack, 3); }
C
#include <stdlib.h> #include <time.h> #include <stdio.h> /** *main -List of Numbers *Return: 0 */ int main(void) { int n; for (n = 0; n <= 9; n++) printf("%d", n); printf("\n"); return (0); }
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
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* fillit.c :+: :+: :+: ...
C
/* PROGRAM: Text.c AUTHOR: Carolina Ayala DATE: 29/Jan/03 PURPOSE: A simple library to display text using glutBitmapCharater */ /**************************************************************************/ /* Include necessary header files *******************************************************...
C
/* MIT License Copyright (c) 2019 abirvalarg */ #include "list.h" #include <malloc.h> size_t _list_append(struct _list_base *l, const void *data, size_t data_len) { struct _list_node *new = malloc(sizeof(struct _list_node) + data_len); struct _list_node *last = l->tail; memcpy((char*)(new + 1), data, da...
C
/* * Implentation of lms circle fitting algorithm from: * 'A simple approach for the estimation of circular arc centre and * its *radius' * by S M Thomas and Y T Chan, CVGIP Vol 45, pp 362-370, 1989 */ #define FALSE 0 #define TRUE (!FALSE) #define SQR(x) ((x) * (x)) extern int representation_ok; compute_circle...
C
#include "myChatting_client.h" int main(int argc, char *argv[]) { if(!isValidMainArg(argc, argv)) { perrorAndExit("inValid arg input occured"); return -1; } int clientSocket; struct sockaddr_in serverAddress; pthread_t sendMessageId, receiveMessageId; void * threadReturn; sprintf(chatName, "%s", argv[3])...
C
#include <sys/types.h> #include <stdio.h> int main() { pid_t id_proceso; pid_t id_padre; id_proceso = getpid(); id_padre = getppid(); printf("Identificador del proceso:%d\n",id_proceso); printf("Indetificador del proceso padre:%d\n",id_padre); }
C
#include <stdio.h> int main(){ int seq[10]={}; int seqm[]={}; int i,j,k,l,soma,maior,tamanho; float media; s = 0; tamanho = ((sizeof seqm)/sizeof(int)); media = maior/tamanho; for(i=0;i!=10;i++){ printf("Digite o %dº número:\n",i); scanf("%d", &seq[i-1]); } for(i=0;i!=10;i++){ for...
C
#define CRT_SECURE_NO_WARNINGS #include <stdio.h> void TempSwap(int *m, int *n) { int temp; temp = n; n = m; m = temp; } void Add_Swap(int *m, int *n) { *m = *m + *n; *n = *m - *n; *m = *m - *n; } void MultSwap(int *m, int *n) { *m = *m * *n; *n = *m / *n; *m = *m / *n; } void ExclSwap(int *m, int *n) { *m ...
C
/* Non-blocking interface to read arbitrarily long lines Copyright (C) 1997-2013 Petr Tesarik <ptesarik@suse.cz> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 o...
C
#include "sandpiles.h" /** * sandpiles_sum - Stablish the sandpile result of a sum of two sandpiles. * * @grid1: First Sandpile. * @grid2: Second Sandpile. * Return: Nothing. */ void sandpiles_sum(int grid1[3][3], int grid2[3][3]) { int n = 0, i, j, new_grid[3][3]; for (i = 0; i < 3; i++) { for (j = 0; j <...
C
//========================================================================= //naive dgemm c file // //Results: // gsl runs at about ~3.5 GFLOP/s on my machine regardless of input sizes // my worst results are ~280 MFLOP/s with block-size of 4/unrolling 4 // my best results are: ~820 MFLOP/s: block-size of 64, unroll 8 ...
C
#include "stdio.h" #define MAXLEN 100 void shellsort(int v[], int n); int main(void) { int v[MAXLEN], n, i; printf("Enter the number of elements: "); scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d", &v[i]); shellsort(v, n); for (i = 0; i < n; i++) printf("%d ", v[i]); printf("\n"); retur...
C
#include "Header.h" void addtolist(teacher** allt, char* user, char* name) { if (*allt == NULL) { printf("no teachers signed up!\n"); return; } bool exist = false; teacher* t; teacher* ret; t = (struct teacher*) malloc(sizeof(struct teacher)); t = *allt; bool contin = true; while (contin) { ...
C
// #include <stdio.h> // #include <cs50.h> int main(void) { //Create name variable that takes user input string name = get_string("What is your name?"); //Print greeting to user using name variable printf("hello, %s\n", name); }
C
#include <stdio.h> int main() { int a[5] = {1,2,3,4,5} int b[5] = {5,4,3,2,1} int t = 0; int i = 0; for (i = 0; i < 5; i++) { t = a[i]; a[i] = b[i]; b[i] = t; } for (i = 0; i < 5; i++) { printf("%d %d",a[i],b[i]); } return 0 }
C
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> // Reprezentacia jedneho uzla zretazeneho zoznamu typedef struct _node { int data; // hodnota uzla struct _node * next; // dalsi uzol zoznamu } NODE; // Reprezentacia zretazeneho zoznamu typedef struct { NODE * first; // prvy uzol }...
C
#include <sys/socket.h> #include <arpa/inet.h> //inet_addr #include <unistd.h> //write #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { sockaddr_un address; int socket_fd, connection_fd; socklen_t address_length; pid_t child; char buffer[256]; int n; socket_fd = socke...
C
#include <stdio.h> #include <stdlib.h> /* estructura autorreferenciada */ struct nodoCola { char dato;/* define dato como un char */ struct nodoCola *ptrSiguiente; }; /* fin de la estructura nodoCola */ typedef struct nodoCola NodoCola; typedef NodoCola *ptrNodoCola; /* prototipos de las funciones *...
C
#include <sys/types.h> #include <sys/times.h> #include <time.h> #include <limits.h> #include <unistd.h> #include <stdlib.h> #include <stdio.h> int main(void) { time_t t; struct tms mytms; clock_t t1, t2; if ((t1 = times(&mytms)) == -1) { perror("times 1"); exit(1); } sleep(5); if ((t2 = times(&mytms)) ==...
C
#include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/shm.h> #include <sys/wait.h> #include <unistd.h> #include <sys/sem.h> #define P(s) semop(s, &Pop, 1); #define V(s) semop(s, &Vop, 1); struct sembuf Pop; struct sembuf Vop; #define MAX 5 typedef struct{ int da...
C
#include "ush.h" /* * Adds spaces ' ' before and after separator symbols * Example: * >>> "echo 1&&echo 2; pwd" * <<< return "echo 1 && echo 2 ; pwd" * PS. this is needed for splitting str by spaces. */ static int status_value(int status, char chr) { int tmp_status = status; if (chr == '\"' && ...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #define MAX 500 struct product{ char name[50]; int size; float price; }; void token(char *str, struct product *products, int position); void printData(struct product *products, int counter); int main(int argc, char *argv[]){ char bff[MAX]; struct produc...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "eaDSStack.h" #define DEFAULT_EXP_FACTOR 2 #define DEFAULT_STARTING_CAPACITY 4 struct _eaDSStack { void ** Data; size_t Count, Capacity; unsigned short ExpFactor, StartingCapacity; void * (*dataCreateAndCopy)(const void *); int (*da...
C
#include<stdio.h> void merge(int c[],int start,int mid,int end) { int i,j,k=start; int tmp[end+1]; i=start;j=mid+1; while(i<=mid&&j<=end) { if(c[i]<c[j]) { tmp[k++]=c[i]; i++; } else { tmp[k++]=c[j]; j++; } } while(i<=mid) { tmp[k++]=c[i]; i++; } while(j<=en...
C
/* Test stores performed in the kernel. * * The values stored should be able to be loaded by the CPU after the kernel is * finished. * * Performance is dependent on the relationship between the unrolling factor of * the inner loop and cache queue size/bandwidth. */ #include <stdio.h> #include <math.h> #include ...
C
/* Programming Assignment 1: Exercise E * * Study the program below. This will be used for your next and final * exercise, so make sure you thoroughly understand why the execution * sequence of the processes is the way it is. * * Questions * * 1. Can you explain the order of what gets printed based on the code...
C
/* * NQueens.cpp * * Created on: Dec 20, 2011 * Author: Venkat, Kooburat * Adapted from: Sankar's NQueens */ #include "vtime.h" #include "debug.h" #include <stdlib.h> #include <unistd.h> #include <stdio.h> #include <signal.h> #include <assert.h> #include <string.h> //#define PRINT_BOARD /* Global ...
C
/** * Return an array of size *returnSize. * Note: The returned array must be malloced, assume caller calls free(). */ int* plusOne(int* digits, int digitsSize, int* returnSize) { int c = 1; //carry *returnSize = digitsSize; for (int i = 0; i < digitsSize; ++i) { digits[digitsSize - i - 1] += c; ...
C
#ifndef MODBUS_PROTOCOL_DATA_UNIT_H #define MODBUS_PROTOCOL_DATA_UNIT_H #include <stdint.h> #ifdef __cplusplus extern "C" { #endif /*! * \file * \brief The PDU descriptions. * * This file contains the structures, that describes PDU. * And useful macros. * */ enum { MAX_PDU_SIZE = 256 }; enum { MAX_PDU_DATA_S...
C
/** Nama: Kurnia Ramadhan Putra Tanggal: 19-02-2020 Nama Program: menu_program.c */ #include <stdio.h> double tambah(double a, double b) { return a + b; } int main() { int pilihan; double angka1, angka2; printf("Menu Program\n"); printf("----------------------\n"); printf("1. Tambah\n"); printf("Masukkan pil...
C
#include <stdio.h> #include <stdlib.h> int htoi(char s[]); int mod_16(char c); int power(int n); int main(void) { char hex[] = "4aC"; printf("hex: %s, int: %d\n", hex, htoi(hex)); return EXIT_SUCCESS; } /* htoi: converts a a hexadecimal string to an integer */ int htoi(char s[]) { char c; int i, j, n, unit...
C
#include<stdio.h> #include<windows.h> #include<stdbool.h> /** 静态顺序表的基本使用 */ #define MAX_LEN 10 typedef struct seqlist { int data[MAX_LEN]; // 最大长度 int cnt; // 有效长度 } SeqList; void initList(SeqList * pL); // 初始化 void traverseList(SeqList * pL); // 遍历数组 bool listInsert(SeqList * ...
C
#include "dt.h" #include "tap.h" int main() { const dt_zone_t *zone; size_t len; { len = dt_zone_lookup("cst", 3, &zone); cmp_ok(len, "==", 3, "dt_zone_lookup(cst)"); is(dt_zone_name(zone), "CST", "name is CST"); ok(dt_zone_is_rfc(zone), "CST is RFC"); ok(dt_zone_i...
C
#include <stdio.h> /* Read input from a text stream * and copy its input to output. * if the character is a tab, * backspace, or back slash * print the corresponsing escape * sequence */ int main(void) { int c; // Store the character in the text stream // While the character are entered // check if...
C
// This is an Academic Project, and was published after finishing the lecture. // @author Joao Elvas @ FCT/UNL #include <string.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <pthread.h> #include "client.h" #include "mysocks.h" #define LINESIZE 1024 pthread_mutex_t lock = PTHREAD_MUTEX_INITIA...
C
/*Arreglo de apuntadores y apuntador a arreglo*/ #include<stdio.h> int main(){ int arreglo[5]={1,2,3,4,5}; int i=0; int var1=1; int var2=2; int var3=3; int var4=4; int var5=5; for(i=0;i<5;i++){ printf("\n El elemento %i tiene la direccion %p",i,&arreglo[i]); //cada 4 bytes ...
C
#include <stdio.h> #include <stdlib.h> typedef struct { float value; int key; }node; int numberNode; float **matrixProb; int **matrixKey; void sortNode(node p[numberNode][numberNode]) { } float **fillMatrixProb( float **pMatrixProb, int numberNode, float pNodeProb[numberNode]) { pMatrixProb = (float**) ...
C
#pragma once #include<stdio.h> #include<stdlib.h> #include<string.h> #define TRUE 1 #define FALSE 0 #define OK 1 #define ERROR 0 #define INFEASIBLE -1 #define OVERFLOW -2 typedef int status; typedef int KeyType; typedef struct { KeyType key; int ID; char name[20]; } TElemType; //二叉树结点类型定义 typedef str...
C
#include <math.h> #include <stdio.h> #include "Maxfiles.h" // Includes .max files #include <MaxSLiCInterface.h> // Simple Live CPU interface #include "common.h" #include "multiparse.h" int areFloatsEqual(float first, float second, float epsilon) { if (fabs(first - second) < epsilon) { return 1; } else { ret...
C
// HELLO #include <stdio.h> #define gc getchar_unlocked inline int getn(){ int n = 0, c = gc(); while(c < '0' || c > '9') c = gc(); while(c >= '0' && c <= '9') n = (n<<3) + (n<<1) + c - '0', c = gc(); return n; } int main(){ int T,U,N,M,C, i, mi; double D,R, mc,pc; T = getn(); wh...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> int main() { int num,g,ng=0,a; srand(time(0)); num = rand() % 100 + 1; printf("**********GUESS THE NUMBER GAME************\n"); do{ printf("Guess the number between 1-100 ---> "); scanf("%d",&g); if (g>nu...
C
#include "led.h" #include "keyboard.h" void Delay(int iHowLongDelay) { int iMiliSecond = 5997; unsigned int uiCounter; char cCharIncrementation; for(uiCounter=0; uiCounter < (iHowLongDelay*iMiliSecond); uiCounter++) { cCharIncrementation++; } } int main(){ enum LedState{BUTTON_PUSHED0, DEFAULT_STAY}; ...
C
/* ** Copyright 2015 K.J. Hermans (kees@pink-frog.com) ** This code is part of simpledbm, an API to a dbm on a finite resource. ** License: BSD */ #ifdef __cplusplus extern "C" { #endif #include "hd_private.h" /* static int hd_sort_empties (hd_t* hd, unsigned level) { unsigned ptr1 = hd->header.off_e, last = ptr...
C
/* * - Test 5 - * Teste prioridades * Execucao: * - Cria processo f1 com prioridade LOW e f2 com prioridade MEDIUM. * - Executa processo F2 ate o fim pois este tem prioridade maior. * - Processo F1 inicia execucao e cria um processo com prioridade maior que a sua ( MEDIUM ). * - Processo F1 para de executar apos...
C
/*************************************************************************************************** * Copyright: washing * FileName: 0687.c * Author: washing * Version: 1.0 * Date: 2022-9-2 10:31:57 ***************************************************************************************************/ /** * Defin...
C
/* Test flawfinder. This program won't compile or run; that's not necessary for this to be a useful test. */ #include <stdio.h> #define hello(x) goodbye(x) #define WOKKA "stuff" main() { printf("hello\n"); } /* This is a strcpy test. */ int demo(char *a, char *b) { strcpy(a, "\n"); // Did this work? strcpy(a...
C
#include <SDL.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <stdbool.h> #include <time.h> #include "data.h" #include "game.h" #include "bub.h" /* **************************************************************************************************************** * * **********...
C
#include<stdio.h> void main() { int a,b,sum; printf("enter two number:\n"); scanf("%d%d",&a,&b); sum =a+b; printf("sum of number=%d",sum); }
C
#ifndef __MEMORY_H__ #define __MEMORY_H__ typedef unsigned short u16; /* 根据不同平台,指针和long类型字节数相同 */ typedef unsigned long UL; #define MEMPOOL_ALIGNMENT 4 struct MemoryBlock { u16 nSize; //所有内存单元的大小 u16 nFree; //内存块还有多少自由的内存单元 u16 nFirst; //记...
C
#ifndef MAP_H_ #define MAP_H_ struct bomb; struct monster; typedef enum cell_type { CELL_EMPTY=0, CELL_GOAL, // 1 CELL_SCENERY, // 2 CELL_PLAYER, // 3 CELL_CASE, // 4 CELL_BONUS, // 5 CELL_MONSTER, // 6 CELL_BOMB, // 7 CELL_DOOR, // 8 CELL_KEY, // 9 CELL_CLOSED_DOOR, // 10 CELL_FLAG, // 11 } cell_typ...
C
/** * file: good_memory.c * * To compile to an executable: * gcc -Wall -Wextra -pedantic -std=c99 -o good_memory good_memory.c * * To execute and test with valigrind: * valgrind --leak-check=full ./good_memory * * This correctly makes use of dynamic memory by allocating then deallocating memory as we...
C
#include <stdio.h> /** * prints hello world **/ void my_hello_world(){ printf("hello world!\n"); } /** * sums up two numbers * @param a * @param b * @return a + b **/ int my_sum(int a, int b){ return a+b; } /** * executes a operation and doubles the result * @param a * @param b * @return 2 * (a ? ...
C
// This file is part of Blend2D project <https://blend2d.com> // // See blend2d.h or LICENSE.md for license and copyright information // SPDX-License-Identifier: Zlib #ifndef BLEND2D_RANDOM_H_INCLUDED #define BLEND2D_RANDOM_H_INCLUDED #include "api.h" //! \addtogroup blend2d_api_globals //! \{ //! \name BLRandom - ...
C
/* ** move2.c for in /home/cottin_j/lemipc-2015-2014s-cottin_j ** ** Made by joffrey cottin ** Login <cottin_j@epitech.net> ** ** Started on Sun Mar 25 17:07:53 2012 joffrey cottin ** Last update Sun Mar 25 17:58:23 2012 hallux */ #include "lemipc.h" int vert_move(int pos, int pos_en, int *battlegrou...
C
#ifndef _PWM_H_ #define _PWM_H_ #include <stdint.h> #define SUCCESS (1) #define FAIL (0) /* * Initializes PWM * Arguments: none * Returns: none */ void Timer0_PWM_Init(void); /* * Starts PWM * Arguments: none * Returns: none */ void Timer0_PWM_Start(void); /* * Stops PWM * Arguments: none * Returns: n...
C
#include <ncurses.h> // also includes <stdio.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include "ictdata.h" // ictFile and ictCategory, and some extern variables struct ictFile* files = NULL; size_t nFiles = 0; struct ictCategory* categories = NULL; size_t nCategories = 0; #include "saverestore...
C
/** * @file rdma_cs.c * @author Austin Pohlmann * @brief File containing the definitions of the functions listed in rdma_cs.h * */ #include "rdma_cs.h" /** * @brief Print an error message and exit the application * * @return @c NULL * @param reason a string representation of what the error came from * ...
C
/************************************************************************************************ * L3 EEA - Projet Techniques Scientifiques * Theme : Algorithme Genetique * Auteurs: * - AIT MOUHOUB Farid * - AOUCI Sofiane * - JAQUET E.Prince * - LAVAL Hugo **********************************...
C
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> int max(int a, int b) { } int main() { long long int x1, y1, x2, y2; long long int x3, y3, x4, y4; int shape=0; scanf("%d%d%d%d%d%d%d%d", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4); if (x1 == x4 || x2 == x3) { if (y1 == y4 || y2 == y3)...
C
#include<stdio.h> #include<stdbool.h> #include<stdlib.h> #include<string.h> #include<locale.h> #include "tabuleiro.c" #include "hospedes.c" #include "validacao.c" #include "ajudante.c" #include "fases.c" int main() { setlocale(LC_ALL, "Portuguese"); printf("Esse jogo basea-se em inserir hóspedes...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_exit.c :+: :+: :+: ...
C
#include <stdio.h> int main() { /** * Escreva a sua solução aqui * Code your solution here * Escriba su solución aquí */ int i; double n, N[100]; scanf("%lf", &n); for(i=0;i<100;i++){ N[i] = n; n/=2; } for(i=0;i<100;i++){ ...
C
/* * File: skip_list.c * Author: Finnur Smári Torfason * Compiler: GCC 4.9.1 */ #include <time.h> #include "skip_list.h" static int seed_set = 0; int rand_height(int max) { if ( !seed_set ) { seed_set = 1; srand((unsigned int)time(NULL)); } static int bits = 0; static int reset = 0; int h, fo...
C
#include "binary_trees.h" /** * binary_tree_size- goes through a binary tree counting the size * @tree: pointer to the root node * Return: the size of the tree */ size_t binary_tree_size(const binary_tree_t *tree) { size_t count = 1; if (tree == NULL) return (0); if (tree->left) count += binary_tree_size(...
C
#include "buffer.h" //Nollställer bufferten void bufferInit(FIFO *buffer) { buffer->count = 0; buffer->in = 0; buffer->out = 0; } //Lägger till ett elem i buffern. //Returnerar 1 om det lyckades, 0 annars. uint8_t bufferPut ( FIFO *buffer, uint8_t elem) { //Kollar om bufferten är full. if (buffer-...
C
#include "holberton.h" /** * clear_bit - function to unset bit * @n: unsigned long int input * @index: index of the bit to unset * Return: 1 if true or -1 if false */ int clear_bit(unsigned long int *n, unsigned int index) { unsigned long int pow = 1; unsigned int size = sizeof(n) * 8; if (*n == '\0') return (-1...
C
#include <unistd.h> void ft_putchar(char c) { write(1, &c, 1); } int main(int argc, char**argv) { char *str; int i; int flg; flg = 0; i = 0; str = argv[1]; if (argc != 2) ft_putchar('\n'); else { while (str[i] == ' ' || str[i] == '\t') i++; while(str[i] != '\0') { if (str[i] == ' ' || str[i...
C
/*5) Escribir en C una función que pida al usuario que ingrese una cadena y la imprima invertida. */ #include<stdio.h> #include<string.h> #define MAX_LENGHT 20 void imprimir_invertida(char cadena[], int longitud){ int i; printf("Longitud:%d\n", longitud); printf("Cadena invertida:"); for(i = longitud ...
C
#include "EllipseFit_int.h" EllipseFloat FitEllipse_int(int32_t *x, int32_t *y, int16_t numberOfPoints) { int16_t _i; // Storage for the scatter matrix. It is a 6x6 symmetrical matrix. int64_t scatterMatrix[21] = {0}; int64_t S3Determinant = 0; int64_t T[9] = {0}; // Eigensystem matrix storage. int6...
C
#include <stdio.h> #include <cs50.h> int main (void) { int x=get_int("height: "); while(x<0 ||x>23) { x=get_int("height: "); } for(int r=1;r<=x ;r++) { for(int i=0;i<x-r;i++) { printf(" "); } for(i...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> int comp(const void *a,const void *b) { return (*(int*)b-*(int*)a); } int main() { int t,n,sum,a[1000],temp,i; scanf("%d",&t); while(t--) { scanf("%d",&n); temp=0; while(temp<n) scanf("%d",&a[temp++]); qs...
C
#include<string.h> #include<stdio.h> long long int findIntermediateResult(long long int a,char o,long long int b) { switch(o) { case '+': return a+b; case '-': return a-b; case '*': return a*b; } } long long int findAnswer(char str[]) { int i; long long int answer=0; i=strlen(str)-1; answer=findIntermediat...
C
#include <stdio.h> #define NAME "홍길동" #define AGE 24 #define PRINT_ADDR puts("주소: 경기도 용인시 \n"); int main(void) { printf("이름: %s \n", NAME); printf("나이: %d \n", AGE); PRINT_ADDR; return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> int main() { int ret; char *ttyname0,*ttyname1,*ttyname2; ttyname0 = ttyname(0); ttyname1 = ttyname(1); ttyname2 = ttyname(3); printf("file0 : %s\n",ttyname...
C
/* j = 0 i = 2 j = 1 i = 4 j = 2; i = 8 j = 3; i = 16; j = 4; i = 32; j = 5; i = 64; j = 6; i = 128; 0 || 1 = 0 = w1 1 && 0 == 0 = w2 */ #include <stdio.h> int main(void) { int Int; char Char; short Short; float Float; Int = 100; printf("Int = %i\n", Int); Char = '$'; pri...
C
#include<stdio.h> void main() { char c[20]; printf("Enter the ip address:"); gets(c); int a=((c[0]-48)*100); int b=((c[1]-48)*10); int e=((c[2]-48)*1); int d=a+b+e; printf("\na=%d",a); printf("\nb=%d",b); printf("\ne=%d",e); printf("\nd=%d",d); printf("\n\nip address is:%s\n\n",c); int i; i=0; if (d>=0 &...