language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include "queue.h"
void insertq(Queue* q, int item)
{
int size = q->size;
if ((q->front == 0 && q->rear == size - 1) || (q->front == q->rear + 1))
{
printf("queue is full to insert %d", item);
display(q);
return;
}
else if (q->rear == - 1)
{
q->rear++;
q... |
C | #include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <string.h>
#define STR_SIZE 19
int main()
{
int file = open("ex1.txt", O_RDWR);
char str[19] = "This is a nice day";
char *map = mmap(NULL, STR_SIZE - 1, PROT_READ | PROT_WRITE, MAP_SHARED, file, 0);
ftruncate(fil... |
C | int len_list=0; //lunghezza della stringa formata dai nomi di tutti i file
struct nomeFile
{
char nome[50];
struct nomeFile *next;
};
void reverse(char s[]) //inverte l'ordine delle lettere di una stringa
{
int i, j;
char c;
for (i = 0, j = strlen(s)-1; i<j; i++, j--)
{
c = s[i];
s[i] = s[j];
s[... |
C | /*
* stack.c: a file that implements the fundamental operations on the stack such as
* adding and deleting elements
*
* NOTE: mainly used the dynamic memory files as a guide :)
* ANOTHER NOTE: this is the same stack from rpn but adapted for this hw
*
*/
#include "stack.h"
#include <stdio.h>
#include <stri... |
C | #include<stdio.h>
int main()
{
int n,i,j,k,h,l,a,b[50];
while(scanf("%d",&a)==1)
{
for(j=1;j<=a;j++)
{
h=0;
l=0;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&b[i]);
for(i=1;i<n;i++)
{if(b[i]>b[i-1])
h=h+1;
if(b[i-1]>b[i])
l=l+1;}
printf("Case %d: %d %d\n",j,h,l);
}
}
return 0;
}
|
C | /***************************************************************************//**
@file libstephen/log.h
@author Stephen Brennan
@date Created Sunday, 24 May 2015
@brief Logging facilities for libstephen.
@copyright Copyright (c) 2015-2016, Stephen Brennan. Released under ... |
C | /*======================================================================
BVIS(A,n)
BETA-digit vector insertion sort.
Inputs
A : An array of pointers to m vectors of n BETA-digits.
m : A positive BETA-digit.
n : A positive BETA-digit.
Side Effects
Rearranges the pointers in A so that the vect... |
C | #include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
int main(void)
{
int out;
out = open("file1B.in",O_WRONLY|O_CREAT,S_IRUSR|S_IWUSR);
for(int i = 0; i < 1; i++){
write(out,"a",1);
}
out = open("file4KB.in",O_WRONLY|O_CREAT,S_IRUSR|S_IWUSR);
for(int i = 0; i < 4096; i++){
write(out,"b",1);
}
ou... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
//definicao da estrutura
typedef struct aluno {
char* nome;
int matricula;
float p1;
float p2;
float p3;
} Aluno;
void imprime_aprovados (int n, Aluno** turma){
float mediaAluno;
printf("\nAPROVADOS:\n");
for(int i=0; i<n; i++)... |
C | // Replace tabs by \t, backspace by \b, backslash by \\
#include<stdio.h>
#include<string.h>
#define STATE0 0
#define STATE1 1
int main(void){
char str[50];
int len;
int state = STATE0;
printf("Enter the input string: ");
gets(str);
len = strlen(str);
char *p = str;
while(*p){
switch(*p){
... |
C | /*ROUSSEAU ET GOUGEON*/
#include <stdio.h>
#include <stdlib.h>
#include "listchar.h"
int main(/*int argc, char const *argv[]*/) {
listchar listeTest = newListe();
if (isEmpty(listeTest)) {
printf("Liste est vide\n");
} else {
printf("Liste non vide\n");
}
addCharNext(listeTest, 'c');
addCharNext... |
C | #include <stdio.h>
#include <stdlib.h>
#include "task_types.h"
#include "edf/edf.h"
#include "rm/rm.h"
#include "dm/dm.h"
#define RESULTS_FILE_EDF "out/results_edf.txt"
#define RESULTS_FILE_RM "out/results_rm.txt"
#define RESULTS_FILE_DM "out/results_dm.txt"
/*
* FORWARD DECLARATIONS
*/
ProgramInfo parseFile(c... |
C | /*
Name: cardtest4.c
Author: Duy Nguyen
Date: 4/26/2015
Assigiment 2 - CS 362
Program: Testing the VILLAGE card
*/
#include "assert.h"
#include "dominion.h"
#include <stdio.h>
#include "rngs.h"
#include <stdlib.h>
#include <math.h>
int main (int argc, char** argv) {
struct gameState *q = newGame();
i... |
C | #include "rf.h"
#include "../oled/oled.h"
uint8_t rf_buffer[RF_BUFFER_SIZE];
uint8_t rf_length = 0;
uint8_t rf_rssi = 0;
uint8_t rf_crc = 0;
uint8_t map(uint8_t x, uint8_t in_min, uint8_t in_max, uint8_t out_min, uint8_t out_max)
{
return (uint8_t)(((int)x - (int)in_min) * ((int)out_max - (int)out_min) / ((int)... |
C | #include "binary_trees.h"
/**
* binary_tree_delete - delete a tree
* @tree: address of the root
* Return: a pointer to the new node, or NULL on failure
*/
void binary_tree_delete(binary_tree_t *tree)
{
if (tree != NULL)
{
if (tree->left != NULL)
binary_tree_delete(tree->left);
if (tree->right != NULL)
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf_d.c :+: :+: :+: ... |
C | //
// main.c
// 07project10
//
// Created by cappuccino on 2020/11/26.
//
#include <stdio.h>
#include <ctype.h>
int main(int argc, const char * argv[]) {
int num = 0;
char ch;
printf("Enter a sentence:");
while ((ch = getchar()) != '\n') {
ch = toupper(ch);
switch (ch) {
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <glib.h>
#include <string.h>
#include "tm_internal.h"
#include "tm_lib.h"
struct tag*
tma_tag_read(int id)
{
return (struct tag*) tma_read(TAG, id);
}
GSList*
tma_tag_read_all()
{
return tma_list(TAG);
}
struct tag*
tma_tag_create(char* description)
{
struct tag* t ... |
C | #include<stdio.h>
#include<string.h>
#include<math.h>
void main()
{
int n,i,m;
float sum=0,x,c,a[20];
printf("enter the order of polynomial1\n");
scanf("%d",&n);
for(i=0;i<=n;i++)
{
printf("enter the coff. of x^%d\n",i);
scanf("%f",&a[i]);
}
printf("enter the order of polynomial2\n");
scanf("%d",&m);
for(i=0;i<=m;i... |
C | /*
ID: nasiles1
LANG: C
TASK: comehome
*/
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#define INF 99999999
int a[60][60], p, visit[60], d[60];
int ord(char c)
{
if (islower(c)) return c - 'a';
else return c - 'A' + 26;
}
int main()
{
FILE *fin = fopen("comehome.in", "r");
FILE *fout = ... |
C | /*======================================================================
PTRADV2(L; a,b,Lp)
Advance 2. (assuming first two elts of L are pointers)
Inputs
L : a list of length 2 or more. (first two elts are pointers)
Outputs
a : the first element of L.
b : the second element of L.
... |
C | /*
* This file is a part of the EpsiFlash Copyright (c) 2000-2007 Michal
* Szwaczko, WireLabs Systems contact: mikey@wirelabs.net
*/
/*#include <ctype.h>*/
#include "chips.h"
#include "hardware.h"
extern struct chiptable chips[];
extern unsigned char control;
extern void generic_probe(void);
int chipi... |
C | #include<stdio.h>
void main(){
int array[10]={11,21,21,41,41,61,71,71,91,91};
int i=0;
int j;
for(j=0;j<10;j++){
if(array[j] != array[i]){
i++;
array[i]=array[j];
}
}
int n=i+1;
for(int k=0;k<n;k++){
printf("%d ",array[k]);
}
} |
C | #include <stdio.h>
#include <pthread.h>
#include <unistd.h>
#include <sys/wait.h>
#include <stdlib.h>
void *hilo(void *arg);
void *hilo2(void *arg);
void *hilo3(void *arg);
int main(void)
{
pthread_t id_hilo;
pid_t pid;
int i=0,status;
char *cad="Practica 5";
char *cad2="";
if((pid=fork())==0)
... |
C | #include<stdio.h>
main(){
int array[20] = {25,12,86,19,6,2,8,11,29,45,7,9,15,18,50,34,70,65,1,4};
int search, c, count = 0;
int index[20];
for(c=0;c<20;c++){
printf("%d,",array[c]);
}
printf("\nmasukkan nilai yang dicari : ");
scanf("%d",&search);
for(c=0;c<20;c++){
if(array[c]==search){
index[coun... |
C | // ahnentafel.c implements the conversions of numbers and genealogy!
// @author: exl2748 Erica LaBuono
// // // // // // // // // // // // // // // // // // // // // // // //
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
#include <ctype.h>
#include <string.h>
#define MAXLENGTH 285
// ... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<time.h>
char inputChar()
{
char c;
c = (char)((rand() % 94) + 32); // produces a character b/w ( and }
return c;
}
char *inputString()
{
char* consonants = "bcdfghjklmnpqrstvwxyz";
char* b = "aeioubt";
char* c = "aeioukhc... |
C | #include "common_include.h"
#include "ncode_hexa.h"
#include "ncode_base64.h"
#include "ncoder.h"
int Ncode(NCODE_TYPE eNcodeType, void *pstArgs, int szArgs)
{
if (eNcodeType == NCODE_TYPE_HEXA)
{
if (sizeof(NCODE_TYPE_HEXA_ARGS) != szArgs)
{
fprintf(stderr, "sizeof(NCODE_TYPE_HEXA_... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../jsmn.h"
//구조체 타입 선언
typedef enum {
C_FOOD = 0,//set
C_SET =1 //food
}mycategory_t;
typedef struct {
mycategory_t cat; //메뉴분류//cat=0이면 food
char name[20]; // 메뉴명
char size[10]; // 사이즈
int price; //가격
}mymenu_t;
void printmenu(mymenu_t... |
C | #pragma once
#include <stdlib.h>
#include "list.h"
/* Linked list Stack */
/* ġ */
#define stack_peek(stack) ((stack)->head == NULL?NULL:(stack)->head->data)
/* Push */
/* linked list head */
int stack_push(Stack* stack, const void* data)
{
return list_ins_next(stack, NULL, data);
}
/* pop */
/* linked... |
C |
#ifndef __TIMER_WRAP__
#define __TIMER_WRAP__
#include <signal.h>
#include <time.h>
#include <unistd.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
typedef enum{
TIMER_INIT,
TIMER_DELETED,
TIMER_PAUSED,
TIMER_CANCELLED,
TIMER_RESUMED,
TIMER_RUNNING,
} TIMER_STATE_T;
typedef enum{
SUCCESS... |
C | #include "expr_assert.h"
#include "CRevision.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
void test_fibonacci_returns_1_for_1(){
int *array;
array= (int *)malloc(sizeof(int));
assertEqual(fibo(1,array),1);
assert(array[0]==0);
assert(array[1]!=1);
free(array);
}
void test_fibonacci_returns_0_f... |
C | #include<stdio.h>
void main() {
char *color[6] = { "red", "green", "blue", "white", "black", "yellow"};
printf("color gives base addres of given array of char pointers :%u\n", color);
printf("(color+2) gives address of 3rd element of array of char pointers :%u\n",(color + 2));
printf("*color gives the 1st string :%... |
C | #include <stdio.h>
#include <stdlib.h>
#define OK 1
#define ERROR 0
typedef int Status;
typedef int ElemType;
typedef struct Gnode{
int tag:1;
union{
int atom;
struct Gnode *hp,*tp;
};
} *Glist;
int getLength(Glist G){
if(G!=NULL){
return 1 + getLength(G->tp);
}
return 0;
}
int getDepth(Gli... |
C | #include <stdio.h>
#include <stdlib.h>
#include <ncurses.h>
typedef struct node{
char c;
int id;
struct node *nextNode;
int myx, myy;
}node;
int row, col;
int x ,y;
FILE *fp;
WINDOW *topbar, *textbox, *bottombar, *textOuter;
struct node* array = NULL, *end = NULL, *tmp = NULL;
int total = 0;
int posX... |
C | ///*
//
//#########################
//# #
//# OMANSAK #
//# #
//#########################
//
//Queue (First in,First Out) : https://www.tutorialspoint.com/data_structures_algorithms/dsa_queue.htm
//
//*/
//
//
//
//#include <stdio.h>
//#include <s... |
C | #ifndef _BOX_H
#define _BOX_H
#include "data.h"
#include "nets.h"
#define DEFOLT_DATA_ELEM_SIZE 4
//coord(i, j, k, n) -> (i * n_j * n_k + j * n_k + k) * n_n + n
//coord(n, i, j, k) -> n * n_i * n_j * n_k + i * n_j * n_k + j * n_k + k
typedef struct box_t{
point_t start;
double step;
int borders[3];
int nets_... |
C | // https://www.urionlinejudge.com.br/judge/en/problems/view/2775
#include <stdio.h>
void swap(int *a, int *b)
{
int c = *a;
*a = *b;
*b = c;
}
int main()
{
int N;
int packets[1000], times[1000];
int i, swapped, total_time;
while (scanf("%d", &N) != EOF) {
total_time = 0;
... |
C | int dfs(int row, int n, int col_used, int dia1_used, int dia2_used)
{
if (row == n)
return 1;
int res = 0, pos = 1 << n;
for (int i = 0; i < n; ++i) {
pos >>= 1;
if (col_used & pos || dia1_used & pos || dia2_used & pos)
continue;
res += dfs(row + 1, n, col_used | ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <sys/time.h>
#include "thingmodule.h"
#define max(a,b) (((a) (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
/* Subtract the ‘struct timeval’ values X and Y,
* storing the result in RESULT.
* Return 1 if the di... |
C | // opal.c
// Yinghong Zhong
#include <stdio.h>
typedef struct {
int day, mon, year;
} Date;
typedef struct {
int hour, minute;
} Time;
typedef struct {
int transaction_nb;
char weekday[4]; //Mon, Tue...Sun
Date date;
Time time;
char mode; // 'B', 'T'
char start_stop[32];
char en... |
C | //updated by Circe 5/26/04 with new desc, lore, radiate magic, etc.
#include <std.h>
inherit POTION;
int num;
int side_effect();
void create() {
::create();
add_id("potion of raging heal");
add_id("raging heal");
add_id("reddish gold potion");
add_id("reddish gold");
set_obvious_short("%^RED%^A m... |
C | /***************************** MPEG-4 AAC File Parser ************************
Author(s): Arlon Lee
Description: AAC File Parser interface
*******************************************************************************/
#include <stdlib.h>
#include <string.h>
#include "aac_file_parser.h"
#define MAX_CHANN... |
C | /*****************************************************************************/
/*** fichier: testvar.c ***/
/*** Calcul de variance ***/
/*****************************************************************************/
... |
C | #include<stdio.h>
#include<string.h>
#include<stdbool.h>
#include<stdlib.h>
void subject(int index);
void mention(float score);
bool checkScore(int score);
bool numOnly(char *score);
void pass(float average);
int main(){
char score[20];
int total = 0, points;
for(int i = 0; i < 5; i++){
subject(i)... |
C | #ifndef _GC_H_
#define _GC_H_
// Ce fichier contient l'interface de votre ramasse-miettes
// La fonction gcmalloc doit renvoyer un nouvel objet.
// Vous vous servirez de la fonction pre_malloc qui se trouve dans
// les fichiers alloc.h et alloc.c.
// Si vous commencez à manquer de place,
// vous devez déclancher une ... |
C | #include "types.h"
#include "stat.h"
#include "user.h"
int
main(int argc, char* argv[]){
if(fork()==0){
while(1){
write(1, "Child\n", 7);
yield();
}
}
else{
while(1){
printf(1, "Parent\n", 8);
yield();
}
}
return 0... |
C | /*
** EPITECH PROJECT, 2018
** libmy
** File description:
** is_upper.c
*/
#include <criterion/criterion.h>
#include "my/char.h"
Test(Char, is_upper)
{
cr_expect(is_upper('\0') == false);
cr_expect(is_upper('\t') == false);
cr_expect(is_upper('\n') == false);
cr_expect(is_upper(' ') == false);
cr_expect(is_upper... |
C | #include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <string.h>
#define MAX_BS 1000
int bstoi(const char *);
char * itobs(int, char *);
char * tail(int n, char *); // remove n first char
int main(int argc, char * argv[])
{
int a, b;
int lena, lenb;
int len;
char BS_result[MAX_BS];
if (argc != 3) {... |
C | #include "../include/freq.h" /* needed for freq_t */
#include "../include/arbre.h" /* needed for arbre_t */
#include "../include/coding.h" /* constuirecodage */
#include <stdlib.h> /* exit, NULL */
#include <stdio.h> /* FILE*, fopen, fclose*/
void parcours_arbre(arbre_t arbre){
if(!arbre) return;
parcours_arbre(le... |
C | #include "threadPool.h"
/* Data structure */
/* Internal methods */
static void* threadPoolThread(void* tp){
ThreadPool* pool = (ThreadPool*)(tp);
for(;;)
{
pthread_mutex_lock(&(pool->lock));
/* Handle waiting for work RUNNING and SOFT_SHUTDOWN */
while ((pool->state == RUN... |
C | /*
** get_next_line.c for get_next_line.c in /home/ibanez_j/CPE_2016_getnextline
**
** Made by Jean-Alexandre IBANEZ
** Login <ibanez_j@epitech.net>
**
** Started on Fri Jan 6 15:36:54 2017 Jean-Alexandre IBANEZ
** Last update Thu Feb 02 18:08:22 2017 Benjamin BRIHOUM
*/
#include <stdlib.h>
#include <unistd.h>
#in... |
C | #include<stdio.h>
void main(){
int point1,point2,point3,point4,point5;
int val;
printf("Points for
point1,point2,point3,point4,point5\n");
scanf("%d,%d,%d,%d,%d"
"&point1,&point2,&point3,&point4,&point5");
val = point1+point2+point3+point4+point5;
printf("%f\n",val);
}
/*
Output-
pradnya@pradnya-Latitude-3480... |
C | #include <stdio.h>
int main( )
{
FILE *fp ;
char path[100];
char ch;
printf("Enter the file path: ");
scanf("%s",path);
fp = fopen ( path, "r" ) ;
while ( 1 ){
ch = fgetc ( fp ) ;
if ( ch == EOF )
break ;
printf ( "%c", ch ) ;
}
printf ( "\n" ) ;
fclose ( fp ) ;
} |
C | #include <stdio.h>
int ft_atoi(char *str)
{
int nombre;
int signe;
char *charptr;
nombre = 0;
signe = 1;
charptr = str;
while (*charptr == ' ' || (*charptr >= 9 && *charptr <= 13))
charptr++;
while (*charptr == '-' || *charptr == '+')
{
if (*charptr == '-')
signe *= -1;
charptr++;
}
while (*cha... |
C | #include "movement.h"
int mod (int n, int div)
{
int r = n % div;
return r < 0 ? r + div : r;
// return (x % N + N) % N;
}
struct vector movement (enum direction d, struct vector v)
{
struct vector v2 = {v.x, v.y};
switch (d) {
case UP:
v2.y--;
break;
case RIGHT:
v2.x++;
break;
case DOWN:
v2.y++;
... |
C | #include <sys/wait.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
int main()
{
pid_t pid;
if((pid = fork()) < 0)
{
perror("fork error");
exit(1);
}
if(pid == 0)
{
sleep(30);
exit(2);
}
else
{
int status;
pid_t ret = wai... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <arpa/inet.h>
char *ip2str(unsigned int ipv4, char *str_ip, unsigned int str_len)
{
if (str_ip == NULL || str_len < 16) {
return NULL;
}
sprintf(str_ip, "%d.%d.%d.%d", (ipv4>>24)&0xff, (ipv4>>16)&0xff,
(ipv4>>8)&0xff, ... |
C | #define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
int main(int argc, char **argv)
{
FILE *fp;
char *line;
char ssid[16];
char passwd[16];
size_t rlen;
if(argc < 2){
printf("%s [FILE PATH]\n", argv[0]);
return -1;
}
fp = fopen(argv[1], "r");
assert(fp);
... |
C | /*****************************
FLAG - @
ESC - !
****************************/
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MSGSZ 1024
#define FLAG '@'
#define ESC '!'
struct message_buf
{
long mtype;
char s[MSGSZ];
};... |
C | #include "common.h"
#define ETEST 7
void test(int level)
{
extern int item[3], scorearray[SCHSIZE][ASIZE], gobackstart;
extern int TotalScore, O_X[MAX_Q];
extern char sch[SCHSIZE][SIZE];
char word[SIZE], input[SIZE];
int key, addtime = 0, num;
int result, x;
//
resetOX();
// ̾ƿ
sys... |
C | #include "simulador_de_festa.h"
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
#include "aluno.h"
void cria_threads_alunos(int numero_alunos);
void cria_thread_seguranca();
void lanca_threads();
int global_max_tempo_chegada;
int global_max_tempo_sala;
int global_max_tempo_ronda;
vo... |
C | #include <time.h>
#include "timer.h"
int start_time;
void timer_start(){
start_time = time(NULL);
}
int timer_check(){
return difftime(time(NULL), start_time) > 3 ? 1 : 0; //Er det noe lurt som skjer her? Kommentar?
} |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_modif_len.c :+: :+: :+: ... |
C | #define MAXQUEUE 5
struct state_t { int a[MAXQUEUE]; int front; int rear; int size; };
#define assume_ibeta() \
__VERIFIER_assume(s1.front >= 0); \
__VERIFIER_assume(s1.front <= 5 -1);\
__VERIFIER_assume(s1.rear >= 0); \
__VERIFIER_assume(s1.rear <= 5 -1); \
__VERIFI... |
C | #include<dirent.h>
#include<unistd.h>
#include<sys/types.h>
#include<stdlib.h>
#include<stdio.h>
int main(int argc,char *args[]){
DIR *sima;
struct dirent *dalao;
if(argc!=2)
printf("usgae: directory_name");
sima=opendir(args[1]);
if(sima==NULL)
printf("Can't open %s",args[1]);
... |
C | #include <stdio.h>
#include <string.h>
/*int main(void)
{
char *pc;
int *pi;
double *pd;
printf("*pc ũ : %d\n", sizeof(pc));
printf("*pd ũ : %d\n", sizeof(pi));
printf("*pd ũ : %d\n", sizeof(pd));
printf("char* ũ : %d\n", sizeof(char*));
printf("short* ũ : %d\n", sizeof(short*));
printf("int* ũ : %d\n", size... |
C | #include <vxWorks.h>
#include <sysLib.h>
#define nelem(x) (sizeof(x) / sizeof(x[0]))
static void
serialprint(const char *str)
{
int port;
size_t i;
port = 0x3f8;
for (i = 0; str[i]; i++)
sysOutByte(port, str[i]);
}
static int
stoib(char *buf, unsigned long long val, unsigned long long base)
{
static const ch... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>
int leap_year(int year)
{
if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0)
{
return 1;
}
else
return 0;
}
int main()
{
int y = 0;
printf("ݣ");
scanf("%d", &y);
if (leap_year(y) == 1)
{
printf("\n");
}
else
{
printf("\n");... |
C | /**
* @file main.c
* @author Jiangwen Su <uukuguy@gmail.com>
* @date 2014-11-07 23:47:06
*
* @brief
*
*
*/
#include "common.h"
#include "daemon.h"
#include "filesystem.h"
#include "sysinfo.h"
#include "logger.h"
static char program_name[] = "edbroker";
typedef struct{
const char *frontend;
c... |
C | /**
libsmacker - A C library for decoding .smk Smacker Video files
Copyright (C) 2012-2021 Greg Kennedy
See smacker.h for more information.
smacker.c
Main implementation file of libsmacker.
Open, close, query, render, advance and seek an smk
*/
#include "smacker.h"
#include "smk_malloc.h"
#include <assert.... |
C | struct node
{
int info;
struct node *next;
};
struct node *create(struct node *head)
{
struct node *p=NULL,*temp=NULL;
int i,n;
printf("How many values\n");
scanf("%d",&n);
temp=head;
printf("Enter the actual value\n");
for(i=0;i<n;i++)
{
p=((struct node *)malloc(sizeof(struct node)));
scanf("%d",&p->info);
p->next=NU... |
C | #include <stdio.h>
int main(){
int n,count=0;
int p=789456;
scanf("%d",&n);
int c[n];
for(int i=0;i<n;i++){
scanf("%d",&c[i]);
}
for(int i=0;i<n-1;i++)
{
for(int j=i+1;j<n;j++)
{
if(c[i]==c[j])
{
count++;
... |
C | /***********************************************************************
**
** REBOL [R3] Language Interpreter and Run-time Environment
**
** Copyright 2014 Atronix Engineering, Inc
** REBOL is a trademark of REBOL Technologies
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not us... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#define MAX_String 1024
int My_strlen (const char* str)
{
int size = sizeof(*str);
const char* temp = str;
while ((*str != '\0') && (*str != '\n')) {
str++;
}
return ((str - temp)/size);
}
char* My_strncpy(char* dest, const ch... |
C | /* ----------------------------------------------------------------------------
FILE: lcdlib.c
PROJECT: pinguino32
PURPOSE: LCD routines for use with pinguino 32X board
Based on LiquidCrystal lib from Arduino project.
PROGRAMER: Port by Marcus Fazzi (anunakin@ieee.org)
FIRST RELEASE: 30 May 2011
U... |
C | #include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <cs50.h>
int main(void)
{
int count = 0;
int words = 1;
int sentences = 0;
//Prompt for text input
string text = get_string("Text: ");
// caclculate and print text length
for (int i = 0, len = strlen(text);... |
C | #include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "unity.h"
#include "Token.h"
#include "Error.h"
#include "read_file.h"
#include "Tokenizer.h"
#include "Exception.h"
#include "getStrToken.h"
#include "linkedList.h"
#include "handlePinMappingDesc.h"
#include "handlePortDescription.h... |
C | #include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
int CalcGCD(int);
int GetMultiplicativeInverse(int);
int main()
{
int i, j, k, gcd, alpha, beta, numstr[100], numcipher[100], alphaInverse;
char str[100], cipher[100];
printf("Enter a string\n");
gets(str);
... |
C | #include <stdio.h>
#include <string.h>
#pragma warning(disable :4996)
//
//// ȯ ḮƮ
//typedef int ElementType;
//typedef struct tagNode
//{
// ElementType Data;
// struct tagNode* PrevNode;
// struct tagNode* NextNode;
//} Node;
//Node* CreateNode(ElementType NewData)
//{
// Node* NewNode = (Node*)malloc(sizeof(Node)... |
C | #ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <winsock2.h>
#include <windows.h>
#include <ws2tcpip.h>
#include <iphlpapi.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#pragma comment(lib, "Ws2_32.lib")
#define BUFLEN 1024
char ADDRESS[16]; // 255.255.255.255, 15 characters
i... |
C | #include "uri/uri.h"
#include <stdlib.h>
typedef int (*yyrule)();
extern int yyparse();
extern int yyparsefrom(yyrule);
extern int yy_start();
extern const char *charbuf; /* Buffer of characters to be parsed. */
extern uri_t *parse_result; /* Results of parse. */
uri_t *parse_uri(const char *input) {
charbuf = inpu... |
C | #include "ft_printf.h"
/*
** @brief Reset buffer if size + len >= BUFFER_SIZE
** @param core
** @param len
*/
void reset_buffer(t_core *core, size_t len)
{
size_t size;
size = ft_strlen(core->buffer);
if ((size + len) >= BUFFER_SIZE)
{
write(core->fd, core->buffer, ft_strlen(core->buffer));
ft_bzero(core-... |
C | #include <stdio.h>
int main()
{
int x;
for(x=100 ; x>=1 ; x--)
printf("%d\n",x);
}
|
C | /*
* Ramp.c
*
* Created on: Mar 22, 2021
* Author: Rasmus Bank Mikkelsen
*/
/* Includes */
#include <math.h>
#include <stdio.h>
#include <stdint.h>
#include "Throttle.h"
#include "main.h"
/* External Variables */
float f_dutyCapRAMP;
uint16_t uint16_throttleCalcRAMP;
/* Internal Variable... |
C | ////////////////////////////////////
// Problem Satement : Program to accept filename from user and write to it
///////////////////////////////////
#include<stdio.h>
#include<unistd.h> //universal standard library
#include<fcntl.h> //file control open,close etc
#include<string.h>
int main(int argc, char ... |
C | #include <stdio.h>
int t,r;
double s;
int main(void) {
scanf("%d",&t);
while(t--)
{
scanf("%d",&r);
s=(8.0*(2.0-pow(2,0.5))*r*r*r);
printf("%0.4lf\n",s);
}
// your code goes here
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
int maxInts(int numArgs, ...) {
va_list args;
va_start(args, numArgs);
int i = 1;
int max = va_arg (args, int);
while (i < numArgs)
{
int maybe_max = va_arg (args, int);
if (maybe_max > max){
max = maybe_ma... |
C | /*
** buil.c for buil in /home/pignol_r/Epitech/rendu/PSU_2015_minishell2
**
** Made by pignol_r
** Login <pignol_r@epitech.net>
**
** Started on Fri Apr 1 18:14:53 2016 pignol_r
** Last update Tue Apr 12 14:47:39 2016 pignol_r
*/
#include <stdlib.h>
#include <unistd.h>
#include "my.h"
#include "prototype.h"
void... |
C | #include<stdio.h>
// programa que recebe a altura da piramide e imprime a mesma
int main(void)
{
int i=0,j=0,altura=0;
printf("digite a altura da piramide: \n");
scanf("%d", &altura);
printf("\n");
for(i=0;i<altura;i++) // controla cada camada da piramide
{
for(j=0;j<=i;j++) // impri... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_mlx_sphere.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
double findMedianSortedArrays(int *nums1, int nums1Size, int *nums2, int nums2Size)
{
int mid = (nums1Size + nums2Size) / 2;
if (mid == 0)
{
if (nums1Size == 0)
return nums2[0];
if (nums2Size == 0)
return nums1[0];
}
int... |
C | void addPointers(int* res, int* b, int* a)
{
*res = *a + *b;
} |
C | #include <stdio.h>
int main(int argc, char* argv[]){
FILE* input = fopen(input_ex2.txt, "r");
FILE* output = fopen(output_ex2.txt,"w");
char c;
fseek(input,-1,SEEK_END);
while((c=fgetc(input)) != EOF){
fputc(c,output);
fseek(input,-2);
}
fseek(input,0,SEEK_SET);
fputc(fgetc(input),output);
fclose(input);... |
C | /*
** utils.c for corewar in /home/flavian.gontier/Tek1/C_Prog_Elem/CPE_2016_corewar_vm/src/vm/virtual_machine
**
** Made by flavian gontier
** Login <flavian.gontier@epitech.eu@epitech.net>
**
** Started on Sun Apr 02 15:39:13 2017 flavian gontier
** Last update Sun Apr 02 16:36:51 2017 flavian gontier
*/
#inclu... |
C | //Call by reference
#include<stdio.h>
void cbr(int*,int*);
int main(){
int a=2,b=3;
printf("\t@@@@Call by reference@@@@");
printf("\nValues of a and b before calling function cbr(): a=%d b=%d",a,b);
cbr(&a,&b);
printf("\nValues of a and b after calling function cbr(): a=%d b=%d",a,b);
return 0;
}
void cbr(int *x... |
C | /*
* Logic: Print pyramid using *.
*
Sample output:
Example 1:
> /path/ ./a.out
5
*
* * *
* * * * *
* * * * * * *
* * * * * * * * *
> /path/
*/
#include <stdio.h>
void func(int rows);
int main()
{
int i,space,rows;
scanf("%d",&rows);
func(rows);
re... |
C | #include <TF1.h>
Double_t ArScintillationSpectrum( const Double_t* k, Double_t *par)
{
Double_t waveL;
Double_t kk=k[0];
waveL =exp(-0.5*((kk-128.0)/(2.929))*((kk-128.0)/(2.929)));
return waveL;
}
// Calculates the dielectric constant of LAr from the Bideau-Sellmeier formula.
// See : A. Bideau-Mehu et al., ... |
C | /* dmdo - this will become entry point for rd7 ?? */
/* receives dm file pointer, file opened with wb attribute,
** pointer to data buffer and length of input buffer
****************************************************/
/****************************************************************
** header segment is based upon D... |
C | /*
* UART.c
*
* Created on: 8 wrz 2014
* Author: MiCkl
*/
#include "UART.h"
void USART_Init( unsigned int ubrr )
{
/*Set baud rate */
UBRRH = (unsigned char)(ubrr>>8);
UBRRL = (unsigned char)ubrr;
/*Enable receiver and transmitter */
UCSRB = (1<<RXEN)|(1<<TXEN);
/* Set frame format: 8data, 1stop bit */
UCS... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.