language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include <stdlib.h> #include "mochilaDoHeroi.h" float areaCirculo(float raioCirculo); void main(){ apresentacao(); printf("\nCalculadora de area de circulo"); float raioCirculo = lerFloat(); printf("\nA area do circulo e %f", areaCirculo(raioCirculo)); despedida(); } float areaCirculo(fl...
C
#include <stdio.h> #include<string.h> int main(void) { char flag[3]="0"; char pass[15]=""; int i=0; puts("CTFłBtOFLAG_ZŽ`Ŏ܂B"); while(i<3){ puts("pX[h͂Ă:"); scanf("%s",pass); if(strcmp(pass,"banana")==0){ strcpy(flag,"correct"); } if(strcmp(flag,"0")!=0){ puts("OC܂B"); puts("pX[hbananał...
C
// nget.c #include "nget.h" void usage( char* argv0 ) { fprintf(stderr, "Usage: %s [-r|-l|-d|-c|-n] [-h HOST[:PORT]] RANK\n\ Options:\n\ -l lowest latency\n\ -r highest free RAM\n\ -d highest free disk\n\ -c highest free CPU\n\ -h HOST[:PORT] Access t...
C
#include <stdio.h> #include <stdlib.h> // You will write a program that keeps track of exam results. // First, your program should ask the user how many classes took the exam. Let's say this number is N. // Then you need to ask how many students took the exam in the first class. Let's say this number is M. // You need...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> int is_prime(int number) { int i=3; float max=sqrt(number); for(;i<=max;i+=2) { if(number%i==0) return 0; } return 1; } int next_prime_candidate(int x) { int closest_tenth=x-(x%10); int zero[]={0,6,0,0,0,0,0,4,0,0}; int one[]= {0,2,0,4,0,0,0,2,0,4}...
C
#include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> int main(void) { int fd1, fd2, sz1,sz2; char *c1 = (char *) calloc (100, sizeof(char)); char *c2 = (char *) calloc (100, sizeof(char)); fd1 = open("content1.txt", O_RDWR | O_APPEND); fd2 = open("content2.txt", O_RDWR); if(fd1 < 0) { perror("...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* checker.c :+: :+: :+: ...
C
#include "graphs.h" #define WHITE 0 #define GRAY 1 #define BLACK 2 int color[MAX]; void GraphgraphL (GraphL g, int V) { FILE *f = fopen("graph.dot", "w"); Edge p; fprintf (f, "digraph G {\n"); fprintf (f, "\tlabelloc=\"t\";\n"); fprintf (f, "\tlabel=\"Graph\";\n"); for (int u=0; u<V; ++u) { ...
C
/*#include <stdio.h> #include <stdlib.h> int main() { printf("HELLO GAMES \n THIS TIME , I CAME WITH A TIC TOE GAME\n"); int row, col; int arr[3][3]; for (row=0 ; row <3 ;row++) { for (col=0 ;col<3 ; col++) { arr[row][col]==0; } } print(arr); int x,...
C
// circumference of a circle #include<stdio.h> #include<stdlib.h> int main(int argc, char const *argv[]) { float radius,c; scanf("%f",&radius); c=3.14*radius*radius; printf("%0.2f",c); return 0; }
C
#include <string.h> #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include "httpClient.h" #define HTTP_RCVBUF_SIZE_MAX (3*1024*1024) #define HTTP_SERVER_IP "127.0.0.1" #define HTTP_SERVER_PORT 6666 #define HTTP_SERVER_PATH "/" #define POSTDATA "{\"username\":\"gailun\",\"password\":\"123123...
C
#include<stdio.h> int rotateArray(int arr[],int,int); void display(int arr[],int); void leftRotatebyOne(int arr[], int n); int main(){ int a,b,size; scanf("%d ",&a); int arr[5]; size=sizeof(arr)/sizeof(arr[0]); int c=0; while(c<size){ ...
C
#include <stdio.h> int main() { float score; char grade; printf("score="); scanf("%f", &score); if (score>=90) grade = 'A'; else if (score>=80) grade = 'B'; else if (score>=70) grade = 'C'; else if (score>=60) grade = 'D'; else grade = 'F'; printf("%.2f %c", score, grade); return 0; }
C
// 範例:用來減少判斷的次數. #include <stdio.h> #define N 10 int add(int a, int b) { return a + b; } int sub(int a, int b) { return a - b; } int mul(int a, int b) { return a * b; } int div(int a, int b) { return a / b; } int main(void) { int (*oper)(int a, int b); char key; int a[N], b[N], c[N]; ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <errno.h> #include <dirent.h> // function prototypes void parse_line(char *command); char **tokenize(char *line, int *num_tokens); // static variables static char *li...
C
#include <stdio.h> #include <sys/types.h> #include <unistd.h> int main() { // forks to main process => subprocess1 fork(); // forks main process => subprocess2, subprocess1 => subprocess3 fork(); // main and subprocess1-3, executes below. printf("Called fork() system call\n"); return 0; }
C
#include <stdio.h> #include <stdlib.h> int main(void) { float loan, rate, day, sum; printf("Enter loan principal (-1 to end): "); scanf_s("%f", &loan); while (loan != -1) { printf("Enter interest rate: "); scanf_s("%f", &rate); printf("Enter term of the loan in days: "); scanf_s("%f", &day); sum = loan...
C
#include <omp.h> #include <stdio.h> int main(int argc, char const *argv[]){ int iam = 0, np = 1, i = 0; //MODIFICACIÓN HECHA //iam debe de ser privada porque si no el th_id se repetiría, np también #pragma omp parallel private(i, iam, np) { #if defined (_OPENMP) np = omp_get_num_threads(); iam = omp_...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_get_unsign_ptr_bin.c :+: :+: :+: ...
C
#include "accounts.h" #define PIPE_READ 0 #define PIPE_WRITE 1 static pthread_mutex_t accountMutexes[MAX_BANK_ACCOUNTS]; static bank_account_t accounts[MAX_BANK_ACCOUNTS]; static bool usedAccounts[MAX_BANK_ACCOUNTS]; bank_account_t* getAccount(uint32_t account_id) { if(!usedAccounts[account_id]) return NULL; ...
C
/* * 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 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be use...
C
#include <stdio.h> #include "ft_printf.h" static int f_x_sharp(t_data *data, const char *ptr) { if (data->flags[SHARP] > 0 && *ptr == 'x') print_str("0x", data); else if (data->flags[SHARP] && *ptr == 'X') print_str("0X", data); return (0); } int pick_f_x_two(char *result, t_data *data, const char *ptr) { if ...
C
#include <stdint.h> #include <stm8s.h> // works ok! // Setup the system clock to run at 16MHz using the internal oscillator. void initialize_system_clock() { CLK_ICKR = 0; // Reset the Internal Clock Register. CLK_ICKR |= (1 << CLK_ICKR_HSIEN); // Enable the HSI. CLK_ECKR = 0; ...
C
/* * tiny_web - a mini simple web program. */ #include "csapp.h" void sigchld_handler(int sig) { while (waitpid(-1, 0, WNOHANG) > 0) ; return; } void doit(int fd); /* main - an C/S module. */ int main(int argc, char **argv) { struct sockaddr_in cliaddr; int listenfd, connfd, port; socklen_t clilen; pid_t c...
C
#include <stdio.h> int nullTheEven(int value) { int mask = 0x55555555; int result = value & mask; return result; } int main() { int a; a = 31; printf("%i", nullTheEven(a)); return 0; }
C
/* psinv.c CCMATH mathematics library source code. * * Copyright (C) 2000 Daniel A. Atkinson All rights reserved. * This code may be redistributed under the terms of the GNU library * public license (LGPL). ( See the lgpl.license file for details.) * ---------------------------------------------------...
C
// One-star problem // Problem 10038 Jolly Jumpers /* This program is written by Prof. Chua-Huang Huang Department of Information Engineering and Computer Science Feng Chia University Taichung, Taiwan Disclaimer: The programming problem is downloaded from UVa Online Judge (https://uva.onlinejudge.org/). ...
C
/********************************************************** Copyright (C) 2015 . File name: SVGAmode.H Author: Version 2.0 Date 2015/8/12 Description SVGAʾģʽͷļģʽ»ijʼͼͼȵʵ֡ 괦SVGAmode.hС Ϊ궨ԵʣϽļжΪRGBrgbı Ϊgraphics.hеĺдĸд дĻοϵΪ׼ LineCircleCirclefillΪϴ룬빤 Աļ޸뼰ʱ¸ʽ¼棨ÿ޸ĵг Function L...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<math.h> struct hash{ struct node **arr; int size; }; struct node{ char *ch; struct node *next; }; struct node* create_node(char *str){ struct node* new; new = (struct node*)malloc(sizeof(struct node)); new->next = NULL; new->ch = (char*)malloc(...
C
#include <stdio.h> #include "functions.h" #include <stdlib.h> struct min_heap{ int index; int data; struct min_heap* left; struct min_heap* right; }; struct min_heap* min_heap_tree(struct min_heap* root, int arr[], int i, int n){ if(i < n){ struct min_heap* new_node = (struct ...
C
/* ** check_all_ship.c for in /home/januar_m/delivery/PSU/PSU_2016_navy ** ** Made by Martin Januario ** Login <martin.januario@epitech.eu> ** ** Started on Mon Feb 13 11:16:12 2017 ** Last update Mon Feb 13 11:32:05 2017 */ #include <stdio.h> #include "battleship.h" int check_all_ship(int **all_ship) { in...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #define SIZE 50 #define LENGHT 25 typedef struct List { char code[LENGHT]; char AuthorName [SIZE]; char PaintingName [SIZE]; double Price; int year; struct List *next; }Painting; void menu (); void choiceManage...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* print_int.c :+: :+: :+: ...
C
#define _CRT_SECURE_NO_WARNINGS #include "stdafx.h" #include <stdio.h> #include <string.h> #include <stdlib.h> #include <locale.h> #include <conio.h> #include <Windows.h> // Вспомогательные функции: int not_a_stop_symbol(char sym) { if ((sym == ' ') || (sym == '.') || (sym == ',') || (sym == '!') || (sym == '?'...
C
#include "ev_header.h" #include <string.h> #include <stdio.h> #include <stdlib.h> struct function_table funtable; extern char *EV_LOG; static char mylog[512]; static struct table_entry *get_entry(struct function_table *table, struct se_symbol symbol) { if (table->entry_count < 1) { strcpy(mylog, "Low...
C
#include <stdio.h> int main() { printf("Hello World"); float x = 5; float z = 6 + 5; int n = 0; for (int i = 0;i < 10; i++) { cout << "Hello World"; << endl; } while (n != 0) { cout << 'a' << endl; } char c = 'a'; double output = p; std::cout << "This is a simple test \n" << std::endl; char c; pr...
C
#include "LDE.h" LDE *criaNo(int value) { LDE *novo = (LDE *)malloc(sizeof(LDE)); if (novo) { novo->prox = NULL; novo->prev = NULL; novo->value = value; } else { printf("Erro de alocacao de memoria.\n"); exit(1); } return novo; } LDE *novaLista()...
C
#include <stdio.h> #include <string.h> int main() { char a[20]; int i; int count=0; for(i=1;i<=5;i++) { scanf("%s",a); if(strstr(a,"FBI")!=NULL) printf("%d\n",i); else count++; if(count==5) printf("HE GOT AWAY!\n"); } return 0; }
C
#include <stdio.h> #include <math.h> #define NVERT 5 #define NPERM 24//number of permutations of vertices. Excluding cyclical permutations, (NVERT-1)! #define NPART 16 //The problem asks for a 16-digit string ==> 10 appears only once, so it must be in external node //It can be shown that both the sums of internal and...
C
#include <stdio.h> #include <stdlib.h> #define BLOCKSIZE 8 static void loop_opt() { int i = 0; int limit = 33; /* could be anything */ int blocklimit; /* The limit may not be divisible by BLOCKSIZE, * go as near as we can first, then tidy up. */ blocklimit = (limit / BLOCKSIZE) * B...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* parse_vertex.c :+: :+: :+: ...
C
#include <assert.h> #include "../common/alloca.h" int main() { char *b1 = alloca(13); int i; int lastoffs = 0; for(i = 0; i < 5; ++i) { char *bfs = alloca(24); int offset = b1 - bfs; memset(bfs, 0, 24); assert(offset > lastoffs); lastoffs = offset; } return 0; }
C
#include "./Include/mpu.h" #include <stdlib.h> #include <math.h> void _mpu_reset(pMPU* p) { uint8_t buf[] = { 0xFF, 0xAA, 0x52 }; HAL_UART_Transmit(p->huart, buf, sizeof(buf) / sizeof(buf[0]), 10); } void _mpu_acc(pMPU* p, float* x, float* y, float* z) { uint8_t buf[MPU_BUFSIZ]; uint8_t ptr = 0; HAL_UART_Receive...
C
#include <sys/types.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> int main(void) { int count = 0; pid_t pid; pid = fork(); if(pid < 0) { printf("error in fork!"); exit(1); } else if(pid == 0) { printf("I am the child process,the count is %d,my process ID is %d\n",count,getpid()); } else...
C
#include<stdio.h> #include<stdlib.h> int a[10][10],vis[10],ex[10],n,j; void topo_dfs(int v) { vis[v]=1; for(int i=1;i<=n;i++) { if(a[v][i]==1&&vis[i]==0) topo_dfs(i); } ex[j++]=v; } int main() { int m,u,v; printf("enter no of vertices \n"); scanf("%d",&n); for(int i=1;i<=n;i++) { for(int j=1;j<=...
C
// Demetrios Doumas 3/9/17 // Part 3 --Part2 // Copy the content of source.txt into destination1.txt and destination2.txt // Replace all 1s with As in source.txt into destination1.txt // Replace all 2s with Bs in source.txt into destination2.txt #include<stdio.h> #include<unistd.h> #include<sys/types.h> #include<sys...
C
#include "sam.h" #include <stdio.h> #include "utils/print.h" #include "utils/delay.h" #define CONF_SERCOM_2_USART_BAUD_RATE 9600 #define CONF_SERCOM_0_USART_BAUD_RATE_REGISTER_VAL \ (65536 - ((65536 * 16.0f * (CONF_SERCOM_2_USART_BAUD_RATE)) / 120000000)) void initClocks(void); void initUSART(void); void initGPIO...
C
#include<stdio.h> #include<string.h> main() { char string[10],i,*fp=fopen("file","r"); while(fscanf(fp,"%s",string)!=EOF && printf(" ")) for(i=strlen(string);i>=0;printf("%c",string[i--])); }
C
#include <stdio.h> #include <math.h> /*Operação soma*/ float soma(float x, float y) { return (x+y) ; } /*Operação subtração*/ float sub(float x, float y) { return (x-y) ; } /*Operação multiplicação*/ float multi(float x, float y) { return (x*y) ; } /*Operação divisão*/ float div(float ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* check_space_wall.c :+: :+: :+: ...
C
#include<stdio.h> int main() { int inta = 97; int intb = 98; printf("%d\n", intb-inta); int intc = 3; printf("%f\n", (float)intc); char chara = 'a'; char charb = 'b'; printf("%d\n", charb-chara); char charc = 3; printf("%f\n", (float)charc); }
C
/* ** Filename : db_manipulation.c ** ** Made by : Vincent GU�NIN ESGI - 3AL-1 ** ** Description : Contains the database manipulation functions */ /*================ INCLUDES ================*/ #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include "../header/db_manipulation.h" #incl...
C
/* Listing B.6 (read-file.c) Read a File into a Buffer */ /* Read the contents of FILENAME into a newly allocated buffer. The size of the buffer is stored in *LENGTH. Returns the buffer, which the caller must free. If FILENAME doesn't correspond to a regular file. returns NULL. */ #include <fcntl.h> #include...
C
#include<stdio.h> struct singly { int info; struct singly *link; }; void main() { struct singly n1,n2,n3,n4; n1.info=20; n2.info=30; n3.info=50; n4.info=90; n1.link=&n2; n2.link=&n3; n3.link=&n4; n4.link=NULL; struct singly *start=&n1; struct singly *PTR; PTR=star...
C
//AdjacencyMultilist邻接多重表 //邻接多重表是无向图的优化存储结构,方便对边进行操作 //顶点表 //datafirstedge //firstedge指向顶点data的序号(下标)与ivex的值相同的边 //边表 //ivexilinkjvexjlink //ivex和jvex表示某条边的两个顶点序号(顶点表的下标) //ilink表示指向包含ivex的另一条边, //ilink指向的边的jvex一定要和它本身的ivex的值相同,如果没有就为NULL //jlink表示指向包含jvex的另一条边, //jlink指向的边的jvex一定要和它本身的jvex的值相同,如果没有就为NULL //邻接多重表与邻...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ //quanganh-me1-02-20200031 int main(int argc, char *argv[]) { int a,b,i,check; check=0; scanf("%d", &a); if(a<=1){ check=1; goto A; } b=sqrt(a); ...
C
#include <stdio.h> int main () { int a; scanf("%d", &a); printf("%s", (a % 2 == 0) ? "짝수" : "홀수"); // 선생님께선 입출력과연산자 테스트 중 제 질문에 삼항도 조건문이라고 하셧읍니다. }
C
#include <stdio.h> #define row 5 #define col 5 void place(int rows, int column, char color); int balloon[row][col]; int placeRow=row-1; void initialize(){ for(int i=0; i<row; i++) for(int j=0; j<col; j++) balloon[i][j]='-'; } void printBalloon(){ printf("\n"); for(int i=0; i<row; i++){ for(int j=0; j<col...
C
#include <stdio.h> #include <stdlib.h> #include <malloc.h> int main(int nargs, char ** args) { FILE * fin; FILE * fout; long i,ii; long j,jj; long idx; float f; float *slice; long iPlusOne; long sliceSize; long sliceSizePlusOne; long nextSliceSize; long nextSliceSizePlusOne; ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int *newArray(int size) { int *array; // A pointer! not an array declaration array = (int*) calloc(size, sizeof(int)); // Get 'size' items large enough to hold one int each return array; } void populate_array(int *array, int ...
C
// // order_search.c // demo // // Created by vision chen on 2021/3/28. // #include "order_search.h" void order_search(int* a,int len, int m) { int i; for (i = 0 ; i < len; i++) { if (a[i] == m) { printf("下标为:%d\n",i); break; } } if (i == len) { print...
C
/* 实现 ps aux | grep xxx 子进程:ps aux,子进程结束后, */ #include <unistd.h> #include <stdio.h> #include <sys/types.h> #include <stdlib.h> #include <string.h> #include <wait.h> int main() { int pipefd[2]; int ret = pipe(pipefd); if (ret == -1) { perror("pipe"); exit(0); } pid_t pid...
C
#include <stdio.h> #include <sys/socket.h> #include <netinet/in.h> #include <unistd.h> #include <errno.h> #include <stdlib.h> #include <string.h> #include <netdb.h> #include <signal.h> #include <sys/wait.h> #define TEMP_BUF_LEN 1024 #define BUFFER_MAX 1024 // Program functions // int main(int argc, char* argv...
C
#include<stdio.h> int main() { int array[10],i; { for(i=0;;i++) { scanf("%d",&array[i]); if(array[i]==61) { printf("Brasilia\n"); } else if(array[i]==71) { printf("Salvador\n"); } else if(array[i]==11) { printf("Sao Paulo\n"); } else if(array[i]==21) { printf("Rio de Janerio\n"); } else if(array[i]==32) { printf("Juiz ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <locale.h> typedef struct lista_encadeada{ int conteudo; struct lista_encadeada *pc; } celula; void imp(celula *lista){ celula *aux; for(aux = lista->pc; aux!=NULL; aux = aux->pc){ printf("%d->", aux->conteudo); } ...
C
#include <stdio.h> #include <stdlib.h> typedef struct PNode* PtrToPNode; typedef PtrToPNode Polynomial; struct PNode { int cof; int exp; struct PNode* Next; }; Polynomial ReadPoly(); Polynomial Add(Polynomial P1,Polynomial P2); Polynomial Mul(Polynomial P1,Polynomial P2); void Print(Polynomial P); int m...
C
#include<stdio.h> int main(void) { char ch='0'; int asc=ch; printf("ascii_value:\t %d\n", asc); }
C
#include "codage.H" int DecodeI2( unsigned char *Source) { int EntierC; EntierC = Q1((short)MOINS( Source[1] ), 7); EntierC += Q0((short)MOINS( Source[0] ), 7); return EntierC; } void To_2_oct(short l, unsigned char *tb) { tb[1] = (unsigned char)PLUS(P1(l, 7)); tb[0] = (unsign...
C
#include <stdlib.h> #include <stdio.h> #include <stdint.h> unsigned int absolute(int x) { if(x < 0) x = x * (-1); return x; } unsigned int absolute_asm(int x); int main(int argc, char **argv) { unsigned int x = absolute_asm(-10); unsigned int y = absolute_asm(20); printf(...
C
#include <string.h> extern const char *ramdisk_path_array; extern const char *ramdisk_file_data_array; extern size_t ramdisk_file_size_array; extern const unsigned int ramdisk_num; const char *ramdisk_lookup(const char *path, size_t *nbytes) { int i; for (i = 0; i < ramdisk_num; i++) { if (strcmp(pat...
C
/* * Various functions using read and stdio for handling reads and buffers * Written by: James Ross */ #include "input.h" /* * Uses the read() system call to read from the given file descriptor. * Result of the read is placed in the provided buffer. * nbyte is the size of the buffer. * * Reads nbyte-1 and pl...
C
#include <stdlib.h> #include <stdio.h> #include <limits.h> int maxTriProd(int *arr, int size) { int max = 0, prod; for (int i = 0; i < size; i++) for (int j = 0; j < size; j++) for (int k = 0; k < size; k++) { // controlliamo gli indici e non gli elementi // ...
C
#include <linux/module.h> #include <linux/kernel.h> #include <linux/netfilter.h> #include <linux/netfilter_ipv4.h> /* This is the structure we shall use to register our function */ static struct nf_hook_ops nfho; /* This is the hook function itself */ unsigned int hook_func(void *priv, struct sk_buff *skb, const stru...
C
/* * main.c * * Created on: 10 Nov 2019 * Author: oriel */ #include "stdio.h" #include "math.h" #include "myMath.h" int main(){ double x; printf("Please insert a real number:\n"); scanf("%lf",&x); float ansi = sub(add(Exp((int)x),Pow(x,3)),2.0); float ansii = add(mul(x,3),mul(Pow(x,2),2)); float ansii...
C
#include <LPC214X.H> #include "font.h" unsigned char c; unsigned char z=0; void ctrloff() { IOSET1=0x00000000; //rs=rw=en=cs1=cs2=0; } //DELAY FUNCTION void delay(unsigned int j) { int k; for(k=0;k<=j;k++) { long i; for(i=0;i<90000;i++); } } void displayon() { ctrloff(); IOSET0=0x0000003F; IOSET1=0x001C0000; dela...
C
#include <event2/listener.h> #include <event2/bufferevent.h> #include <arpa/inet.h> #include <unistd.h> #include <pthread.h> #include <signal.h> #include <stdbool.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> #if 0 gcc -o server.out libevent_server.c -levent #endif static char *SERV...
C
/* * spi_tx.c * * Created on: 25 Nis 2020 * Author: ERCAN */ #include <string.h> #include "stm32f103xx.h" #include "spi_driver.h" /* * PA6 --> SPI1_MISO * PA7 --> SPI1_MOSI * PA5 -> SPI1_SCLK * PA4 --> SPI1_NSS */ void SPI1_GPIOInits(void) { GPIO_Handle_t SPIPins; SPIPins.pGPIOx = GPIOA; SPIPin...
C
#include "sparse_interface.h" #include "iter_solve_sparse.h" #include <math.h> #include "solvers.h" #define ABS(value) ( (value) >=0 ? (value) : -(value) ) #define EPS 1e-14 static int iter = ITER_NUM; static double tolerance = ITER_TOL; static void print_vector_gsl(gsl_vector* A) { int i; for(i = 0; i < A->si...
C
#include "sigprobe.h" #include "task.h" #include <unistd.h> #include <stdio.h> #include <signal.h> #include <setjmp.h> /* * flag to show if signal is recieved */ volatile static sig_atomic_t haveSig; /* * using it to jump back */ static jmp_buf env_prev; volatile static sig_atomic_t sig_ret; /* * FUNCTION HELPER...
C
#include <stdio.h> #include "range.h" void check_int(int i, int target) { if (i == target) printf("==> success\n"); else printf("==> failure\n"); } void check_str(const char* s, const char* target) { if (strcmp(s, target) == 0) printf("==> success\n"); else printf("==> failure\n"); } int main() { ...
C
/** * C语言永远只传值给函数 * * @Author: Wang An * @Date: 4/27/2020 8:55 PM */ #include <stdio.h> void swap(int a, int b); int main() { int a, b; printf("Please input two numbers:\n"); scanf("%d %d", &a, &b); printf("a = %d, b = %d\n", a, b); swap(a, b); printf("a = %d, b = %d\n", a, b); return...
C
--------------------------------------------------------------------------- David Vogel CS362 Assignment 3 Due Feb 3, 2016 Filename: coverage1.c I've appended the output from gcov for my 4 card tests below. I have removed all functions that were not covered at all. Here is the summary: Lines executed:23.05% of 59...
C
/** * gdalio.h * Authors: Yizhao Gao <ygao29@illinois.edu> * Date: {05/25/2018} */ #ifndef GDALIOH #define GDALIOH /** * NAME: gdalIORegister * DESCRIPTION: Register drivers * PARAMETERS: void */ void gdalIORegister(); /** * NAME: getCellCenterLatLon * DESCRIPTION: Get the latitude and longtitude of pixel...
C
#include <stdio.h> #include <unistd.h> #include <malloc.h> #include <pthread.h> #include <time.h> #include <stdlib.h> #include "common.h" #include "main.h" #include <iobb.h> // Library to access GPIO of Beaglebone // macros and variables long int start, stop, count; // Variables to store values //clock_t before, en...
C
#ifndef SKIPLIST_H #define SKIPLIST_H #include <stdlib.h> #ifdef __cplusplus extern "C" { #endif /*************************************************************************** * M A C R O S ***************************************************************************/ #define SKIPLIST_MA...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* solve_instruments.c :+: :+: :+: ...
C
#include <stdio.h> #include <fcntl.h> #include <stdlib.h> #include <unistd.h> int main(int argc, char *argv[]){ int val; printf("argc is %d\n", argc); printf("argv[1] is %s\n", argv[1]); val = fcntl(atoi(argv[1]), F_GETFL, 0); printf("val is %d\n", val); if (atoi(argv[1]) == 5){ int n = write(5, "iii...
C
#include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <math.h> #include <assert.h> #include <string.h> #include <time.h> struct list { int id; struct list * next; }; void print_way (int * table, int n) { for (int i = 0; i < n; i++) { for (int j = 1; j < n; j++) { for (int k = 1; k < n; k++) { ...
C
struct A_2_1 { int a; int b; int *p; }; int foo_2_1() { struct A_2_1 a; a.b = a.a; return 0; } // Memory int bar_2_1() { struct A_2_1 a; *a.p = 1; return 0; }
C
#include "boolector.h" #include "minand.h" #include "utils/btorutil.h" #include <stdio.h> #include <stdlib.h> int main (int argc, char **argv) { int num_bits; Btor *btor; BoolectorNode *formula, *zero_num_bits_m_1, *tmp, *a, *b, *c, *d, *m; BoolectorNode *result, *one, *x_and_y; BoolectorNode *premisse, *a_...
C
/* gentree version 1.2; Brendan McKay Aug 2017 */ /* This program is a wrapper for the program FreeTrees.c written * by Gang Li & Frank Ruskey. See below for their original * comments. */ #define USAGE \ "gentreeg [-D#] [-Z#:#] [-ulps] [-q] n [res/mod] [file]" #define HELPTEXT \ " Generate (unrooted) trees.\n\ \n...
C
int power(int x, int y) { int result; result = 1; if(y == 0) { return 1; } else if(x<0 || y<0) { return -1; } else if(y > 0 && x>0) { result = x*power(x,(y-1)); if(result < x) { return -1; ...
C
#include <stdio.h> int n; int k; int A[100000]; // 槍の長さは0,1,2,3...と // 整数で制限されているものとする // 長さxの槍がk本作れる場合は0を返す.作れない場合は1を返す. // これはxに対し単調増加となる. // 長さ0の槍は必ずk本作れるとする. int p(int x) { int k_avail = 0; //長さxの槍は何本作れるか int i; // 0除算を防止し,長さ0の槍は何本でも作れると考え,0を出力する. if (x == 0) return 0; for (i = 0; i < n; i++) { // A[i]...
C
#include "watchdog.h" /*-------------------ӲŹ-------------------------*/ /* * IWDG ijʱʱ * Tout = prv/40 * rlv (s) * prv[4,8,16,32,64,128,256] * prv:ԤƵֵȡֵ£ * @arg IWDG_Prescaler_4: IWDG prescaler set to 4 * @arg IWDG_Prescaler_8: IWDG prescaler set to 8 * @arg IWDG_Prescaler_16: IWDG prescaler ...
C
#include "heclibDate.h" #include "standardIntervals.h" void minsToDateTime(int minsSince1900, char *dateString, char *timeString, size_t sizeofDateString, size_t sizeofTimeString) { // Takes minutes since 01Jan1900 and converts it to a date and time character string // int julian; int minsSinceMidnight; julia...
C
/* Building.h DEFINISI ABSTRAKSI GAME */ #ifndef _BUILDING_H #define _BUILDING_H #include "Point/Point.h" #include "bool/bool.h" typedef struct { Point Koordinat; char Type; int Troops; int Level; int A; // Nilai penambahan pasukan pada bangunan tiap awal giliran int M; // Jumlah maksimum pas...
C
/** * Return an array of arrays of size *returnSize. * The sizes of the arrays are returned as *returnColumnSizes array. * Note: Both returned array and *columnSizes array must be malloced, assume caller calls free(). */ void _color(int** g, int r, int c, int x, int y, int oc, int nc) { if (x < 0 || x >= r || ...
C
#include<stdio.h> void print(int num); main() { int input; scanf("%d", &input); print(input); } void print(num) { int i, j,k=65,l=1; char ch=k; for (i=0;i<num;i++) { for(j=0;j<num-i;j++) { printf(" "); } for(j=0;j<l+i;j++) { if(i==0) { printf("%c", ch); break; } else { if(...
C
/* Image.h: header file for basic image manipulations */ /* Do not modify it */ #ifndef IMAGE_H #define IMAGE_H typedef struct { unsigned int W; /* image width */ unsigned int H;/* image height */ unsigned char *R; /* pointer to the memory storing all the R intensity values */ unsigned char *G; /* pointer t...
C
/** * Implementation of various scheduling algorithms. * * Shortest-Job-First scheduling */ #include <stdlib.h> #include <stdio.h> #include <stddef.h> #include "task.h" #include "list.h" #include "cpu.h" struct node *head = NULL; Task *pickNextTask(); // add a new task to the list of tasks voi...