language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /* 253. Time Object */
# include <stdio.h>
# include "time.h"
void initTime(Time *time){
time->hour = 0;
time->minute = 0;
time->second = 0;
}
void setTime(Time *time, int hour, int minute, int second){
time->hour = hour;
time->minute = minute;
time->second = second;
}
void addTime(Time *time, ... |
C | #include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <err.h>
#include <errno.h>
int main()
{
const char* f1 = "f1";
const char* f2 = "f2";
const char* f3 = "f3";
struct stat st;
if (stat(f1, &st) < 0)
{
err(2, "Cannot stat file '%... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define NUM_CLASS 7
#define ATTRIBS 16
//NUM_CLASS is the number of classes we wish to train for. In zoo.data it is 7
// ATTRIBS is the number of attributes we have in our training examples.
//Specific Boundary consists of an array of NUM_CLASS pointers. Each... |
C | ERROR: type should be string, got "https://app.codility.com/demo/results/training9E4NP2-H33/\n\n#include <string.h>\n\ntypedef struct {\n int pos;\n int cost;\n} node_t;\n\nint *fib;\nint fibSize;\n\nint solution(int A[], int N) {\n // write your code in C99 (gcc 6.2.0)\n //Initializa Queue\n \n if (N < 3) return 1;\n \n node_t *queue = (node_t *)malloc(sizeof(node_t) * N);\n memset(queue, 0, sizeof(node_t) * N);\n int first = 0;\n int last = 0;\n int qsize = 0;\n\n int *visited = (int *)malloc(sizeof(int) * N);\n memset(visited, 0, sizeof(int) * N);\n \n fib = (int *)malloc(sizeof(int) * N);\n fib[0] = 0;\n fib[1] = 1;\n fibSize = 2;\n for (int i = 2; ; i++) {\n int sum = fib[i - 1] + fib[i - 2];\n if (sum > N) {\n break;\n }\n fib[i] = sum;\n fibSize++;\n \n if (A[fib[i] - 1] == 1) {\n queue[last].pos = fib[i] - 1;\n queue[last].cost = 1;\n qsize++;\n last = (last + 1) % N;\n visited[fib[i] - 1] = 1;\n } else if (fib[i] == N + 1) {\n free(fib);\n free(queue);\n return 1;\n }\n }\n \n while (qsize > 0) {\n int cur_pos = queue[first].pos;\n int cur_cost = queue[first].cost;\n first = (first + 1) % N;\n qsize--;\n \n for (int f = 1; f < fibSize; f++) {\n int pos = cur_pos + fib[f];\n if (pos == N) {\n free(fib);\n free(queue);\n return cur_cost + 1;\n } else if (pos < N && !visited[pos] && A[pos] == 1) {\n queue[last].pos = pos;\n queue[last].cost = cur_cost + 1;\n qsize++;\n last = (last + 1) % N;\n visited[pos] = 1;\n }\n }\n }\n \n free(fib);\n free(queue);\n return -1;\n}\n" |
C |
//Função para definição de operações.
TPconsulta operacoes(doenca *vetD, medico *vetM, int chave[2][2], int nDoenca, int nMed){
char op[8];
TPconsulta lista=NULL;
while(1){
scanf("%s", op); //Obtenção da operação desejada.
if (op[0]=='0')
break;
switch(op[1]){
case 'd': lista = insereOrd(chave, l... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* disp_settings.c :+: :+: :+: ... |
C | #ifndef UNIT_TESTING
#define UNIT_TESTING
#endif
#include "fake_estantes.h"
#include "fake_mercadeo.h"
#include "fake_supervisor.h"
#include "../../modulos/cajeras.h"
#include <stdio.h>
#include <stdlib.h>
static void* cliente_aleatorio(void *);
int main() {
srand( time(NULL) );
pthread_t clientes_aleatori... |
C | #include <stdio.h>
#include <string.h>
int main() {
char smlst[100], lrgst[100];
int i = 0;
char temp[100];
while(1) {
printf("Enter word: ");
scanf("%s", temp);
if(i == 0) {
strcpy(smlst, temp);
strcpy(lrgst, temp);
}
else {
if(strcmp(temp, smlst) < 0) {
strcpy(smlst, temp);
}
if(strcmp(temp, lrgst)... |
C | /*
CH-230-A
a1 p2.[c or cpp or h]
Jose Biehl
jbiehl@jacobs-university.de
*/
#include <stdio.h>
int main() {
int result;
result = (2 + 7) * 9 / 3;
printf("The result is %i\n", result);
return 0;
}
//the variable "result" is not included in the printf statement of the original code, so the %d tries ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line.c :+: :+: :+: ... |
C | #include <cs50.h>
#include <stdio.h>
void make_pyramids(int height);
void make_half_pyramid(int row, int height, char side);
void print_hashes(int n);
void print_spaces(int n);
static const int gap = 2;
int main(void)
{
int height;
do
{
printf("Height: ");
height = get_int();
}
wh... |
C | /*
* make KOI8->CP866(ALT) and CP866(ALT)->KOI8 translation table
* from koi-alt.tab.
*
* Tatsuo Ishii
*
* $PostgreSQL$
*/
#include <stdio.h>
main()
{
int i;
char koitab[128],
alttab[128];
char buf[4096];
int koi,
alt;
for (i = 0; i < 128; i++)
koitab[i] = alttab[i] = 0;
while (fgets(b... |
C | #include <stdio.h>
int main(void)
{
float n;
int a;
scanf("%f",&n);
if(n<0)
{
a=(int)(n-0.5);
}
else
{
a=(int)(n+0.5);
}
printf("%d",a);
return 0;
}
|
C | /**
* @file mmi_mae_text_util.h
*
* @version $Id: mmi_mae_text_util.h $
*/
#ifndef __MMI_MAE_TEXT_UTIL_H__
#define __MMI_MAE_TEXT_UTIL_H__
#include "mmi_mae_common_def.h"
/*
@brief - to define a ucs2 code of white space character.
*/
#define TEXT_WHITE_SPACE 0x0020
#define TEXT_LINE_FEED 0x000A
#define TEXT_CARR... |
C | /* Modify the get_first() function of Listing 8.8 so that
it returns the first non-whitespace character encountered.
Test it in a simple program.
*/
#include <stdio.h>
#include <ctype.h>
char get_first(void);
int main(void)
{
printf("%c\n", get_first());
return 0;
}
char get_first(void)
{
int ch;
fo... |
C | bool IsItemEquipment (Item item){
extern u8 EquipmentList[];
if (item.number == 0) {
return false;
}
int cnt = 0;
while(EquipmentList[cnt] != 0){
if (item.number == EquipmentList[cnt]){
return true;
}
++cnt;
}
return false;
}
bool CanUnitEquipItem (Unit* unit, Item item){
if (!IsItemEquipment(it... |
C | #include <stdio.h>
#include <sys/shm.h>
#include <sys/stat.h>
#include <pthread.h>
void *thread1(void *var);
void *thread2(void *var);
int main(void)
{
//identifier for the shared memory segment
int segment_id;
pthread_t tid1,tid2;
//a pointer to the shared memory segment
char* shared_memory;
//the size (int... |
C | #include "clutil.h"
#include <stdio.h>
void print_error(const char *function, cl_int error){
fprintf(stderr,"Error when calling %s, code: %d\n",function,error);
}
/* determine length of file, allocate memory for the output pointer
* and read in the bytes into pointer */
void read_cl_source(const char *filename, ch... |
C | inherit "living";
#include <event.h>
#include <macros.h>
#include <state.h>
#include <properties.h>
private int allowed_move;
private object rider;
/*
* Function name: create_mount
* Description: redefinable constructor
*/
static void
create_mount()
{
}
/*
* Function name: create_living
* Description: s... |
C | // Akash and too many assignments
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void update(char*array,int i,int alphabet,int**fenwikTree,int n){
int olderAlphabet=array[i]-'a';
array[i]=alphabet+'a';
int j=i+1;
while(j<n+1){
fenwikTree[j][alphabet]++;
j=j+(j&(-j));
}
... |
C | /* 3c905C_cntl.c - _3c905C_cntl */
#include <xinu.h>
/*------------------------------------------------------------------------
* _3c905C_cntl - implement control function for a 3c905C device
*------------------------------------------------------------------------
*/
devcall _3c905C_cntl(
struct ether *ethptr, ... |
C | #include <stdio.h>
#include <string.h>
int main(){
char str[10] = "abcdefg";
printf("%s", strchr(str, 'c'));
} |
C | //**************************************************************
// *
// 1º Trabalho - Técnicas de Programação 2009.1 *
// Equipe: *
// Murilo Lima de Holanda(líder) Mat:0286740 ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "load_sys_file.h"
int load_file(char *vmlist_file_path, char *pmlist_file_path, int *divide_count, LIST *vmlist, LIST *pmlist){
init_uvmp(vmlist_file_path, pmlist_file_path, divide_count);
init_pvm_list_fp = init_pvm_list;
(*init_pvm_list_fp)(vmlis... |
C | #include "../include/support.h"
#include "../include/scheduler.h"
#include "../include/cthread.h"
#include "../include/cdata.h"
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#define SIZEIDENTIFY 67
#define GROUPNAMESTRING "Guilherme Cattani 243589\nAugusto Timm 113887\nGabriel Warken 179787\n"
/********... |
C | #include <avr/io.h>
#include <avr/interrupt.h>
#define period (int)((2000000/1) / (3.744*1000))
int set;
int main(void) {
PORTA_DIR = 0xFE; //input switch
PORTC_DIR = 0xFF; //Output LED
PORTC_OUT = 0xFF; //Initially off
tcc0_init();
while(1){
if(PORTA_IN ==0x00 && set==0){
tcc0_init();
PMIC_CTRL = PM... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <memory.h>
/* LU matrix decomposition from Burden, Faires, p359,
implementation for non-singular matrices only.
Real indexing is from 0->n-1, but code is from 1->n.
Must have a(1,1) != 0.
L has diagonal elements 1.
*/
#define a(i,j) a[i-1][j-1]
#define l... |
C | // 6.3 -- embedded loop
#include <stdio.h>
#define SIZE 6
int main(void)
{
// variant 1
char ch = 'F';
char start;
char end;
for(end = ch; end >= 'A'; end--)
{
for(start = ch; start >= end; start--)
printf("%c", start);
printf("\n");
}
// varian... |
C | #include <sys/socket.h>
#include <stdio.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <string.h>
#define BUFFERSIZE 32
#define MAXPENDING 5
/*
1. Create server socket
2. Assign server address and client address using the sockaddr_in struct
3. Bind the socket to the port
4. Listen for requests
5. Accept connec... |
C | /*
C Programming Practice - Struct Basic
Teerapat Kraisrisirikul
*/
#include <stdio.h>
#include <stdlib.h>
typedef struct {
int day;
int month;
int year;
} Date;
typedef struct {
char name[30];
int age;
Date birthday;
} Person;
int main () {
/* Main function */
Person customer[5] = {... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
struct hashtable {
int entries;
int buckets;
char ** keys;
void ** values;
};
struct hashtable makeHashtable(int buckets) {
struct hashtable ht;
ht.buckets = buckets;
ht.entries = 0;
ht.keys = malloc(buckets*sizeof(char *));
bzero(ht.keys, b... |
C | #include <stdlib.h>
#include <unistd.h>
#include "thread_pool.h"
int sem_wait(m_sem_t *s)
{
pthread_mutex_lock(&s->lock);
// if the critical part is occupied, then wait
if (s->occupied) {
pthread_cond_wait(&s->cond, &s->lock);
}
// set the critical part as occupied
s->occupied = true;
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "arvore.h"
#include "lista.h"
#include "compactador.h"
#define TAM 256
void inic_vet(int *vet, int tam);
int main(int argc, char** argv) {
int vet[TAM];
inic_vet(vet, TAM);
unsigned char* buffer = le_arq(argv[1]);
soma_freq(vet, buffer... |
C | #include <stdio.h>
#include <math.h>
#include <webots/robot.h>
#include <webots/supervisor.h>
#include <webots/receiver.h>
#define MAX_ROB 4
#define TARGET_FLOCKING_DIST 0.3
#define ROBOT_MAX_SPEED 0.002
enum {POS_X=0,POS_Y,POS_Z};
static WbNodeRef robs[MAX_ROB];
static WbDeviceTag receiver;
const double *loc[MAX_R... |
C | #ifndef COMMON_H
#define COMMON_H
#include <stdint.h>
#ifndef MAX_PATH
#define MAX_PATH 256
#endif
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define MAX(x,y) ((x) > (y) ? (x) : (y))
typedef enum LogLevel {
INFO_LEVEL,
DEBUG_LEVEL,
ERROR_LEVEL,
FATAL_LEVEL,
} LogLevel;
void logger(LogLevel level,... |
C | /*
** EPITECH PROJECT, 2020
** NWP_myftp_2019
** File description:
** pasv
*/
#include "myftp.h"
static char *dots_by_coms(char *str)
{
if (!str)
return (NULL);
for (int i = 0; str[i] != '\0'; i++) {
if (str[i] == '.')
str[i] = ',';
}
return (str);
}
int cmd_pasv(int clien... |
C | int cmp(const void *x,const void *y)
{
return *(int*)x-*(int *)y;
}
int main()
{
int n;
scanf("%d",&n);
int i=0,j,k,a=0,b=0;
char sex[10];
float man[40],woman[40],h;
while(i<n)
{
scanf("%s %f",sex,&h);
if(sex[0]=='m')
{
man[a]=h;
a++;
}
else
{
woman[b]=h;
b++;
}... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* stack_operations.c :+: :+: :+: ... |
C | #include <stdio.h>
#include<time.h>
int main()
{
int a;
printf("Vvedite 1, esli hotite sami ugadivat chislo ili vvedite 0, esli hotite chtob computer ygadival chislo");
do
{
scanf("%d", &a);
} while ((a != 1) && (a != 0));
if (a == 1)
{
int n, x, k = 0;
srand((unsigned int)time(NULL));
n = rand() % 1000;... |
C | #include "window.h"
/**
* info_error - handler error
*
* @message_error: message error
*
*/
void info_error(char *message_error)
{
size_t bytes_readed = 0;
bytes_readed = write(2, message_error, strlen(message_error));
if (bytes_readed == EOF)
exit(EOF);
}
/**
* is_map - valid if it's a valid map the conten... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
printf("%s is the best %s ever!\n","Svetlozar","programmer");
printf("I ate %d sandwiches last night!\n", 6);
printf("My body temperature is %f.\n", 36.52);
printf("Yesterday it was %.2f.\n", 36.04);
return 0;
}
|
C | #ifndef ABB_H
#define ABB_H
#include <stdbool.h>
#include <stddef.h>
/* Los structs deben llamarse "abb" y "abb_iter".*/
typedef struct abb abb_t;
/*Funcion para comparar una clave pasada por parametro con una clave de posicion
* actual del abb.
* Debe devolver 0 si los elementos comparados son iguales. Un número ... |
C | #include <stdio.h>
#include "log.h"
// Flash is 1024 * 1024 bits.
// One item is 9 * 8 bits
// 1024 * 1024 / (8 * 9) = 14 563,56
#define LOG_MAX_ITEMS 14563
/** LOG FORMAT
*
* | ... | Address
* +----------+----------+----------+----------+
* | ID_(n+0) | ID_(n+1) | ID_(n... |
C | #include <stdio.h>
#include <cs50.h>
#include <ctype.h>
#include <string.h>
int main(int argc, string argv[])
{
// Get the key & validate key
if (argc != 2)
{
printf("Usage: ./substitution key\n");
return 1;
}
// Checking for length
if (strlen(argv[1]) != 26)
{
printf("key must be at least 26 characters... |
C | /*Fig. 7.14: fig07_14.c
Attempting to modify a constant pointer to constant data. */
#include <stdio.h>
int main(int argc, char *argv[])
{
int x = 5;
int y;
/* ptr is a constant pointer to a constant integer. ptr always
pointer to the same location; the integer at that location
cannot be modified ... |
C | /*
** EPITECH PROJECT, 2017
** count_lines.c
** File description:
** algo bsq
*/
int count_lines(char *str)
{
int count = 0;
while (str[count] != '\n')
count++;
return (count);
}
|
C | #include<stdio.h>
#include<string.h>
void add(char a[],char b[])
{
int s[501];
int len1=strlen(a)-1;
int len2=strlen(b)-1;
int d=0;
int c=0;
int i;
int w;
while(len1>=0 || len2>=0)
{
w=0;
if(len1>=0) w+=a[len1]-'0';
if(len2>=0) w+=b[len2]-'0';
w+=c;
s[d]=w%10;
c=w/10;
d++;
l... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "util/task_helper.h"
void oneback(char *text)
{
int l=strlen(text);
text[l] = '\n';
text[l + 1] ='\0';
}
void uppercase(char *textuppercase)
{
int lungime=strlen(textuppercase),i=1;
if(textuppercase[0]>='a' && textuppercase[0]<='z')
textup... |
C | #include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdbool.h>
#include <assert.h>
float fkgrade(char str[]){
int sentences=0, i;
char last = ' ';
for (i=0; str[i] != '\0'; i++){
if(str[i] == '.' || str[i] == '?' || str[i] == '!'){
sentences++;
last = ' ';
... |
C | // Projeto : JNA Example #19
// Algoritmo: example19.c
// Função : : Get a union from C
// Autor(es) : Hugo Dionizio Santos (adaptações e correções), Ethan Shayne in http://www.eshayne.com/jnaex
// Data : Sáb Mai 16 16:27:45 BRT 2015
// Seção de Variáveis Globais
// Interface do algoritmo
// Função Principal
// Seçã... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include "plannodes.h"
#include "testability.h"
/*
* example to pass arguments
* isCN, relname, selectivity, targetname, qual op, qual left, qual right, groupcolname
* e.g.
* 0, "tbl1", 50, "product_id", "=", "cust_id", "literal", "product_id"
*/
... |
C | #include <stdio.h>
#include <math.h>
#include <string.h>
int main(int argc,char **argv)
{
int i,j,trial,number;
long x_len,count = 0;
char row[256];
char string[16];
char out_name[32];
FILE *fin,*fout;
//complex_t *in_data[8];
double in_data[256];
int chan_flag = 1;
if( argc < 2)
{
printf("Usage:read... |
C | #include "window.h"
struct event
{
int counter;
char me[20];
};
ENetAddress address;
ENetHost *client;
ENetPeer *peer;
char message[1024];
char me[20]; //Player id
ENetEvent netevent;
ENetPacket *packet;
int neteventStatus;
SDL_Event event;
bool gameover = false;
bool FAILURE = false;
bool SUCCESS = true;
bo... |
C | //1457 - Oráculo de Alexandria
#include <stdio.h>
#include <string.h>
int main(void)
{
int T;
scanf("%d", &T);
while (T--)
{
long long int N;
int tam;
char K[20];
int vetor[20];
scanf("%lld %s", &N, K);
tam = strlen(K);
int X = 1, cont = 0;
... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<pthread.h>
#include<semaphore.h>
#define BUFFER_SIZE 100
sem_t s;
typedef struct{
char type;
int amount;
char unit;
} item;
item buffer[BUFFER_SIZE];
int first = 0;
int last = 0;
item *consume() {
sem_wait(&s);
item *i = malloc(sizeof(item));
w... |
C | #include "stdio.h"
#include "stdbool.h"
/********** PROTOTIPO DE FUNCIONES **********/
void ImPar();
void Perfecto();
int PerfectoAnid(int);
void Reverso();
int main(){
/********** DECLARACION DE VARIABLES **********/
int opc;
bool band;
band = false;
/********** ENTRADAS **********/
printf("1) Define si ... |
C | #ifndef _RGB_COLOR_SENSOR_ARRAY_REGISTERS_H_
#define _RGB_COLOR_SENSOR_ARRAY_REGISTERS_H_
/*
* This 1 byte register is R/W
* Read:
* [0] - 1 if the RGB Color Sensor Array is in free-running
* mode and has exclusive control over the LEDS,
* 0 if free-running mode is disabled and the
* user is free to control ... |
C | #include <stdlib.h>
#include <string.h>
#include "group.h"
#include "mark.h"
Group* group_create()
{
Group* g = malloc(sizeof (Group));
g->marks = list_create();
return g;
}
size_t size_group(Group* g)
{
return size_marks(g->marks) + (sizeof (short)) + strlen(g->name) + 1;
}
void serialize_group(Group* g, v... |
C | /* 05E04.c (p. 107) */
#include <stdio.h>
#include <string.h>
typedef enum { False = 0, True } bool;
bool strend(char s[], char t[]);
main() {
char s1[] = "This is the first test string.";
char t1[] = "test string.";
char s2[] = "Oogly boogly boo!";
char t2[] = "blah blah";
printf("First comparis... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<assert.h>
struct Tree;
struct TreeLog;
struct MemoEntry;
typedef unsigned long int symbol_t;
typedef struct ParserContext {
const unsigned char *inputs;
size_t length;
const unsigned char *pos;
struct Tree *left;
// AST
... |
C | #include <avr/io.h>
#include <String.h>
void usart_Init()
{
/*Set baud rate */
UBRR0 = 103;
/*Enable receiver and transmitter */
UCSR0B |= (1<<RXEN0)|(1<<TXEN0);
/* Set frame format: 8data, 1stop bit and no parity */
UCSR0C &= ~(1<<USBS0) ; //1 stop bit
UCSR0C |= (1<<UCSZ00) | ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_check_format.c :+: :+: :+: ... |
C | #ifndef HASH
#define HASH
#include <stdio.h>
#include <stdlib.h>
/**
* struct hash_node_s - holberton
*
* @key: int
* @value: int
* @next: int
*/
typedef struct hash_node_s
{
char *key;
char *value;
struct hash_node_s *next;
} hash_node_t;
/**
* struct hash_table_s - holberton
*
* @size: int
* @array: i... |
C | /******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debu... |
C | #include <stdio.h>
#include <conio.h>
#define n 80
int main()
{
int i, j, m;
char line[5][n],*min,*max,*p;
printf("write number of your lines:\n");
scanf("%d", &m);
m+=1;
if(m>5) m=5;
printf("write your simbols:\n");
for(i=0;i<m;i++)
gets(line[i]);
for(i=0;i<m;i++)
puts(line[i]);
for(i=0;i<m;i++)
{
mi... |
C | #include<stdio.h>
#include<sys/types.h>
#include<unistd.h>
#include<stdlib.h>
int main()
{
//int ret, ret1;
//ret = fork();
//fork();
//fork();
//if(!ret)
//{
printf("This is child process:\n");
//}
//else
//{
//fork();
//fork();
//sleep(5);
//printf("This is parent process:\n");
//}
return 0;
}
|
C |
#include <avr/io.h>
#include <stdio.h>
#include <stdlib.h>
#include "twi.h"
// Initial TWI
void TWIInit ( void ){
// set SCL to 400kHz
TWSR = 0x00;
TWBR = 0x0C;
// enable TWI
TWCR = ( 1 << TWEN );
}
//
// Start read/write
void TWIStart ( void ){
TWCR = ( 1 << TWINT ) | ( 1 << TWSTA ) | ( 1 << TWEN );
while (... |
C | #include <stdio.h>
#include <stdlib.h>
struct node {int i; struct node *next;};
void print_list(struct node * l_list);
struct node * insert_front(struct node * l_list, int addend);
struct node * free_list(struct node * l_list);
|
C | #include <stdio.h>
int main (void)
{
int account_no=0;
float begin_balance, total_credit, total_charges, credit_limit, balance;
while(account_no!=-1)
{
printf("Enter account number(-1to end):");
scanf("%d", &account_no);
if(account_n... |
C | # c-programming
#include <stdio.h>
int main()
{
char str[100],i=0,length;
printf("\nEnter the string:");
gets(str);
while(str[i] !='\0')
i++;
length=i;
printf("\nThe length of the string is:%d",length);
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
void login ();
void reg ();
/*void adminlog (int variabel);
void adminreg (int variabel);
void akundelete (int variabel);
void tambahmodul (int variabel);
void userlog (int variabel);
void userreg (int variabel);
void usergantipass (int variabel);
... |
C | #include "resources.h"
#include "lang_common.h"
#include "lang_en.h"
#include <stdlib.h>
#include <string.h>
// 洢ַ/
StrObject* resources[COUNT];
// ȡַ/
StrObject* _readStrObj(const char** strarray, size_t width, size_t height)
{
StrObject* newobj = malloc(sizeof(StrObject));
if (newobj == NULL)... |
C | #include<linux/init.h>
#include<linux/module.h>
#include<linux/moduleparam.h>
MODULE_LICENSE("GPL");
static int a,b;
module_param(a,int,S_IRUGO);
module_param(b,int,S_IRUGO);
static int __init hello_init(void)
{
printk(KERN_INFO"INIT_MODULE: The sum of the two numbers is %d\n",a+b);
return 0;
}
static void __exit... |
C | #include <stdio.h>
int main() {
char num1 = 28;
int num2 = 1000000002;
char num3 = num1 + num2; //(char ū ڴ )
//28+2 ڸ .
printf("%d\n", num3); // 30
return 0;
}
// https://dojang.io/mod/page/view.php?id=113 |
C | //
// vente.c
// PharmApp
//
// Created by Braksa - Boutaib on 12/25/15.
// Copyright © 2015 NSApps. All rights reserved.
//
#include "vente.h"
// Implémentation des fonctions
Vente* create_vente(time_t date_time, int nombre_medicaments, int medicaments[VENTE_MAX_MEDICAMENTS_IDS][2]) {
// Alloc new Comm... |
C | #include<stdio.h>
#include<limits.h>
#include<stdlib.h>
#include<string.h>
#define min(a, b) (a<b?a:b);
#define s(x) scanf("%d", &x);
#define p(x) printf("%d\n", x);
typedef struct queue{
int front, rear, size, capacity;
int *array;
} queue;
queue* create(int capacity){
queue *q = (queue*)malloc(sizeof(... |
C | //
// Created by Matthieu Costa on 01/06/2021.
//
#include <string.h>
int correct_tail(const char *body, const char tail[1]) {
return body[strlen(body) - 1] == *tail;
} |
C | #include<stdio.h>
#include<math.h>
int main()
{
void invert(int* a,int count);
int a[10]={1,3,5,7,9,8,6,4,2,0};
int *pa;
for(pa=a;pa<a+10;pa++)
{
printf("%d\t",*pa);
}
printf("\nafter invert\n");
invert(a,10);
for(pa=a;pa<a+10;pa++)
{
printf("%d\t",*pa);
}
... |
C | #include <stdio.h>
#include <layout.h>
#define MS_BPS 512
/*
* Calculate the length between the sectors, given the length of the track
* and the number of sectors that must fit on it.
* The proper formula would be
* (((TLEN/2) - INDEXLEN) / unit->mu_SectorsPerTrack) - BLOCKLEN;
*/
int
Gap(int tlen, int sectors... |
C | /*
* @Author: DESKTOP-0VVB0MB$
* @Date: 2018-09-27 19:02:55
* @Last Modified by: TD21forever
* @Last Modified time: 2018-09-28 23:17:47
*/
// a+b
#include<stdio.h>
#include<stdlib.h>
int main(int argc, char const *argv[])
{
int n,sum;
while(scanf("%d",&n)==1)
{
sum = 0;
int i;
for (i = ... |
C | #include <iostream>
using namespace std;
int main() {
int i, n;
cin >> n;
for (i=0; i<n; i++) {
cout << "hello world\n";
}
return 0;
}
Raw
gistfile2.cs
using System;
namespace Solution {
class Solution {
static void Main(string[] args) {
var line1 = System.Console.Re... |
C | #include <stdint.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#define DARK_SQUARES 0xAA55AA55AA55AA55ULL
#define LIGHT_SQUARES (~DARK_SQUARES)
#define FILE_H 0x0101010101010101ULL
#define FILE_G (FILE_H << 1)
#define FILE_F (FILE_H << 2)
#d... |
C | #include<stdio.h>
//ͱ飬iȷѭtм
//ݵһһ
int main() {
int i,t;
int a[5] = { 0, 1, 2, 3, 4 };
int b[5] = { 5, 6, 7, 8, 9 };//ʼ
for (i = 0; i < 5; i++) { //ͨtνa[i]b[i]ֵ
t = a[i];
a[i] = b[i];
b[i] = t;
}
for (i = 0; i < 5; i++)
printf("%d\t", a[i]); //a[5]
printf("\n");
for (i = 0; i < 5; i++) //b[5]
p... |
C | //模拟实现strcat
#include<stdio.h>
#include<stdlib.h>
#include<assert.h>
char *Strcat(char *dest, char *src)
{
char* ret = dest;
assert(*dest != NULL);
assert(*src != NULL);
//寻找dest的'\0'位置
while (*dest)
{
dest++;
}
//src的内容依次拷贝到dest的内容后面
while (*dest++ = *src++)
;
return ret;
}
int main()
{
char a[100] =... |
C | #include<stdio.h>
#include<string.h>
void main()
{
char text[100],word[100],rpwd[100],str[10][10];
int k=0,i=0,j=0,w=0,p;
gets(text);
scanf("%s %s",word,rpwd);
p=strlen(text);
for(k=0;k<p;k++)
{
if((text[k]!= ' '))
{
str[i][j]=text[k];
k++;
}
else
{
str[i][j]='\0';
j=0;
i++;
}
}
w=i;
for(i=0;i<=w;i++)
{
if(... |
C | #include "estoque.h"
#include <stdio.h>
TProduto leProduto(void){
TProduto p;
printf("\n");
printf("ID..: ");
scanf("%d", &p.id);
fflush(stdin);
printf("Nome: ");
scanf("%40s[^\n]", p.nome);
fflush(stdin);
printf("Quantidade: ");
scanf("%d", &p.quant);
fflush... |
C | /******** http://blog.csdn.net/robertkun ********/
/******* 客户端程序 client.c ************/
// linux 下读取大于2GB文件时,需指定
#define _FILE_OFFSET_BITS 64
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <netdb.h>
#include <sys/socket.h>
... |
C | #ifndef STRUCTS_H
#define STRUCTS_H
/**
* guarda coordenadas de um ponto no mapa
**/
typedef struct Point{
int row;
int column;
} Point;
/**
* guarda as coordenadas de um ponto, o custo para o atingir
* partindo da origem e um ponteiro para o Node do ponto que o
* precede. aquando a sua inserção no acervo é... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "arguments.h"
int num_ini_seq = 5;
double selection_rate = 0.0;
double M = 10.0;
void parseArguments(int argc, char **argv)
{
char *c;
int seed = time(NULL);
for (argc--;argc>0;argc--) {
c = argv[argc];
while (1) {
... |
C | #include <stdio.h>
#include <unistd.h>
int main(void){
printf("before fork\n");
fflush(stdout);
pid_t pid = fork();
if(pid > 0) {
// parent
printf("parent\n");
} else if(!pid) {
// child
// default pattern for fork()
printf("child\n");
execlp("lsaa", ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
/Copia a string str1 para a str2 sem o ultimo caractere/
void copyString(char *str1, char*str2) {
int n = strlen(str1), i;
for(i=0;i<n-1;i++){
str2[i] = str1[i];
}
str2[i] = '\0';
}
int main () {
FILE *fp1, *fp2;
char nomeArquivo[30], nom... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* server.c :+: :+: :+: ... |
C |
#include <stdio.h> // libreria estandar
#include <stdlib.h> // para usar exit y funciones de la libreria standard
#include <string.h>
#include <pthread.h> // para usar threads
#include <semaphore.h> // para usar semaforos
#include <unistd.h>
#define LIMITE 50
pthread_mutex_t mutex1;
pthread_mutex_t m... |
C | #include<stdio.h>
#include<math.h>
main()
{
int x,y,i,z,n = 0;
float arr[10];
float a = 0.0;
printf("Vavedete chisloto\n");
scanf("%d",&x);
for(i = 0; i < 10; i++)
{
for(z=x*n; (z < (n+1)*x); z++)
{
a = a + cos(z);
}
arr[i] = a;
n = n+1;
}
for(i=0; i < 10; i++)
{
printf("Arr{%d} ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#define ESPACO 5
typedef struct ArvoreBinaria{
int valor;
struct ArvoreBinaria * esquerda;
struct ArvoreBinaria * direita;
} Arvore;
// Funções pedidas no trabalho
//As comentadas estão faltando
Arvore * loadTreeFromFile(char *path);
void showTree(Arvor... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define N 10 /* */
int main()
{
int a[N]; /* a N */
int i,boole; /* */
srand(time(NULL)); /* */
/* Array a */
for(i = 0; i < N; i++){
a[i] = rand()%100;
printf(" %d", a[i]);
}
printf(";\n");
boole = ... |
C | #include <stdlib.h>
#include <string.h>
#include <stronghold/point_mutations.h>
#include <lcthw/dbg.h>
int hamming_distance(char *s, char *t)
{
check(s != NULL, "'s' can't be NULL");
check(t != NULL, "'t' can't be NULL");
check(strlen(s) == strlen(t), "Lengths don't match");
int i = 0;
int diff = 0;
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
double altura = 0, pesoIdeal = 0;
printf("Informe a Altura: ");
scanf("%lf", &altura);
pesoIdeal = (72.7 * altura) - 58;
printf("Peso ideal: %.1lf\n", pesoIdeal);
//gletch();
return 0;
}
|
C | #include <sys/types.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <time.h>
#include <err.h>
#include "hirschberg.h"
double wall_time () {
struct timeval time;
gettimeofday(&time, NULL);
return ((double)time.tv_sec * (double)1e6 + (double)time.tv_usec);
}
cha... |
C | #include "gir_internals.h"
#include "gir.h"
/* String Interning
*****************************************************************************/
static uintptr_t intern(GirCtx* ctx, char* str) {
uintptr_t sym = (uintptr_t)hamt_lookup(&(ctx->intern_pool), str);
if (sym == 0) {
hamt_insert(&(ctx->intern_p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.