language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <string.h> #include <stdlib.h> #include "make_message.h" #include "matrix.h" void generaMat(char matrix[][5], char *key, char *alfa) { removeSpaces(key); removeDoubles(key); char *Alfabet = calloc(26 + strlen(key), sizeof(char)); strcpy(Alfabet, key); removeDoubles(strcat(Alfabet...
C
#ifndef __GRID_H__ #define __GRID_H__ #include "sudoku.h" #include "debug.h" /* Sudoku grid management: cell reference, selection, modification and conflict detection The sudoku game can be seen as a 2 dimension array ( 9 rows * 9 columns ) of cells. Internally, rows and columns are in the range [0-8]. Each c...
C
#ifndef MAIN_UTILSSTRUCTURES_H #define MAIN_UTILSSTRUCTURES_H struct Pixel { uint8_t r; uint8_t g; uint8_t b; uint8_t a; }; struct Point { // координаты в пикселях int x; int y; }; struct PointT { // координаты в тайтлах int x; int y; }; struct ObjectBorders { ObjectBorde...
C
#include <x86intrin.h> #define ENABLE_SSE_CALC_DIST static inline float CalcDistance(float p1[], float p2[]) { #ifdef ENABLE_SSE_CALC_DIST /* make sure that p[NDIMS] = 0.0 & p is aligned 16 */ __m128 v_diff = _mm_sub_ps(_mm_load_ps(p1), _mm_loadu_ps(p2)); __m128 v_dist = _mm_dp_ps(v_diff, v_diff, 0x77); return _m...
C
#include<stdio.h> #include<conio.h> #include<stdlib.h> #include<string.h> int mdtc=1,mntc=1,c=0,d=0; char ins[20],line[20],str[10],op[10],ala[10]; struct mdtable { int mdtc1; char ins1[10]; char opr[10]; }mdt[10]; struct mntable { int mdtc2,mntc2; char ins2[10]; }mnt[10]; void main() { int l,i,...
C
#define CANSET 11 #define CANGET 12 #define ACK 51 #include <stdio.h> main() { unsigned int id,stat,crate,subject; unsigned char rtr,dlc,trt,data[8]; /* reset_can(); */ crate=1; subject=6; id=(subject<<7) | crate; stat = can_tx(id,8,1,data); stat = can_rx(&id,&dlc,&rtr,&data[0]); print...
C
#include "sparse_dok.h" // **************** UTILITIES *********************** static void *emalloc(size_t amt,char * location) { void *v = malloc(amt); if(!v){ fprintf(stderr, "out of mem in quad_tree: %s\n",location); exit(EXIT_FAILURE); } return v; }; // *************************...
C
/*Triangle Pattern Enter no. of rows:5 A A B A B C A B C D A B C D E */ #include<stdio.h> int main() { int i,j,row; printf("Enter no. of rows:"); scanf("%d",&row); for(i=1;i<=row;i++) { for(j=1;j<=i;j++) printf("%c ",(j+64)); printf("\n"); } return 0; }
C
/** * @file my_string.c * @author Ruthvika Garlapati * @brief Your implementation of these famous 3 string.h library functions! * * NOTE: NO ARRAY NOTATION IS ALLOWED IN THIS FILE * * @date 2021-03-25 */ // DO NOT MODIFY THE INCLUDE(s) LIST #include <stddef.h> #include "hw7.h" /** * @brief Calculate the leng...
C
void ft_swap(int *a, int *b) { int c; c = *a; *a = *b; *b = c; } void ft_sort_int_tab(int *tab, int size) { int i; int j; i = 0; while (i < size) { j = i + 1; while (j < size) { if (tab[i] > tab[j]) ft_swap(&tab[i], &tab[j]); j++; } i++; } } #include <stdio.h> int main() { int tab[]...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(){ char in[300], out[300]; int i, j; gets( in ); i = j = 0; while( in[i] ){ if( in[i] == '.' ) out[j++] = '0'; else if( in[i] == '-' && in[i+1] == '.' ) out[j++] = '1', i++; else out[j++] = '2', i++; i++; } out[j] = 0; puts( out ); ...
C
/* This file is part of Designar. Author: Alejandro Mujica (aledrums@gmail.com) */ #include <bitset.H> #include <list.H> #include <set.H> #include <polygon.H> using namespace std; using namespace Designar; ostream & operator << (ostream & out, const Polygon::PointType & p) { out << p.to_string(); return o...
C
/******************************************* Author : LHearen E-mail : LHearen@126.com Time : 2016-03-03 20:55 Description : Source : https://leetcode.com/problems/generate-parentheses/ *******************************************/ #include <stdlib.h> void traverse(char*** arr, int* returnSize, ch...
C
/// Encapsulates the idea of a location made up of an X point and a Y point. /// @author Darren Brogan #ifndef COORDINATE_H #define COORDINATE_H struct Coordinate { /// The X position. int x; /// The Y position. int y; Coordinate(); Coordinate(int x, int y); }; #endif
C
/* ************************************************************************** */ /* */ /* :::::::: */ /* ft_lsttostrarr.c :+: :+: ...
C
#include <time.h> #include <stdio.h> #include <unistd.h> #include <sys/socket.h> int write_all(int fd, void* buffer, size_t length) { while (length > 0) { int written = write(fd, buffer, length); if (written < 0) return -1; length -= written; buffer += written; } ...
C
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A // PARTICULAR PURPOSE. // // Copyright (C) 1993-1997 Microsoft Corporation. All Rights Reserved. // // M...
C
/* * This file contains declaration of all the public functions, definition of custom data structures and types for the TETRIS game. * * @author: Eduardo Ocete, Natalia Paredes, Ovie Osimiry * * */ #ifndef SHAPE_H #define SHAPE_H #include "includes.h" #include <math.h> #include "arm_math.h" //Enum definition f...
C
#include "../headers/file_array.h" struct file *initialize_file(char *file, uint64_t number_of_rows, uint64_t number_of_columns) { struct file *new_file = (struct file *)malloc(sizeof(struct file)); if( new_file == NULL) { perror("initialize_file failed"); return NULL; } new_file->name...
C
#include<stdio.h> int main(void) { char *fname = "Wang"; char *lname = "Pengliang"; char *address = "Chaoyang Beijing"; printf("Name is %s %s\n",fname,lname); printf("Address is %s\n",address); return 0; }
C
/* * com_comm_manage.c * - implement function of fiscal manage * * Author : Leonardo Physh * Date : 2014.9.24 */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <ctype.h> #include "config.h" #include "common.h" #include "error.h" #include "input.h" #include "keyboard...
C
/****************************************** File: randNumRec.c Description: Random number generator. Modified from TIPS package. (c) 1997, Thomas F. El-Maraghi *******************************************/ #include <math.h> #include <time.h> #include "randNumRec.h" /* The number of entries in the mSeedTab...
C
//#include"Header.h" //////////////////////////////////////////////////////////////////////////////////// //Function Name : Count //Paramiter : Integer //Return Value : Integer //Discription : This is simple function which will take one number from user And Count frequency of each Digits which are l...
C
#include <stdio.h> #include <unistd.h> #include "smash.h" //#include <String.h> int showtok(char *bfr); char *tokenArr[4096]; char path[256]; void executeCommand(char *str) { char *token; token = strtok(str, " "); char *newbuff = malloc((strlen(str) + 1) * sizeof(char)); strncpy(newbuff, str, strlen(s...
C
#include "ft_printf.h" static int recdigits_unsigned(unsigned num, unsigned base) { if (num == 0) return (0); else return (1 + recdigits_unsigned(num / base, base)); } int count_digits_unsigned_base(unsigned num, unsigned base) { if (num == 0) return (1); else return (recdigits_unsigned(num, base)); }
C
/************************************************************************* > File Name: slice.c > Author:perrynzhou > Mail:perrynzhou@gmail.com > Created Time: Mon 28 Oct 2019 02:22:11 PM CST ************************************************************************/ #include "slice.h" #include <stdio.h> #incl...
C
#include<stdio.h> /* while 문 - while ( 조건식 ) { 조건식이 참이면 실행 } > 반복문의 실행 조건식만 알고 있을때 사용 > while 문의 조건식에 아무것도 작성하지 않으면 Error do while문 - do { 실행 코드 } while ( 조건식 ); > 반복문의 코드를 먼저 실행하고 조건식을 확인하기 때문에, 반복문의 코드를 무조건 한번은 실행한다 */ int main() { int i = 0; while (i < 5) { printf("%d\n", i); ++i; } ...
C
#include <stdio.h> int main(void){ char ch = 'a'; printf("a is %d\n",(int) ch); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct { char name[256]; float radius; int nMoons; }Planet; int main(void) { int i, numPlanets=5; Planet* solarSystem = (Planet*)malloc(numPlanets * sizeof(Planet)); for(i=0;i<numPlanets;i++) { printf("Enter planet %d name: ", i+1); scanf("...
C
// *********************************************************************************************************************** // * File Name : main.c // * Project : Software Assignments // * Version : 1.0 // * Device(s) : NA // * Description : Used for calling other sub functions // * Author : Visha...
C
bool isSumEqual(char * firstWord, char * secondWord, char * targetWord){ int length1 = strlen(firstWord); int length2 = strlen(secondWord); int length3 = strlen(targetWord); int firstValue = 0, secondValue=0, targetValue=0,i; for(i=0;i<length1;i++) { firstValue = firstValue + ((firstWord[i]-97)*(pow(10,...
C
void clip_upper(const MKL_INT n, float *v, const float max) { v = __builtin_assume_aligned(v, ALIGNMENT); for(MKL_INT i = 0; i < n; ++i) v[i] = (max < v[i]) ? max : v[i]; } void clip_lower(const MKL_INT n, float *v, const float min) { v = __builtin_assume_aligned(v, ALIGNMENT); for(MKL_INT i =...
C
/* ** full_pix.c for full_pix in /home/gauthier/rendu/gfx_tekpaint/src ** ** Made by Gauthier Cler ** Login <cler_g@epitech.eu> ** ** Started on Mon Jan 11 20:21:27 2016 Gauthier Cler ** Last update Tue Jan 26 18:30:06 2016 Gauthier Cler */ #include "tekpaint.h" void full_pix(t_bunny_pixelarray *pix, t_color ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* test_line_format_is_valid.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> float x1,x2,x3,x4; float s; float mean; int main() { printf("enter numbers for variation equation: \n "); scanf("%f %f %f %f", &x1, &x2, &x3, &x4); s = (x1 + x2 + x3 + x4) * 1/4; printf("the mean of the four numbers is: %0.1f\n", s); s = (pow((x1-s),...
C
#include<stdio.h> #include<string.h> #define MaxSize 50 #define INF 10000000 double graph[MaxSize][MaxSize]; double prim(int n) //Initially select vertex 0 { double lowcost[n],sum = 0; //Array lowcost is used to store the shortest distance from the vertex in V-T to T, lowcost[i] = 0 me...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include "test.h" #include <time.h> #include "colimacon.h" int main(int argc, char *argv[]){//proramme qui va lancer la fonction test avec differents parametres mis en entree int i,j; printf("Beginning of test phase\n\n\n"); for(i=0;i<6;i++){// ici les p...
C
#include <stdio.h> char bufor1[100], bufor2[100]; char *funkcja(char x[], char y[]); int main(){ puts("Wpis pierwszy tekst: "); gets(bufor1); puts("Wpis drugi tekst: "); gets(bufor2); printf("Dluzszy lancuch znakow: %s\n", funkcja(bufor1, bufor2)); return 0; } char *funkcja(char x...
C
#include <stdio.h> #include <stdlib.h> #include "utils.h" int main (int argc, char **argv) { #define WIDTH 400 #define HEIGHT 200 uint32_t *dest = malloc (WIDTH * HEIGHT * 4); pixman_image_t *src_img; pixman_image_t *dest_img; int i, j, k, p; typedef struct { pixman_point_fixed_t p0; pi...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <string.h> #include <unistd.h> #include <htable.h> unsigned int hash_time(const time_t * t) { unsigned char * p = (unsigned char *)t, * end = p + sizeof *t - 1; unsigned int h = 0; while ( p < end ) h ^= ( h << 5 ) + ( h >> 2 ) + ...
C
#include <stdio.h> #include <conio.h> int main() { char ch; printf("Enter any character: "); scanf("%c",&ch); if((ch>='a'&&ch<='z')||(ch>='A'&&ch<='Z')) printf("%c is an Alphabet",ch); else printf("%c is not an Alphabet",ch); return 0; }
C
#include "gpio.h" #include "uart.h" #include "can.h" #define CAN_TX_ID 0x10 #define CAN_RX_ID 0x56 /* ʵƣCANͨŲ ʵƽ̨˿ оƬMK64DN512ZVQ10 ʵЧʹCAN0ģ3жϵķʽ0x56 ʹ20x10ַ豸ݣʱ500 */ /* CANͨ жϻصждյ */ void CAN_ISR(void) { uint8_t buf[8]; uint8_t len; uint32_t id; if(CAN_ReadData(HW_CAN0...
C
#include<stdio.h> #include<stdlib.h> #include<errno.h> #include<fcntl.h> #include<string.h> #include<unistd.h> #define RECEIVE_BUFFER_LENGTH 6 #define WRITE_BUFFER_LENGTH 6 #define MOTOR_ANGLE 1 #define ENCODER_ANGLE 2 #define MOTOR_SPEED 3 #define CLOCKWISE 1 #define ANTI_CLOCKWISE 2 ...
C
#include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <signal.h> #include <string.h> #include <ctype.h> #include <ucontext.h> #include <fcntl.h> #include <sys/mman.h> #include <errno.h> long unsigned hex2int(char *str) { unsigned long intVal = 0; int i = 0; while(1){ switch(str[i]){ ...
C
// Copyright © 2014-2015 Inria, Written by Lénaïc Bagnères, lenaic.bagneres@inria.fr // 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/LICENSE-2.0 // // U...
C
#include <sys/socket.h> #include <netinet/in.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <arpa/inet.h> #include <unistd.h> int main() { struct sockaddr_in client, server; char a[100]; int fd, addr_len, len, i; memset(&server, 0, sizeof(server)); memset(&clien...
C
#include <SDL.h> #include <stdlib.h> #include <string.h> #include "Game.h" #include "Event.h" #include "Const.h" #include "Collider.h" #include "Log.h" int game_init(struct Game* game) { if (SDL_Init(SDL_INIT_EVERYTHING) < 0) { log_error("SDL initialization failed. SDL Error: %s", SDL_GetError()); return -1; } ...
C
#include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <string.h> static const char *filename = "myfifo"; static const char *fifo_id = "FIFO_2"; int main() { int fd; char buf[100]; char revbuf[100]; if (access(filename, F_OK) < 0) { ...
C
//backref.c // created by: Kurt L. Manion // on: Sat., 12 May 2018 // #include "backref.h" #include <limits.h> #include <stdio.h> #include <string.h> #include <err.h> backref_t* __pure2 backref_make( const ptrdiff_t p, const size_t n, char *const pattern) { backref_t *br; br = (backref_t *)malloc(backref_sz...
C
#include<stdio.h> #include<conio.h> void main() { int n; clrscr(); printf("Enter the number:"); scanf("%d"&n); if(n/2==0) { printf("%d number is even"); } else printf("%d number is odd"); getch(); }
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #if DEBUG #include <execinfo.h> void assert_(int ok, char * x) { if (ok) return; printf("\n=== assert(%s) failed ===\n", x); void *array[10]; size_t size; size = backtrace(array, 10); backtrace_symbols_fd(array, size, 2); exit(1); }...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #include "parser.h" #include "../symbol_table/hashtable.h" #include "../lexer/lex.h" #include "../list/list.h" //Grammar in grammar.txt struct list_t *symbol; struct hashtable_t *symbol_table; struct List list = {.first = NULL}; char *_EOI = "\0"; char *_...
C
// cookiedough -- cspan() & friends: colored span draw functions #ifndef _CSPAN_H_ #define _CSPAN_H_ // draw span (straight line) with interpolated color (ISSE-optimized) VIZ_INLINE void cspan( uint32_t *pDest, int destIncr, unsigned int length, // length of span unsigned int drawLength, // visible length ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ch_operations_sp.c :+: :+: :+: ...
C
/* the math library */ /* the math library contains: - miscellaneous math functions e.g. ceil(), fabs(), floor() - exponential and logarithmic functions e.g. exp(), pow(), log10() - trigonometric and hyperbolic functions e.g. acos(), cos(), cosh() more functions can be seen at: http://www.tutorialspoint.c...
C
/** * * * * proc(5) - wirtualny system plików, który udostępnia interfejs do struktur danych jądra. Zwyczajowo znajduje się w /proc. procfs - wirtualny system plików pozwalający na komunikację z jądrem uniksowego systemu. Jego struktura występuje jedynie w pamięci operacyjnej komp...
C
/* * ADC_LCD.c * * Created: 2019-02-15 오전 2:06:37 * Author : tlgus */ #define FUNCSET 0x28 //function set, 데이터 선 4비트, 2줄로 표시, 5X7비트 사용 #define ENTMODE 0x06 //entry mode set, LCD표시창에 문자를 표시하고 커서를 오른쪽으로 이동 #define ALLCLR 0x01 //all clear, LCD표시창을 클리어시키고 커서를 첫 줄의 첫 칸에 위치 #define DISPOFF 0x08 //display off, 표시 off ...
C
#include "shell.h" /** * _dirch - Implements the directory change * * @cmm: Parameter of the directory to change to. if no directory is given, * change to home directory * @env: Enviroment variables * Return: Always 0 (Success) */ int _dirch(char **cmm, char **env) { int stat = 0, len = 0; char *dir = NULL;...
C
#include <easy_rng.h> #include "rng.h" #ifdef DMALLOC #include "dmalloc.h" #endif easy_rng* aml_rng_init(long rng_seed) { easy_rng *rng = easy_rng_alloc(easy_rng_default); if(rng_seed!=-1) { easy_rng_set(rng,rng_seed); // printf("setting rng to %ld\n",rng_seed); } else { struct timespec *t =...
C
#include <stdio.h> #include <stdlib.h> typedef struct pilha { int *dados; int N, p, u; } fila; int enfileira (fila *p, int x){ if (p->u <= p->N ){ if (p->u == p->N ){ p->dados = realloc(p->dados, 2*p->N*sizeof(int)); if (p->dados == NULL) exit(EXIT_FAILURE); ...
C
#include <stdio.h> #include <stdio_ext.h> #include <stdlib.h> #include "gfx.h" #include <unistd.h> typedef struct lista_Dupla{ int info; struct lista_Dupla *prox; struct lista_Dupla *ant; }ListDup; /*------------------------------------------------------------------------- DESENHAR A SETA PARA IDENTIFICAR UM NUME...
C
/* ** EPITECH PROJECT, 2021 ** bsq.c ** File description: ** bsq.c */ #include <stdlib.h> #include "c_funct.h" #include "bsq.h" char *clean_map(char *content_file) { int start = my_index_of(content_file, '\n', 0) + 1; int length = my_strlen(content_file); char *cleaned_map = malloc(sizeof(char) * (length ...
C
#include <stdio.h> #define MAX_L 4 int fac(int x); int facsum(const int src); int list[] = {1,1,2,6,24,120,720,5040,40320,362880}; int main(void) { int sum = 0; int cnt = 0; // counter int tp = 0; // temp while (cnt < MAX_L) { tp++; if (facsum(tp)) { printf("\r%d\n",tp); cnt++; sum += tp; } ...
C
#ifndef _IPXE_SOCKET_H #define _IPXE_SOCKET_H /** @file * * Socket addresses * */ FILE_LICENCE ( GPL2_OR_LATER ); #include <stdint.h> /** * @defgroup commtypes Communication semantics * * @{ */ /** Connection-based, reliable streams */ extern int tcp_sock_stream; #define TCP_SOCK_STREAM 0x1 #define SOCK_ST...
C
/* docIdSub.c was originally generated by the autoSql program, which also * generated docIdSub.h and docIdSub.sql. This module links the database and * the RAM representation of objects. */ #include "common.h" #include "linefile.h" #include "dystring.h" #include "jksql.h" #include "docId.h" #include "portable.h" ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.c :+: :+: :+: ...
C
#include <stdio.h> int main(void){ int sum,x,i; for(i=0;i<=100;i++){ sum = sum+i; printf("足し合わせた値は%d",sum); printf("足した回数は%d\n",i); } return(0); }
C
#include <stdlib.h> #include <stdio.h> int exist(int *v, int size, int key) { int i; for (i = 0; i < size; i++) if (v[i] == key) return 1; return 0; } int main(int argc, char *argv[]) { int i, count, read, *numbers = NULL; FILE *fp; if (argc < 2) { printf("Error: file not found\n"); exit(0); } f...
C
/* Program #1 - My first C program. */ #include "stdio.h" main() { printf("This is my first C program."); }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { FILE *filePtr; char msg[1024]; int msgLen; printf("Enter message to be sent "); gets(msg); filePtr = fopen("/proc/my_proc_file", "w"); if (filePtr == NULL) { printf("I couldn...
C
#include "server_functions.h" #include <stdio.h> #include <string.h> #include "crawler_functions.h" #include <stdio.h> #include <netinet/in.h> #include <sys/socket.h> #include <sys/types.h> #include <arpa/inet.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/stat.h> #include <time.h> #includ...
C
#include <stdio.h> int main() { char a,b,c; scanf("%c%c%c",&a,&b,&c); printf("%c\n%c\n%c\n",a,b,c); return 0; }
C
#include <lib.h> #include <string.h> /* * Run with: SWAP_DISC_SIZE=12 and QEMUEXTRA="-m 15M" make run-testoomother-nox * Child allocates a big chunk memory first. * Parent tries to allocate too much so that OOM kills child bc it has higher badness score. */ int main(int argc, char **argv) { char *addr = (void *)...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "CuTest.h" #include "game-test.h" #include "helper.h" #include "../tiCtaCtoC/game.h" #include "../tiCtaCtoC/messages.h" int isBoxGood, corners[4] = {0, 2, 6, 8}; void confirmCornerBox(int box) { for (int i = 0; i < 4; i++) { if (box == co...
C
#include<stdio.h> int main() { int i=0; char Nom[30]; printf("Quel est votre nom ?\n"); printf("Nom:"); scanf("%s",Nom); while(Nom[i]!='\0') { i++; } printf("Le nombre des caracteres =%d",i); return(0); }
C
#include"player.h" #include<math.h> #define MOVE_SPEED 30 #define ROTATE_SPEED 200 #define CLICK_DISTANCE 100 Player create_player(PSL_Input input) { Player player; player.pos[0] = 9.0f; player.pos[1] = 10.0f; player.pos[2] = 9.0f; player.rot[0] = 0.0f; player.rot[1] = 0.0f; player.rot[2] = 1.0f; player...
C
#include<stdio.h> #include<stdlib.h> #include<unistd.h> #include<string.h> #include<fcntl.h> int executeCommand (char *cmd) { pid_t pid = fork(); if(!pid){ // Breaking the cmd into main command and its options by splitting it by " ", "\n", "\0". char* excmd[11]; char* buf = strtok(cmd," \n\0"); int n = 0; ...
C
//odd no sum #include<stdio.h> void main() { int i=1,sum=0; while(i<=100) { if(i%2!=0) { printf("%d\n",i); sum =sum+i; } i++; } printf("sum= %d",sum); }
C
#include <stdio.h> #include <math.h> void fibo(int n) { unsigned long int fibo[2] = {0, 1}; unsigned long int helper = 1; while (1) { if (fibo[0] >= sqrt(n)) { printf("Liczba nie jest iloczynem kolejnych elementow ciagu fibonacciego \n"); return; } ...
C
#include <stdio.h> #include <stdlib.h> #define NO 10 void arryin(int vc[],int no); void bsort(int vc[],int no); int main(void) { int i; int vc[NO] = {0}; arryin(vc,NO); putchar('\n'); bsort(vc,NO); for(i = 0;i < NO;i++) { printf("Bvc[%d] = %d\n",i,vc[i]); } return 0; } void...
C
#include "binary_tree.h" int main(int argc, char * argv[]){ //Pass the size of the tree. The function returns the root. bin_tree * root = create_random_binary_tree(9); preorder(root); puts(""); inorder(root); puts(""); postorder(root); puts(""); pretty_print(root); }
C
#include "lists.h" /** * add_dnodeint_end - entry point * @head: head node * @n: value of new node at end * Return: new node at end, NULL on failure */ dlistint_t *add_dnodeint_end(dlistint_t **head, const int n) { dlistint_t *temp; dlistint_t *new = malloc(sizeof(dlistint_t)); if (new == NULL) { return (NULL)...
C
int input(void) { } void output(int out) { } int num[4]; int max(void) { int m; int i; m = 0; i = 0; while (i <= 3){ if(m < num[i]) m = num[i]; i = i + 1; } return m; } void main(void) { int a; num[0] = 5; num[1] = 9; num[2] = 21; num[3] = 8; a = max(); output...
C
/** Make dcl recover from input errors */ #include <stdio.h> #include <string.h> #include <ctype.h> #define MAXTOKEN 100 enum { NAME, PARENS, BRACKETS }; int dcl(void); int dirdcl(void); int gettoken(void); /* return next token */ int tokentype; /* type of last token */ char token[MAXTOKEN]; /* last token string *...
C
#include "wolf3d.h" static void wall_color(t_env *e, int x, int y) { if (y >= e->a.d_start && y <= e->a.d_end && e->a.side == 0 && e->a.stepx == -1) { e->mlx.data[(int)(x * 4 + y * e->mlx.size) + 2] = 238; e->mlx.data[(int)(x * 4 + y * e->mlx.size) + 1] = 106; e->mlx.data[(int)(x * 4 + y * e->mlx.size)] ...
C
#include <stdio.h> #include <conio.h> #include <stdint.h> #include <math.h> #include "FIR_lpf_coefficients.h" #include "waveForms.c" #include "ruido.c" #define SIGNAL_LENGTH 320 #define W 0.05 //freq señal float his[K]; /*funcion filtro fir float input : nueva entrada de muestreo float *h : ...
C
#include <stdio.h> #include <string.h> #define TAMANO_MAX 80 int main(int argc, char *argv[]) { char cadena[TAMANO_MAX+1]="una Prueba de Cadena", cadena_invertida[TAMANO_MAX+1]; int i, tamano_cadena; // obtenemos el tamao de la cadena tamano_cadena = strlen(cadena); i=0; // trabajamos sobre la copia directa...
C
/* Area: ffi_call Purpose: Check structures. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" typedef struct { float f; } s55; static s55 ABI_ATTR f55(s55 ts, float f) { s55 r; r.f = ts.f + f; printf ("f55>> %g + %g = %g\n", ts.f, ...
C
#include<stdio.h> #include<stdlib.h> #include<time.h> #include<getopt.h> #include<unistd.h> #include<ctype.h> void swap_alg(int num_nodes, int num_swaps, int **a, int **b, int *num_a, int *num_b); int main(int argc, char * argv[]){ int num_nodes, num_swaps, i, j, k, opt, nflag; int min, max, range, shift, inde...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <math.h> #include "hash_table.c" const int MAX_MEM = 32768; char* extractString(char* src) { char buff[256]; char *subString; strcpy(buff, src); subString = strtok(buff,"'"); subString=strtok(NULL,"'"); return subString...
C
#include <stdio.h> #include <string.h> #include "cmdparse.h" #define DEBUG FALSE void printCmd(CMD *cmd); /** * Creates Cmd structure corresponding to raw command string. * Parameters: * rawCmd - pointer to raw string consisting of, at most, two sub-commands. * May contain "|", "&", "<", ">", and/or ">>" ...
C
#include <stdio.h> int main() { float salario; int horas; scanf("%f\n%i", &salario, &horas); salario += (salario * 0.05 * horas); printf("%.2f\n", salario); return(0); }
C
#include <stdio.h> #include <readline/readline.h> #include <readline/history.h> #include "execution.h" #include "minishell.h" #include "utils.h" /* ** Malloc and initialize t_command_invocation */ t_command_invocation *cmd_init_cmdinvo(const char **exec_and_args) { t_command_invocation *cmdinvo; cmdinvo = malloc(si...
C
#include <sys/resource.h> #include <stdio.h> #include <string.h> #include <stdlib.h> int main () { for (int i = 0; i < 10; ++i) { void* a = malloc(10*1024*1024); memset(a, 0, 10*1024*1024); struct rusage ret; getrusage(RUSAGE_SELF, &ret); printf("%li\n", ret.ru_maxrss); sleep(1); } }
C
#ifndef SPBPRIORITYQUEUE_H_ #define SPBPRIORITYQUEUE_H_ #include <stdbool.h> /** * SP Bounded Priority Queue summary * * Minimum priority queue of SPListElement elements. * Queue is prioritized by the element's value. * Queue is bounded by a maximum number of elements maxSize. * * The following functions are av...
C
#include<stdio.h> #include<string.h> typedef struct poke{//포켓몬 구조체 char name[23]; int number; }pMon; pMon list[100003];//입력 char copy[100003][23]; int cmp(const void *a,const void *b)//포켓몬 이름별로 정렬 { pMon *p1=(pMon*)a; pMon *p2=(pMon*)b; return strcmp(p1->name,p2->name); } int main() { int n,m; char s[23]; scanf...
C
// -*- C -*- /** * @file GeneFeatureData.h * @brief Definition of a GeneFeatureData class. * @author Shumin Guo (guo.18@wright.edu) * @version 1.0.99 */ // $Log$ #ifndef _GeneFeatureDataClass_ #define _GeneFeatureDataClass_ #include <iostream> #include <vector> #include "defs.h" #include "GeneFeatureItem.h" #in...
C
//#define _CRT_SECURE_NO_WARNINGS 1 // //#include <stdio.h> //#define lev(n) (n%4==0 &&(n%100 || n%400==0)) // //int main() //{ // int y,m,d,i,s; // int month[2][13] = { // {0,31,28,31,30,31,30,31,31,30,31,30,31}, // {0,31,29,31,30,31,30,31,31,30,31,30,31} // }; // while(scanf("%d/%d/%d",&y,&m,&d)!=EOF) ...
C
// array.c: Defines NewLang's array type. // // Eventually, this entire file will have to be written in assembly and the // majority of the functions will be inlined directly (except maybe // resize_dynamic, since it should be called infrequently). This little library // will replace raw contiguous memory as de-facto ...
C
/* module.c Jack Walpuck and Torrie Edwards Graphics CS 351 October 28, 2014 -----------------------------------------------------------------------------*/ #include <stdlib.h> #include <stdio.h> #include <math.h> #include <graphics.h> /*allocate and return an initalized but empty Element*/ Element *elem...