language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
// TODO : Write a program which accept one number from user and print that number of even numbers on screen. /* ALGORITHM START Accept one number from user and store it in variable. Iterate one loop till that number and print even number till that number Display the even numbers on s...
C
/* File Server (FS) invoked with: ./FS [-q FSport] [-n ASIP] [-p ASport] [-v] The FS server accepts TCP requests on the well-known port FSport, to answer User requests. */ #include "config.h" #include "connection.h" #include <arpa/inet.h> #include <dirent.h> #include <errno.h> #include <netdb.h> #include <net...
C
#include<stdio.h> #include<stdlib.h> typedef struct a{ int id; struct a *prev, *next; }Node; //for an item of linkedlist typedef struct { Node *head, *tail; }List; void push(List *list, int id){ Node *t = (Node *) malloc(sizeof(Node)); t->id = id; t->prev = t->next = 0; if(list->head =...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> char Alphabet[11]="dcba"; char Buffer[101]; int Len; void Make(int Dep) { int T,L; char Local[101]; L=strlen(Buffer); memcpy(Local,Buffer,L+1); if (Dep<Len) { for (T=0; T<=L; T++) { strncpy(Buffer,Local,T); ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* algo.c :+: :+: :+: ...
C
#include <stdio.h> #include <time.h> #define MAXLEN 29168 #define EOF_VALUE -49 #define NEW_LINE_VALUE -38 #define ASCII_OFFSET 48 void decode(char decode_line[MAXLEN]); // array of Look-up tables ordered from 0-4 char LUT_DIRECTORY[5][4][2] = { { "c2", "+1", "b2", "+2" },{ "a1", "a1", "e2", "+3" ...
C
#include <stdio.h> #include <stdlib.h> typedef struct { int k; int a; int b; } number; long get_gcd(long a, long b) { if (b) while ((a %= b) && (b %= a)); return a + b; } number* get_num(long a, long b) { long gcd = get_gcd(a, b); a /= gcd; b /= gcd; if (b < 0) { b = -b; a = -a; } number* new_num = (n...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/ipc.h> #include <sys/sem.h> #include <sys/shm.h> #include <signal.h> /* ȫֱ */ union semun{ int val; struct semid_ds *ds; unsigned short *array; struct seminfo *_buf; }; int shmid,semid; key_t shmkey,semkey; //char bu...
C
#include <stdio.h> int main() { int T; scanf("%d",&T); for(int i=0;i<T;i++) {int n; scanf("%d",&n); int a[n][n]; for(int j=0;j<n;j++) {for(int k=0;k<n;k++) {scanf("%d",&a[j][k]); } } for(int k=0;k<n;k++) {for(int j=n-1;j>=0;j--) {printf("%d ",a[j][k]); ...
C
#include<stdio.h> #include<math.h> int main() { double num,root; printf("Enter any number to find square root:\n"); scanf("%lf",&num); root = sqrt(num); printf("\nSquare root of the %.2lf is %.2lf\n", num, root); return 0; }
C
#include<errno.h> #include<stdio.h> #include "csapp.h" #define MAX_HEAP (1 << 20) static char *mem_heap; static char *mem_brk; static char *mem_max_addr; static char *heap_listp = 0; void mem_init(void){ mem_heap = (char *)Malloc(MAX_HEAP); mem_brk = (char *)mem_heap; mem_max_addr = (char *)(mem_heap + ...
C
# include <stdlib.h> # include <stdio.h> # include <stdint.h> # include "huffman.h" # include "code.h" /*This function allocates memory for a new treeNode and returns the node. * @param s is the symbol or character in the file that the node will represent. * @param l is whether the node is a leaf node or not. *...
C
#include "user.h" #include "piu.h" #include "survey.h" #include "util.h" #include "stdlib.h" #include "memory.h" #include "assert.h" // Storage of surveillance requests static int num_requests; static surveillance_request * requests_to_scan; surveillance_request* create_surveillance_request(int num_patterns, FILE* fi...
C
#include <stdio.h> int cryp(char text[101]){ char result[101]; int cont = 0; for (int i = 0; text[i] != '\0'; ++i) { if(text[i] == 'a'){ cont++; result[i] = 'b'; }else{ result[i] = text[i]; } } printf("Texto Criptografado:\n"); puts(result); return cont; } int main() { char texto[101]; in...
C
#include "cpu.h" int main(int argc, char *argv[]) { char *instruccionESO; unsigned int instruccion = 0; int resultadoEjecucion; cargar_archivo_de_configuracion(CONFIG_PATH); int header = 0; // Conectar con kernel if (conectar_al_kernel() == -1) { printf("No se pudo conectar con el kernel\n"); exit(1); } ...
C
#include "../rtv1.h" static t_double3 reinit_double() { t_double3 rgb; rgb.x = 1; rgb.y = 1; rgb.z = 1; return (rgb); } static t_double3 hex_to_double(t_env *env, t_pars *pars, char *str) { char *tmp; t_double3 rgb; double hex[6]; int i; tmp = ft_strnew(ft_strlen(str)); tmp = ft_strcpy(tmp, str); ...
C
#include <stdio.h> int main() { int answer1, answer2; printf("Input the value of answer1: "); scanf("%d", &answer1); printf("Input the value of answer2: "); scanf("%d",&answer2); if (answer1 > answer2) { printf("answer1 is bigger"); } else if (answer1 < answer2) { ...
C
#include <stdio.h> #include <stdlib.h> int main() { int x = 0; int y = 1; while (x < 255) { printf("%d %02x\n", x, x); int z = y; y = x + y; x = z; } return 0; }
C
#include "dht11.h" static int get_level(int time, _Bool status) { int sec = 0; while (gpio_get_level(GPIO_DHT11) == status) { if (sec > time) return -1; sec++; ets_delay_us(1); } return sec; } static void set_up_dht11(int *check) { gpio_set_direction(GPIO_DHT11...
C
/* 6. Escreva um programa que pede para o usuário digitar 5 inteiros e imprime o menor desses inteiros. Deve haver apenas um scanf no código e nesse scanf deve haver apenas um %d. */ #include <stdio.h> #include <limits.h> int main() { int inteiros = 0, numero, menor, var = 0; while(inteiros < 5) { printf("Digit...
C
/* * Filename: makeAnagramTable.c * Author: Diana Ho * Userid: cs30xje * Description: Creats an array of struct anagram objects on the Heap * Date: February 18, 2015 * Sources of Help: PA3 Write up, Piazza, Discussion notes, friends */ /* Include files */ #include "pa3.h" #include "pa3_strings.h" #include <std...
C
#include <stdio.h> #include <stdlib.h> #include <errno.h> #include <string.h> #include <sys/time.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/un.h> #include <sys/resource.h> #include <fcntl.h> #include <ctype.h> #include "errors.h" #define SOCK_PATH "./sock" #define MAX_CLI 5 #define BUFF_SIZE 4096...
C
#ifndef UART_H #define UART_H #include <stdint.h> #include "common.h" // UART special function register offsets (add to the base address from main.h to select the UART) #define REG_UART_TX 0x00 #define REG_UART_STATUS 0x04 #define REG_UART_RX 0x08 #define REG_UART_BAUDRATE ...
C
#include "stdio.h" int n,m,i,j,x,y,r,k,c; char map[1051][1051]; int main(){ scanf("%d%d",&n,&m); for(i = 0; i < n; i++){ scanf("%d%d", &x, &y); map[x][y] = 1; } for(k = 0; k < m; k++){ scanf("%d%d%d",&x,&y,&r); for(i = x-r>0?x-r:0,c=0; i <= x+r; i++){ for(j = ...
C
#include "tp2virtual.h" unsigned lru(TabelaPagina * tabelaPagina){ int lru = tabelaPagina->referenciado[0]; int moldura = 0; //busca pela página com o menor clock for(int i = 0; i < tabelaPagina->numMolduras; i++){ if(tabelaPagina->referenciado[i] < lru){ lru = tabelaPagina->referenciado[i]; moldura...
C
#include <stdio.h> #include <sys/types.h> #include <unistd.h> #include <sys/wait.h> #include <string.h> #include <stdlib.h> #include <math.h> #include <fcntl.h> typedef struct HistoryNode { char *command; struct HistoryNode* next; }HistoryNode; typedef struct PathNode { char *path; struct PathNode* next; }PathNod...
C
#include "systemf.h" void welcome(){ system("clear"); printf("--------------------------------------\n"); printf("| WELCOME TO THE GAME |\n"); printf("--------------------------------------\n"); usleep(1000000); // 1 seconde d'attente } void begin() { system("clear"); printf("------------...
C
/** * @brief Free-running timer example * @author Yiqing Huang * @date 2020/11/01 */ #include <LPC17xx.h> #include "timer.h" #include "uart_polling.h" #include "printf.h" #define TIMER1 1 void add_op(uint32_t num_op) { uint32_t x = 0; uint32_t i = 0; for ( i = 0; i < num_op; i++ ) { x...
C
/* * Copyright (C) 2004-2010 Regents of the University of California. * All rights reserved. * * Author: Gautam Altekar */ #include "vkernel/public.h" #include "private.h" #define EXPECTED_MAX_ACCESS_SECTORS 200 #define EXPECTED_MAX_EP_SECTORS (EXPECTED_MAX_ACCESS_SECTORS*2) static const size_t ep_table_sz =...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "wise_gen.h" #include "wise_rle.h" #define SINGLE 0 #define DOUBLE 1 #define MULTI 2 #define RAW 3 #define MAXBLOCKS 2000 typedef struct block { int type; int size; unsigned char value; unsigned char value2; unsigned char...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* strnstr.c :+: :+: :+: ...
C
#include <stdio.h> #include <math.h> int main (void) { int a; scanf("%x", &a); // 1st task printf("%d\n", a); // 2nd task printf("%x %x\n", a, a >> 2); //3rd task printf("%x %x\n", a, ~a); //4th task int b; scanf("%x", &b); printf("%x\n", a | b); //5th task }
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> void main() { // Code... // int sesi = 0; // while(sesi <= 1000) { // printf("%d\n", sesi); // sesi++; // } // int bilangan; // printf("Masukan bilangan: "); // scanf("%d", &bilangan); // if(...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <sys/socket.h> #include "constants.h" #define debug_hex(_s, _len, _c) {int _i; fprintf(stderr, _c); for(_i = 0; _i < _len; _i++){fprintf(stderr, "%x|", _s[_i]);} fprintf(stderr, "\n");} /* SRARQ functions ...
C
#include <fcntl.h> #include "my_tar.h" int is_directory(char* name) { struct stat current_file; if (stat(name, &current_file) == 0) { if (S_ISDIR(current_file.st_mode)) { return 1; } } return 0; } int open_archive_file(tar_options* options) { int fd_archive;...
C
#include "mpi.h" #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int n , pid, p ; // sendA , sendB are data in p0 // finalC is gathered by p0 // recA and recC are local data in all other processors int *sendA, *sendB, *finalC , *recA , *recC ; int tagn = 0 ; ...
C
/* * vector.c * * Copyright (C) 2007-2012, Computing Systems Laboratory (CSLab), NTUA * Copyright (C) 2007-2011, Kornilios Kourtis * Copyright (C) 2011-2012, Vasileios Karakasis * Copyright (C) 2011-2012, Theodoros Gkountouvas * All rights reserved. * * This file is distributed under the BSD License. See LICEN...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> struct record{ double cgpa; char *name; }; typedef struct record *Record; void *readfile(FILE *fp,void *arr,int *sz); int totalheap=0; int maxheap=0; void *myalloc(int n){ void *temp = malloc(n+sizeof(int)); int *first = (int*)temp; *first = n; total...
C
#include <winsock2.h> #include <stdio.h> #include <process.h> // for _beginthread() #define BUFF 1024 int Port=6666,ret; char sendbuff[BUFF]; char recvbuff[BUFF]; struct infor { SOCKET client; char name[1024]; }; struct infor info[100]; SOCKET c; struct sockaddr_in serveadd; int i=0; void thread_send()...
C
#include <stdio.h> int somaincremental(int n1, int n2){ if(n2 == 0){ return n1; } n1++; return somaincremental(n1,n2-1); } int main(int argc, char const *argv[]) { int n1, n2; printf("Digite n1: \n"); scanf("%i",&n1); printf("Digite n2: \n"); scanf("%i",&n2); printf("%i\n",somaincremental(n1, n2...
C
#include <stdio.h> #include <unistd.h> #include <strings.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <time.h> #include <fcntl.h> #define PORT 1234 #define MAXDATASIZE 100 void process(FILE *fp, int sockfd); char* getMessage(char*...
C
#include <wiringPi.h> #include <wiringPiI2C.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> unsigned int readI2CRegister16bit(int addr, int reg) { wiringPiI2CWrite(addr,reg); sleep(1); unsigned int t = wiringPiI2CReadReg8(addr,reg); return t; } void main(void) { int dID = 0x20; int fd; i...
C
/** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */ /** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */ struct TreeNode* buildBST(struct Lis...
C
#include<stdio.h> #include<string.h> #include<limits.h> #include "bitshow.h" void show_bytes(byte_pointer,size_t); void show_short(short x); void show_int(int x); void show_long(long x); void show_double(double x); void show_float(float x); void show_pointer(void *x); void show_unsigned(unsigned x); int uadd_ok(unsign...
C
/* ******************************************************** * α׷ : Main_Scene.c * ۼ : ڼ, 1 ù(ڽ, ڰ, ڼ, ں) * ۼ : 2017.05.31 * α׷ : ޴ α׷Դϴ. ******************************************************** */ #include "Main_Scene.h" void _RenderMainTitle(); // ŸƲ κ void _setTitleImage(); // ȭ鿡 ŸƲ ̹ մϴ. void _Re...
C
#include "fthread.h" #include "stdio.h" #include <stdlib.h> /* efficiency of await_n implementation */ #define CYCLES 100000 #define NUMBER 100 // less than the max number of threads void waiter (void *args) { ft_thread_await_n ((ft_event_t)args,CYCLES); fprintf (stdout, "end waiting\n"); exit (0); } int m...
C
#include <cs50.h> #include <stdio.h> int shower_convert(int shower_time); int main(void) { printf("Enter length of shower in minutes "); int shower_length = get_int(); shower_convert(shower_length); printf("The equivalent amount in number of bottles is %i\n", shower_convert(shower_length)); } int sho...
C
/* Pointers and multi-dim arrays */ #include <stdio.h> int main() { int i, j; // Iteration int matrix[2][5] = { {1, 2, 3, 4, 5}, {6, 7, 8, 9, 10} }; for (i = 0; i < 2; i++){ for (j = 0; j < 5; j++){ printf("matrix[%d][%d] address: %p Value: %d\n", i, j, &matrix[i][j], ...
C
#include <stdio.h> #include "string.h" // 正确的 // #include <fun.c> 错误:<>只能包含系统库文件,当前自己写的文件只用用 “”包含 #include "fun.c" /*#include <>和#include “ ”的区别 #include <>:直接去系统文件中找对应的文件,只能用于包含系统文件。 #include “ ”: 先在当前目录中找对应的文件,如果没有再去系统文件中找。可用于包含当前目录文件和系统文件。 */ void function(int a, int b); int main(int argc, char const *argv[...
C
#include<stdio.h> int fact(int n) { if(n == 0) return 1; return n * fact(n - 1); } int main() { printf("%d\n", fact(4)); return 0; }
C
#include "HD44780.h" void LCD_out_bits(uint8_t bits_to_write) { if(bits_to_write & 0x01) PORT(LCD_DATA_PORT) |= (1<<LCD_D4_PIN); else PORT(LCD_DATA_PORT) &= ~(1<<LCD_D4_PIN); if(bits_to_write & 0x02) PORT(LCD_DATA_PORT) |= (1<<LCD_D5_PIN); else PORT(LCD_DATA_PORT) &= ~(1<<LCD_D5_PIN); if(bits_to_write...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* utility.c :+: :+: :+: ...
C
/*---------------------------------------------------------------------------- File name : gnuplot_i.h Author : N. Devillard Created on : Fri Sept 26 1997 Description : C interface to gnuplot gnuplot is a freely available, command-driven graphical display tool for Unix. It co...
C
#include <stdio.h> #include <dirent.h> /* This file to use readdir function */ #include <string.h> /* String function */ #include <sys/stat.h> /* Header for mkdir function */ #include <stdlib.h> /* Malloc Calloc function */ /* Function to get file mode and convert to string */ int FILE_MODE_Get(char *fileNam...
C
/** * @file SPI.c * @author Kamil Gierlach * @date December 2020 * @brief File contain definitions for SPI */ #include "SPI.h" /** *PRIVATE DEFINITION */ #define SCK 0 #define MOSI 7 #define CS 5 #define DC 7 #define RST 11 void SPI_Init(void){ //enable clock SIM->SCGC5 |= SIM_SCGC5_P...
C
#include <unistd.h> #include <arpa/inet.h> #include <stdio.h> #include <string.h> #define BUF_SIZE 60000 int main() { struct sockaddr_in addr; // address int rl = 0; // total lenght of the message char request[BUF_SIZE], response[BUF_SIZE]; int s = socket(AF_INET, SOCK_STREAM, 0); // soc...
C
#define NRANSI #include "nrutil.h" #include "linmin.h" #include <stdarg.h> #include <stdio.h> #define TOL 2.0e-4 int ncom; float *pcom,*xicom,(*nrfunc)(float []); void imprimirLogLinmin (char* s, ...) { va_list ap; FILE* archivoLog = fopen ("reconstructor.log", "a"); va_start (ap, s); vfprintf (archivoLog, s...
C
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include "myMacros.h" #include "Company.h" #include "AirportManager.h" #include "General.h" #include "main.h" const char* str[eNofOptions] = { "Add Flight", "Add Airport", "PrintCompany", "Print all Airports", "Print flights between origin-destin...
C
#include <stdio.h> int main(void) { if(remove("sample.txt") == 0) printf("sample.txt를 삭제하였습니다.\n"); else printf("sample.txt를 삭제할 수 없습니다.\n"); return 0; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* equation_sphere.c :+: :+: :+: ...
C
/* ** signal.c for navy in /home/benjamin.g/delivery/PSU_2016_navy ** ** Made by Benjamin GAYMAY ** Login <benjamin.g@epitech.net> ** ** Started on Thu Feb 2 16:26:45 2017 Benjamin GAYMAY ** Last update Fri Feb 3 11:13:50 2017 benoit pingris */ #include "navy.h" char *get_cell(char bool, int do_or_not) { static...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <unistd.h> int main() { pid_t pid; int i; for(i = 0; i<5;i++) { pid = fork(); printf("创建了一个子进程!\n"); if(pid < 0){ perror("fork error!\n"); } else if(pid == 0) { break; } } if(i<5){ sleep(i); printf("c...
C
#include "shell.h" /* global variable for ^C handling */ unsigned int sig_flag; /** * sig_handler - handles ^C signal interupt * @uuv: unused variable (required for signal function prototype) * * Return: void */ static void sig_handler(int uuv) { (void) uuv; if (sig_flag == 0) _puts("\n$ "); else _puts("\...
C
// // Created by hao on 18-5-23. // #ifndef UDGADJMATRIXTRAVERSE_UDG_ADJ_MATRIX_H #define UDGADJMATRIXTRAVERSE_UDG_ADJ_MATRIX_H #include <stdio.h> #include "circular_queue.h" #define MAXVEX 100 // 最大顶点数 #define INFINIFY 65535 // 用 65535 代表无限大 #define TRUE 1 #define FALSE 0 #define LENGTH(a) (sizeof(a) / sizeof(a[0...
C
/*-----------------------------------------------------------------------*/ /* Low level disk I/O module skeleton for FatFs (C)ChaN, 2014 */ /*-----------------------------------------------------------------------*/ /* If a working storage control module is available, it should be */ /* attached ...
C
//ALGROTIMOS P2 - Melisa Dimitry Beltrán #include <stdio.h> #include <math.h> #include <sys/time.h> #include <inttypes.h> #include <stdlib.h> #include <time.h> #include <malloc.h> #define UMBRAL 1 double microsegundos() { struct timeval t; if (gettimeofday(&t, NULL) < 0 ) return 0.0; return (t.tv_usec + t.tv_...
C
#include <stdio.h> void message(void) { printf("Have Fun With Programming!\n"); } int main(void) { int i; for(i=1;i<=7;i++) { printf("%2d:",i); message(); } }
C
#include <stdio.h> int main() { double pi; double raio; pi = 3.14159; scanf("%lf", &raio); double area = pi*raio*raio; printf("A=%.4lf\n", area); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "../lib/sqlite3.h" #include "header.h" int debitMoney(sqlite3 *db, double amount, char *operationDate, int clientID, int accountID) { char *operationName; double balance; int operationID; int exitCode; sqlite3_stmt *statement; const char *se...
C
/***************************************************************************** * | File : LCD_APP.c * | Author : Waveshare team * | Function : Hardware underlying interface * | Info : * Used to shield the underlying layers of each master * and enhance portability...
C
#include<stdio.h> typedef struct person{ char name[50]; int age , salary; } person; int main() { person person1; printf("Enter your name:"); scanf("%s",person1.name); printf("Enter your age:"); scanf("%d",&person1.age); printf("Enter your salary:"); scanf("%d",&per...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include "diff_tensor.h" /*--------------------------------------------------------------------------*/ /* */ /* COHERENCE-ENHANCING ANISOTROPIC DIFFUSION FIL...
C
#include <stdio.h> #include <stdlib.h> int main() { char name[20]; int age; int classYear; char hairColor[20]; int heightInInches; char eyeColor[20]; printf("Enter your name: "); scanf("%s", name); printf("Enter your age: "); scanf("%d", &age); printf("Enter your class year...
C
/** @file halt.c @brief This file contains all the checks for dynamical states that result in the termination of the program. @author Rory Barnes ([RoryBarnes](https://github.com/RoryBarnes/)) @date Mar 7 2014 */ #include "vplanet.h" int fiNumHalts(HALT *halt,MODULE *module,int iBody) { /* Count the n...
C
/*พงษธร,ดัชนีมวลกาย*/ //ดัชนีมวลกาย #include<stdio.h> void main(){ system("cls"); float h, w, bmi; printf("Enter a no of height : "); scanf("%f",&h); printf("Enter a no of weight : "); scanf("%f",&w); h = h / 100; bmi = (w/(h*h)); printf("bmi = %.2f\n",bmi); if(bmi >=...
C
/* Name: Nick Klabjan * CS login: klabjan * Section(s): Lecture 1 * * Filename: cache1D.c */ int arr[100000]; // global array of integers of size 100,000 int main() { // iterates through the array for (int i = 0; i < 100000; i++) *(arr+i) = i; // sets the value of each element in the array as the...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <string.h> #include <sys/stat.h> #include <sys/types.h> // 프로세스 생성해서 한줄씩 프린트, 터미널 clear하는 테스트 char javafile[30][100], cfile[30][100]; int main(void){ pid_t pid; int status, ret_val; FILE *javafp, *cfp; int javasize, ...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #define K 6 #define N 5 int main(int argc, char *argv[]) { int a[K][N], n, count = 0; srand(time(NULL)); printf_s("n = "); scanf_s("%d", &n); for (int i = 0; i < K; ++i, printf_s("\n")) { for (int j = 0; j < N; ++j) ...
C
#include "stm32f10x_type.h" #include "buffer.h" uint32 receive_buffer_pool_map = 0; uint8 *receive_buffer_pool[RECEIVE_BUFFER_COUNT]; uint8 BUFFER[MAX_BUFFER_LENGTH]; uint16 buffer_size[RECEIVE_BUFFER_COUNT] = { 12, 12, 12, 25, 25, 25, 55, 55, 55, 100, 100, 100 }; uint32 READ_INT32(int offset,void *addr) { uint...
C
#include <stdio.h> void ClearLineFromReadBuffer(void); int main() { char perID[7]; // ex) 911105'\0' 7 迭 ʿ. char name[10]; fputs("ֹιȣ 6ڸ: ", stdout); // Ϳ fgets(perID, sizeof(perID), stdin); // ִ ũ 7 byte Ű Է . /************/ ClearLineFromReadBuffer(); // Է ۸ . ׳ о. ȯ. /************/ fputs("̸...
C
// Programs using command-line arguments rely on the user's memory of how to use them // correctly. Rewrite the program in Listing 13.2 so that, instead of using command-line // arguments, it prompts the user for the required information. #include <stdio.h> #include <stdlib.h> #define MAX 20 void replace(char * st...
C
#include <stdio.h> #include <conio.h> #include <stdlib.h> #include<string.h> #define bool char #define true 1 #define false 0 #define MAX(a,b) (a>b?a:b) #define MIN(a,b) (a<b?a:b) /** * Return an array of size *returnSize. //["i", "love", "leetcode", "i", "love", "coding"], k = 2 * Note: The returned array must ...
C
#include <stdio.h> #include <stdlib.h> #define PI 3.14 void main(void) { /* printf("Hello world!\n"); //area of square int h,area_square; printf("enter h of the square :"); scanf("%d",&h); if(h>0) { area_square=h*h; printf("the area of square = ...
C
#include <stdio.h> #include <stdlib.h> void foo(int a,int b) { int d= (b+=4)-(a*=2); // a=12 , b=3 , d= -9 a=(d^=2); // a=-11 , b=3 , d=-11 d=(b/=4)*(a-=3); // a=-14 , b=0 , d=0 } int main() { //wpisz wartosci zmiennych po wykonaniu danej linijki kodu int a = 162410; //tu wpisz swoj numer indek...
C
/* * Licensed to Elasticsearch B.V. under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. Elasticsearch B.V. licenses this file to you under * the Apache License, Version 2.0 (the "License"); you may * not u...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <time.h> #include <string.h> #include <dirent.h> #include <fcntl.h> #define KEEP_VIDEO_NUM (6*24*2) char *get_current_dir_name(void); int readFileList(char *basePath) { unsigned int i = 0; DIR *dir; struct dirent *ptr; ...
C
#include "bases.h" /* The function is obsolete from the previous excersise void func1(const vector* x, vector* fx, matrix* jacobian){ double A=10000; fx->data[0]=A*x->data[0]*x->data[1]-1;// A*x*y = 1 , fx->data[1]=exp(-1*x->data[0])+exp(-1*x->data[1])-1-1/A;//exp(-x) + exp(-y) = 1 + 1/A, double j11 = A * x->d...
C
#include <signal.h> #include <stdio.h> #include <unistd.h> int count = 0; void my_sig_handler(int sig) { count++; } int main(int argc, char **argv) { struct sigaction sa; sa.sa_handler = &my_sig_handler; sa.sa_flags = 0; sigfillset(&sa.sa_mask); if(sigaction(SIGINT,&sa,NULL) == -1) { printf("Error install...
C
#include<stdio.h> #include<conio.h> int main() { int n1,n2,i,p,flag=0; clrscr(); printf("enter the two numbers\n"); scanf("%d%d",&n1,&n2); p=n1*n2; for(i=1;i<=p/2;i++) { if(i*i==p) { flag=1; break; } } if(flag==1) { printf("...
C
/* * ecp_cpy.c * * Created on: Nov 20, 2015 * Author: tslld */ #include "ecdsa.h" #include "ec.h" #include "ec_point.h" /** Make a copy of the point P. * \param R pointer to an ec_point structure * \param P pointer to an ec_point structure * \return 1 if successful, 0 if failed */ int ec_point_cpy(ec_...
C
#include <stdio.h> int main() { float lc = 0; int c; while((c = getchar()) != EOF){ if (c == '\n') ++lc; } printf("%0.f\n", lc); }
C
/* * helper_fcns.c * author: Eli Pandolfo * * some helper functions called by eval_expr.c */ #include "deque.h" /* duplicates a character with malloc */ char *ft_chardup(char c) { char *str; str = malloc(2); str[0] = c; str[1] = 0; return (str); } /* checks if a char is an operator (+, -, *, /, %) */ int is_o...
C
/*************************************************/ /* Author : Abdullah Muhammad */ /* Date : 14/3/2018 */ /* Version: V01 2 */ /*************************************************/ ...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #include "stp_print.h" #define update_ctx(ctx,bytes) { \ ctx->buf+=bytes; \ ctx->buf_size -= bytes; } static char* indent(char* buf, int buf_size, const char* msg, ...
C
#include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> int main (int argc, char *argv[]){ int n; int *vet; int i; pid_t pid[2]; n = atoi (argv[1]); vet = (int *)malloc(n * sizeof(int)); if (vet == NULL) { printf("Allocatin Error.\n"); exit(1); ...
C
#include <stdbool.h> #include <stdlib.h> #include "types/word.h" #include "types/instruction.h" #include "types/location.h" #include "types/wordType.h" #include "types/memoryMap.h" #include "types/private/memoryMap.h" MemoryMap *createMemoryMap(int maxWords) { MemoryMap *map = malloc(sizeof(MemoryMa...
C
struct heap; //pushes data onto the heap; returns -1 if error otherwise 1 int Push_Data(struct heap ** provided, void ** data); //Delete's the heap and it's internal allocations but not the data void Delete_Heap(struct heap ** provided); //Not destructive in the normal sense; but free's the data as well v...
C
//Write a program in C to find the length of a string without using library function. #include<stdio.h> int main(){ char str[] = {"string"}; int count = 0; while(str[count] != '\0'){ count++; } printf("%d", count); return 0; }
C
#include "holberton.h" /** * print_alphabet_x10 - return void * Return: void (success) * void - is return type */ void print_alphabet_x10(void) { int i; for (i = 0; i < 10; i++) { char j; for (j = 'a'; j <= 'z'; j++) _putchar(j); _putchar('\n'); } }
C
#include <stdio.h> /*用的是主函数中a,b的地址对其初始化 可以实现a,b的值得交换*/ /*void swap(int *a,int *b) { int temp; temp = *a; *a = *b; *b = temp; }*/ /*用的是主函数中a,b的地址对其初始化 但在本函数中实现的是地址之间的交换 , * a,b的值并没有交换*/ /*void swap(int *a,int *b) { int *temp = NULL; temp = a; a = b; b = temp; }*/ void swap(int a,in...