language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
int main(void)
{
char c;
int x;
scanf("%d",&x);
c=(char)x;
printf("%c",c);
return 0;
} |
C | // reads value on ADC channel 2, which is AIN2 on Pin PC4 (pin 14)
// and send it via UART
#include "stm8s.h"
#include "stdafx.h"
#define WITH_UART_EXP 1
char count = 0;
char digit[5] = "";
int main( void ){
uint16_t i; // Always use standardized variable types...
uint16_t nCount = 0;... |
C | /**
* @file tmin.c
*
* @brief
* This program performs a numerical integration using the
* Trapezoidal Method. The upper and lower bound is accepted
* as the inputs and t to represent the minimum trapezoids
* need in order to be as accurate as we can to 14 significant
* figures of the true value of ... |
C | #ifndef SEARCHING_H
#define SEARCHING_H
//=== Alias
using value_type = long int ; //!< Simple alias to help code maintenance.
// iterative linear search
const value_type * lsearch( const value_type *, const value_type *, value_type);
// iterative binary search
const value_type * bsearch_it( const value_type *, const... |
C | #include <minix/drivers.h>
#include "timer.h"
static int proc_args(int argc, char *argv[]);
static unsigned long parse_ulong(char *str, int base);
static void print_usage(char *argv[]);
int main(int argc, char **argv)
{
/* Initialize service */
sef_startup();
if (argc == 1)
{
print_usage(argv);
return 0;
... |
C | #include <project.h>
#define HIGH 1u
#define LOW 0u
#define FREQ_SCALE 4294967295/125000000
#include "stdio.h"
#define RX_LEN 20
#define ERR_MSG ": invalid input_str. Type 'help' to see available input_strs\r\n"
#define CMD_LEN 4
#define OPTION_LEN 4
#define NUM_LEN 15
const char help_message[] =
"\r\nHi! This is... |
C | #include<stdio.h>
#include<stdlib.h>
struct BST
{
int data;
struct BST *left;
struct BST *right;
};
typedef struct BST node;
node * insertintoBST(node *root,int key) ///OK
{
node *temp,*curr,*p;
temp=(node*)malloc(sizeof(node));
temp->data=key;
temp->left=temp->right=NULL;
if(root==NULL)
... |
C | #include<stdio.h>
#include<conio.h>
int main()
{
char *p = "3+5/9";
char *cur = p;
char *cur2 = p;
while(*cur)
{
//printf("%c",*cur);
if((*cur) == '/' || (*cur) == '*')
{
}
else if(*cur == '+' || *cur == '-')
{
*cur = 's';... |
C | #include<stdio.h>
#define pr printf
#define sc scanf
void read(int a[], int n){
int i;
for (i = 0; i < n; i++)
sc("%d", &a[i]);
}
void print(int a[], int n){
int i=0;
for(i; i<n; i++){
pr("%d ", a[i]);
}
}
main(){
int a[100],b[100],n,m;
pr("a array: "); sc("%d",&n);
pr... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
/* Import user configuration: */
#include <uk/config.h>
#include <uk/plat/memory.h>
#include <uk/hexdump.h>
#include <uk/alloc.h>
#include <dirent.h>
int main()
{
DIR *dr = opendir("/");
struct dirent *de;
whi... |
C | // P(w:lʤ) = P(w:0) + P(w:1) + ... + 1/2P(w:l)
// = P(w-1:0) + P(w-1:1) + ... + P(w-1:l)
// WA Ҳ
#include<math.h>
#include<stdio.h>
int main(void)
{
int hp1, hp2, ap1, ap2;
double res, lgcom;
int w, l, s;
int i;
while (scanf("%d%d%d%d", &hp1, &hp2, &ap1, &ap2) !=EOF)
{
w = (hp2-1) / ap1 + 1;
l =... |
C | #include "json.h"
void printCompanies(Company *companies, int count) {
char *sizeToStr;
printf("\n*********************** Companies *************************\n");
for (int i = 0; i < count; i++) {
if (companies[i].size == 1)
sizeToStr = "Large";
else if (companies[i].size == 2)
... |
C | #include <stdio.h>
/*
Write a function setbits(x,p,n,y) that returns x with the n bits that begin at
position p set to the rightmost n bits of y , leaving the other bits unchanged.
*/
unsigned getbits(unsigned x, int p, int n);
unsigned setbits(unsigned x, int p, int n, unsigned y);
void main() {
unsigned... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
#include "header.h"
static void createNewHeap_emptyHeap_zeroCount(void ** state){
heap_t * heap1 = heap_new(5);
assert_null(heap_amountOfObjects(he... |
C | #include<stdio.h>
void main()
{
int a;
printf("enter the num");
scanf("%d",&a);
if(a<0)
printf("the num is negative");
else
printf("the num is positive");
}
|
C | typedef struct {
int x, y;
int width, height;
} WorkAreaData;
WorkAreaData* getWorkAreaData() {
WorkAreaData **workAreaData = (WorkAreaData**)malloc(sizeof(WorkAreaData*));
*workAreaData = (WorkAreaData*)malloc(sizeof(WorkAreaData));
RECT workAreaSystemData;
SystemParametersInfo(SPI_... |
C | /** \file \brief fooLib.c - foo function library */
/**
* \internal \copyright
*
* Copyright (c) 2019 Wind River Systems, Inc.
*
* The right to copy, distribute, modify, or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/**
*
\inter... |
C | #include <stdio.h>
void increase_std(){
static int svalue = 1;
printf("svalue: %d\n", svalue++);
printf("HE");
}
int main(int argc, char *argv[]){
for(int i = 0; i < 5; i++){
increase_std();
}
return 0;
}
|
C | /* Name: main.c
* Author: <insert your name here>
* Copyright: <insert your copyright message here>
* License: <insert your license reference here>
*/
#include <avr/io.h>
// #include "USARTInit.h"
#include <avr/interrupt.h>
#include <util/delay.h>
#define bit_set(p,m) ((p) |= (m));
#define bit_flip(p,m) ((p) ^=... |
C | #ifndef SHAPES_H
#define SHAPES_H
#include "Colour.h"
typedef struct Point
{
unsigned short x, y;
} Point;
typedef struct Rect
{
unsigned short x, y;
unsigned short width, height;
} Rect;
typedef struct Circle
{
unsigned short x, y;
unsigned short radius;
} Circle;
unsigned short doesRectContainPoint(Rect re... |
C | #ifndef _LY_TRACE_H
#define _LY_TRACE_H
#define MAX_IP_ADDR 50
#define MAX_DOMAIN 150
#define PROBE_NUMBER 3
typedef struct route_info{
int ttl; //
char domain[PROBE_NUMBER][MAX_DOMAIN]; //
char ip[PROBE_NUMBER][MAX_IP_ADDR]; //IPַ
int time[PROBE_NUMBER]; //ÿ̽ʱ䣬λ
... |
C | #include<stdio.h>
#define r 2
#define c 3
int main()
{
int i,j;
int a[r][c];
int b[r][c];
int t[r][c];
printf("enter first matrix:\n");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("enter second matrix:\n");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
... |
C | /*******************************************************
LEDTool
Alternative tool to upload messages to the VADIV LED Nametag
Device 12x48 (VID:0x483, PID:0x5750)
STMicroelectronics 0STM32 Composite MSC+HID
Philipp Kutsch
********************************************************/
#include <stdio.h>
#include <stdl... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int n, i, *ptr, update, entry, j, num, x;
int a[3];
ptr = a;
printf("how many number yoou want in array:");
scanf("%d", &n);
ptr = (int *)calloc(n, sizeof(int));
int size = sizeof(a);
printf("%d", size);
// for (i = 0; i... |
C | /**
* @file libsck.c
* @brief
* @version 0.1
* @date 2020-01-30
*
* @copyright Copyright (c) 2020
*
*/
/* Fichier d'inclusion */
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
#include <stddef.h>
#include <fcntl.h>
#include <errno.h>
#include <netdb.h>
#include <string.h>
#i... |
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | #include <stdio.h> //Bibliotecas utilizadas
#include <stdlib.h>
#include <string.h>
int main()
{
char L[100][21]; //Matriz para receber os idiomas falados por cada pessoa
int k, n; //Variáveis para recebimento de quantias
scanf("%i", &n); //Recebe quantos casos
for (int i = 0; i < n; i++)
{... |
C | #include <string.h>
#include <math.h>
#include <stdlib.h>
#include "block.h"
block_t * block_Alloc( size_t i_size )
{
block_t *p_block = malloc( sizeof(block_t) );
if ( !p_block )
return NULL;
size_t i_max = ceil( i_size * 1.0 / 4096 ) * 4096;
p_block->p_buffer = malloc( i_max );
if ( !p_b... |
C | #include<stdio.h>
int main(){
int num;
printf("enter a number to determine if it is positive or negative:");
scanf("%d",&num);
if (num < 0)
printf("The number is negative\n");
else
{
printf("The number is positive\n");
}
return 0;
} |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
/* m - line , n - pillars */
int m, n;
int x, z; /* SCH */
int mem;
int min;
int xmin;
int zmin;
int o;
int p;
min = 150;
srand(time(NULL));
m = rand() % 10 + 3;
n = rand() % 10 + ... |
C | /*
** EPITECH PROJECT, 2018
** rush2
** File description:
** Rush 2 Detect Lang
*/
#include "my.h"
#include "rush.h"
int count_alpha(const char *str);
int count_letter(const char *str, char c)
{
int counter = 0;
char *tmp = str;
tmp = my_strlowcase(tmp);
if (c >= 65 && c <= 90)
c = c + 32;
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* exec_sep.c :+: :+: :+: ... |
C | #include <stdio.h>
int bubbleSort(int arr[], int sizeArr);
int main()
{
int array[] = {2,6,7,8,1,9};
int sizeArray = sizeof(array) / sizeof(int);
bubbleSort(array,sizeArray);
return 0;
}
int bubbleSort(int arr[], int sizeArr)
{
int result = 1;
while(result)
{
result = 0;
... |
C | #include<unistd.h>
#include<sys/types.h>
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
int main(void)
{
int data_processed;
int file_pipes[2];
const char some_data[]="123";
char buffer[BUFSIZ+1];
pid_t fork_result;
memset(buffer,'\0',sizeof(buffer));
if (pipe(file_pipes) == 0)
{
fork_result=fork(... |
C | #include<stdio.h>
/*Print Fahrenheit-Celsius table
for fahr=0,20,40....300*/
int main(){
int fahr,celsius,lower,upper,step;
lower=0;//lower limit
upper=300;//upper limit
step=20;
while(fahr<=upper){
celsius=5*(fahr-32)/9;
printf("%d\t %d\n",fahr,celsius);
fahr=fahr+step;
}
}
|
C | #include <stdio.h>
int max;
int hailstone(int n){
if(max<=n)
max=n;
if(n%2==0)
hailstone(n/2);
else if(n%2==1&&n!=1)
hailstone(n*3+1);
else if(n==1)
return max;
}
int main()
{
int t;
int n,result;
scanf("%d",&t);
while(t--){
scanf("%d",&n);
max=n;
printf("%d\n",hailstone(n));
max=0;
}
... |
C | #include <dirent.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdio.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
char *Pattern;
/*Prototipo de funciones usadas*/
int isFile(char *path);
int isDirectory(char *path);
void movDir(char *path);
int BruteForce(int fd);
int main(... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strsplit.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stddef.h>
#include "individual.h"
const char* statusNames[] = { "susceptible", "infected", "immune" };
void printIndividualState(individual i) {
printf("[ID: %d] status: %s, position: (%f, %f), speed: (%f, %f), cumulated time: %ld\n",
i.id, statusNames[i.status], i.pos... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#define NODE
#include "tree_def.h"
enum types_t
{
BAD_OP = -1,
TEXT = 0,
NUMBER = 1,
VARIABLE = 2,
CALL = 3,
OPERATOR = 4,
COMPARISON = 5,
ASSIGN = 6,
IF_T = 7,
ELSE_T = 8,... |
C | #include "./Header/StepperMotorSTM.h"
#include "./Header/StepperMotorTimer.h"
#include "./Header/StepperMotorIO.h"
#include "./Header/StepperMotorPosition.h"
#include "./Header/Constant.h"
unsigned char panSpeedAdjustment(unsigned char direction)
{
static unsigned char directionHistory [4] = {STAY_PUT,STAY_PUT,STA... |
C |
struct BIT
{
int n;
vector<int>bit;
BIT(int _n)
{
n=_n;
bit.resize(n+1);
}
void update(int indx,int val)
{
if(indx>0) for(;indx<=n;indx+=(indx&-indx)) bit[indx]+=val;
}
int sum(int indx)
{
int tot=0;
for(;indx>0;indx-=(indx&-indx)) tot+=bit[indx];
return tot;
}
int sum(int l,int r)
{
... |
C | /* File: q19.c
*
* Purpose: A program in which multiple MPI processes receive a slice of two vectors (v1,v2)
* and a escalar (a) and makes: (a*v1) * v2
*
* Compile: mpicc -g -Wall -o q19 q09.c
* Usage: mpiexec -n <number of processes> ./q19
*
* Input: arrays size, escalar, array elements
* Output: ... |
C | #include <stdio.h>
#define MAXLINE 1000
int getlines(char s[], int max);
int main()
{
int len, i;
char line[MAXLINE];
while ((len = getlines(line, MAXLINE)) != 0)
{
if (len > 1)
{
for (i = len-1; (line[i] == ' ' || line[i] == '\t' || line[i] == '\n'); i--)
;
... |
C | #include<stdio.h>
int main(){
int i, n , m;
/*
Arrays
Arrays are defined as the collection of similar type of data items stored
at contiguous memory locations.
Arrays are the derived data type in C programming language which can store
the primitive type of data such as int, char, double, float, et... |
C | /*
* Simple Timer
* Demonstrates the use of a non-core Arduino Library and Serial Communications
* Joshua Pierce
*/
#include <SimpleTimer.h>
SimpleTimer timer; //Constructor for the timer function from SimpleTimer
boolean currentLEDState;
int ledPin = 13;
void setup(){
currentLEDState = false;
pinMode(ledPi... |
C | #include <stdlib.h>
#include <stdio.h>
#include "Tree.h"
Tree makeNode0(char *x, int indent){
Tree root;
root = (Tree) malloc(sizeof(struct Node));
root->label = x;
root->child = NULL;
root->sibling = NULL;
root->indent = indent;
root->freeable = false;
return root;
}
Tree makeNode1(c... |
C | #ifndef INTERSECT_H
#define INTERSECT_H
#include <stdio.h>
#include <stdlib.h>
#include "fonction.h"
/* Ici, on est oblige d'utiliser la notation struct listepoint,
car la structure s'auto-reference!*/
typedef struct elemListe {
POINT p;
VECTEUR vecteur;
struct elemListe* suivant ;
} ELEMT ;
typedef struct Liste{... |
C | /***********************************************************************************/
/* Program: arraysort2D.c
By: Brad Duthie
Description: Sorts a 2D array by the value of a column element.
Compile: gcc randpois.c -ansi -Wall -pedantic */
/*********************... |
C | //All rights reserved to Custodio Co. Copyright 2020
#include<stdio.h>
#include<stdlib.h>
#include <locale.h>
int main(){
setlocale(LC_ALL, "Portuguese");
FILE *fp;
char username[100];
char password[50];
char ponto[1] = {';'};
int i;
fp = fopen("user.dat","wb");
if(!fp){
printf("Erro na ... |
C | /*******************************************************************************
* File Name: pjJpegFile.c
* Author: Joyee Peng
* Email: joyee.peng@gmail.com
* Github: https://github.com/joyeepeng
* Blog: http://blog.csdn.net/pengqianhe
* History:
2012-10-23 initial release version
************************************... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* base64.c :+: :+: :+: ... |
C | // use.c
#include <ansi.h>
#include <skill.h>
inherit SSERVER;
int main(object me, string arg)
{
object target,weapon,arrow,creater;
seteuid(getuid());
if( !weapon=me->query_temp("weapon") ) return 0;
if( weapon->query("skill_type")=="bow")
{
if( !arrow=present("arrow", me ) ) return notify_fail(" A... |
C | #ifndef __SET_H__
#define __SET_H__
typedef List Set;
void set_init(Set *set, int (*match)(const void *key1, const void *key2),
void (*destory)(void *data));
#define set_destory list_destory
/**
* 插入操作成功返回0;如果插入的成员在集合中已经存在返回1;否则返回-1
* 复杂度O(n)
* */
int set_insert(Set *set, const void *data);
/**
* 如果移除操作成... |
C | #define _XOPEN_SOURCE
#include <cs50.h>
#include <stdio.h>
#include <crypt.h>
#include <string.h>
#include <unistd.h>
int main(int argc, string argv[])
{
if (argc == 2)
{
string salt1 = argv[1];
char salt[3];
strncpy(salt, salt1, 2);
salt[2] ='\0';
char input[6];
... |
C | #include "TPrincipal.h"
#include "iomanip.h"
void principal(Int_t n=10, Int_t m=10000)
{
//
// Principal Components Analysis (PCA) example
//
// Example of using TPrincipal as a stand alone class.
//
// We create n-dimensional data points, where c = trunc(n / 5) + 1
// are correlated with the re... |
C | #include <sys/time.h>
#include <signal.h>
#include <unistd.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
// calculates addition of positive arguments
void add(struct timeval * a, long b)
{
a->tv_usec = a->tv_usec + b;
if (a->tv_usec >= 1... |
C | //#include <stdio.h>
//#include "Vector_tools.h"
#define TRUE 1
#define FALSE 0
#define VECTOR_EPSILON 0.00001f
#define DISTANCE_EPSILON 1e-08f
#define ANGLE_EPSILON 0.00872665f
#define MOD(A,B,C) (float) sqrt( A*A + B*B + C*C )
#define PI_VALUE 3.14159265359f
#define DEGREE_TO_RAD 0.... |
C | /*1. Escreva uma função que imprime todos os inteiros de 1 a 1000. Escreva também um programa que chama
essa função.*/
#include <stdio.h>
void contador();
int main() {
contador();
return 0;
}
void contador() {
int i;
for(i = 1; i <= 1000; i++)
{
printf("%d\n", i);
}
} |
C | #ifndef MOTOR_H_
#define MOTOR_H_
/* ---MOTOR CONFIGURATION-- */
/**
* @brief Init both motors
* @param Nothing
* @return Nothing
* @note Nothing
*/
void Init_Motor();
/**
* @brief Start both motors
* @param Nothing
* @return Nothing
* @note Nothing
*/
void Motor_Start();
/**
* @brief Stop both motors
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct mahasiswa
{
char nim[20];
char namamhs[20];
struct mahasiswa *next;
};
struct mahasiswa *ujung;
int tambah_data_mhs()
{
struct mahasiswa *tampung;
int j=0;
char jawab[2];
printf(" Linked List LIFO(Last In First Out) ");
p... |
C | #include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
int main() {
int n,i,j,c=0,s;
scanf("%d", &n);
int *ar = malloc(sizeof(int) * n);
for(i = 0; i < n; i++){
scanf("%d",&ar[i]);
}
int d;
int m;
... |
C | #include <stdio.h>
#include <stdlib.h>
int max(int x, int y)
{
return x^((x^y) & -(x < y));
}
int main()
{
int a, b;
printf("Enter the two no:\n");
scanf("%d \n %d", &a, &b);
printf("The maximun of two no is : %d", max(a, b));
return 0;
}
|
C | /*
* File: Initialize.c
* Author: Craig
*
* Created on August 4, 2011, 10:03 PM
*/
#include "pic.h"
void initialize();
void initialize()
{
//Programming
/* MCLREN;//Enables the MCLR pin to reset the PIC
MCLRE = 1;//MCLR set as MCLR
//I need access to CONFIG as a register for so many reasons! See pg ... |
C | #include "Stepin-Unit-Converter-and-Calculator.h"
#include<stdio.h>
int main()
{
int choice;
double input1,input2;
double result;
int res1;
int in1,out;
double triginput,trigoutput;
int a=0;
int b=0;
int c=0;
int d=0;
int z=0;
int n,ram=0;
int year;
... |
C | #include <stdio.h>
int isBigger(int a, int b)
{
int x1, x2;
x1 = a;
x2 = b;
if (x1 > x2)
return 1;
else
return -1;
}
int main(void)
{
int a = 5;
int b = 10;
printf("The bigger values is %d\n", isBigger(a,b));
return 0;
} |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(int argc, char** argv){
int i;
for(i = 1; i < argc; i++){
int len = strlen(argv[i]);
printf("%c", argv[i][len-1]);
}
printf("\n");
return 0;
}
|
C | #include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <math.h>
struct frac{
long long num;long long denom;
};
typedef struct frac * FP; //fraction-ponter
FP get_fraction()
{
FP f=(FP)malloc(sizeof(struct frac));
return f;
}
long long gcd(long long a,long long b)
{
if(a<b)return gcd(b,a);
else... |
C | #include "vector.h"
//#include "time.h"
#include <memory.h>
#include <stdio.h>
#include <errno.h>
/*
* Implementation of C++ like vector in C.
*
* Author: Martin Hedberg
*
* Version information:
* 2021-05-13: v1.1, added back poping.
* 2021-04-21: v1.0, first implementation.
*/
struct vector {
void** dat... |
C | #include "lpc_types.h"
#include "lcd_commands.h"
#define LCD_ADDRESS 0x3b
#define DDRAM_SIZE 80
void lcd_init();
/**
* Sends data to the lcd address: LCD_ADDRESS in lcd.h
* @param data array of 8 bit ints to send
* @param length lenth of the array. use LEN() macro from utils
*/
void lcd_send_data(uint8_t *data,... |
C | #include <stdio.h>
int main(){
int x = 10;
int y = 15;
printf("The address of x: %p\n", &x);
printf("The address of y: %p\n", &y);
return 0;
} |
C | #include<stdio.h>
#include<stdlib.h>
#define MAX_SIZE 100
int main()
{
FILE *fp1,*fp2;
int c1,c2;
char file_name[2][MAX_SIZE];
printf("比較するファイルを入力して下さい: ");
scanf("%s %s",file_name[0],file_name[1]);
fp1=fopen(file_name[0],"rb");
if(fp1==NULL){
printf("Cannot open the %s!!\n",file_name[0]);
exi... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
// mesure copy-on-write, also with pthread
#include "benchmark.h"
#define N 42
int main (int argc, char *argv[]) {
timer *t = timer_alloc();
recorder *parent_rec = recorder_alloc("parent.csv");
recorder *child_rec = recorder_alloc("child.csv");
pi... |
C | #include <stdio.h>
#include <sched.h>
int main (void)
{
struct sched_param shdprm;
printf ("SCHED_FIFO : from %d to %d\n",
sched_get_priority_min (SCHED_FIFO), sched_get_priority_max (SCHED_FIFO));
printf ("SCHED_RR : from %d to %d\n",
sched_get_priority_min (SCHED_RR), sched_get_priority_max (SCHED_RR));
pr... |
C | #include "filesystem.h"
int copy_file_to_fs(t_fs *fs, int prev_inode) {
char *tmp;
int nb_blocks;
int index_block;
int index_block_prev;
int len;
int i;
int inode;
inode = 0;
while (inode < MAXBLOC && fs->tab_inode[inode].available == FALSE) {
inode++;
}
if (already_exist(fs, fs->tab_inode[p... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_get_next_line.c :+: :+: :+: ... |
C | #include "foundation/container/ineighbor.h"
/* ineighbor destructor */
void ineighbor_destructor(const imeta* meta, iptr o) {
ineighbor *neighbor = icast(ineighbor, o);
ineighborclean(neighbor);
}
/* set the relation entry in graphics */
void ineighborbuild(ineighbor *neighbors, ientryrefjointresrelease entry... |
C | /*************** Whetting Your Apitite ***************/
/*************** C Language ***************/
/*************** Chapter No.5 ***************/
/*************** Operators *... |
C | #include <kcommon/call.h>
#include <kcommon/file.h>
#include <kcommon/memory.h>
#include <kcommon/string.h>
void file_close(unsigned int fd)
{
call_close(fd);
}
unsigned int file_info(char *name, struct file_info *info)
{
return call_info(name, info);
}
int file_open(char *name)
{
return call_open(name);
}
unsig... |
C |
#include <stdio.h>
#include <stdlib.h>
#include "fila.h"
//Cria a fila
TFila* criaFila(void){
TFila *f = (TFila *) malloc(sizeof(TFila));
f->ini = f->fim = NULL;
return f;
}
int filaVazia(TFila *f){
return f->ini == NULL;
}
//Insere um elemento na fila
void insere(TFila *f, int x){
TNO *novo = (TNO *) malloc(s... |
C | #include <stdio.h>
int main()
{
long long int L, H, V, S, cnt, temp, temp1, i;
while (scanf("%lld%lld", &L, &H))
{
if (L == 0 && H == 0)
return 0;
if (L > H)
{
temp1 = L;
L = H;
H = temp1;
}
S = 0;
for (i=L;... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <string.h>
#include <limits.h>
#include "mapping.h"
#define INF INT_MAX
int main(int argc, char * argv[]) {
if (argc != 3) {
fprintf(stderr, "Input format: ./proj3 mapfile queryfile\n");
return EXIT_FAILURE;
}
// Read file, bu... |
C | #include <assert.h>
#include <stdlib.h>
#include "type.h"
#include "letter_score.h"
#include "xor.h"
#define MAX_KEYSIZE 40
#define MIN_KEYSIZE 2
size_t edit_distance(const byte_t * str1, const byte_t * str2, const size_t len) {
size_t total = 0;
for (size_t i = 0; i < len; ++i) {
byte_t xor = str1[i... |
C | #include <stdio.h>
#include <assert.h>
#include <stdlib.h>
int main(void){
int T,N,curSum,ans,bestDiff;
scanf("%d",&T);
assert(T>=1 && T<=100);
while(T>0){
scanf("%d",&N);
assert(N>=1 && N<=100);
ans = 0;
curSum = 0;
int ele[N];
int sum[450002];
for(int i=0;i<N;i++){
scanf("%d",&ele[i]);
a... |
C | #ifndef CGTFS_TESTS_RECORDS_TRIPS_C
#define CGTFS_TESTS_RECORDS_TRIPS_C
#include "greatest/greatest.h"
#include "records/trip.h"
TEST trip_read(void) {
#define FIELDS_NUM_13 10
char *field_names[FIELDS_NUM_13] = {
"route_id", "service_id", "trip_id", "trip_headsign", "trip_short_name",
"direc... |
C | // Runtime: 0 ms, faster than 100.00% of C online submissions for Split a String in Balanced Strings.
// Memory Usage: 5.1 MB, less than 100.00% of C online submissions for Split a String in Balanced Strings.
int balancedStringSplit(char * s){
int r = 0;
int l = 0;
int count = 0;
while(*s) {
i... |
C | #include <stdio.h>
#define TAM 12
#define TRUE 0
#define FALSE -1
#define MAX_LINHAS 800
// A implementação (corpo) destas funções está lá embaixo
void imprime_numero(char, unsigned int); // imprime em binário ou hexadecimal
void imprime_vazios(char, int); // imprime espaços vazios
// E... |
C | /*
將單字從檔案讀入並顯示
*/
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#define Q_NO 3 /* 問題個數 */
FILE* fp;
/*--- 初始處理 ---*/
int initialize(void)
{
fp = fopen("DATA", "r");
return ((fp == NULL) ? 0 : 1);
}
/*--- 結束處理 ---*/
void ending(void)
{
fclose(fp);
}
/*--- 主函式 --... |
C | #include <stdio.h>
#include "test.h"
int main()
{
printf("%d", max(10, 20));
return 0;
}
int max(int a, int b)
{
if (a > b)
return a;
else
return b;
} |
C | #include <stdio.h>
int main(void)
{
int n, iguais;
double a1, a2, soma, produto;
soma = 0;
produto = 1;
iguais = 0;
printf("Quantos pares de numeros? ");
scanf("%i", &n);
for (int i = 0; i < n; ++i)
{
printf("Digite a1: ");
scanf("%d", &a1);
printf("Digite a2: ");
scanf("%d", &a2);
if (a1 > a2)... |
C | /** @file
* \brief a small set of validation functions for strings
* \author Mingcheng Zhu
* \email zhumc11@gmail.com
* \date 19 Jan 2018
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include "svalidate.h"
/**
* \fn char * trim (char * input)
* \param input... |
C | #include <arpa/inet.h>
#include <netinet/in.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
#define BUFLEN 512
#define NPACK 10
#define PORT 6868
#define SRV_IP "18.225.5.21"
static int s;
struct client {
int host;... |
C | /*next steps
1. implemnet the grid
2. implement key presses with SDL
3. test if everything works*/
#include "encryption.h"
#define GRIDSIZE 10
void enc_shufle(char word[LENGTH], int size);
int enc_isenc_vowel(char c);
char enc_vowel();
char enc_constant();
void enc_changeRow(char word[LENGTH], int size);
void enc_cha... |
C | /* Implement Merge Sort through Recursion */
#include<stdio.h>
#include<conio.h>
#define MAX 20
int array[MAX];
void merge(int low, int mid, int high )
{
int temp[MAX];
int i = low;
int j = mid +1 ;
int k = low ;
while( (i <= mid) && (j <=high) )
{
if (array[i] <= array[ j])
temp[k++] = array[i++] ;
else
temp[k++] = a... |
C | #include<stdio.h>
#include<stdlib.h>
int truck_on_road[100],r=-1; /*array for trucks on road*/
int truck_in_garage[100],days_of_stay[100]; /* circular queue 1 for truck in garage and circular queue 2 for days of stay of truck in garage*/
int front=0,rear=-1,truck,c;
int charge();
i... |
C | /* ************************************************************************** */
/* Copyright (C) 2018 Remi Imbach */
/* */
/* This file is part of Ccluster. ... |
C | #include <stdio.h>
#include <conio.h>
int main()
{
double fat, n;
printf("Insira um valor para o qual deseja calcular seu fatorial: ");
scanf("%lf", &n);
if (n <= 20)
{
for(fat = 1; n > 1; n = n - 1)
fat = fat * n;
printf("\nFatorial calculado: %lf", fat);
}
else
printf("... |
C | #include <stdio.h>
#include <malloc.h>
#include <stdbool.h>
#include <assert.h>
#pragma warning(disable:4996)
#define ElemType int
typedef struct LinkQueueNode
{
ElemType data;
struct LinkQueueNode *link;
}LinkQueueNode;
typedef struct LinkQueue{
struct LinkQueueNode *head;
struct LinkQueueNode *tail;
}Li... |
C | /**
* Tema 1 SO - Hash table
*
* Copyright (C) 2018, Oana-Bianca Bouleanu 333CA
* <oana.bouleanu@stud.acs.upb.ro>
*
* Unauthorized copying of this file, via any medium is strictly prohibited
* Proprietary and confidential
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "hash.h"
#incl... |
C | #include <stdio.h>
#include "queue.h"
int main() {
queue_t* c = createQueue();
int a[10] = {0,1,2,3,4,5,6,7,8,9};
int i;
for (i=0; i<10; i++) {
enqueue(c, &a[i]);
}
for (i=0; i<10; i++) {
int* e = dequeue(c);
printf("dequeued %d\n", *e);
}
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.