language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include "hospital.h"
int main () {
int med, mdc, pac, op, op2, cod, i;
Medico *medicos;
Paciente *pacientes;
Medicamento *medicamentos;
Criar_Lista_Vazia_pac(&L);
Carregar_Arquivo_Pac (X);
Ponteiro_pac P;
med = mdc = pac = 0;
op = Menu_Principal();
do{
switch(op){
case 1:
system ("clear");
... |
C | #include <stdio.h>
#include "test_lib.h"
void assert_void_int_equal(Void_ptr actual, Void_ptr expected){
printf("%s", *(int *)actual == *(int *)expected ? " ✅" : " ❌");
};
void assert_void_char_equal(Void_ptr actual, Void_ptr expected){
printf("%s", *(char *)actual == *(char *)expected ? " ✅" : " ❌");
};
void as... |
C | /*******************************************/
/* Programma per l'ordinamento di un array */
/*******************************************/
/*****************************/
/* Inclusione delle librerie */
/*****************************/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
/**********************... |
C | #include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv) {
double width, height;
printf("width = ");
scanf("%lf", &width);
printf("height = ");
scanf("%lf", &height);
double perimeter = 2 * width + 2 * height;
double area = width * height;
printf("perimeter = %.1lf\nare... |
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "threechessgame.h"
char a[3][3] = { '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0' };
int main()
{
srand((unsigned int)time(NULL));
int input = 0;
do{
menu();
scanf("%d", &input);
swit... |
C | #include <stdio.h>
int main()
{
int linha,coluna,n=0,maior=0,matriz[10][10], mlinha, mcoluna;
for (linha=0; linha < 10; linha++)
{
for(coluna=0; coluna<10; coluna++)
{
n++;
matriz[linha][coluna] = n;
if(matriz[linha][coluna] > maior)
{
maior = matriz[linha][coluna];
mlinha = linh... |
C | #include <stdint.h>
#include <stdio.h>
#include "platform.h"
#include "uart.h"
#include "util.h"
// 8-bit SAE J1850 CRC
unsigned char crc8(unsigned char *data, int length) {
/*
* 8-bit CRC calculation
* polynomial : 0x1D
* initial value : 0xFF
* reflect input : no
* reflect result : no
* XOR value ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define NROWS 8
#define NCOLS 7
int average, power[NROWS][NCOLS], smallest, greater;
int i=0,j=0,k=0;
int main()
{
//open that bad boi up
FILE * power1 = fopem("power1.dat", "rt");
//did it open?
if (!power)
{
prin... |
C | #include<stdio.h>
main() {
int hour,mnt;
printf("enter your time(24): ");
scanf_s("%d:%d", &hour, &mnt);
printf("the time(12) is %d:%d", hour > 12 ? hour - 12 : hour, mnt);
} |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utility.c :+: :+: :+: ... |
C |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef FORTIFY
#include "fortify/fortify.h"
#endif
#include "base/result.h"
#include "base/utils.h"
#include "utils/array.h"
#include "datastruct/ntree.h"
#include "test/all-tests.h"
/* ---------------------------------------------------------------------... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(){
float a, b, c, f1, h1, h2;
printf("\n *** USO DE LA ECUACION CUADRATICA ***\n\n");
printf(" Hola usuarios :3, Bienvenidos!!\n");
printf("\n El dia de hoy vamos hallar las raices de una ecuacion cuadratica utilizando la formula genera... |
C | int main() {
unsigned char a, b;
int result;
a = 1;
b = 2;
result = a + b;
printf("a,b,result = %d,%d,%d\n",a,b,result); /* SF030514 */
} |
C | /**
* I2C bus scan.
*
* Scans the bus by addressing each of the possible device ids.
* Reports a device as found if it responds with an ACK. This
* is useful if we have a new device and want to check if it
* is there and active.
*
* @author Matthias L. Jugel
* @date 2016-04-01
*
* Copyright 2016 ubirch GmbH ... |
C | #include <stdlib.h>
#include <string.h>
#include "source.h"
int* join_arrays(unsigned int n1, const int* a1,
unsigned int n2, const int* a2,
unsigned int n3, const int* a3) {
int* array = malloc((n1+n2+n3)*sizeof(int));
memcpy(array, a1, n1*sizeof(int));
memcpy(array+n1, a2, n2*sizeof(int));
memcpy(array+n1... |
C | //
// Created by Ahmed on 18-Aug-16.
//
#ifndef INTERPRETER_TERM4_STACK_POSTFIX_TO_INFIX_H
#define INTERPRETER_TERM4_STACK_POSTFIX_TO_INFIX_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define TYPE char
#define MAXSIZE 100
char postFix[100] = {'\0'};
typedef struct doubleStack {
... |
C | //==============================================================================
//
// File : AHC_VersionEx.c
// Author : Caesar Chang
// Revision : 1.0
//
//==============================================================================
/*==============================================================... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
int main(int argc, char * argv[])
{
char buff[256];
int fd = 1;
if(argc > 1)
{
close(1);
fd = open (argv[1],O_WRONLY| O_CREAT, 0777);
}
int fd1 = open ("f4.txt", O_RDONLY);
int n;
printf("HI /mujeeb :)");
... |
C | #include <stdio.h>
int main(){
int n=10;
int a=5;
int i;
if (n>0)
for (i=0;i<n;i++)
if (a>i)
printf("a=%d, i=%d, and a>i\n",a,i);
else
printf("error:n<0\n");
return 0;
}
|
C | #include <stdlib.h>
#include <string.h>
#include "RTDS_String.h"
/*
* FUNCTION safe_strcpy:
* ---------------------
* Copies a string to another with a maximum number of copied character.
* Different from strncpy because it never copies more than the length of
* the copied string. The destination str... |
C | #include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>
#include "lib/double_linked_list.h"
#include "lib/hashtable.h"
#define NUM_PLAYERS 2
#define MAX_DIGITS 2 // Max digits in card values
#define HISTORY_SIZE 2048 * 4
int combat_game(struct list_meta **decks);
int combat_round(int *cards);... |
C | #include "../shell.h"
int builtin_remindme(char **args)
{
if (!args[1] || !args[2])
{
fprintf(stderr, "mysh: unexpected number of arguments to \"remindme\"\n");
return 1;
}
int interval = atoi(args[1]);
pid_t cpid = fork();
if (cpid == -1)
{
perror("fork");
... |
C | #include "v3.h"
#include <asm-generic/errno-base.h>
#include <pthread.h>
#include <errno.h>
#include <sys/epoll.h>
//可能多个链接请求任务加入到线程池中,所以必须让accept保证
//同一时刻只有一个线程在执行accpet
static pthread_mutex_t _acceptLock = PTHREAD_MUTEX_INITIALIZER;
//保存所有挂载在树上的节点的额外参数的信息
static pthread_mutex_t _listenFDlock = PTHREAD_MUTEX_INITIAL... |
C | #include "utils/allocator.h"
#include <CUnit/Basic.h>
#include <CUnit/CUnit.h>
#include <stdlib.h>
#include <utils/array.h>
#include <utils/iterator.h>
array test_array;
void *test_ptr;
#define TEST_STR_SIZE 8
void test_array_create(void) {
array_create(&test_array);
CU_ASSERT(test_array.filled == 0);
CU... |
C | #include <stdlib.h>
#include <stdio.h>
typedef struct list_node_t {
int element;
struct list_node_t *next;
} list_node_t;
typedef struct {
list_node_t *begin;
int size;
} list_t;
/**
* crée une liste vide.
* Retourne NULL en cas de problème.
*/
list_t *list_create(void) {
list_t *l = malloc(... |
C | #include <stdio.h>
#include <string.h>
int main()
{
int n = 0;
while(1)
{
printf("Enter an integer of 10, 20, 25, 30, 40, or 50\r\n");
scanf("%d", &n);
switch(n)
{
case 10:
printf("You entered number 10.\r\n");
break;
case 20:
case 25:
... |
C | #include <stddef.h>
#include "mkasmtb.h"
typedef struct
{
short a;
short c;
short *b;
long *d;
} HASH;
short symtb[] = { 1, 2, 3, 4, 5, 6, 7, 8 };
long abs[] = { 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 8, 7, 6, 5, 4 };
HASH hash[4] =
{
{ 0, 6, &symtb[1], &abs[7] },
{ 1, 5, &symtb[3], &abs[1] },
{ 2, 4, &symtb[0], &ab... |
C | /*
** fonction_print.c for allum1 in /home/daguen_s//myalum1
**
** Made by simon daguenet
** Login <daguen_s@epitech.net>
**
** Started on Sun Feb 10 18:47:31 2013 simon daguenet
** Last update Tue Feb 12 22:29:47 2013 simon daguenet
*/
#include "allum1.h"
void my_putchar(char c)
{
write(1, &c, 1);
}
void my_... |
C | #include <stdio.h>
List Merge( List L1, List L2){
List L = (List)malloc(sizeof(struct Node)); //
List p1, p2, p;
p1 = L1->Next;
p2 = L2->Next;
p = L;
while(p1 && p2){
//ȽϸԪ
if(p1->Data<=p2->Data){
p->Next = p1;
p = p1;
p1 = p1->Next;
}
else{
p->Next = p2;
p = p2;
p2 = p2->Next;
}... |
C | #include<stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <stdlib.h>
#include <dirent.h> //for working with directories
#include <fcntl.h> //for working with files
#include <unistd.h>
#include <string.h>
/*
Requirement:
-you give a single parameter <directory> which will contain a number
of subfiles... |
C | #ifndef STRUCTURES_H
#define STRUCTURES_H
#define VARIABLE_TYPE_INTEGER 'Z'
#define VARIABLE_TYPE_REAL 'R'
#define POPULATION_LIMIT 40
#define DEFAULT_MUTATION_RATE 5
#define BUFSIZE 200
typedef struct Configuration {
char **intervals; /* intervals for genes */
char *meta_data_file... |
C | #include <stdio.h>
#include <stdlib.h> // malloc, atof, etc
#include <inttypes.h> // int64
#include <stdbool.h> // bool
#include <string.h>
#define _STR(x) #x
#define _STR2(x) _STR(x)
#define __SLINE__ _STR2(__LINE__)
#define HERE __FILE__ "(" __SLINE__ ")"
// usage: printf(HERE "x=%d\n"... |
C | /*
Print fibonacci series to get n'th fibonacci series number
*/
#include<stdio.h>
#include<string.h>
// ITERATIVE FUNCTION :: Time taken for this function is O(2^n) => faster
int fiboSeries_iterative(int n)
{
int t0 = 0, t1 = 1, next, i;
for (i = 2; i <=n; i++)
{
next = t0 + t1;
t0 ... |
C | /* Uses recursion to balance curly opening and closing braces */
#include <stdio.h>
enum token{NONE, OPEN='{', CLOSE='}', END};
FILE *fid;
char curToken;
char readToken()
{
char curChar;
while(1)
{
curChar = getc(fid);
if(curChar == EOF || curChar == '\0')
return END;
if(curChar == '{')
r... |
C | #ifndef _HEAP_H_
#define _HEAP_H_
/*
* the i is start at 0
*/
#define LEFT(i) (((i+1)<<1)-1)
#define RIGHT(i) ((((i+1)<<1)+1)-1)
#define PARENT(i) (((i+1)>>1)-1)
#endif
|
C | /*
* for-loop.c
*
* Created on: Feb 4, 2021
* Author: imtiyazhirani
*/
#include <stdio.h>
int main(){
for(int i=0 ; i<10 ; i++ ){ //i=0 , 1 , 2 , 3 .... 10
printf("i=%d. welcome\n", i);
}
printf("** for considerations **\n");
int j=0;
for( ; j<5 ; ){ //0 1
printf("thank you\n");
j++;
}
printf("... |
C | /*
** EPITECH PROJECT, 2019
** PSU_minishell2_2018
** File description:
** redirection_right
*/
#include "../headers/fourty_two_sh.h"
env_modif_t run_redirect_left(linked_t *tree, env_modif_t env)
{
char *left = leftest(tree->right);
if (same_str(tree->command, "<") && directory(left))
return ((env_m... |
C | // LABORATORIO 3 ESERCIZIO 1
// DATA DI REALIZZAZIONE: 20/10/2016
#include <stdio.h>
#include <stdlib.h>
#define MAXR 50
#define MAXC 50
#define NOMEINPUT "matrice.txt" // Siccome il nome del file non va richiesto all'utente, lo stabilisco personalmente.
int leggiMatrice(int matrix[][MAXC], int r_max, int*... |
C | #include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define FILE_PATH "./Factures.txt"
#define DELIM "#"
#define END "end"
void error(char *msg){
perror(msg);
exit(0);
}
void getFact(char* buff, char* code){
strcpy... |
C | #include "usertraps.h"
#include "misc.h"
void main (int argc, char *argv[])
{
int childpid;
int was = 300;
// Now print a message to show that everything worked
Printf("\n\ntest for fork starts (%d)=======================\n", getpid());
Printf("test for fork (%d): Before fork was=%d\n", getpid(), was);
... |
C | #include <stdio.h>
#include <string.h>
int main()
{
char s[100], s1[100];
gets(s);
fflush(stdin);
gets(s1);
printf(strcmp(s, s1) ? "no" : "yes");
} |
C | #include "TIME_8051.h"
#include "c8051F020.h"
#define SYSCLK 22118400
/**
* Variables de TIME:
*/
// Indique si 1 ms s'est réalisée:
bit TIME_flag = 0;
// Indique si 100 ms s'est réalisée:
bit TIME_flag_100 = 0;
// Compteur de ms:
unsigned int TIME_counter = 0;
// Compteur pour 100 ms:
unsigned char TIME_counte... |
C | // DONE BY VERA
// Funcin que realiza la operacin
int calculate(char* a, int b, int u, int w)
{
float z;
switch (a[b])
{
case '*':
z = u * w;
return (z);
case '+':
z = u + w;
return (z);
case '-':
z = u - w;
return (z);
case '/':
z = u / w;
return (z);
case '%':
z = u % w;
return (z);
}
... |
C | #include <stdio.h>
int
main ()
{
int *i;
int test = 0;
i = &test;
printf ("Wert von test = %i\n", test);
printf ("Adresse von test = %i\n", &test);
printf ("Adresse auf die i zeigt = %i\n", i);
return 0;
}
|
C | /*
calculation for time 500 ms
(1/(p*16))*c=500*1000
r*c=16*500*1000
lets c=256
r=31,250
intial value=65536-31250=34,286
calculation for time 2 ms using timer0
(1/(p*16))*c=2000
r*c=16*2000
lets r=256
c=125
initial value 256-125=131
*/
#include<avr/io.h>
#include<avr/interrupt.h>
void delay50(){... |
C | /*Brandon Hayame
bhayame@ucsc.edu
CMPE 121 FALL 19
This program continuously transmits a 4096 byte array from one location in memory to another and
reports the number of errors and elapsed time using hardware interrupts.
*/
#include "project.h"
#define BLOCK_SIZE 4096
static uint8 transmitArray[BLOCK_SIZE - 1], rec... |
C | #include<stdio.h>
#include<conio.h>
#define max 5
struct queue
{
arr[max];
front;
rear;
};
void add(struct queue *,int);
void del(struct queue *);
void display(struct queue);
void main()
{
struct queue q;
int m,i,num;
q.front=-1;
q.rear=-1;
while(i!=3)
{
display(q);
printf("1:add element in the queue \n");... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "game.h"
#include "map.h"
#include "maze.h"
// depth-first search maze generator from
// https://en.wikipedia.org/wiki/Maze_generation_algorithm
typedef struct {
int x;
int y;
void *parent;
char wall;
char dirs;
} Node;
static Node *nodes = NUL... |
C | #include "global.h"
s32 __osStrcmp(const char* str1, const char* str2) {
char c1;
char c2;
do {
c1 = *str1++;
c2 = *str2++;
if (c1 != c2) {
return c1 - c2;
}
} while (c1);
return 0;
}
|
C | #include "hashmap.h"
#ifndef HMAP_TAILLE
#define HMAP_TAILLE 1001
#endif
#ifndef HMAP_CLE_STR_LEN
#define HMAP_CLE_STR_LEN 9
#endif
/* We need to keep keys and values. */
typedef struct paire t_paire, *h_paire;
struct paire{
char *cle;
void *donnee;
h_paire ... |
C | /*
* The MIT License
*
* Wavefront Alignments Algorithms
* Copyright (c) 2017 by Santiago Marco-Sola <santiagomsola@gmail.com>
*
* This file is part of Wavefront Alignments Algorithms.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this softwa... |
C | #include <stdio.h>
#include <string.h>
#include <math.h>
#include "matrix.h"
#include "optimization.h"
void test_rosembrock(char* filename, int max_iter, double tg, double tx, double tf, Step step, double alpa_i){
//read from file...
FuncInfo f;
f.function = rosembrock;
f.gradient = rosembrock_gradient;
f.h... |
C | #include <iostream>
using namespace std;
int main()
{
int number_1,number_2,i,count_div5 = 0;
cout << "Enter Number : ";
cin >> number_1;
cout << "Enter Number : ";
cin >> number_2;
for(i=number_1;i<=number_2;i++)
{
if((i % 5) == 0)
{
cout << "(" << i << "... |
C | #include<stdio.h>
#include<stdlib.h>
int max=0,a[1000],h=1;
/* structure node having three pointer*/
struct node{
int data;
struct node* left;
struct node* right;
struct node* parent;
}*tree=NULL;
/* insertion function of tree*/
struct node* insert(struct node *tree, int data)
{
/* z get new memory of size node and... |
C | // candykids.c - cmpt300 - A3
// Jeff Wang (301309384) jwa220
//include
#include "bbuff.h"
#include "stats.h"
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
//#include <string.h>
#include <unistd.h>
//#include <time.h>
#include <pthread.h>
// threads and locks
// #include <signal.h>
// #include <pt... |
C | #include <stdio.h>
/*
需求:读入一个自然数n,计算其各位数字之和,用汉语拼音写出和的每一位数字。
输入格式:每个测试输入包含1个测试用例,即给出自然数n的值。这里保证n小于10^100。
输出格式:在一行内输出n的各位数字之和的每一位,拼音数字间有1 空格,但一行中最后一个拼音数字后没有空格。
*/
//MARK: 第一种方法(不用数组,但是崩了)
void demo1(){
// a 为需要计算的数
long a = 0;
// b 为求10余的数
int b = 0, c = 0, d = 0;
scanf("%ld",&a);
do {
... |
C | #ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS
#endif
#include <stdio.h>
#include <inttypes.h>
#include <stdlib.h>
#include "pq_ttd.h"
int16_t pt2_v2_to_ttd(pq_rec_t pq_rec, ttd_t *ttd_rec, ttd_t *overflow_correction, pq_fileinfo_t *file_info) {
int16_t channel = (int16_t) pq_rec.ph_t2_bits.channel;
i... |
C | #include<stdio.h>
void main()
{
int i,j,a,b;
scanf("%d%d",&a,&b);
int n;
for(i=a;i<=b;i++)
{
n=i;
int count = 0;
for(j=2;j<i;j++)
{
if(n%j == 0)
{
count++;
break;
}
}
if(count == 0 && i>1... |
C | /*Math formulas:
give_pence-cost_pence=return_pence
if return_pence>or=200
then [return_pence/200]=_2pounds & return_pence mod 200=new return_pence
else circulation
*/
#include<stdio.h>
struct Change {
int cost_pence, give_pence;
int _2pounds, _1pounds, _50pence, _20pence, _10pence;
int _5pence, _2pence, _1pence;... |
C | int main(void)
{
int* numbers = malloc(sizeof(int));
int size = 0;
const int elements = 1000;
for(int i = 0; i < elements; i++)
{
numbers[i] = i;
}
size = sizeof(numbers)/sizeof(int);
printf("size = %d\n", size); //prints 2 instead of 100... |
C |
/**************************************************************************
this user program allows you to access the sys_monotor_reset
and sys_get_pf system calls added to the kernel via the
service-installer module of the page fault monitoring architecture
*************************************************... |
C | #define RH 0777777
#define PRARG 0545 /* PRARG% jsys # */
#define PRGBLEN 0200
int blk[PRGBLEN];
#include <stdio.h>
static char *bp7();
main()
{
int cnt = gprarg(blk, PRGBLEN);
if (cnt < 0)
printf("PRARG%% failed\n");
else if (cnt == 0)
printf("PRARG%% returned zero length block\n");
else shoblk(blk, cnt);
}... |
C | /*
[ܽd]:Bӯx}ۭG
*/
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
void MatrixMultiply(int*,int*,int*,int,int,int);
int main()
{
int *A,*B,*C;
int M,N,P;
int i,j;
printf("пJx}A(M,N): \n");
printf("M= ");
scanf("%d",&M);
printf("N= ");
scanf("%d",&N);
A = (int*)malloc(M*N*sizeof(int));
printf("[пJx}AU... |
C | #include "Agent.h"
#include "Protocol.h"
#include "Field.h"
#include "BOARD.h"
#include "Oled.h"
#include "FieldOled.h"
#include <stdlib.h>
Field myField;
Field enemyField;
FieldOledTurn turn;
void AgentInit()
{
turn = FIELD_OLED_TURN_NONE;
int i;
int row = rand() % 6;
int col = rand() % 10;
int d... |
C | #include "../pipe/pipe.h"
#include <stdio.h>
#include <string.h>
int main(int argc, char * argv[]) {
if (argc > 1) {
char * args[argc];
for (int i = 0; i < argc; i++) {
args[i] = argv[i+1];
}
printf("%d, is equal %d\n", find_pipe(args), !strcmp(argv[find_pipe(args) + 1]... |
C | #include <stdio.h>
/*
@JUDGE_ID: 20044WC 10013 C
*/
int main() {
int i,t,n,k;
short int w[1000000];
scanf("%d",&t);
for (;t>0;t--) {
scanf("%d", &n);
for (i=0;i<n;i++) {
scanf("%d %d", &w[i], &k);
w[i] += k;
};
for (i=n-2;i>=0;i--) {
w[i]+= (w[i+1]/10);
w[i+1] = w[i+1] % 10;
};
for (i=0;i... |
C | /*
* author: Praharsh Verma
* email: pbv5036@psu.edu
* parse_url.c for CMPSC 311 Fall 2019
* last updated: 11/20/2019
*/
#include "parse_url.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <regex.h>
// returns 1 if the url starts with http:// (case insensitive)
// and returns 0 otherwise
//... |
C | #include "var5.h"
#include "mls.h"
#include "m_tool.h"
#include <stdint.h>
#include <time.h>
static int mvar_assign(int mstr )
{
int ls = m_split_list( m_str(mstr), "=" );
if( m_len(ls) != 2 ) goto leave;
int v = mvar_parse( INT(ls,0), VAR_STRING );
mvar_put_string(v, m_str(INT(ls,1)), 0);
leave:... |
C | #ifndef _CLOCK_TEXT_H_
#define _CLOCK_TEXT_H_
#include "rle_graphics.h"
#include "fonts/clock_font.c"
extern TFT_ST7735 tft;
#define font_width 59
#define font_height 15
void displayNumber(uint8_t chr, uint8_t x, uint8_t y)
{
unsigned char const*cmp;
// extract pointer to RLE encoded character
if (chr >= ... |
C | #include <stdio.h>
#include "/usr/include/pcap.h"
#include <netinet/in.h>
#pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
#pragma GCC diagnostic ignored "-Wincompatible-pointer-types"
#pragma GCC diagnostic ignored "-Wimplicit-function-declaration"
#define MAC_SIZE 18
#define ETHERNET_OFFSET 14
#define TCP_OF... |
C | #include <stdio.h>
#include <stdint.h>
int main() {
// Initialize two 2-element arrays
uint16_t a[2] = { 110, 110 };
uint16_t b[2] = { 590, 590 };
// Print their addresses and contents
printf("&a: %p\n", &a);
printf("a[0]: %d\n", a[0]);
printf("a[1]: %d\n", a[1]);
printf("a[2]: %d\n... |
C | /* model.c
* 2015, Cody M Leff
* for Argo coding challenge - Semantic Analysis
* -------------------------
* Summary: creates a model of a piece of text by recording every word that is
* found to follow a given word from the text, then creates sentences from
* the model by randomly selecing a word and then... |
C | #include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/epoll.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#include <sys/mman.h>
#include <errno.h>
#include <sys/stat.h>
#include <time.h>
#inc... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
//implement a linked list
struct node{
struct node *previous,*next;
char word[200],synonyms[400];
};
struct node *start=NULL;
//creating array node using doubly linked list
struct node* createNode(char *word,char *synonyms){
struct node *new... |
C | /*
* dma.c -- DMA operation
*
*
*/
/* standard library */
#include <stdint.h>
/* TI resource */
#include "tm4c123gh6pm.h"
/* project resource */
#include "common.h"
#include "abm.h"
#include "dma.h"
/* module private definition */
#define DMA_NUM_OF_ELEMENT_MAX 1023
/* DMA channel description table */
struct dm... |
C | #include <stdio.h>
void
main()
{
int no;
printf(" enter the number ");
scanf("%d", &no);
if(no < 0){
printf(" nuber is negative ");
}
if(no > 0){
printf(" number is positive ");
}
if(no == 0){
printf(" number is zero ");
}
}
|
C | /*
* Video Lecture: 23
* Programmer: Arif Butt
* Course: System Programming with Linux
* rv2.c: The main() receives two file names via cmd line arg
* Creates two threads and pass each a filename
* Each thread computes and return the number of xters in the file
* Finally main thread displays the character count
*... |
C | #include <stdio.h>
long int countsecs(int h, int m, int s){
return h*60*60 + m*60 + s;
}
int main() {
int h, m, s;
scanf("%d:%d:%d", &h, &m, &s);
int hi, mi, si;
scanf("%d:%d:%d", &hi, &mi, &si);
long int a = countsecs(h, m, s);
long int b = countsecs(hi, mi, si);
if (a >= b) {
... |
C | #include <iostream>
#include "Gamemaster.C"
using std::endl;
void linebreak(){
std::cout<<"########################################################" << endl;
};
void newgame(int display){
Gamemaster gm = Gamemaster(display);
//gm.board.displayBoard();
gm.display->update();
while (gm.checkmate == false && gm.s... |
C | #include <iostream>
#include <fstream>
#include <map>
using namespace std;
#define UNDEF_DOCUMENT 0
#define HWP_DOCUMENT 1
#define MSWORD_DOCUMENT 2
#define ANOTHER_DOCUMENT 3
class Document {
public :
virtual bool Open(char* pFileName) = 0;
};
class HwpDocument : public Document {
... |
C | // -----------------------------------------------------------------------------
//
// "00_AccelGraph"
//
// -----------------------------------------------------------------------------
// Copyright (c) 2014-2019 All rights reserved
// -----------------------------------------------------------------------------
... |
C | #ifndef DEFS_H_
#define DEFS_H_
/* Declares and defines includes, structures and functions for both client and server programs */
/* Include */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#in... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int a, b, c;
printf("Digite um número: ");
scanf("%d", &a);
printf("Digite um número: ");
scanf("%d", &b);
printf("Digite um número: ");
scanf("%d", &c);
if (a > b && a > c) {
if(b > c) {
printf("Maior número: %d ... |
C | #include "array2d.h"
//deserialize a 2d array of Array2d values
Array2d Array2d_deserialize(FILE* in, void* (*deserializeElement)(json_t *)) {
json_t *array_info;
json_error_t error;
array_info = json_loadf(in, 0, &error); //load json object from file
//make sure the json object storing our array has correct numb... |
C | #include <unistd.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
void nothing();
void do_int();
int main(){
int i;
unsigned sec = 1;
signal(SIGINT, intComing);
for(i = 1; i < 11; i++){
alarm(sec);
signal(SIGALRM, semmi);
printf("%d\n", i);
... |
C | /*
Quest 1-8-5 Ń[vȂm
*/
#include "C:\Factory\Common\all.h"
#include "C:\Factory\Common\Options\CRRandom.h"
int main(int argc, char **argv)
{
int madokami_sai;
int c;
mt19937_initCRnd();
for(madokami_sai = 1; madokami_sai <= 7; madokami_sai++)
{
cout("madokami_sai: %d\n", madokami_sai); // 7 == ̃[vI -> K[v
... |
C | #include <string.h>
#include <ctype.h>
/*----------------------------------------------------- SpacesBefore.c
| Function: size_t SpacesBefore(const char *string)
| Author : william h robertson
|
| Purpose : Get number of leading spaces in a string.
|
| Params : *string (to parse)
|
| Returns : number of leadi... |
C | #include "game.h"
#include "memory.h"
struct Enemy*
enemy_new(float x, float y)
{
struct Enemy *enemy = make(struct Enemy);
if (!enemy) {
return NULL;
}
enemy->x = x;
enemy->y = y;
enemy->hitpoints = ENEMY_INITIAL_HITPOINTS;
enemy->ttl = ENTITY_TTL;
enemy->body.x = x;
enemy->body.y = y;
enemy->body.radius ... |
C | #include "bn.h"
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
enum bn_codes {
BN_OK, BN_NULL_OBJECT, BN_NO_MEMORY, BN_DIVIDE_BY_ZERO
};
typedef unsigned long long int uint64;
typedef long long int int64;
typedef unsi... |
C | #include <stdio.h>
int main() {
int cont = 0;
char nome[100];
double dist, total = 0.0;
while(scanf("%[^\n]", nome) != EOF) {
scanf("%lf", &dist);
total += dist;
cont++;
}
printf("%.1lf\n", (total/cont));
return 0;
} |
C | //Ricardo de Jesus Saldaa Medina
//1742168
#include<stdio.h>
#include<ctype.h>
#include<string.h>
struct Alumnos{//Struct con datos de los alumnos
int id;
char first_name[30];
char last_name[30];
char birth[30];
char school[30];
char grade[30];
char career[30];
char gender[30];
}alu;//Variable de... |
C | // Simple program that prints "Jai Ganesh"
#include<stdio.h>
main(){
printf("Jai Ganesh\n");
} |
C | #include <conio.h>
void main(void)
{
char s[23];
s[0] = 20;
cputs("digite uma string: ");
cgets(s);
cputs(&s[2]);
}
|
C | /* Victor Luccas S V B Antunes RA178018 MC102W Lab01b */
#include <stdio.h>
/* faixas inteiras de valores de consumo */
#define faixa1 17.34
#define faixa2 24.10
#define faixa3 111.00
int main() {
int c_at, c_ap;
float original, cotado;
scanf("%d %d", &c_ap, &c_at);
/* Calculo do valor original em... |
C | #include<stdio.h>
void main()
{
int a[20],f[20],i,j,n,coun=1;
printf("enter size of array\n");
scanf("%d",&n);
printf("enter array elements\n");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
f[i]=-1;
}
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
... |
C | #include <prodcons.h>
void consumer(int count)
{
//Use system call wait() and signal() with predefined semaphores
//produced and consumed to synchronize critical section
//Code to consume values of global variable 'n' until the value
//of n is less than or equal to count
//print consumed... |
C | /*
* Universidade Federal do Rio de Janeiro
* Escola Politecnica
* Departamento de Eletronica e de Computacao
* EEL270 - Computacao II - Turma 2019/2
* Prof. Marcelo Luiz Drumond Lanza
*
* Autor: <nome completo>
* Descricao: <descricao sucinta sobre o programa>
*
* $Author$
* $Date$
* $Log$
*
*/
#include... |
C | #include <stdio.h>
struct S {
int S;
};
int main(void) {
struct S S;
S.S = sizeof(struct S) / sizeof(S);
printf("%d",S.S);
return 0;
}
|
C | /*
TWI.h
. ds1307 TWI(I2C)
*/
// DS1307
#define DS1307_ADDR 0b01101000
// DS1307 +
#define DS1307_ADDR_R (DS1307_ADDR<<1)|1
// DS1307 +
#define DS1307_ADDR_W DS1307_ADDR<<1
//
#define ds1307_SetAddress(x) I2C_SendPocket(x,DS1307_ADDR_W)
//
void ds1307_WriteReg (char n,char m)
{
I2C_St... |
C | #include <stdio.h>
long long int memo[10001][10001];
long long int f(int a, int b)
{
if(memo[a][b]) return memo[a][b];
else if(b==0 || a==b) return 1;
else return memo[a][b] = f(a-1, b)+f(a-1, b-1);
}
int main()
{
int a, b;
scanf("%d %d", &a, &b);
printf("f(%d, %d) : %lld", a, b, f(a, b));
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.