language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include<stdio.h>
void main()
{
int a=11;
if(a>10)
{
printf("Hello\n");
}
else{
printf("Indore\n");
}
}
|
C | /*
* metronom.c
*
* This module implements the timer callback facility for Dreamreel.
*/
#include <kos.h>
#include "dreamreel.h"
#include "metronom.h"
/* total vblank counter */
static int counter = 0;
static volatile int metronom_started;
/*static*/ volatile int64_t pts_counter;
static int pts_inc;
static int ... |
C | /*
The function int hthread_cond_broadcast(hthread_cond_t *cond); shall unblock
all threads, hardware or software, currently blocked on the specified
condition variable cond.
Hardware must be tested on the board
Methodology
1. Create a number of threads that will wait on the condvar
2. Wait until... |
C | #include <omp>
#include <stdio>
int main(int argc, char* argv[])
{
printf("I am the main thread.\n");
#pragma omp parallel
{
printf("I am thread %d of %d.\n", omp_get_thread_num(), omp_get_num_threads());
}
return 0;
}
|
C | // 2016-03-02 Daniel Stenekap och Gran Forstrm
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define TRUE -1
#define FALSE 0
// Defines fr flushRestOfLine
#define C_RADSLUT 10
// Defines fr itemStruct
#define C_ITEM_NAME_LENGTH 30
#define C_UNIT_NAME_LENGTH 30
#define C_LIST_LENGTH 3
// Defines for r... |
C | /*
============================================================================
Name : SwitchSample.c
Author :
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
============================================================================
*/
#include <stdi... |
C | #include <stdio.h>
#include "Big_Block.h"
#include <limits.h>
#include <error.h>
big_block_list bigBlockList;
void BigBlockList_init()
{
for (int i = 0; i < MAX_SIZE_FOR_BIG_BLOCK; i++)
{
bigBlockList.bigBlock[i].blockptr = NULL;
bigBlockList.bigBlock[i].availablesize = 0;
bigBlockLi... |
C | // #############################################################################################
//
// Data taken from https://www.ticketcity.com/nba/nba-finals-tickets/nba-finals-champions.html
//
//
// This project explores whether the NBA Finals outcomes are consistent with two
// equally matched teams. The metric... |
C | #pragma once
#include<iostream>
struct ArrayList {
/* */
int count;
int capacity;
int* data;
/* */
ArrayList(); //
ArrayList(int cap); //
/* */
~ArrayList();
void push_back(int element); //
void print(); //
}; |
C | #include <stdlib.h>
#include <assert.h>
/*
Doubly linked list
*/
typedef struct llnode {
struct llnode * left;
struct llnode * right;
void* value;
} llnode;
typedef struct linkedlist {
llnode * left;
llnode * right;
int count;
} linkedlist;
linkedlist * ll_ctor() {
linkedlist * ll = ma... |
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 | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* client_bonus.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<string.h>
#include<math.h>
//Function for selection of random number n
int selectn(){
int i;
i= rand() % 9;
if(i<4){
return (i+4);
}
return i;
}
int randomprofit(){ //Function to create randomised profits between 10-30
//Use current time as seed f... |
C | /*
* PRACTICA 1 - EJERCICIO 2
* Realiza un programa que escriba en pantalla las constantes โAโ, 3 y 3.3 como datos de
* tipo char, int y float respectivamente.
*/
#include <stdio.h>
int main()
{
#define A 'A'
#define tres 3
#define tres_con_tres 3.3
printf("%c %d %0.1f", A, tres, tres_con_tre... |
C | #include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
#include <semaphore.h>
#define ITEM_MAX 10
#define THREAD_SIZE 5
sem_t Empty_check; //์์ฐ์์ ์ธ๋งํฌ์ด
sem_t Item_exist; //์๋น์์ ์ธ๋งํฌ์ด
sem_t mutex; //์ํธ ๋ฐฐ์ฌ๋ฅผ ์ํ ์ ์ธ
int count = 0; //๊ณต์ ๋ณ์
int... |
C | //#include "unistd.h"
#include "types.h"
#include "stat.h"
#include "user.h"
#include "fcntl.h"
//#include "stdlib.h"
char buf[502];
int
main(int argc, char *argv[]){
if(argc <= 1){
printf(1, "touch: missing file operand\n");
exit();
}
int ret =chdir(argv[1]);
if(ret==0){
printf(1,"fail to access %s... |
C | #include <cholmod.h>
#include <math.h>
#include <assert.h>
#include "photospline/detail/splineutil.h"
int
ndsparse_allocate(struct ndsparse* s, size_t rows, size_t ndim)
{
s->rows = rows;
s->ndim = ndim;
s->i = calloc(ndim, sizeof(int*));
if (!s->i)
return (1);
s->ranges = calloc(ndim, sizeof(int));
if (!s->r... |
C | #include<stdio.h>
int main()
{
int rupee,i;
double money,dob=100.0,paisa;
scanf("%lf",&money);
rupee=(int)money;
//paisa=(int)((double)(money-rupee)*100);
paisa=money-rupee;
if(((int)money)%2!=0 && ((int)money)%5!=0 )
paisa+=100;
printf("NOTAS:\n");
for(i=100; ;i/=2)
{
... |
C | // Juliet CWE761_Free_Pointer_Not_at_Start_of_Buffer__wchar_t_fixed_string_05.c
// Original structure: conditional-mem-leak
// #################################################################
// ## Variant: conditional-mem-leak_01
// ## CHANGE: Made global variable `const`
// #########################################... |
C | #include "defs.h"
#define NITERMAX 30
/* Exact solver functions */
real fk_prime(const real p, const real pk, const real dk, const real ak, const real Ak, const real Bk, const real gamma_5) {
if (p > pk) {
return ( 1 - .5*(p-pk)/(Bk+p) ) * sqrt(Ak/(p+Bk));
}
else {
return 1./(ak*dk) *... |
C | #include "CacheManager.h"
#include "FileSystem.h"
#include "DynamicMemory.h"
// ํ์ผ ์์คํ
์บ์ ์๋ฃ๊ตฌ์กฐ
static CACHEMANAGER gs_stCacheManager;
// ๋ด๋ถ ํจ์
static void kCutDownAccessTime(int iCacheTableIndex);
// ํ์ผ ์์คํ
์บ์๋ฅผ ์ด๊ธฐํ
BOOL kInitializeCacheManager(void)
{
int i;
// ์๋ฃ๊ตฌ์กฐ ์ด๊ธฐํ
kMemSet(&gs_stCacheManager,0,sizeof(gs... |
C | #include <string.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdint.h>
#include "reunion.h"
static int debug= 1;
typedef struct {
pthread_mutex_t m;
pthread_cond_t c;
int entraron, salieron, esperados;
} Verif;
typedef struct {
Reunion *r;
int delay;
ch... |
C | #include <stdio.h>
#include <stdlib.h>
#define MAX 100000
int LerDados()
{
int aux;
scanf("%d",&aux);
return aux;
}
int main()
{
int num,j=0,i,flag=1,tam;
int cont=0,cont2=0,A[MAX],B[MAX];
int *contador;// = (int*)calloc(MAX,sizeof(int));
scanf("%d",&num);
contador = (int*)calloc(n... |
C | #include "types.h"
#include "stat.h"
#include "user.h"
void
printf(int fd, char *s, ...)
{
write(fd, s, strlen(s));
}
int
main(void)
{
int pid;
if ((pid=fork2())==0){
printf( 1,"Filho aki\n");
int i=0;
while(i<100000)i++;
printf( 1,"Filho is dead\n");
}else{
printf( 1,"Pai aki\n");
int... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: ... |
C | #include "sam.h"
#define PORTA_Ena(data) PIOA->PIO_PER=(1<<data); //PIOA I/O ์ฌ์ฉ ์ค์
#define PORTA_Out(data) PIOA->PIO_OER=(1<<data); //PIOA ์ถ๋ ฅ ์ฌ์ฉ ์ค์
#define PORTA_In(data) PIOA->PIO_ODR=(1<<data); //PIOA ์
๋ ฅ ์ฌ์ฉ ์ค์
#define PORTA_Set(data) PIOA->PIO_SODR=(1<<data); //PIOA data set ์ค์
#define PORTA_Stat PIOA->PIO_PDS... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
void result(int a, int b, int *x, int *y, int *z);
int samsam(void)
{
char c = '.';
int i, j, k, start, round;
int x = 0, y = 0, z = 0;
const char *a[3] = { "Rock", "Paper", "Scissors" };
const char *b[3] = { "Rock", "Paper", "Scissors" };
srand(time(0))... |
C | #include <windows.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <conio.h>
struct book
{
char number[100];
char tittle[100];
char writer[100];
char publisher[100];
char date[100];
char price[100];
char status[100];
char reader[100];
};
void search_book();
void bor... |
C | //
// Created by Oleg Bukatchuk on 15/09/2017.
//
#include <stdio.h>
int main()
{
int num = 1234567890;
printf("Size of int data type is %d bytes\n", sizeof (int));
printf("Size of int variable is %d bytes\n", sizeof (num));
printf("Size of an int array is %d bytes\n", sizeof (int[3]));
struct ... |
C | #include <stdio.h>
#include <sys/socket.h>
#include <netdb.h>
#include <stdlib.h>
#include <string.h>
#define BUF_LEN 4096
#define HTTP_PORT 80
int main (int argc, char ** argv)
{
int sock, count;
char * buf;
struct hostent * host;
struct sockaddr_in addr;
if (argc < 2) {
fprintf (stderr, "... |
C | #include<stdio.h>
#define N 10
int a[N];
int top=-1;
void push(int );
int pop();
void main()
{
char post[10];
int i=0,n1,n2,ans;
printf("Enter postfix expression : ");
scanf("%s",post);
while(post[i]!='\0')
{
if(post[i]>=48 &&post[i]<=57)
push(post[i]-48);
else
{
n2=pop();
n1=pop();
if(post[i]=... |
C | #include <stdio.h>
#if 0
int main()
{
unsigned i ;
for( i = 0 ; i < 4 ; ++i )
{
fprintf( stdout , "i = %d\n" , ("11213141") ) ;
}
getchar();
return 0 ;
}
#include <stdio.h>
char* fun()
{
return "awake";
}
int main()
{
printf("%s",fun()+ printf("I see you"));
getchar();
return 0;
}
#include<st... |
C | /******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby,
C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.
*********... |
C | #ifndef __SIMPLE_JSON_VALUE_H__
#define __SIMPLE_JSON_VALUE_H__
#include "simple_json_list.h"
#include "simple_json_string.h"
typedef enum
{
SJVT_NULL,
SJVT_Object,
SJVT_Array,
SJVT_String
}SJValueTypes;
/**
* @brief this is the abstract container structure for all json data
* This structure may be... |
C | #define _GNU_SOURCE
#include<signal.h>
#include<sys/wait.h>
#include"library/common.h"
#include"library/merge_sort.h"
#include"library/priority.h"
#include"library/heap.h"
char N[MAX_PROCESS_NUM][PROCESS_NAME];
unsigned int R[MAX_PROCESS_NUM], T[MAX_PROCESS_NUM];
extern int nProcess;
extern int idProcess[MAX_PROCESS... |
C | /*
============================================================================
Name : ElGamal-Test.c
Author : Albert Soliz Team 19
Version :
Copyright : Uses mini-gmp as the bignum library. Open-source.
Description : ElGamal Algorithm in C.
=====================================================... |
C | #include<stdio.h>
#define N 40
#define M 4
int main(void){
int i, ih, j, k;
double theta[N]={0}, ripple[M]={0},kakudo[M]={0},counth;
FILE *input, *output;
input =fopen("theta.txt","r");
output =fopen("kakudo.txt","w");
if(input==(NULL)){
printf("thetaใฎใใผใฟใ่ฆใคใใใพใใใงใใใ\n");
return 0;
}
... |
C |
//
// fileread.c
//
// Copyright (c) 2017 JesseChen <lkchan0719@gmail.com>
//
#include "fileread.h"
/*
* Return the file size of `filename` or -1
*/
size_t
file_size(FILE *stream) {
size_t size = 0;
fseek(stream, 0, SEEK_END);
size = ftell(stream);
rewind(stream);
return size;
}
/*
* read t... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_add_to_stack.c :+: :+: :+: ... |
C | #include "holberton.h"
/**
* append_text_to_file - appends text at the end of a file.
* @filename: filename.
* @text_content: string.
* Return: 1 on success, -1 on failure.
*/
int append_text_to_file(const char *filename, char *text_content)
{
int fd, wr;
int lenTextContent;
if (filename == NULL)
return (-... |
C | #include "fractol.h"
#include <stdio.h>
/*
int ft_exit(t_mlx *mlx)
{
mlx_destroy_image(mlx->ptr, mlx->img.img_ptr);
mlx_destroy_window(mlx->ptr, mlx->wdw);
exit(1);
}
*/
void ft_error(void)
{
write(2, "Error mlx\n", 10);
exit(1);
}
void ft_init_mlx(t_mlx *mlx)
{
if (!(mlx->ptr = mlx_init()))
... |
C | //**************************************
// Name: Lexical Analyzer in C
// Description:It will lexically Analyze the given file(C program) and it willgive the various tokens present in it..
// By: Aditya Siddharth Dutt (from psc cd)
//
// Inputs:Input the Complete file name with pateh... It can also be given in the pro... |
C | #include <stdio.h>
#include <stdlib.h>
#include "../Vector.h"
#include "../interp.h"
int main(int argc, char** argv) {
size_t ndata=10;
size_t ninterp=100;
double step = ((double)ndata)/ninterp;
struct f64vector* x=f64vector_range(ndata);
struct f64vector* y=f64vector_new(ndata);
for (size_t ... |
C | #include <stdio.h>
void fun1();
void fun2();
void fun3();
int main()
{
printf("Inside main starting\n");
fun1();
fun2();
fun3();
printf("Inside main: ending\n");
}
|
C | #include <stdio.h>
struct node
{
struct node *next;
int data;
};
int n,d,i,n1;
int main(void) {
scanf("%d%d",&n,&d);
while(n!=0&&d!=0)
{
struct node *temp=(struct node *)malloc(sizeof(struct node));
struct node *head;
head=temp;
temp->data=1;
for(i=2;i<=n;i++)
{
temp->next=(struct node *)malloc(sizeof(str... |
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>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/socket.h>
#include <signal.h>
#include "socket.h"
/** Crรฉe une socket serveur qui รฉcoute sur toute les interfaces IPv4
de la machine sur le port passรฉ en paramรจtre . La socket retournรฉe
doit pouvoir รชtre utili... |
C | #include <stdlib.h>
#include <stdio.h>
#include "grafos.h"
static void free_vertice(Vertice *vertice);
Grafo cria_grafo(int n_vertices, int orientado) {
Grafo grafo = {.n = n_vertices, .orientado = orientado};
grafo.vertices = (Vertice *) malloc(sizeof(Vertice) * n_vertices); // cria n vรฉrtices no grafo
// inici... |
C | #ifndef __POWER_BAR_H__
#define __POWER_BAR_H__
// In this file we define how we render the health bars of the tanks
#include "body.h"
typedef struct power_bar {
body_t *outer;
body_t *inner;
body_t *power_level;
} power_bar_t;
// Creates a new power bar for the tank and assigns the power_bar field of t1... |
C | typedef struct
{
int idMarca;
char descripcion[20];
}eMarca;
typedef struct{
int dia;
int mes;
int anio;
}eFecha;
typedef struct{
int idColor;
char nombreColor[20];
}eColor;
typedef struct{
int idAuto;
char patente[7];
int idMarca;
int idColor;
int modeloAnio;
int isEmpty;
}eAut... |
C | /*
Write a function that searches for a number in an array of integers. If the number is stored, the function should return the position of its first occurrence, otherwise โ1. Write a program that declares an array of integers sorted in ascending order. The program should read an integer and use the function to display... |
C | #include "global.h"
#include "ast.h"
void free_pipeline_node(struct s_pipeline_node *node)
{
if (node == NULL)
return;
if (node->commands != NULL)
{
for (int i = 0; i < node->nb_commands; i++)
free_ast_node(node->commands[i]);
free(node->commands);
}
free(node);... |
C | #include "ButtonsReader.h"
#include "Pin.h"
#include "Sequencer.h"
uint8_t inputsValues = 0;
struct inputsState inputToggle[SR_MAX_BUTTONS];
inline static void ButtonsReader_StartTimerInt(void);
inline static void ButtonsReader_StopTimerInt(void);
void ButtonsReader_Init() {
PIN_Set(SR_LOAD_PIN, PIN_OUTPUT);
PIN_S... |
C | #include "common.h"
#include <stdio.h>
#include <unistd.h>
#include <assert.h>
#include "com.h"
#include "commands.h"
#include "consult_constants.h"
typedef enum
{
state_RUNNING,
state_STOPPING,
state_FINALISED
} state_t;
static FILE *s_file;
static state_t s_state;
int com_init( char *path )
{
s... |
C | /* find, substitute subst.c */
/* letzte aenderung:So 18.01.87 11:29:20 */
#include "cswitches.h"
#include "cportab.h"
#include "cestack.h"
#include "cedit.h"
#include "cscred.h"
#include "cencod.h"
#include "ctred.h"
extern char msg[];
static VOID ende(a,b)
STACK *a,*b;
... |
C | /*
** EPITECH PROJECT, 2021
** B_CPP_300_BER_3_1_CPPD02M_karl_erik_stoerzel
** File description:
** func_ptr.c
*/
#include "func_ptr.h"
void print_normal(const char *str)
{
printf("%s\n", str);
}
void print_reverse(const char *str)
{
int len = (int)strlen(str);
for (int i = len - 1; i >= 0; i--)
{
... |
C | #include<stdio.h>
int main()
{
int arr[3][3],i,j,sum;
int *ptr;
ptr=&arr[0][0];
//input array elements
printf("The elements are:");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
scanf("%d",&arr[i][j]);
}
}
//access array elements
printf("\nThe matrix is:\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
... |
C | int i,j,a[]={1,4,3,7,5,9,8,3,10},*b;
void ft_sort_integer_table(int *tab, int size);
void ft_sort_integer_table(int *tab, int size){
for(i=0;i<size;i++){
for(j=i;tab[j]<tab[j-1];j--){
tab[j-1]=tab[j];
}
}
}
int main(){
b=a;
ft_sort_... |
C | #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
void getString(char a[]){
char c = '\0'; int i = 0;
while( (c = getchar()) != '\n'){
a[i++] = c;
} a[i] = '\0';
}
int StringToIntger(char a[]){
int i = 0;
int len = strlen(a);
int Integer = 0, sign = 1;
for (i = 0; i < len; ++i) {
... |
C | #include <stdio.h>
int cpuWordSize()
{
void *p = 0;
return sizeof(&p);
}
int main()
{
printf("CPU word size: %d\n",cpuWordSize());
return 0;
}
|
C | /*===============================================================================================
PlaySound Example
Copyright (c), Firelight Technologies Pty, Ltd 2004-2016.
This example shows how to simply load and play multiple sounds. This is about the simplest
use of FMOD.
This makes FMOD decode the in... |
C | //--------------------------------
// Lab 4 - Sample - Lab04_sample.c
//--------------------------------
//
//
#include "init.h"
#include <stdint.h>
#include <stdlib.h>
ADC_HandleTypeDef hADC3;
DAC_HandleTypeDef hDAC1;
uint32_t voltage=0;
//uint32_t x=0; //uint32_t with name of x, x_1, x_2 and putout are for C lan... |
C | #include <stdio.h>
void maior(float a, float b, float c)
{
float maior;
if(a > b && a > c)
maior = a;
else if(b > a && b > c)
maior = b;
else if(c > a && c > b)
maior = c;
printf("O numero maior e %.2f", maior);
}
int main()
{
float v[3];
for(int c = 0; c < 3; c++)... |
C | #include <stdio.h>
#include <dirent.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
void transverse_back(char *pathname, ino_t inum)
{
DIR *dp;
static char *pwd;
struct dirent *dir;
/*Base case - when the root has been reached return*/
if(strcmp("..",pathname) != 0)
retu... |
C | #include "mesinkata.h"
#include <stdio.h>
void BacaKata(KATA *X){
int i;
i = 0;
(*X).length = 0;
while ( (i < 100) && (KATA(*X,i-1) != '\n' )){ //Memasukkan Command ke variabel KATA atau nulis apapund deh
scanf("%c", &KATA(*X, i) );
(*X).length = (*X).length + 1;
i = i + 1;
}
(*X).length = (... |
C | #include<stdio.h>
int main()
{
int i,n,c=1;
scanf("%d",&n);
for(i=1;i<n;i++)
{
if(n%i==0)
{
c++;
}
}
if(c==2)
{
printf("is prime");
}
else
{
printf("is not prime");
}
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "check.h"
#include "test_centering_measure.h"
#include "eval_cent_meas.h"
#include "OpenBLAS/cblas.h"
#include "test_util.h"
#include "smatvec.h"
#include "umfpack.h"
#include "spmat.h"
#include "linear_solvers.h"
#include "barriers.h"
START_TEST (test_... |
C | /*
* UNIX threads
*/
#ifndef _AINTUTHR_H
#define _AINTUTHR_H
#include <pthread.h>
#include "allegro5/internal/aintern_thread.h"
#ifdef __cplusplus
extern "C" {
#endif
/* threads */
struct _AL_THREAD
{
/* private: */
pthread_t thread;
pthread_mutex_t mutex;
bool should_stop;
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <errno.h>
#include <signal.h>
#include <setjmp.h>
#defi... |
C | #include <stdio.h>
int average(int l, int a[l])
{
int sum = 0, i;
for (i = 0; i < l; i++)
{
sum += a[i];
}
sum /= l;
printf("ฦฝ %d", sum);
}
int main()
{
int i, l, a[l];
printf("\n");
scanf("%d", &l);
printf("ษผ\n");
for (i = 0; i < l; i++)
{
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* sdl_utils.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define CONST_Incidenza 50
#define CONST_Seguiti 50
#define CONST_Seguaci 1
#define CONST_SeguitiPesati 100
#define CONST_Sorensen 5
#define CONST_HDI 1
#define CONST_RA 100
#define CONST_RWR 100
#define CONST_RWRP 100
stat... |
C | /* _Fmtval function */
#include <limits.h>
#include "lr/locale.h"
#include <stdio.h>
#include <string.h>
/* marcos */
#define FN_INT_CUR -2 /* International Monetary Amount */
#define FN_LCL_CUR -1 /* Local Monetary Amount */
char *_Fmtval(char *buf, double d, int fdarg)
{
/* format number by locale-specific ... |
C | #include <stdio.h>
int main(){
int i, sum = 0;
int mean[] = {1,2,3,4,5};
for(i=0;i<5;i++){
sum = sum + mean[i];
}
int length;
length = ( sizeof(mean) / sizeof(mean[0]) );
sum = sum / length;
printf(" = %d\n", sum);
return 0;
}
|
C | #include <stdio.h>
int main(int argc, char const *argv[])
{
int n;
scanf("%d", &n);
float bil[n];
int depan[n];
int belakang[n];
int i;
for(i=0; i<n; i++){
scanf("%f", &bil[i]);
}
for(i=0; i<n; i++){
depan[i] = bil[i];
belakang[i] = (bil[i] - depan[i]) * 10 + .5;
}
int j=0;
while(j<n){
if((depan... |
C | #include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
#include <errno.h>
#include <string.h>
void* tmain(void* arg) {
printf( "[thread %08lx] thread group id (pid): %d\n",
(unsigned long)pthread_self(), getpid() ); // requires <unistd.h>
return NULL;
}
int main ( int argc, char*... |
C | /******************************************************************************/
/* */
/* COMPRESS.H */
/* ... |
C | //็ดๆฅๆๅ
ฅๆๅบ
void InsertSort(datatype arr[],int n)
{
for(i=2;i<=n;i--)
if(arr[i].key<arr[i-1].key)
{
arr[0]=arr[i];
for(j=i-1;arr[0].key<arr[j].key;j--)
arr[j]=arr[j+1];
arr[j+1]=arr[0];
}
}
//ๅๆณกๆๅบ
void bubblesort(datatpye arr[],int bgn,int end)
{
bool isLoop = true ;
for (int i = end; true == isLo... |
C | #include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
void forkExample()
{
// child process if it return 0 value
pid_t pid= fork();
if ( pid == 0){
pid_t pid= fork();
sleep(5);
if(pid == 0){
printf("\n\nHello from grand-Chi... |
C | /* Problem 139 = 10057761 */
#include <stdio.h>
#include "../algorithms.h"
#define MAXPERIMETER 100000000
int main() {
int m = 2;
int n = 1;
int a;
int b;
int c;
int k;
int answer = 0;
a = 2 * m * n;
b = m * m - n * n;
c = m * m + n * n;
do {
w... |
C | /*
** utils.h -- some useful wrapper functions
*/
#ifndef _UTILS_H
#define _UTILS_H
#include <stdio.h>
#include <ctype.h>
#include <netdb.h>
#include <string.h>
#include <unistd.h>
#include <sys/poll.h>
#include <arpa/inet.h>
/*
** read a '\n'-terminated line from a file into buffer, up to a max # of bytes
**
** @pa... |
C | #include<stdio.h>
int main(){
char* str[] = {"abc", "def", "xyz", "111", "222"};
for(int num = 0; num < 5; num++){
printf("%s\n",str[num]);
}
return 0;
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<stdlib.h>
void *mycalloc(unsigned, unsigned);
void *mycalloc(unsigned n,unsigned size)
{
unsigned i,nb;
char *p,*q;
nb = n * size;
if((p = q = malloc(nb)) != NULL)
for(i = 0; i <nb; i++)
*p++ = 0;
return q;
}
int main(int argc, char *argv[]) {... |
C |
#include <stdio.h>
#define CharArrayTo16(val, index) (val[index + 1] | val[index] << 8)
#define CharArrayTo24(val, index) (val[index + 1] << 8 | val[index + 2] | val[index] << 16)
#define CharArrayTo32(val, index) (val[index + 1] << 16 | val[index + 2] << 8 | val[index + 3] | val[index] << 24)
#define isNotBoundPad(... |
C | #include "SeqList.h"
int main(void){
SeqList sl = newList();
sl=insertAtFront(sl,5);
printList(sl);
sl=insertAtEnd(sl,21);
printList(sl);
sl=insertInOrder(sl,18);
sl=insertInOrder(sl,2);
sl=insertInOrder(sl,40);
printList(sl);
sl=deleted(sl,2);
printList(sl);
sl=deleted(sl,40);
printList(sl);
sl=d... |
C | //
// main.c
// 14_08 - refining prototypes
//
// Created by jim Veneskey on 2/3/16.
// Copyright ยฉ 2016 Jim Veneskey. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
// Prototypes are defined here
// note - no sample var names included, just their types
double func(double, double);
int main(int a... |
C | #include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/select.h>
#include <stdint.h>
#include <signal.h>
#include <unistd.h>
#include <sys/time.h>
#include <errno.h>
#include <string.h>
#include <math.h>
#include <pthread.h>
#include <stdlib.h>
#include ... |
C | #include <stdio.h>
#include <fcntl.h>
#include <zconf.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/mman.h>
int file;
char* buf;
void print_file (int sig) {
for (int i = 0; *(buf + i) != '\0'; ++i) {
printf("%c", *(buf + i));
}
exit(0);
}
int time_scan (int sec, char* input) {
signa... |
C | #pragma once
void sbus_setup() {
// The SBUS protocol uses inverted serial logic with:
// - Baud rate of 100000
// - 8 data bits
// - Even parity bit
// - 2 stop bits
HardwareSerial *bus = &Serial1;
bus->begin(100000, SERIAL_8E2);
bus->flush();
}
uint8_t sbus_read_byte() {
return Serial1.read();
}
... |
C | &a[0]=2000
&a[1]=2002
&a[2]=2004
&a[3]=2006
&a[4]=2008
a = constant pointer to the first element = &a[0] = 2000
a+1 = constant pointer to the second element = &a[0] + 1*sizeof(int) = 2000 + 2 =2002
a+2 = constant pointer to the third element = &a[0] + 2*sizeof(int) = 2000 + 4 =2004
a+3 = constant pointer to t... |
C | #include "binary_trees.h"
/**
* binary_trees_ancestor - find lowest common ancestor
* @first: first node to check
* @second: second node to check
*
* Return: the ancestor or NULL on failure
*/
binary_tree_t *binary_trees_ancestor(const binary_tree_t *first,
const binary_tree_t *second)
{
size_t df, ds;
... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "undos.h"
void struct2file(STACKUNDOS a, char *user)
{
char fname[200];
sprintf(fname, "/var/www/html/%sstack.txt", user);
STACKUNDOS ant = a;
FILE *fp;
fp = fopen(fname, "w");
while (ant != NULL)
{
fprintf(fp, "%d %d %d %d\n", ant->isSave, a... |
C | #include<stdio.h>
#include<conio.h>
void main()
{
int a;
char c;
int b;
scanf("%d%c%d",&a,&c,&b);
if(c=='/')
{
printf("%d",a/b);
}
if(c=='%')
{
printf("%d",a%b);
}
getch();
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_asigning.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include "Fila.h"
struct fila {
int capacidade; //Tamanho do array F
int ini; //Posicao do "primeiro" elemento
int fim; //Posiรงรฃo livre onde um elemento deve ser inserido
int n; //Nรบmero de elementos na estrutura
int *F; //Array... |
C | #ifndef __STRING_PICO_H_
#define __STRING_PICO_H_
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
extern size_t strlen(const char *s);
extern size_t strnlen(const char *s, size_t n);
extern char* strcpy(char* dest, const char *s);
extern char* strncpy(char* dest, const char* src, size_t n);... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <time.h>
uint64_t usec_diff(struct timeval start_time)
{
struct timeval tv;
gettimeofday(&tv,NULL);
return
(uint64_t)((tv.tv_usec + tv.tv_sec*1e6) -
(start_time.tv_usec + start_time.tv_sec*1e6));
}
... |
C | #include <stdio.h>
#include <string.h>
int main(){
char input[40] = "";
printf("Warning: do not strings this program, just input something:\n");
fgets(input, sizeof(input), stdin);
for(int i = 6 ; i < strlen(input)-2 ; i++){
input[i] = input[i] ^ 16;
}
if(!strcmp(input, "CGCTF... |
C | #include <stdio.h>
#define MAX 255
struct Book{
char bookName[255];
int bookID;
double bookPrice;
};
void push(struct Book* bookInstance,struct Book* bookArray,int* top){
if(*top==MAX-1){
printf("Stack Full!\n");
}else{
(*top)++;
bookArray[*top]=*bookInstance;
printf("Book has been added!\n");
}
}
st... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.