language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /*
* Copyright (c) 2019 Kevin Townsend (KTOWN)
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <errno.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <zsl/zsl.h>
#include <zsl/matrices.h>
/*
* WARNING: Work in progress!
*
* The code in this module is very 'naive' in the sense that n... |
C | #include <scurl.h>
#include <struct.h>
//
// url_encode - url 编码, 需要自己free
// s : url串
// len : url串长度
// nlen : 返回编码后串长度
// return : 返回编码后串的首地址
//
char *
url_encode(const char * s, int len, int * nlen) {
register uint8_t c;
uint8_t * to, * st;
const uint8_t * from, * end;
DEBUG_CODE({
if (!s || !*s || len... |
C | /*
* Implement strsep() but only use a single delimiter.
*
* char *strsepc(char **stringp, int c);
*/
#include <stdio.h>
#include <assert.h>
char *
strsepc(char **stringp, int c)
{
char *orig = *stringp;
char *s = *stringp;
if (s == NULL)
return (NULL);
while (*s != '\0' && *s != c) {
#if 0
printf("%c\n"... |
C | #include<stdio.h>
#include<string.h>
int main()
{
char a[10],b[10];
printf("Enter the string");
scanf("%s",&a[10]);
b[10]=strrev(a);
printf("The reverse is %s",b[10]);
}
|
C | // Copyright (C) 2015 Mars Saxman. All rights reserved.
// Permission is granted to use at your own risk and distribute this software
// in source and binary forms provided all source code distributions retain
// this paragraph and the above copyright notice. THIS SOFTWARE IS PROVIDED "AS
// IS" WITH NO EXPRESS OR IMPL... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <fcntl.h>
int react(char skip) {
struct stat sb;
int fd = open("day5.txt", O_RDONLY);
fstat(fd, &sb);
char *buf = mmap(NULL, sb.st_size, PROT_WRITE, MAP_PRIVATE, fd, 0);
int pos = -... |
C | #include <stdio.h>
#include <stdlib.h>
#include "scanner.h"
#include "parser.h"
#include "display.h"
#include "stmt.h"
#include "allocator.h"
#include "interpreter.h"
#include "preprocessor.h"
static void p(const char* name, size_t size){
printf("\n%s : %lu bytes", name, size);
}
static void printSize(){
p("... |
C | /**
* Exercise 1-6
*
* Verify that the expression
* getchar() != EOF
* is 0 to 1.
*/
#include <stdio.h>
int main()
{
int c;
printf("%d\n", getchar() != EOF);
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int* shortestSeq(int* big, int bigSize, int* small, int smallSize, int* returnSize){
if (big == NULL || small == NULL) {
*returnSize = 0;
return NULL;
}
int* res = (int*)malloc(sizeof(int) * 2);
memset(res, 0, sizeof(int) * 2);... |
C | // challenge 3
#include "KDB-Files.c"
#include "md5.c"
int main(int argc, const char *argv[]){
unsigned char jpgBuf[4], temp[2], magicStart[4];
unsigned char standard[4] = {0xFF, 0xD8, 0xFF, 0xe0};
unsigned char jpegEnd[2] = {0xFF, 0xD9};
long offset, inputSize;
int fileSize = 0, endCheck = 0;
... |
C | /*
* Copyright (C) 2021 William Manley <will@stb-tester.com>
*
* Fault injection system
* ======================
*
* This allows us to inject faults into pulsevideo to deterministically create
* failures at various points in the system. It's controlled by environment
* variables. So if I set:
*
* fdpay_... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <signal.h>
static void sighandler(int s)
{
kill(0, SIGQUIT);
}
static void sighandler2(int s)
{
printf("bye-bye\n");
exit(1);
}
int main(void)
{
pid_t pid;
int i;
signal(SIGALRM, sighandler);
signal(SIGQUIT, sighandler2);
for (i = 0... |
C | #include <stdio.h>
void function1()
{
printf("Hello from function1\n");
}
int function2(int id,float score)
{
if(score > 50)
{
printf("ID = %d -> Pass\n",id);
}
printf("Hello from function2\n");
return(score);
}
char function3(char name[], int score, char sex)
{
char grade;
if(score > 79)
... |
C | #include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#define PORT 6969
int main(int argc, char const *argv[])
{
int sock = 0, readvalue;
struct sockaddr_in serv_addr;
char *msg = "Leave one Client alive and the Server are never safe. (Message from ... |
C | #include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/random.h>
#include <errno.h>
#include "monocypher/monocypher.h"
void _free(void* buf, int bufsize)
{
if (buf != NULL) {
crypto_wipe(buf, bufsize);
free(buf);
}
}
int _fclose(FILE **fp)
{
int rv = fclose(*fp);
*fp ... |
C | // gcc -o leak-sensor-monitor leak-sensor-monitor.c -l bcm2835
// sudo chown root ./leak-sensor-monitor; sudo chmod +s ./leak-sensor-monitor
// ./leak-sensor-monitor
// to install bcm2835 see http://www.airspayce.com/mikem/bcm2835/
// you have to download the tarball and compile it locally
// Inspired by a sample by ... |
C | void *real2(void *sth)
{
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
int sit, a, b;
while (!stop) // rand()함수는 실제로 랜덤하지 않으므로 시간있으면 다른함수로
{
sit = rand() % 4; //case가 0이면 -- 1이면 -+ 2면 +- 3이면 ++
a = rand() % 10 + 1;
... |
C | #include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <errno.h>
#include "libtlv.h"
/**
* 4BVARL uses simple 7-bit VARQ encoding of 28-bit data
* where bit7 means more data following (28-bit = 4-byte)
* to avoid 0xff as padding, 0x80 byte can be prepended
*
* DIG | HEX | SHORTEST | ... |
C | #include "mnist.h"
#include <errno.h>
#include <fcntl.h>
#include <math.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int mnist_train_label_info[LEN_LABEL_INFO];
int mnist_train_image_info[LEN_IMAGE_INFO];
int mnist_test_label_info[LEN_LABEL_INFO];
int mnist_test_image_info[LEN_IMA... |
C | #include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
int main(){
int sock0;
struct sockaddr_in addr;
struct sockaddr_in client;
socklen_t len;
int sock1,sock2;
/* ソケットの作成 */
sock0 = socket(AF_INET, SOCK_STREAM, 0);
/* ソケットの設定 */
addr.sin_fami... |
C | #include <stdio.h>
#include <string.h>
#define BUFHEIGHT 350
#define BUFWIDTH 50
#define ARRLENGTH(x) (sizeof(x)/sizeof((x)[0]))
int num_trees(char chart[][BUFWIDTH], int h, int w, int vector[2]) {
int x = 0;
int y = 0;
int trees = 0;
for (int y = 0; y < h; y+=vector[1]) {
char pos = chart[y... |
C | #include"common.h"
#include"genasm.h"
void common_output(FILE* des)
{
fprintf(des , ".data\n");
vt_process(des);
fprintf(des , "_prompt: .asciiz \"Enter an integer:\"\n");
fprintf(des , "_ret: .asciiz \"\\n\"\n");
fprintf(des , ".globl main\n");
fprintf(des , ".text\n");
fprintf(des , "read:\n");
fprintf(des ,... |
C | /*
* Copyright 1994, 1995 University of Washington
* All rights reserved.
* See COPYRIGHT file for a full description
*
* HISTORY
* 26-Mar-96 Przemek Pardyak (pardy) at the University of Washington
* Added unlock_unlocked.
*
* 10-Dec-94 Emin Gun Sirer (egs) at the University of Washington
* Created. Log fun... |
C | #include <stdio.h>
#include "function.h"
void flooding(int R, int C, int pr, int pc){
//initial
if(pr == 0)
Map[pr][pc] = 'W';
//left
if(pc != 0){
if(Map[pr][pc - 1] == 'H'){
Map[pr][pc - 1] = 'W';
flooding(R, C, pr, pc - 1);
}
}
//rig... |
C | #include <stdio.h>
#include <math.h>
#include "sistlinear.h"
Matriz criaA();
Matriz criaB();
void teste();
int main(int argc, const char * argv[]) {
double b1[3] = {3, 3, -6}, b2[6] = {2.5, 1.5, 1, 1, 1.5, 2.5};
Matriz A, B;
printf("Teste Matriz A:\n");
A = criaA();
teste(3, A, b1);
printf("Teste Matriz B:\... |
C | #ifndef ORION_SINGLETON_H
#define ORION_SINGLETON_H
// singleton
#define SINGLETON(className)\
private:\
className() {}\
~className() {}\
public:\
static className& Instance() {\
static className instance;\
return instance;\
}\
className(className&&) = delete; \
className(className const&) = delete; \
clas... |
C | #include "grille.h"
void visuGrille(char grille[NBRE_LIGNE][NBRE_COL]){
char i = 0, j =0, k = 0, l = 0;
for(i=0; i<NBRE_LIGNE; i = i+3){
for(j=0; j<NBRE_LIGNE/3; j++){
for(k=0; k<NBRE_COL/3; k++){
for(l=0; l<NBRE_COL/3; l++){
printf("%d ", grille[i+j][k*3+l]);
}
printf(" ");
}
prin... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "hi_fstool.h"
void ShowHelp()
{
#ifdef __HuaweiLite__
printf("mkfs usage:sample clusterSize(KB) mode partition\n"
"\n"
"description\n"
"clusterSize(KB) : 64 \n"
"mode : -a(advanced) or -d(di... |
C | #include <stdio.h>
#include <stdlib.h>
int test(char **, char*);
int main(int argc, char **argv) {
if (argc == 2) {
printf("%s\n", ++*argv);
}
int i;
for (i=0; i < 10; i++) {
printf("%d:%d\t", i, i % 2);
}
printf("\n");
/* int j;
for (j=0; j < 50; j++) {
p... |
C |
#ifndef ALGORITHMS_COUNTINGSORT_H
#define ALGORITHMS_COUNTINGSORT_H
void countingSort (int *a, int n) {
int max = a[n - 1], min = a[0];
for (int i = 0; i < n; i++) {
if (a[i] > max) max = a[i];
if (a[i] < min) min = a[i];
}
int *c = new int[max + 1 - min];
for (int i = 0; i < max... |
C | #include <exception>
using namespace std;
#include "SelectionSort.h"
SelectionSort::SelectionSort()
{
}
SelectionSort::~SelectionSort()
{
}
void SelectionSort::SortData(int *data, size_t count)
{
for (int i = 0 ; i<count; i++) {
int min = i;
for (int j=i+1; j< count; j++... |
C | #include <stdio.h>
#include <stdlib.h>
FILE *Fin;
FILE *Fout;
int smax;
void clear()
{
char jj;
int i;
int full = 0;
int sol = 0;
fscanf(Fin, "%d", &smax);
fscanf(Fin, "%c", &jj);
for (i = 0; i < (smax + 1); i++)
{
fscanf(Fin, "%c", &jj);
if (full < i)
{
sol = (sol + i) - full;
f... |
C | #include<stdio.h>
#include<stdlib.h>
typedef struct node {
int data;
int height;
int lc;
int rc;
struct node* left;
struct node* right;
}node;
int height(struct node *N)
{
if (N == NULL)
return 0;
return N->height;
}
int max(node* a,node* b)
{
if(a!=NULL && b!=NULL)
return (a->height)>(b->he... |
C | #include <stdint.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include "led.h"
#include "sleep_led.h"
#ifndef SLEEP_LED_TIMER
# define SLEEP_LED_TIMER 1
#endif
#if SLEEP_LED_TIMER == 1
# define TCCRxB TCCR1B
# define TIMERx_COMPA_vect TIMER1_COMPA_vect
# if defined(__AVR_ATm... |
C | main()
{
int a[10],sum1=0,sum2=0,i;
printf("enter ten numbers");
for(i=0;i<=9;i++)
{
scanf("%d",&a[i]);
if(a[i]%2==0)
{
sum1=sum1+a[i];
}
else
{
sum2=sum2+a[i];
}
}
printf("sum of even number is %d and sum of odd number is %d",sum1,sum2);
getc... |
C | #include <stdint.h>
#include <stdarg.h>
#include <string.h>
#include <wchar.h>
int wcscmp(const wchar_t* str1, const wchar_t* str2)
{
while ((*str1) && (*str1 == *str2))
{
str1++;
str2++;
}
return *(uint16_t*)str1 - *(uint16_t*)str2;
}
size_t wcslen(const wchar_t* str)
{
size_t length = 0;
while (*str != L'... |
C | #include "client.h"
#include "global.h"
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
// Array of all the client requests
struct client_request *creq = NULL;
size_t creq_size = 0;
int prepare_clients(const struct settings * settings, void *data) {
unsigned int clientthreads = 0;
unsigned int i;
ass... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.c :+: :+: :+: ... |
C | #include <stdio.h>
int main(){
int n,i,valor,cont=0,fora=0;
scanf("%d", &n);
for(i=1;i<=n;i++){
scanf("%d", &valor);
if((valor >= 10)&&(valor <= 20)){
cont++;
}else{
fora++;
}
}
printf("%d in\n", cont);
printf("%d out\n", fora);
return 0;
}
|
C | #include <stdio.h>
#include <string.h>
#define INIT_VALUE 999
int findSubstring(char *str, char *substr);
int main() {
char str[40], substr[40], *p;
int result = INIT_VALUE;
printf("Enter the string: \n");
fgets(str, 80, stdin);
if (p = strchr(str, '\n')) *p = '\0';
printf("Enter the substring: ... |
C | #include <stdio.h>
#include "assemble.h"
#include "cerr.h"
#include "word.h"
int main(){
int i;
WORD r;
char *str[] = {
"#32768", "#-1", "#G", "#FFFF", "#0", "#1", "#ab", "#AB", "#20"
"0", "01", "1a", "-5G", "123", "32767", "32768", "32769",
"-1", "-2345", "-32768", "-32769", "-3277... |
C | #include<stdio.h>
#include<string.h>
void main()
{
char a[20]="hello",b[20]="world",des[20];
memcpy(des,a,5);
memcpy(a,b,5);
memcpy(b,des,5);
printf("%s %s %s",des,a,b);
}
|
C | int count_alpha(const char *str)
{
int c;
int i;
c = 0;
i = 0;
while (str[i] != '\0')
{
if ((str[i] >= 65 && str[i] <= 90) || (str[i] >= 97 && str[i] <= 122))
{
c++;
}
i++;
}
return (c);
}
char *reverse_letter(const char *str)
{
char *rev;
int i;
int j;
int... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
static void my_exit0(int, void *);
static void my_exit1(void);
static void my_exit2(void);
char str[9] = "for test";
int main(void) {
if (atexit(my_exit2) != 0) {
perror("can't register my_exit2");
exit(-1);
}
if (atexit(my_e... |
C | #include <stdio.h>
#include <string.h>
#define NUM_STUDENT 4
#define NAME 0
#define ID 1
int main(int argc, char* argv[]) {
char IdBook[NUM_STUDENT][2][10] = {
{"KDS", "20201234"},
{"KYW", "20192535"},
{"LJH", "20187854"},
{"HPC", "20180301"}
};
char buf[255] = { 0 };
printf("Enter the student name: ");
... |
C | #pragma config(Hubs, S1, HTMotor, HTMotor, HTMotor, HTMotor)
#pragma config(Sensor, S1, , sensorI2CMuxController)
#pragma config(Motor, motorA, , tmotorNormal, openLoop)
#pragma config(Motor, motorB, , tmotorNormal, openLoop)
#pragma config(Motor, ... |
C | // This header provides an API for the HiTechnic gyro sensor.
// Version 0.4, made by Xander Soldaat.
#ifndef __HTGYRO_H__
#define __HTGYRO_H__
#pragma systemFile
#ifndef __COMMON_H__
#include "common.h"
#endif // __COMMON_H__
float HTGYROreadRot(tSensors link);
float HTGYROstartCal(tSensors link);
float HTGYROreadC... |
C | // Parallel sum of array
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "mpi.h"
#define N 900000000
int main(int argc, char *argv[])
{
int numtasks, rank, len, rc, i, sidx;
double etime, stime, a[N], value, localsum;
char hostname[MPI_MAX_PROCESSOR_NAME];
// initialize MPI
MPI_Init (&a... |
C | int main()
{
int n,i,j;
char a[50][33];
cin >> n;
cin.ignore ();
for(i=0 ; i< n ; i++)
cin >> a[i];
for(i=0 ; i< n ; i++)
{
j = strlen(a[i]);
if(a[i][j-2] == 'e')
{
if(a[i][j-1] == 'r')
a[i][j-2] = '\0';
}
if(a[i][j-2] == 'l')
{
if(a[i][j-1] == 'y')
a[i][j-2] = '\0'... |
C | #include "uvsqgraphics.h"
int main()
{
init_graphics(600,400);
// Debut du code
POINT bg, hd;
int min, max, imin, imax;
int T[20];
int i;
imin = 0; imax = 0;
min = 100; max = 0;
bg.y = 50;
for (i=0 ; i<20 ; i=i+1)
{
T[i] = alea_int(100);
bg.x = 100 + (20*i);
hd.x = 100 + 20*i + 19;
hd.y = 5... |
C | #include<stdio.h>
int main()
{
int t,n,sum,k,p;
scanf("%d",&t);
while(t--)
{
sum=0;
scanf("%d",&n);
p=n;
while(p>0)
{
k=p%10;
if(n%k==0)
{
sum=sum+1;
}
p=p/10;
}
printf("%d",sum);
}
return 0;
} |
C | /*
* File: LCDDisplay.c
* Author: dd69
*
* Created on February 7, 2019, 5:10 PM
*/
#include <xc.h>
#include "LCDDisplay.h"
#include "spiConfiguration.h"
void InitPMP(void) {
// PMP initialization. See my notes in Sec 13 PMP of Fam. Ref. Manual
PMCON = 0x8303; // Following Fig. 13-34. Text sa... |
C | #include "shell.h"
/* holaaa */
/**
* _strlen - calculates the length of the string pointed to
* @str: First string to be compare
*Return: the number of characters of the string pointed to
*/
int _strlen(const char *str)
{
int len;
for (len = 0; str[len]; len++)
{
}
return (len);
}
/**
* _strcat - concatenat... |
C | #include<stdio.h>
int main()
{
char string[] = {"\x48\x45\x58\x20\x52\x6f\x63\x6b\x73\x21\x0a"};
printf("%s", string);
return 0;
}
|
C | #include "tluac-thread.h"
#include "../tluac-epoll/tluac-epoll.h"
#include "../util/produce-consume.h"
int listenFd;
void thread_new() {
memset(&buffer, 0, sizeof(buffer) );
thread_create();
thread_wait();
}
struct context ctxs[THREADS + 1];
void thread_create(void) {
int temp;
memset(&thread, ... |
C | #include "adds.h"
void validarOperacion(char mensaje [],char mensajeError[], int devolucion){
if(devolucion == 1){
printf("%s",mensaje);
}else{
printf("%s",mensajeError);
}
}
int getInt(char mensaje[],char mensajeError[],int piso, int techo){
int entero;
... |
C | void ft_putchar(char c)
{
write(1, &c, 1);
}
void ft_putstr(char *str)
{
while (*str != '\0')
{
ft_putchar(str);
str++;
}
}
void sastantua(int size)
{
int i;
int space;
int rows;
int k;
i = 1;
space = 1;
rows = 0;
k = 0;
while (i <= rows)
{
while (space ... |
C | #include "Buses.h"
#include "Processor.h"
#include "MainMemory.h"
#include <string.h>
#include <stdlib.h>
// Function that simulates the delivery of an address by means of the address bus
// from a hardware component register to another hardware component register
int Buses_write_AddressBus_From_To(int fromRegister,... |
C | #ifndef _MY_SIMPLE_SORT
#define _MY_SIMPLE_SORT
#include <stdlib.h>
#include <string.h>
#define LT(a,b) ((a) < (b))
#define LQ(a,b) ((a) <= (b))
#define GT(a,b) ((a) > (b))
#define GQ(a,b) ((a) >= (b))
typedef void (*visitSqList)(int a);
typedef void (*setArrayData)(void *target,char *data,int pos);
typedef struct{... |
C | /* getuser.c A function in misclib.
------------------------------------------------------------------------
char *getuser(str)
char *str;
Returns the user's login name in str. The value is determined
simply by looking up the current value of the environmental
variable USER.
Re... |
C | #ifndef GREP_H
#define GREP_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "linkedList.h"
/*
-- Arguments (structure)
Structure of arguments : options, pattern and files
Cf. getArgs()
*/
typedef struct Arguments {
Maillon* options;
char* pattern;
Maillon* files;
} Argum... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include "arm_neon.h"
#define NUM_RANDOM 524288
// pow(2, 19)
// NUM_RANDOM * 32 MACs
#define NUM_REPEAT 256
// XNOR -> bitcount using ARMv7-A NEON intrinsics
int main() {
int * weight = (int *)malloc(sizeof(int) * NUM_RANDOM);
int * inputs = (int *... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct Node {
int val;
struct Node* left;
struct Node* right;
} Node_t;
void insert(int key, Node_t** root) {
if ((*root) == NULL) {
(*root) = (Node_t*) malloc (sizeof(Node_t));
(*root)->val = key;
(*root)->left = NULL;
(*root)->right = NULL;
} else {
if (... |
C | #include <msp430.h>
/**
* main.c
*/
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer
PM5CTL0 &= ~LOCKLPM5; //unlocks the gpio pins
P1DIR |= BIT0; //sets direction
while(1){
P1OUT ^= BIT0; //toggles led
__delay_cycles(1000000); //delays so we can see the led blink
}
r... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int i;
int tamanho;
char nome[50];
printf("Digite o nome\n");
scanf("%s",&nome);
for(i=1; i<=50;i++){
if(*(nome+i)== NULL){
tamanho= i;
break;
}
}
for(i=0;i<tamanho;i++){
printf("\n%s",nom... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* output.c :+: :+: :+: ... |
C | #include<stdio.h>
struct ListNode {
int val;
struct ListNode *next;
};
struct ListNode* addTwoNumbers(struct ListNode* l1, struct ListNode* l2)
{
int nSum = 0,nL1 = 0,nL2 = 0;
int nNodeCnt = 0;
struct ListNode *result = NULL;
struct _STACK
{
int val;
struct _STACK *... |
C |
/*Hay q hacerlo con valores conocidos para comprobarlo!!*/
/*Contemplar la posibilidad de q la muestra sea vacia
* de q la muestra unicamente tenga un valor....
* Y demas situaciones q puedan ser problematicas*/
#include <stdio.h>
#include <math.h>
#include <unistd.h>
#include <stdlib.h>
/*0 es fals... |
C | // write a program to compute the sum and mean of the elements of a two-dimensional array
#include <stdio.h>
int main()
{
int num[5][5], sum[5] = {0, 0, 0, 0, 0};
float mean[5] = {0.0, 0.0, 0.0, 0.0, 0.0};
for (int i = 0; i < 5; i++)
{
for (int j = 0; j < 5; j++)
{
printf("num[%d][... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstmap.c :+: :+: :+: ... |
C | #define ALIEN_DEFORMATION_MAX_VERTICES 16
enum { AlienDeformDirectionForward, AlienDeformDirectionBackwards};
typedef struct {
unsigned int Frame, Frames, Direction;
float OriginalPosition[3], DeformedPosition[3];
} structAlienDeformationPoint;
typedef struct {
unsigned int VerticeIndexes[ALIEN_DEFOR... |
C | #include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <time.h>
#include <sys/time.h>
#include <stdlib.h>
#include <sys/select.h>
#include "protocol.h"
#define TIMEOUT_INTERVAL 1E5
#define EMPTY 0
#define WAITI... |
C | #include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
#include<stdlib.h>
void main()
{
printf("pid : %d!\n" , getpid()) ;
printf("uid : %d!\n" , getuid()) ;
printf("groupid : %d\n" , getgid()) ;
printf("groupid : %d\n" , gettid()) ;
printf("groupid : %d\n" , getppid()) ;
printf("environment variable(U... |
C | #include <stdio.h>
#include "holberton.h"
/**
* print_array - print a elements of an array.
* @a: the array in a parameter
* @n: Is the length of the array
*
*/
void print_array(int *a, int n)
{
int i;
for (i = 0; i < n; i++)
{
if (i != n - 1)
{
printf("%d, ", a[i]);
}
else
printf("%d", a[i]);
... |
C | // Changes some entries in the palette, starting at index color_index
/* e.g. "TERM=xterm-256color ./test_colors 3366FF FF0000 3a4682" */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ncurses.h>
#include <unistd.h>
int main(int argc, char* argv[])
{
int i;
initscr();
start_color();
if (!c... |
C | #if defined(_WIN32)
#include <windows.h>
#include <wincrypt.h>
typedef unsigned int uint32_t;
#else
#include <stdint.h>
#endif
#include <string.h>
#include <stdio.h>
#include "ed25519-donna.h"
#include "ed25519-ref10.h"
static void
print_diff(const char *desc, const unsigned char *a, const unsigned char *b, size... |
C | #include <stdio.h>
#include <ctype.h>
int main(){
int index=0;
char target;
char new;
scanf ("%c", &target);
if (isdigit(target)) {
index=target-48;
scanf ("%c",&target);
scanf ("%c",&target);
}
scanf ("%c",&new);
//printf ("index %d, target %c\n", index,target);
... |
C | /*输入三角形的三边长求三角形的面积
* 参数:double a,b,c
*
*/
#include <stdio.h>
#include <math.h>
int main()
{
double a,b,c,s,area;
printf("input three wigth:");
scanf("%lf%lf%lf",&a,&b,&c);
s=(a+b+c)/2;
area=sqrt(s*(s-a)*(s-b)*(s-c));
printf("%f\t%f\t%f,area=%f\n",a,b,c,area);
return getchar();
}
|
C | //
// main.c
// q3.c
//
// Created by Jacqueline Liao on 3/2/19.
// Copyright © 2019 Jacqueline Liao. All rights reserved.
//
#include <stdio.h>
#include <string.h>
int main(int argc, const char * argv[]) {
int phrase_length = 0;
for (int i = 1; i < argc; ++i) {
phrase_length += strlen(argv[i]);
... |
C | #include <cs50.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main()
{
int d = get_int();
int board[d][d], vmax =(d*d)-1 ;
for (int i =0; i<d; i++)
{
for (int j=0; j<d; j++)
{
board[i][j] = vmax;
vmax--;
}
}
if (d%2 == 0)
{
... |
C | #include <stdio.h>
#include <stdlib.h>
int main(void)
{
int i; /* e n pܼ */
double dtotal, dx;
int n; /* ϥΪ̿J n */
printf("Jn[`: ");
scanf("%d", &n);
for (dtotal=0, dx=1, i=1; i <= n; i++, dx *= 2.0) {
dtotal += 1.0/dx; /* [` 1/(2^i) */
printf("e %2d `M = %f\n", i,dtotal);
}
system("pause"); return(0);
} |
C | #include "stack.h"
void initStack(Stack **p)
{
(*p) = NULL;
}
int EmptyStack(Stack* p)
{
if ( p == NULL)
return 1;
else
return 0;
}
Elm top(Stack* p)
{
if (!EmptyStack(p))
return p->info;
else
printf("Eror: Stack Kosong! ");
}
void push(Stack** p, Elm e)
{
Stack* q;
q = (Stack*)malloc(sizeof(Stack));... |
C | #include<stdio.h>
#include<stdlib.h>
/*
* This is an enum. Also called an enumerable set.
* By default, they are assigned values starting with 0,
* unless custom values are specified.
* If we assign the value 3 to mon, and no other values
* for the consecutive constants, the values 4, 5 6 and so on
* will be as... |
C | #include <string.h>
#include <stdio.h>
int my_strlen(char str[]);
main()
{
char str[20]="paidikumar";
int i;
i = my_strlen(str);
printf("strlen--->=%d\n",i);
}
int my_strlen(char str[])
{
int i=0;
while(str[i]!='\0')
i++;
return i;
}
/*#include <string.h>
#include <stdio.h>
main()
{... |
C | #include <stdio.h>
int main()
{
int * a = NULL;
printf("%d", *a);
return 0;
}
|
C | #include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<string.h>
#include<unistd.h>
#include "book.h"
#include "account.h"
#include "borrowreturn.h"
#include "menu.h"
void borrow(){
char pa[10],pa1[10];
char us[10],bn[10];
char i;
int f=0;
FILE *fp;
account *p;
book *p1,*head;
p=loadaccount();
prin... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define MAXLINE 1000
#define MAXOP 100
#define NUMBER '0'
int getop(char[]);
void push(double);
double pop(void);
void main( void ){
int type;
double op2;
char s[MAXOP];
while( (type = getop(s)) != EOF){
switch(type){
case NUMBER:
push( atof(s) ... |
C | /*
* mpi_communication.c
*
* Created on: 2015年7月7日
* Author: ron
*/
#include <stdio.h>
#include <assert.h>
#include <mpi.h>
#include <stdlib.h>
#include "../structure_tool/log.h"
#include "mpi_communication.h"
static void printf_msg_status(mpi_status_t* status)
{
assert(status != NULL);
char s[512];
int ... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <getopt.h>
#include "shadowvpn.h"
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
static const char *help_message =
"usage: shadowvpn -c config_file [-s start/stop/restart] [-v]\n"
"\n"
" -h, --help show this help ... |
C | #include "UartReceiver.h"
#include "UartFinder.h"
#include "string.h"
#include "TcTime.h"
u8 _readByteViaUart(USART_TypeDef *uart){
u8 res;
while(USART_GetFlagStatus(uart, USART_FLAG_RXNE) == 0);
res=USART_ReceiveData(uart);
USART_ClearFlag(uart, USART_FLAG_RXNE);
return res;
}
int _readBytesViaUart(USART_Typ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define offsetof(TYPE, MEMBER) ((size_t)&((TYPE *)0)->MEMBER)
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member));})
#define GOLDEN_RATIO_PRIME_32 0x9E370001UL... |
C | #include<stdio.h>
main(){
char name[100]; int c=0,i;
char *pointer;
pointer=name;
printf("enter string : "); gets(name);
for(i=0;name[i]!='\0';i++){
if(name[i]==' ')
c++;
}
printf("the amount of word is %d",c);
}
|
C | #include "stepper.h"
#include <avr/io.h>
int main(void)
{
uint8_t step, state = STEPPER_INIT;
for(;;)
{
step = next_step(&state, FULL_STEP | FWD);
PORTB &= 0xF0;
PORTB |= step;
}
return 0;
} |
C | void int_radix_sort(int *lst, int *dst, int n){
int group = 8;
int buckets = 1 << group;
int mask = buckets - 1;
int cnt[buckets];
int map[buckets];
for(int k = 0; k < 32; k += 8){
memset(cnt, 0, sizeof(cnt));
memset(map, 0, sizeof(map));
for(int i = 0; i < n; i++){
cnt[(lst[i] >> k) & ... |
C | #include<stdio.h>
#define min(x,y)(x < y? x:y)
char a[200],b[200];
int as,bs;
int main(){
while(scanf(" %d %s %d %s",&as,a,&bs,b) == 4){
int dp[as+1][bs+1];
for(int i = 0; i <= as;++i) dp[i][0] = i;
for(int i = 0; i <= bs;++i) dp[0][i] = i;
for(int i = 1;i <= as;++i){
f... |
C | #include "func.h"
void sig_handle(int sig)
{
printf("sig comes\n");
}
void makeprocess(int num,int* pairs)
{
int i,fd;
int ret;
for(i=0;i<num;i++)
{//父进程
ret=socketpair(AF_LOCAL,SOCK_STREAM,0,pairs+2*i);
if(-1==ret)
{
perror("socketpair");
return ;
}
}
for(i=0;i<num;i++)
{
if(fork())
{//父进程
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <gsl/gsl_sort.h>
#include <gsl/gsl_errno.h>
#include <gsl/gsl_spline.h>
#include "allvars.c"
/*routine to read the file with the particle coordinates.*/
int readfile(char *filename, int Nparticles)
{
int i;
FILE *pf = NULL;
pf = fopen(filename,"r... |
C | #pragma warning(disable:4996)
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{
char str1[100]; //Է¹ 迭
char word[10][100]; //и ܾ ߹迭
char firstword[100] = ""; // ܾ 迭
char* p1; //
int len1; //Է¹ ڿ
int i, j;
int cnt = 0; //ܾ
//ڿ Է, ڿ
gets(str1);
l... |
C | #include "types.h"
#include "stat.h"
#include "user.h"
#include "fcntl.h"
void ff(int f)
{
if(f<1)
return;
ff(f-1);
ff(f-2);
return;
}
int main()
{
sleep(10);
int pid = fork();
if(pid == 0)
{
sleep (10);
int ppid = fork();
if(ppid == 0)
{
ff(33);
printf(1,"P1\n");
... |
C | #include <stdlib.h>
#include <assert.h>
#include <stdbool.h>
#include "dict.h"
#include "list.h"
#include "pair.h"
#include "index.h"
#include "data.h"
struct _dict_t {
list_t lista;
unsigned int size;
};
unsigned int size = 0;
unsigned int dict_length(dict_t diccionario) {
assert(diccionario != NULL);... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.