language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include <pthread.h> #include "thpool.h" #include <sys/types.h> #include <sys/ipc.h> #include <sys/msg.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #define MAXSIZE 128 void die(char *s) { perror(s); exit(1); } typedef struct msgbuf { long mtype; char mtext[MA...
C
#include <stdio.h> //typedef int JUNGSU; typedef struct point{ int x,y,z; }abc; //typedef abcϸ struct point abc ü ϰڴٴ ǹ void main (){ abc p1, p2; p1.x=10, p1.y=20, p1.z=30; p2=p1; printf("%d %d %d\n",p1.x,p1.y,p1.z); printf("%d %d %d\n",p2.x,p2.y,p2.z); //if(p1==p2) ƴ...
C
/**************************************************************************** return.c 2.15 - return from multi-band display mode The return command returns the user from the multi-band display mode (entered through disp) to the single-band-with-graphics mode. **************************************************...
C
/* * sensor_opt.c * * Created on: 2017年4月12日 * Author: root */ #include "my_include.h" #include "sensor_opt.h" #include "dev_opt.h" #include "elevator_module.h" SENSOR_DEV_INFO sensor_ctx; //定义传感器 void *ReadGyroData(void * arg) { int i; int retval; int rd_len; int sync = 0; fd_set rfds; float x=0.0...
C
#include <stdio.h> void soma_um(int v[], int n) { int i; for (i = 0; i < n; i++) v[i]++; } int main() { int i, v[5] = {1, 2, 3, 4, 5}; soma_um(v, 5); for (i = 0; i < 5; i++) printf("%d ", v[i]); return 0; }
C
/** ****************************************************************************** * Author : Farid Mabrouk * File Name : main.c * Description : Main program ******************************************************************************/ /* Includes */ #include "main.h" #...
C
#include<stdio.h> #include<stdlib.h> int main() { int a, b; scanf("%d %d", &a, &b); getchar(); if(b-a > 0) { if(b <= 2) puts("nova"); else if(b <= 96) puts("crescente"); else puts("cheia"); } else { if(b > 96) puts("cheia"); else if(b < 3) puts("nova"); else puts("minguante"); } return 0; }
C
#include<stdio.h> int main() { int a=0,b=1,i,temp,n; printf("Enter the number:"); scanf("%d",&n); printf("%d",b); for(i=2;i<=n;i++) { temp=a+b; a=b; b=temp; printf("%d",temp); } }
C
// C Program to reverse a string without // using temp variable #include <stdio.h> // Function to reverse string and return revesed string void reversingString(char* str, int start, int end) { // Iterate loop upto start not equal to end while (start < end) { // XOR for swapping the variable str[start...
C
#include<stdio.h> #include<stdlib.h> #include"StateIO.h" #include"WatermanFun.h" void readfile(int n, const char *filename, unsigned char *sseq, int *sseq_num) { int i; FILE *infile; int a,b; infile=fopen(filename,"r"); for(i=0;i<n;i++){ fscanf(infile,"%d",&a); fscanf(infile,"%d",&b); sseq[i]=a;...
C
/***************************************************************************** FileName: fifo.c License/Copyright: Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. email:janvb@caselaboratories.com Redistribution and use in source and binary forms, with or without ...
C
/* Execution test for argument passing with SSE2 and local functions Written by Paolo Bonzini, 25 January 2005 */ /* { dg-do run } */ /* { dg-options "-O2 -msse2 -mfpmath=sse" } */ /* { dg-require-effective-target sse2 } */ #include "sse2-check.h" #include <assert.h> static float xs (void) { return 3.14159265;...
C
// // Created by Jamie on 23/12/2017. // #include <stdio.h> #include <stdlib.h> #include <time.h> #include "../blackJackAPI/blackJack.h" #include "../blackJackAPI/blackJackPlayer.h" #include "../blackJackAPI/blackJackCard.h" #include "../cardCount/probabilityCalculator.h" #include "../../generalAPI/userInput.h" #in...
C
// // Created by alan2 on 24/03/2020. // #include "utils/render_graph.h" #include <stdlib.h> render_node_t *create_node(draw_callback_c callback) { render_node_t *node = malloc(sizeof(render_node_t)); node->draw_callback = callback; node->child = NULL; node->next = NULL; node->previous = NULL; ...
C
#include "constant.h" #include "freq.h" #include <stdio.h> #include <stdlib.h> #include <strings .h> int countFrequency (char * filename , CharFreq * freq ) { FILE * fptr = fopen ( filename , "r"); int count = 0; if ( fptr == NULL ) { return 0; } while (! feof ( fptr )) { int onechar = fgetc ( fptr ); if (...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* print_num.c :+: :+: :+: ...
C
#include "../include/aplex_tty.h" int main(void) { struct aplex_tty aplex_tty1, aplex_tty2, aplex_tty3, aplex_tty4, aplex_tty5, aplex_tty6; pid_t pid1, pid2, pid3, pid4, pid5, pid6; char tty_node1[] = "/dev/ttyO1"; char tty_node2[] = "/dev/ttyO2"; char tty_node3[] = "/dev/ttyO3"; char tty_node...
C
#include <stdlib.h> #include <time.h> #include "enum.h" typedef struct karta { tBarvaKarty barvaKarty; tTypKarty typKarty; char nazev[50];// "Lidsk nzev" karty pro vpisy, p.: "erven eso" struct karta *dalsi; } tKarta; tKarta * vytvorKartu(tBarvaKarty barvaKarty, tTypKarty typKarty, char *nazev); // vrac adresu dy...
C
#include <stdio.h> #include <stdlib.h> typedef int inteiro;// definindo um novo nome para o int. "inteiro"; typedef struct endereco{ char rua[50]; char bairro[50]; char cidade[30]; int numero; } Endereco; // Facilita a indentificação de tipos de dados typedef struct pessoa{ // Definindo um novo nome ...
C
struct ListNode* removeNthFromEnd(struct ListNode* head, int n) { head = reverseList(head); struct ListNode* current = head; if (n == 1){ head = head->next; } else { int x = 1; while (x<n-1){ current = current->next; x++; } current->next = current->next->next; } head = reverseList(head...
C
#include <stdio.h> #include <string.h> #include <libmemcached/memcached.h> int main() { char* config = "--SERVER=127.0.0.1:11211"; memcached_st* mc = memcached(config, strlen(config)); if (mc == NULL) { printf("Init failed\n"); } char* key = "somekey"; char* value = "VALUE333"; ti...
C
#include<stdio.h> #include<string.h> #include<math.h> int ceil2(float a) { printf("\nIn ceil (%f)..",a); int b=a; float res=b-a; if(res==0) return b; else return b+1; } int main() { char str[100]={}; int count[26]={}; scanf("%s",str); for(int i=0;i<strlen(str);i++) { count[str[i]-'a']+=1; } pr...
C
/* This is assembler of an imaginary computer with 14 bit CPU. * It has 256 cells of RAM and 8 registers. The CPU * has 16 instructions. It can work with signed integer numbers and * ASCII set of characters. */ #include <assert.h> #include <ctype.h> #include <malloc.h> #include <errno.h> #include <stdarg.h> #inclu...
C
#include <arpa/inet.h> #include <netinet/in.h> #include <pthread.h> #include <stdio.h> #include <string.h> #include <sys/socket.h> #include <unistd.h> void *connection_handler(void *); int sockList[100] = {0}; int working = 0; // gcc -o server.o server.c -lpthread int main() { struct sockaddr_in server, client; ...
C
/****************************************************************************** * FILE: pi.c * serial code ******************************************************************************/ #include <stdio.h> #include <stdlib.h> static long num_steps = 100000; double step; int main () { int i; double x, pi, sum = ...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> void encrypt(char *s) { while(*s) { if(*s >= 'A' && *s <= 'Z') { *s += 4; if(*s > 'Z') *s = (*s - 'Z' + 3) + 'A'; } if(*s >= 'a' && *s <= 'z') { *s += 4; if(*s > 'z') *s = (*s - 'z' + 3) + 'a'; } ++s; } } int main() { char ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* display_debug_data_bonus.c :+: :+: :+: ...
C
#include <stdio.h> int calculer_nb_sous_trame_req(int y) { return y; } main() { int x; if ( x = calculer_nb_sous_trame_req(4) == 0) { printf("inside if ( x = 3 == 4), x=%d\n", x); } printf("x=%d\n", x); }
C
#include <stdio.h> #include <stdlib.h> int perm(char *p, int i, int n) { int j; char temp; // char p[4]; // for(j = 0; j < 4; j++) // { // p[j] = a[j]; // } if (i == n) { printf("\t%s\n", p); } else { for (j = i; j < n; j++) { if(i!=j)...
C
#include "asm.h" t_token *create_token(char *str_token, t_type_token type) { t_token *token; // if ((token = (t_token *)malloc(sizeof(t_token))) == NULL) // print_error_and_exit(); MFAIL((token = (t_token *)malloc(sizeof(t_token)))); token->str = str_token; token->type_token = type; token->next = NULL; token->...
C
#include <stdio.h> #include <malloc.h> #define null 0 struct Node { int value; struct Node* next; }; void addData(int data, struct Node* pHead) { struct Node* pTemp = (struct Node*) malloc(sizeof(struct Node)); struct Node* pLocTemp; pTemp->value = data; pTemp->next = null; if (pHead == null) { pHead = p...
C
#include <stdlib.h> #include <string.h> void quicksort(float * array, int first, int last) { if (first>last) { return; } float temp; int i = first; int j = last; int mid = first + (last-first)/2; float pivot = array[mid]; while (i < j) { while (array[i] > pivot) { i++; } while (array[j] < p...
C
#include <stdio.h> int main() { char Home_city[100] = " Chengdu"; int Gap, My_Age = 18, Brother_Age = 16; float Pin_money = 7.5;//to declare 4 variables Gap = My_Age - Brother_Age;//To calculate our gap printf("Greetings!\tI am \\Yang Yuxin\\ who come from %s.My age is %d\n", Home_city, My_Age);//To introduce ...
C
#include "HexString.h" static const uint8_t sucHex[16]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; static const uint8_t sucStr[]={0,1,2,3,4,5,6,7,8,9,0,0,0,0,0,0,0,10,11,12,13,14,15}; /** * @brief Hex数据转换到String数据,比如0x31 对应就是 0x33 0x31 * @note 转出后的字母ABCDEF是大写的 * @param [in] pucHex 要转换...
C
#include <stdio.h> #include <stdlib.h> struct student{ char name[30]; float marks; }; int main(){ struct student *student_ptr; struct student real_student; char name[30]; float mark; student_ptr = real_student; scanf("%s", name); // already an address (&name) scanf("%f", &mark); sprintf(student_ptr->name,...
C
#include "stdio.h" #include "datasizes.h" #include "boundary.h" #include "params.h" #define bitsof(type) (sizeof(type) * 8) static inline boundary_t boundary_rotl(boundary_t boundary, int shift) { boundary.bits = (((boundary.bits << (shift * BITS)) & ((1ull << (boundary.size * BITS)) - 1)) | (bo...
C
#ifndef MEASUREMENT_H__ #define MEASUREMENT_H__ enum measurement_datatype { MT_INT8, MT_INT16, MT_INT32, MT_UINT8, MT_UINT16, MT_UINT32, MT_FLOAT, MT_STRING, }; struct measurement { const char *name; enum measurement_datatype type; const void *data; }; struct measure_ca...
C
/* * populaton.c * * Created on: Apr 17, 2018 * Author: Zeeshan * * * Population In a population, the birth rate is the percentage increase of the population due to births, and the death rate is the percentage decrease of the population due to deaths. Write a program that displays the size of a po...
C
#include <assert.h> #include <stdbool.h> #include <stdio.h> #include <stdint.h> #include <string.h> #ifndef __DEBUG__ #define __DEBUG__ 1 #endif #define LOWER_BOUND 0 #define UPPER_BOUND 999 #define STR_BUFFER_SIZE 80 #define NUMSTR_CONJ_AND "AND" #define NUMSTR_HUNDRED "HUNDRED" #define NUMSTR_ZERO ...
C
/* * @Author: cyang * @Date: 2018-08-02 14:36:52 * @Last Modified by: cyang * @Last Modified time: 2018-08-02 14:40:11 */ #include <stdio.h> #include <stdint.h> int hammingDistance(int x, int y) { int ret = 0; for (int i = 0; i < 32; ++i) { /* code */ int a = x & 0x01; int b = y & 0x01...
C
/* * File: main.c * Author: mquilles * * Created on 28 de Agosto de 2017, 20:10 */ #include <stdio.h> #include <stdlib.h> int main() { int a[5], b[5], c[10], i, contador = 0; for (i = 0; i < 5; i++) { printf("Informe o %d número para o vetor A: ",i); scanf("%d", &a[i]); ...
C
#include "sf2d.h" #include "sf2d_private.h" #include <math.h> #ifndef M_PI #define M_PI (3.14159265358979323846) #endif void sf2d_draw_line(float x0, float y0, float x1, float y1, float width, u32 color) { sf2d_vertex_pos_col *vertices = sf2d_pool_memalign(4 * sizeof(sf2d_vertex_pos_col), 8); if (!vertices) return;...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #define DIR_LEFT 0 #define DIR_RIGHT 1 #define DIR_TOP 2 #define DIR_BOTTOM 3 typedef struct { int x; int y; } POSITION; typedef int DIRECTION; typedef struct _KEY_CHAIN { POSITION pos; DIRECTION dir; struct _KEY_CHAIN *next; } KEY_CHAIN; t...
C
#include <iostream> #include <cstring> #include <algorithm> #include <cmath> class Solution { public: int coinChange(vector<int>& coins, int amount) { int n=coins.size(); // dp[i]: 能够拼凑为 i 元,所需要的最少的硬币数量。 int dp[amount+1]; dp[0]=0; for(int i=1;i<=amount;i++){ dp[i...
C
//este archivo es el fichero fuente que al compilarse produce el ejecutable HIJO #include <stdio.h> #include <stdlib.h> #include <unistd.h> /* for fork */ #include <sys/types.h> #include <sys/ipc.h> #include <sys/msg.h> #include <sys/shm.h> #include <sys/sem.h> #include <sys/wait.h> #include <string.h> char status[3] ...
C
#include <bgbccc.h> bool BGBCC_FrBC_TypeSmallIntP( BGBCC_FrCC_State *ctx, frbc_type ty) { if(BGBCC_FrBC_TypeArrayP(ctx, ty)) return(false); if(BGBCC_FrBC_TypePointerP(ctx, ty)) return(false); if((ty.val&FR2C_TY_BASEMASK)==FR2C_TY_I) return(true); if((ty.val&FR2C_TY_BASEMASK)==FR2C_TY_UI) return(true); ...
C
#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define BUFFER 64 #define NAME_SIZE 32 #define MAX_SIZE 100000 struct File; struct Dir { char id[NAME_SIZE]; struct Dir *parent; struct Dir *children; struct Dir *next; struct File *files; }; struct File { size_t size; char...
C
/* * Program to evaluate polynomial expressions ** Author Dept. Date Notes *************************** * Scotty Bauer Comp. Sci April 3 2020 Initial Version * Scotty Bauer Comp. Sci April 8 2020 Added the number array to evaluate polynomial in a loop */ #include <stdio.h> #include <string.h> #in...
C
#define _CRT_SECURE_NO_WARNINGS 1 #include <stdio.h> #include <stdlib.h> int judgeYear(int n)//жĺ { if (n / 4 == 0 || n / 100 != 100 && n / 400 == 0)//ж return 0;//Ƿ0 else return 1;//귵1 } // int main3() { int year = 0; scanf("%d", &year);//жݵĺ if(0==judgeYear(year))//0ʱ printf("%d", year); if (1 == judge...
C
#include "list.h" #include <stdio.h> #include <stdlib.h> #include "item.h" #include "utils.h" struct list { int size; struct node *head; }; struct node { Item value; struct node *next; }; List newList() { List lista = malloc(sizeof(struct list)); lista->head = NULL; lis...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> #include "queue.h" queue *queue_create() { queue *q; q = (queue*)malloc(sizeof(queue)); q->len = 2; q->a = (void**)malloc( 2 * sizeof(void*) ); q->first = q->last = 0; return q; } int queue_empty(queue *q) { ...
C
#include <util.h> char *j_strdup(const char *str) { if (str == NULL) return NULL; else return strdup(str); } char *j_strcat(char *dest, const char *txt) { if (!txt) return(dest); while (*txt) *dest++ = *txt++; *dest = '\0'; return(dest); } int j_strcmp(const char *a, const char *b) { if (a == NUL...
C
#include "ocr.h" #include "preprocess.h" #include <math.h> #include <stdlib.h> #include <stdio.h> #include "preprocess.h" #include "segment.h" #include "system.h" static const int RESIZED_CHAR_DIM = 40; // dimension of resized character image for feature extraction static const int CHAR_ZONE_COUNT = 16; static const ...
C
#include <stdio.h> void divisione(int dividendo, int divisore, int* pquoz, int* presto) { *pquoz = dividendo / divisore; *presto = dividendo % divisore; } int main() { int quoz, resto; divisione(15, 7, &quoz, &resto); printf("%d %d\n", quoz, resto); }
C
/* ** EPITECH PROJECT, 2020 ** hunter ** File description: ** main */ #include "include/my.h" void set_texture(struct_t *hunter) { sfSprite_setTexture(hunter->sprite_background, hunter->texture_background, sfTrue); sfSprite_setTexture(hunter->sprite_backgroundig, hunter->texture_backgroundig, sfTrue);...
C
#include <stdio.h> // Returns the month corresponding to its numerical value // Ex: 1 returns January, 2 returns February, etc. int main() { int monthSelected; printf("Please enter a number corresponding to a month [1 - Jan, 2 - Feb, etc.]\n"); scanf("%d", &monthSelected); while(monthSelected < 1 || ...
C
#ifndef TOYNIX_INC_THREADQ_H #define TOYNIX_INC_THREADQ_H #include <thread.h> #include <setjmp.h> #include <mmu.h> #define THREAD_NUM_ONHALT 4 enum { name_size = 32 }; enum { stack_size = PGSIZE }; struct thread_context { thread_id_t tc_tid; void *tc_stack_bottom; char tc_name[name_size]; void (*tc_entry)(uin...
C
/*=====[Module Name]=========================================================== * Copyright 2019 Gambarotta Martin Abel <magambarotta@mail.com> * All rights reserved. * License: license text or at least name and link (example: BSD-3-Clause <https://opensource.org/licenses/BSD-3-Clause>) * * Version: 1.0.0 ...
C
#include <stdio.h> #include <stdbool.h> #include <math.h> bool hoanThien(unsigned int n) { if(n == 1) return false; unsigned int t = 1; unsigned int moc = sqrt(n); for (; moc > 1; moc--) if (!(n % moc)) t += moc + n / moc; return n == t; } int main() { unsigned int ...
C
#include "TM4C123GH6PM.h" #include <stdint.h> #include <stdio.h> //Declare a function for millisecond delay void delayMs(int n); int main(void) { //declare an integer for storing the ADC value volatile int ADC_VAL; //declare a float for storing the converted ADC value in RPM volatile float RPM; //declare a const...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #define N 100 int Inverse(char str1[], char str2[][N]); int main() { char str1[N],str2[N][N],ch; int j,i; printf("Input a sentence:"); gets(str1); ch=str1[strlen(str1)-1]; str1[strlen(str1)-1]='\0'; j=Inverse(str1,str2); for(i=j;...
C
#include <cs50.h> #include <stdio.h> int main(void) { int squirrels = get_int("How many squirrels do you have? "); if (squirrels > 10) { printf("That's really too many squirrels.\n"); } else if (squirrels < 0) { printf("That's too few squirrels.\n"); } else { ...
C
int i; static int j; int k = 1; static int l = 2; int a[4]; static int b[4]; int c[4] = {1, 2, 3, 4}; static int d[4] = {5, 6, 7, 8};; void tricky(int x, int y) { b[0] = j = i+a[0]+x; d[0] = l = k+c[0]+y; }
C
//floyd ˰ #include <stdio.h> #include <limits.h> #define TRUE 1 #define FALSE 0 #define VERTICES 7 /* */ #define INF 10000 /* Ѵ ( ) */ /* */ int weight[VERTICES][VERTICES]={ { 0, 7, INF, 5, INF, INF, INF }, { 7, 0, 8, 9, 7, INF, INF }, { INF, 8, ...
C
#include "HD44780.h" void WriteNibble(unsigned char nibbleToWrite) { LCD_PORT |= 1<<EN; LCD_PORT = (LCD_PORT & 0xf0) | (nibbleToWrite & 0x0f); LCD_PORT &= ~(1<<EN); } void WriteByte(unsigned char dataToWrite) { WriteNibble(dataToWrite >> 4); WriteNibble(dataToWrite & 0x0f); } void LCD_Command(unsigned char ...
C
#include<stdio.h> #include<stdlib.h> #include<unistd.h> #include<sys/types.h> #include<sys/wait.h> #include<errno.h> #include<string.h> char ** get_args(int * length) { char ** args = calloc(100,sizeof(char *)); char * bigword = calloc(1000, 1); int _low, EOFind; args[0] = bigword; *length = 1; for(_low = 0; ((E...
C
#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <stdio.h> int get_system_entropy(void* buf, unsigned int length) { // TODO: ideally we should use getentropy from sys/random.h if it's // available. int file = open("/dev/urandom", O_RDONLY); int read_bytes = r...
C
#include "ir.h" #include "node.h" #include <stdlib.h> #include <string.h> #include <stdio.h> #include <stdarg.h> #define DEBUG(x) int var_total=0; int temp_total=0; int label_total=0; int struct_error=0; ListHead code; void translate_compst(Node* node); void translate_exp(Node* node,Operand* temp); Operand new_op(){ ...
C
#include <stdio.h> /* Create a my_add function which takes 2 paramters (nbr1 and nbr2) and return a value. This value is the result of the addtion of nbr1 and nbr2 parameters. */ int my_add(int a, int b); int main() { int first_Number = 30; int second_Number = 20; int Result = my_add(first_Number, se...
C
#include <stdio.h> #include "q1_atividadeModulos.h" #include "q1_atividadeModulos_Funcoes.c" void main(void){ printf("Celsius: 10, Fah: %.2f\n", converte(10)); printf("Fatorial de 5: %i", fat(5)); printf("O comprimento de 'Igor Santos': %i", comprimento("Igor Santos")); }
C
/* File: containeri_inl.h * Date: 12 Sep 06 * Rev: 25 Sep 07 * * Container class definitions - version 2 */ /* use clean * then touch container_inl.h * make */ #include <stdlib.h> #include "common.h" #include "entry.h" #include "container.h" inline Container::Container() /* initialize a Container obj...
C
#include<stdio.h> int main() { char i[10],j[10]; printf("Please enter value of i: "); scanf("%s",&i); printf("Please enter value of i: "); scanf("%s",&j); printf("Your full name is : %s %s",i,j); }
C
//############################### CLIENTE ################################### #pragma once #include <stdio.h> #include <signal.h> #include <errno.h> #include <time.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_getnextline.c :+: :+: :+: ...
C
#include "SynADT.h" struct stack_t avlStack(int *myStack, int hdPtr_avl, volatile int command, ptr_t pointer, int volatile operation){ struct stack_t output; int rightMask = 0x80000000; volatile int nodeData; volatile int stackOut; volatile int temp = 0; volatile int temp_r = 100; volatile int command_in = comm...
C
/* * Arduino-serial * -------------- * * A simple command-line example program showing how a computer can * communicate with an Arduino board. Works on any POSIX system (Mac/Unix/PC) * * * Compile with something like: * gcc -o arduino-serial arduino-serial.c * * Created 5 December 2006 * Copyleft (c) 2006, ...
C
#include <string.h> #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include "../../header/includes.h" static int plan_compose(int plan_index, char **line_split, scene *my_scene) { if (ft_len_tab(line_split) == 3) { if (ft_strchrstr(line_split[0], "material") == 0) plan_mat(plan_index, line_split[2]...
C
/* ** store_link.c for store_link in /home/bartel_r//svn/corewar_2013s/trunk/casm ** ** Made by remi bartel ** Login <bartel_r@epitech.net> ** ** Started on Thu Dec 9 21:58:44 2010 remi bartel ** Last update Fri Dec 10 01:37:21 2010 remi bartel */ #include "xfunctions.h" #include "asm.h" #include "op.h" #include...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <math.h> #include "puzzle2D.h" //this file's function will solve the word puzzle and return the position and direction. int *toprightbackwardstobottomleft(char puzzletable[][101], int word_length, unsigned long long int hashvalue)...
C
#include<stdio.h> int sum(int n) { int rem; if(n==0) { return 0; } else { rem=n%10; n=n/10; rem=rem+sum(n); return rem; } } int main() { int n; printf("Enter the number: "); scanf("%d",&n); printf("\nSum of digits is %d.\n",sum(n)); }
C
#include <stdio.h> #include <stdlib.h> int main () { int* vec = NULL; int* aux = NULL; int i = 0, val = 0, cant = 0; printf("ingrese numero\n"); scanf("%d", &val); if(val != 0) { vec = (int*)malloc((cant + 1)*sizeof(int)); if(vec != NULL) { vec[cant] = ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> // include for strerror(3) function #include <errno.h> // include to access errno int checkFile(char *path); int print_error(char *path, int errnum); void checkError(char *path); int main (int argc, char *argv[]){ switch (argc) { case 1: printf("Usage: ...
C
/************************************************ file f6.c ****/ /* function prototype */ double eval(char *str, int length, double *vect, int genes); double eval(char *str, int length, double *vect, int genes) { register int i; double sum; sum = 0.0; for (i = 0; i < length; i++) sum += (str[i] == '0'); r...
C
#include "sh.h" #include <stdio.h> static void terminate_child(char *command) { ft_putstr_fd("Execve failed to execute ", STDERR_FILENO); ft_putstr_fd(command, STDERR_FILENO); ft_putstr_fd("\nProcess returned code -1\n", STDERR_FILENO); exit(-1); } static char **convert_env_array(t_env **ev) { char **tab; t_env...
C
#include<stdio.h> #include<string.h> int main() { int t,l,i,flag; char s[100001]; scanf("%d",&t); while(t--) { scanf("%s",s); l=strlen(s); flag=0; if(l==4) { if(s[0]==s[2] && s[1]==s[3] && s[0]!=s[1]) { printf("YES\n"); } else { printf("NO\n"); } } else if(l...
C
/*----------------------------------------------------------------------------- CMEMC.C -- C memory management routines for use with FORTRAN. Pieter G. Buning 13 December 1988 FORTRAN entry points: SUBROUTINE GETARR(LENGTH,ARRAY,INDEX) __REAL ARRAY(*) Return an index into ...
C
#include <stdio.h> #include <string.h> main() { char c[50],*str; strcpy(c,"How are you?"); str="Fine,thank you!"; puts(c); puts(str); }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> void output(const char *pszInput) { char szBuffer[1024]; if (pszInput) strcpy(szBuffer, pszInput); printf("Your parmeter is \"%s\"\r\n", szBuffer); } void foo(const char *pszInput) { char *p = malloc(strlen(pszInput)); //we don't w...
C
/* * File: main.c * Author: Oscar * * Created on 21 de Dezembro de 2017, 14:19 */ #include <stdio.h> #include <stdlib.h> int main(int argc, char** argv) { int num; printf("Introduza o seu numero: "); scanf("%d", &num); if (num %2 == 0){ printf("Numero %d Par",num); }else...
C
#include <stdio.h> char *string_concat(char *, char *); int main() { char concat[32] = "Holberton "; char *s; s = string_concat(concat, "School!"); printf("%s\n", s); return (0); }
C
#include "binary_trees.h" /** * create_alv_node - create a node for a binary tree * @n: value to insert in the node * Return: a node on succes */ avl_t *create_alv_node(int n) { avl_t *new_node = NULL; new_node = malloc(sizeof(avl_t)); if (!new_node) return (NULL); new_node->n = n; new_node->parent = NULL;...
C
#include<stdio.h> int main() { long long unsigned int num,fact,subs,temp; scanf("%llu",&num); if(num==1 || num == 0) { printf("1"); return 0; } /* For an even number say 8 8! = 8*7*6*5*4*3*2*1 which is equal to 8! = 8*(7*2)*(6*3)*(5*4) 8! = 8*(8+6)*(14+4)*(18+2) For an odd number say 7 7! = ...
C
#include "special_Math_Functions.h"//mention .h file #include <stdio.h> #include <math.h> void math_Functions() { static double result; do { int select_option; double input; printf("Please choose only one option for special math functions:\n");//choose the operations printf(" 1. logarith...
C
#include<stdio.h> int main(){ int i,j,sum=0,n; int ar[20],tm[20]; int disk; //initialising disk variable printf("Enter number of location \t"); scanf("%d",&n); printf("Enter position of head \t"); scanf("%d",&disk); printf("Enter elements of disk queue \n"); for(i=0;i<n;i++){ scanf("%d",ar[i]);//takes inp...
C
#include "mercury_queue.h" #include "mercury_test_config.h" #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { hg_queue_t *queue = NULL; int ret = EXIT_SUCCESS; int value1 = 10, value2 = 20; (void) argc; (void) argv; queue = hg_queue_new(); if (!hg_queue_is_empty...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<ctype.h> int isKeyword(char buffer[]){ char keywords[32][10] = {"auto","break","case","char","const","continue","default", "do","double","else","enum","extern","float","for","goto", "if","int","long","register","return","short","signed", ...
C
/* main.c - main */ #include <xinu.h> pid32 senderID,receiverID; sid32 sendsem,receivesem; int32 CQfull(pid32); int32 CQempty(pid32); int32 CQcount(pid32); void CQinsert(pid32,int32); int32 CQdelete(pid32); void receiver(sid32 , sid32 ); void sender(sid32 , sid32 ); int32 CQfull(pid32 pid) { struct procent *p...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, const char* argv[]) { FILE* archivo1; FILE* archivo2; char c; archivo1 = fopen(argv[1], "r"); archivo2 = fopen(argv[2], "w"); if (archivo1 == NULL || archivo2 == NULL) { printf ("Error al abrir los archi...
C
#include <stdio.h> int isPrime(int n,int divisor); int main (void) { int num = 0; printf("Ingrese un número entero: "); scanf("%d",&num); int div = num/2; if(isPrime(num,div) == 1) { printf("El numero %d es primo\n", num); } else { printf("El numero %d no es primo\n", num); } return -1; } int isPrime...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <ctype.h> int main (){ double salFixo, totVendas, totReceber; char nome[20]; scanf("%c", &nome); gets(nome); scanf("%lf", &salFixo); scanf("%lf", &totVendas); totReceber = salFixo + (totVendas * 0.15); printf("TOTAL = R$...