language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /*
* File: main.c
* Author: Andrew McOlash
*
* Created on December 25, 2016, 7:54 PM
*/
#include "defines.h"
// FUNCTION PROTOTYPES ---------------------------------------------------------
void gpio_init();
bool check_sensor1();
bool check_sensor2();
// MAIN FUNCTION ----------------------------------------... |
C | #ifndef __RWBUF_H__
#define __RWBUF_H__
#include "dartstring.h"
struct rwbuf;
typedef struct rwbuf rwbuf_t;
struct rwbuf {
dstr_t str;
size_t rd, wr;
};
static inline void init_rwbuf_empty(rwbuf_t * buf)
{
init_dstr(&buf->str);
buf->rd = buf->wr = 0;
}
static inline void init_rwbuf(rwbuf_t * buf, c... |
C | #include<stdio.h>
#include<stdlib.h>
#define MAXSIZE 1024
typedef int elemtype;
typedef struct{
elemtype data[MAXSIZE];
int len;
}sqlist;
//ԱͶ
void initlist(sqlist *L){
L->len = 0;
}
//ʼԱ
void print(sqlist *L){
int i;
for(i = 0;i < L->len;i++)
if (i<L->len)
printf("%d",L->data[i]);
else
return;
}
//Ա
... |
C | /*
* usbi.c
*
* package for unsigned big integer package
*
* used for CSCI 247, Assignment 3, Fall 2017
*
* Alexandra Puchko , WWU, November 2017
*
*/
#include <stdlib.h>
#include <stdio.h>
#include "usbi.h"
#define BASE 100 // Each byte of the USBI contains 0-99
#define DIGITS 10 ... |
C | #include "syscall.h"
/*This file is part of testcase of movie theater
* simulation with 30 customers, 3 ticket taker
* 3 concession clerk, 3 ticket taker, a movie
* technician and a manager.
*/
void main()
{
int i=0;
CreateMV("TC\0");
SetMV("TC\0", 1);
CreateMV("TCN\0");
SetMV("... |
C | /* Taylor Clark
CS 4760
Assignment #4
Operating System Simulator: Process Scheduling
I am submitting this project with full knowledge that it does not fully meet the requirements set out in the assignment sheet. What I have included in each of these files however, is commented out code and pseudo-code that I believe w... |
C | #include <stdio.h>
#include <stdlib.h>
#include <pnm.h>
#define PARAM 3
void process(char *ims_name, char *imd_name, float angle){
pnm ims = pnm_load(ims_name);
int width = pnm_get_width(ims);
int height = pnm_get_height(ims);
pnm imd = pnm_new(width, height, PnmRawPpm);
pnm_save(imd, PnmRawPpm,... |
C | #include <stdio.h>
int main (void){
float g;
printf("%s\n", "Please insert a number of grams");
scanf("%f", &g);
printf("%.1f%s\n", g/600, "台斤");
} |
C | #include<stdio.h>
#define RICHARD 0
#define GABRIEL 1
int main(){
int t=0, x=0, r=0, c=0, i=0, win=0, m=0, n=0, tmp=0;
char *winner[]={"RICHARD","GABRIEL"};
scanf("%d",&t);
for (i=1;i<=t;i++) {
scanf("%d %d %d", &x, &r, &c);
m = r>c ? c : r;
n = r>c ? r : c;
win = (m*n)%x==0 ? GABRIEL : RICHARD;
swit... |
C | #include "stack.h"
// 初始化
void InitStack(stack *list)
{
list->top = -1;
list->count = 0;
}
// 判断栈是否为空
bool StackIsEmpty(const stack *list)
{
return list->count == 0;
}
// 判断栈是否已满
bool StackIsFull(const stack *list)
{
return list->count == SIZE;
}
// 获取栈中的项数
int LenStack(const stack *list)
{
retu... |
C | #include <unistd.h>
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
void* sleeper ( void *arg); // prototype
pthread_barrier_t mybarrier;
//-----------------------------------
// Author: R. Tervo
//
//
void main() {
pthread_barrier_init( &mybarrier, NULL, 3);
pthread_create( NUL... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define MAX 12
typedef struct {
int id;
char regiao[3];
char estado[3];
char municipio[100];
char revenda[100];
double cnpj;
char produto[4];
char dataColeta[11];
double valor_venda;
double valor_compra;
char peso[30];
char bandeira[30];... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <malloc.h>
#include <string.h>
void f(int* polje, int n, int m) {
if (n > 1) {
f(&polje[0], n - 1, m);
}
polje[n - 1] = pow(m, n - 1);
return;
}
int main(void) {
int *polje;
int i;
int n = 5;
int m = 10;
polje = (int ... |
C | #include<stdio.h>
int w[10], p[10], v[10][10], n, i, j, cap, x[10] = {0};
int max(int i, int j)
{
return ((i>j)? i:j);
}
int knap(int i, int j)
{
int value;
if(v[i][j] < 0)
{
if(j < w[i])
value = knap(i-1, j);
else
value = max(knap(i-1, j), p[i]+knap(i-1, j-w[i]));
v[i][j] = value;
}
return (v[i][j])... |
C | #include <glob.h>
#include <malloc.h>
#include "list.h"
LinkedList * createList() {
struct linkedList * list = calloc(sizeof(LinkedList), 1);
if (list) {
list->length = 0;
list->head = NULL;
list->end = NULL;
return list;
} else {
printf("Error while creating List");... |
C | #include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <errno.h>
#define MAX_LINE 80
int DEBUG=0;
const int ARGS_MAX_SIZE = MAX_LINE/2 + 1;
/**
* Executes the shell command entered
* @param input_text - this is the tex... |
C | /*
** space.c for lemin in /home/benjamin.g/delivery/CPE_2016_Lemin
**
** Made by Benjamin GAYMAY
** Login <benjamin.g@epitech.net>
**
** Started on Fri Apr 7 09:27:33 2017 Benjamin GAYMAY
** Last update Mon Apr 10 17:08:59 2017 Benjamin GAYMAY
*/
int count_space(char *line)
{
int i;
int space;
i = -1;
sp... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/wait.h>
int main(int argc, char **argv)
{
// pid_t fork(void);
pid_t pid;
pid = fork();
if (pid < 0)
{
perror("fork");
}
else if(pid == 0)
{
sle... |
C | /*
Toy implementation of a Diffie-Hellman key generation (https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange)
Type ./keyGenerator for information on how to use this program
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdbool.h>
#include <assert.h>
//Conver... |
C | #ifndef _UTILS_H_
#define _UTILS_H_
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef enum bool { false,
true } bool;
typedef struct Arguments {
int* buffer;
int counter;
bool mode;
} Arguments;
void clearBuffer(int buffer[], int size);
bool checkIfHasN(c... |
C | #include <stdio.h>
#include <stdlib.h>
int isMagic(int**, int);
int duplicate(int*, int);
int main(int argc, char** argv) {
if (argc != 2) {
printf("Invalid arguments! \n");
return 0;
}
FILE *fp = fopen(argv[1], "r");
int dim, i, j, temp;
fscanf(fp, "%d\n", &dim); // Read from file
int **arr = malloc(... |
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 <conio.h>
#include <math.h>
#include <string.h>
int bcdtodec(int bcd);
int dectobcd(int dec);
main()
{
int x,dec;
int bcd;
x=145;
printf("x value = %x\r\n",x);
dec=bcdtodec(x);
printf("dec value = %d\r\n",dec);
bcd=dectobcd(dec);
printf("bcd value = is %d\r\n",bcd);
... |
C | #include <stdio.h>
int main() {
char input[100] = "";
char temp[100] = "";
char tempC = 'a';
int number = 0;
int countC = 0;
int bools = 0;
int countN = 0;
int countT = 0;
scanf("%d",&number);
input[0]='\0';
while(countN <= number){
while((tempC=getchar())!='\n'){... |
C | #include<stdio.h>
#define INFINITY 9999
#define MAX 6
int dijkstra(int G[MAX][MAX],int n,int startnode,int dist);
void greedyColor(int G[MAX][MAX],int n);
void chooseRate(int dist);
int main()
{
int i,j,n=6,u,dist;
//G est la matrice distance entre les different noeuds
int G[MAX][MAX] = {
{0,500,600,0,0,0}... |
C | ////////////////////////////////////////////////////////////////////////
// COMP2521 20T2 ... the Fury of Dracula
// dracula.c: your "Fury of Dracula" Dracula AI
//
// 2014-07-01 v1.0 Team Dracula <cs2521@cse.unsw.edu.au>
// 2017-12-01 v1.1 Team Dracula <cs2521@cse.unsw.edu.au>
// 2018-12-31 v2.0 Team Dracula <cs2521@c... |
C | #include "hc4led.h"
#include "pic_serial.h"
void hc4led_setup() {
spi_setup();
}
uns8 hc4led_convert(uns8 digit) {
switch (digit) {
case ' ': return 0;
case '0': return 126;
case '1': return 24;
case '2': return 109;
case '3': return 61;
case '4': return 27;
case '5': return 55;
case '6': return 115;
case... |
C | //gcc test.c -o test.linux
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <strings.h>
#include <string.h>
int main(int argc, char* argv[]) {
int fd;
void* pa;
if( -1 == (fd=open("test.txt", O_RDWR|O_CREAT)) ) {
... |
C | #include "buffer_task.h"
#include "../../fifo/fifo.h"
#include "../../timestamp/timestamp.h"
//#include "../../serial/serial.h"
#include <stdint.h> /* Data types */
#include <string.h> /* For memory operations */
#include <stdio.h> /* Standard input/output definitions */
//#include <time.h> ... |
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 <string.h>
int Terreno () {
double larg, comp, valm;
double area, preco;
printf ("Digite a largura do terreno: ");
scanf ("%lf", &larg);
printf ("Digite o comprimento do terreno: ");
scanf ("%lf", &comp);
printf ("Digite o valor do metro quadrado: ");
... |
C | /*
** EPITECH PROJECT, 2019
** main
** File description:
** my_hunter
*/
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h>
#include <math.h>
#include "rpg.h"
void set_levitation(items_s *tmp)
{
int t = sfClock_getElapsedTime(tmp->obj->clock).microseconds;
if (t >= 15000) {
tmp->obj->p.y += ... |
C | /*
* data.c
*
* Created on: May 7, 2015
* Author: skynet
*/
#include <stdio.h>
#include "data.h"
void conversie1(DATA *d)
{
int nr_zile[]={31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
printf("Ziua din luna: ");
scanf("%d", &(d->zi));
printf("Luna: ");
scanf("%d", &(d->luna));
printf("Anul: ");
sca... |
C | /* Keypad 2.c
*
* Created: 6/6/2014 4:55:52 AM
* Author: Saroj Shakya
*/
#include <avr/io.h>
#define F_CPU 8000000UL
#include <util/delay.h>
#define KEY_PORT PORTC
#define KEY_DDR DDRC
#define KEY_PIN PINC
//---LCD Port Definition---//
#define LCD_DATA_PORT PORTA
#define LCD_DATA_DDR DDRA
#define LCD_RS 2
#defin... |
C | /* BubbleSort(バブルソート、0オリジン配列) */
#include<stdio.h>
void trace(int A[],int N){
int i;
for(i = 0; i < N; i++ ){
if( i > 0) printf(" "); /*隣接する要素の間に1つの空白を入力*/
printf("%d",A[i]);
}
printf("\n");
}
int bubbleSort(int A[],int N){
int i, j;
int a;
for(i=0; i < N-1; i++){ //iがN-1より小さい間,
for(j = N ... |
C | // Set the connections for the keypad
char keypadPort at PORTD;
// set the connections for the LCD
sbit LCD_RS at RA4_bit;
sbit LCD_EN at RA5_bit;
sbit LCD_D4 at RA0_bit;
sbit LCD_D5 at RA1_bit;
sbit LCD_D6 at RA2_bit;
sbit LCD_D7 at RA3_bit;
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbi... |
C | /* circle_circle_intersection() *
* Determine the points where 2 circles in a common plane intersect.
*
* int circle_circle_intersection(
* // center and radius of 1st circle
* double x0, double y0, double r0,
* // center... |
C | /*
* FOFOLITO - Sistema Operacional para RaspberryPi
* Funções responsáveis por fazer a comunicação com a Mailbox0 do RPi
*
* Marcos Medeiros
*/
#ifndef __FB_DEV_H__
#define __FB_DEV_H__
#include "types.h"
/* Cálcula o endereço de rasterização de um pixel */
#define __fb_pos(dev, x, y) (dev->base + ((y * dev->w... |
C | /*************************************
* MSYS, LAB8, Part 1 *
* Timer 0 in Normal Mode *
* Led port increments 20 times/sec. *
* *
* STK500 Setup: *
* LEDs connected to PC pins. *
* *
* Henni... |
C | #include "stdio.h"
#define N 1000
void divisor(int n) // 第一题
{
for (int i = 1; i <= n/2; ++i)
{
//这里还有一种写法就是上面为n/2
if (n%i == 0)
{
/* code */
printf("the positive divisor of %d: %d\n",n,i );
}
}
}
int is_perfect(int n) //第二题
{
int sum;
if (n<=0)
{
return 0 ;
}
sum = 0;... |
C | #include <linux/i2c-dev.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include "I2C_light.h"
#include <unistd.h>
int file;
I2C_LSTATE light_setup()
{
file = open(I2C_DEVICE_FILE, O_RDWR); /* open the ... |
C | #include <stdio.h>
#include <math.h>
//PROGRAMME PERMETTANT DE CALCULER LE PI(poids ideal) ET BMI
int main()
{
//variable
char sexe;
float taille = 0;
int poids = 0;
//saisi
printf("Entrer votre sexe (M/F): \n");
scanf("%c", &sexe);
printf("Entrer votre taille (cm): \n");
scanf("%f", &taille);
printf("Entr... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int a = 5;
int b = 12;
int c = 7;
a < b; /* WAHR */
b < c; /* FALSCH */
a + c <= b; /* WAHR */
b - a >= c; /* WAHR */
a == b; /* FALSCH */
a + c == b; /* WAHR */
a != b; /* WAHR */
a = b < c; /* mglich: a = 0 */
a = c < b; /* -"- a = 1 */
return 0;
}
|
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 "list.h"
#include <stdlib.h>
t_point_list *ft_create_elem(int x, int y)
{
t_point_list *elem;
elem = (t_point_list *)malloc(sizeof(t_point_list));
if (!elem)
return (NULL);
elem->x = x;
elem->y = y;
elem->next = NULL;
return (elem);
}
int longest_distance_pos(t_point_list pos1, t_point_list pos2)
{... |
C | /*
* Interpreter.c
*
* Created on: Sep 24, 2015
* Author: mokogobo
*/
#include "Messenger.h"
Message *incomingMessageQueue = NULL;
Message *outgoingMessageQueue = NULL;
char messageUuidBuffer[DEFAULT_UUID_LENGTH] = { 0 };
char grammarSymbolBuffer[MAXIMUM_GRAMMAR_SYMBOL_LENGTH] = { 0 };
char uuidBuffer[DEF... |
C | /*
Copyright 2019 Andy Curtis
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dis... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <signal.h>
#include <signal.h>
#include <stddef.h>
#include <limits.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netinet/udp.h>... |
C | /*************************************************************************
> File Name: ../include/vec.c
> Author: sukong
> Mail: sukong@outlook.com
> Created Time: 2016年07月07日 星期四 10时39分45秒
************************************************************************/
#include<stdio.h>
#include<vec.h>
/*... |
C | #include "SVGwriter.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "commun.h"
void SVG_init(SVGwriter *svg, char *nom, int sizeX, int sizeY) {
if (!svg) {
print_probleme("Pointeur invalide");
return;
}
char filename[100];
strcpy(filename, nom);
strcat(fil... |
C | #ifndef DROGI_OUTPUT_H
#define DROGI_OUTPUT_H
#include "structures.h"
/**
* Wypisuje na standardowe wyjście diagnostyczne jednoliniowy komunikat ERROR n,
* gdzie n jest numerem linii w danych wejściowych zawierającym to polecenie.
* Linie numerowane są od jedynki (ignorowane linie są uwzględniane).
* @param n - n... |
C | #include "stdint.h"
#include "usart.h"
#include "green_led.h"
#include "stm32f0xx_gpio.h"
typedef enum {
PASSED = 1,
FAILED = 0
} test_t;
// function that execute a test and print the result
void execute_test(test_t (*test)(void), char *name) {
test_t result;
// execute test
result = test();
/... |
C | #ifndef __SLIST_H__
#define __SLIST_H__
#include <stddef.h>
typedef void (*FuncionVisitante) (int dato);
typedef struct _SNodo {
int x;
int y;
char state;
struct _SNodo *sig;
} SNodo;
typedef SNodo *SList;
/**
* Devuelve una lista vacía.
*/
SList slist_crear();
/**
* Destruccion de la lista.
*/
void s... |
C | #include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include "toDoList.h"
int main (int argc, const char * argv[])
{
char cmd[3] = " "; //incase user wants to go more than once
char filename[500];
FILE *filepointer;
//declaring tasks and new variables
int tp;
... |
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#define NAME_MAX 25
#define MAX_FILLS 5
#define NUM_VEHICLES 2
struct FillUp
{
double startOdometer, endOdometer;
double fuelUsed;
};
struct DrivingRecord
{
char make[NAME_MAX + 1];
char model[NAME_MAX + 1];
int numFills;
struct FillUp fillups[MAX_FILLS]... |
C | #include <resea/printf.h>
#include <resea/syscall.h>
#include <vprintf.h>
static char printbuf[PRINT_BUF_SIZE];
static int head = 0;
static int tail = 0;
void printf_flush(void) {
if (tail < head) {
sys_console_write(&printbuf[tail], head - tail);
tail = head;
} else if (tail > head) {
... |
C | #ifndef WCVOCAB_H
#define WCVOCAB_H
/* Defines */
#define VOCAB_NEW_GAME 0x72
#define VOCAB_CONTINUE 0x73
#define VOCAB_SHUTDOWN 0x75
/* Types */
typedef struct
{
int id; /* ID code for the string */
char *str; /* Actual string */
}vocabulary;
/*
Loads all vocab
*/
extern void wcvocab_load_all(F... |
C | /*
* 8장 파일 처리
* 파일 이름 : file_copy.c
*/
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
main( int argc, char *argv[])//argv[0] == ./file_copy,[1] = file1 [2] = file2
{
FILE * src; //sorce file
FILE * dst; // destination file
char ch;
int count = 0;
if(argc <3){
printf("Usage: file_copy source_file ... |
C | #include<stdio.h>
int a[200];
int gcd(int x,int y){
return x==0?x:(y,x%y);
}
int main(int argc, char *argv[]){
int n, i;
while(scanf("%d",&n)!=EOF){
int max=0;
for(i=0;i<n;i++){
scanf("%d",&a[i]);
if(a[i]>max)
max=a[i];
}
i... |
C | #include <errno.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "config.h"
#include "popen3.h"
#include "tpkg/cutest/cutest.h"
#define use_stdin(x) (x & (1<<0))
#define use_stdout(x) (x & (1<<1))
#define use_stderr(x) (x & (1<<2))
static int popen3_echo(const char *st... |
C | #include<stdio.h>
void scambia(int *p, int *q){
int comodo = *p;
*p = *q;
*q = comodo;
}
int main(){
int p, q;
scanf("%d %d", &p, &q);
scambia(&p, &q);
printf("%d %d\n",p, q);
return 0;
} |
C | #include <stdio.h>
#include <stdlib.h>
#include <SDL/SDL.h>
#include "menu.h"
#include "config.h"
#include "structs.h"
#include "widget.h"
int main(int argc, char * argv[]){
initSDL(); // Starts the SDL
menu(); // Load main menu
SDL_Quit(); // After menu did its job, stops SDL
return(EXIT_SUCCESS);
}... |
C | #include "libmx.h"
int mx_list_size(t_list *list) {
int count = 0;
for (t_list *walker = list; walker != NULL; walker = walker->next) {
count++;
}
return count;
}
|
C | #include "gdt.h"
#include "asm.h"
#include "bits.h"
#include "shell.h"
#include "utility.h"
#include <stdbool.h>
#include <stdint.h>
#define GDT_SIZE 3
ASM_PROC(load_gdt);
typedef struct __attribute__((__packed__)) t_gdt_register {
uint16_t limit;
uint32_t base_address;
} GdtRegister;
typedef struct __attri... |
C | /*####################################################################################
### Nome: Matheus Gonçalves Peres ###
### RA: 2840481723024 ###
### Professor: Takeda ###
### Atividade: Quadrado Mágico Teste na Matriz ###
##############################... |
C | #include "lists.h"
/**
* listint_len - check the code for Holberton School students.
* @h : int
* Return: Always 0.
*/
size_t listint_len(const listint_t *h)
{
size_t i = 0;
while (h != NULL)
{
h = h->next;
i++;
}
return (i);
}
|
C | #include<triangle.h>
#include<math.h>
float tri_area(Triangle *t) {
float s = tri_perimtr(t)/2.0;
float peri_sq = s * (s - t->a) * (s - t->b) * (s - t->c);
return sqrt(peri_sq);
}
float tri_perimtr(Triangle *t) {
return t->a + t-> b + t->c;
}
|
C | /*************************************************************************
> File Name: common.c
> Author:
> Mail:
> Created Time: Fri 18 Sep 2020 07:09:04 PM CST
************************************************************************/
#include "head.h"
int socket_create(int port) {
int sockfd;
if ((s... |
C | #include<stdio.h>
int findSum(int, int);
int main() {
int x = 10, y = 20;
//printf("Enter x: ");
//scanf("%d", &x);
//fflush(stdin);
//printf("Enter y: ");
//scanf("%d", &y);
printf("Result of adding %d and %d is: %d\n", x, y,(x + y));
return 0;
}
int findSum(int x, int y) {
return (x + y);
}
|
C | int numberOfDifferentBits(int A, int B) {
int diff = A ^ B;
int count = 0;
while (diff > 0) {
count += diff & (0x1);
diff = diff >> 1;
/* or do the following:
diff &= (diff – 1); // clear lowest 1 in diff
count++;
*/
}
return count;
}
|
C | /*
** EPITECH PROJECT, 2018
** generate_perfect_maze.c
** File description:
** generating a perfect maze
*/
#include "generator.h"
void modify_perfect_maze(int x, int y, char *maze, cell_t *cells)
{
cell_t *last_cell = create_first_cell();
last_cell->idx = y * (x + 1) - 2;
for (unsigned int i = 0; i == 0 || cells... |
C | #include <stdio.h>
#include <string.h>
struct student{
char name[30];
int age ;
float WT;
};
int main(){
struct student s;
strcpy( s.name ,"jad");
s.age=14;
s.WT =205;
printf("%s %d %f\n", s.name , s.age , s.WT );
struct student stus[100];
stus[0]=s;
printf("%s\n", stus[0].name);
}
|
C | /*
FILE : iSpeedClient.c
PROGRAMMER : Kevin Park, Julio Rivas
DATE : 2019 - 1 - 21
PROG : IAD - A01
DESCRIPTION : this file is the client side of the c file. it has functionalities of client side applciation for TCP UDP(LINUX AND WINDOW)
*/
#include "../inc/Common.h"
#include "../inc/iSpeedClient.h"
/*
ME... |
C | #include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <pthread.h>
#include <assert.h>
#include <sys/prctl.h>
#include <semaphore.h>
#include "task.h"
#include "klist.h"
#include "inits.h"
#include "mt_log.h"
typedef struct task_info_s {
const char *name;
unsign... |
C | #include <stdio.h>
#include "test.h"
int n = 42;
int m;
static int fib_fast(int n)
{
if (n < 2) return n;
int i = 2, x = 0, y = 0, z = 1;
do {
x = y;
y = z;
z = x + y;
} while (i++ < n);
return z;
}
fibril int fib(int n)
{
if (n < 2) return n;
int x, y;
fibril_t fr;
fibril_init(&fr)... |
C | #include <stdio.h>
int main(void)
{
char name[12];
double sal, vend, total;
scanf("%s %lf %lf", name, &sal, &vend);
total = sal + (vend*0.15);
printf("TOTAL = R$ %.2lf\n", total);
return 0;
}
|
C | /* Tendo testado o programa de diversas maneiras concluimos que o trabalho foi conseguido com sucesso visto até ao momento não termos encontrado nenhum
erro. Em termos da hash-table mudamos a estrurua de dados adoptada (em relação ao diagrama) visto agora agruparmos os artistas e os albums no mesmo sitio
Concluimos que... |
C | /*
** EPITECH PROJECT, 2018
** menger
** File description:
** .c
*/
#include "menger.h"
void menger(int size, int level, int x, int y)
{
size /= 3;
printf("%.3d %.3d %.3d\n", size, x + size , y + size);
if (level > 1) {
menger(size, --level, x, y);
menger(size, level, x, y + size);
... |
C | #include "adc.h"
void Enable_ADC_Clock (ADC_TypeDef * ADC){
if (ADC==ADC1)
RCC->APB2ENR|=RCC_APB2ENR_ADC1EN;
else if(ADC==ADC2)
RCC->APB2ENR|=RCC_APB2ENR_ADC2EN;
else if (ADC==ADC3)
RCC->APB2ENR|=0x1<<15;
}
void Init_Sample_Time (ADC_TypeDef * ADC, float cyclesAcq, u16 ADC_input_channel) {
int sampleTimeBi... |
C | #ifndef TERMINAL_H
#define TERMINAL_H
#include "buffer.h"
/*** terminal **/
/**
* @brief clear screen and return cursor, then print error
* message and exit with a return value of 1.
*
* @param s (additional error string to be printed - function name e.g)
*/
void die(const char *s);
/**
* @brief retur... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "token.h"
#include "ytab.h"
char *format_sval(char * string)
{
int length = 0;
char* strPtr = string;
char* strLen = malloc(strlen(string));
while(*strPtr++ != '\"')
{
// Iterate past first "
strPtr++;
}
while(*strPtr != '\"') // Skip "
... |
C | #include "xparameters.h"
#include "myled_controller.h"
#include "xscugic.h"
#include <stdio.h>
#include "xil_io.h"
void set_reg(void * base_addr,void * offset, int * value);
unsigned int read_reg(void * base_addr,void * offset);
static XScuGic gic;
//istanzio un struttura che gestisce il driver
/*
* XPAR_MYLED_CONTROL... |
C | /* El lenguaje de programacion C, R&K, (Prentice Hall, 2da. edicion, 1991) */
/* # 1.6 */
/* Programa que verifica que la expresion getchar() != EOF es 0 o 1 dependiendo del
caracter leido */
#include <stdio.h>
main(){
int c;
c=(getchar() != EOF);
printf("c = %i \n",c);
}
|
C | /*!
* \file
* \ingroup i2c
* \ingroup hdi
* \author Stefan M. Trenkwalder <s.trenkwalder@openswarm.org>
* \version 1.0
*
* \date 10 August 2015
*
* \brief Hardware dependent implementations to read and write on the I2C interface.
* \copyright adapted FreeBSD License (see http://openswarm.org/license)
*/
... |
C |
#include <stdint.h>
#include <string.h>
#define F_CPU 32000000UL
#include <util/delay.h>
#include <uart_io.h>
#include "bt_rn42.h"
#define TIMEOUT_MS 500
//--------------------------------------------------------------------------------------------------
/**
* \brief Send a raw command to RN42. Waits until respo... |
C | #include <config.h>
#include <stasis/common.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <stasis/operations.h>
#include <stasis/logger/logHandle.h>
#include <stasis/logger/logger2.h>
#include <stasis/logger/safeWrites.h>
#include <stasis/flags.h>
static char * logEntryToString(const LogEntry... |
C | #include<stdio.h>
#pragma pack(1)
struct emp
{
int empno;
char name[10];
float sal;
};
// Having a Pen Name
struct emp e;
void AcceptEmpInfo(void);
void DisplayEmpInfo(void);
int main(void)
{
printf("\n Enter Emp info :: ");
AcceptEmpInfo();
printf("\n Employee info :: ");
DisplayEmpInfo();
return 0;
}
voi... |
C | /*
** my_memset.c for libmy in /home/flipper/rendu/template/lib/my/memory/
**
** Made by Matthis Le Texier
** Login <le-tex_m@epitech.eu>
**
** Started on Mon Apr 4 09:55:07 2016 Matthis Le Texier
** Last update Mon Apr 25 08:51:09 2016 Matthis Le Texier
*/
#include <stdlib.h>
#include "my.h"
int my_memset(void ... |
C | #include <stdio.h>
int main() {
int a = -1, b = -1, potencia = 1;
while(a < 0) {
printf("Digite a base da potencia\n");
scanf("%d", &a);
if(a < 0) {
printf("Valor invalido, digite apenas numero inteiro nao-negativo\n");
}
}
while(b < 0) {... |
C | #include <stdio.h>
#include <math.h>
//#define PI 3.1415926535;
//struct xy {
//double x; /* x座標 */
//double y; /* y座標 */
//};
//struct rect {
//struct xy p1;
//struct xy p2;
//};
//球体の中心座標
typedef struct{
double x;
double y;
double z;
}Point;
//球体の表面を覆う点の座標
typedef struct{
Point center;
Point p;
}Sphe... |
C | /*--------------------------------------------------------------------------
File-name : coran.c
Description : Example of calling Korean Morph. Analyser
Hangul I/O code is KSC-5601-1987
Written-by : Kang, Seung-Shik at Kookmin University 2001. 6.
----------------------------------------------------------------... |
C | /**
* @file app1.c
*
* @date Created on: 2016/01/18
* @author Author: DATT JAPAN Inc.
* @version 1.1
* @brief Exif APP1領域解析用ソースコード
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "app1.h"
#include "common.h"
#include "exif.h"
/*!
@name Exif エントリ関連定義
@{
*/
typedef unsigned short EntryTa... |
C | #include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#define MAXLINE 1000
#define DEFAULTSTOP 4
#define MAXSTOPS 50
#define NUMBER 1
#define MINUS_NUMBER 2
#define PLUS_NUMBER 3
int isnumeric(char *s) ;
void entab(char *s, char *t, int *tabstops) ;
int main(int argc, char **argv)
{
/* parse arguments */
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <signal.h>
#define ile_procesow 3
void killgroup(pid_t * id, int sig){
int i;
for(i=0;i<ile_procesow;i++){
kill(id[i], sig);
}
}
pid_t inicjalizujProces(char * arg1, char * arg2){
pid_t child = fork();
... |
C | #include "client.h"
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <pthread.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <stdio.h>
#include "../protocol/protocol.h"
#include "../collections/queue.h"
#define CLNT_CALLBACK(cb, ...) \
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include "buffer.h"
// TODO
#define MAX_BUFF_SIZE 6969
#define LINE_TO_PRINT_SIZE 80
// since we only pass one function and argument to st_thread_create
typedef struct {
BoundedBuffer *from; // buffer from which input will be consumed
... |
C | /*
* File: main.c
* Author: Milos
*
* Created on September 18, 2017, 9:41 PM
*/
#include "bitconfig.h"
#include "xcincludes.h"
#include "realtimeclock.h"
#include "lcd.h"
#include "stepper_motor.h"
#include <stdio.h>
#define debounce_delay() __delay_ms(50)
#define BLANK_LINE " "
enum KEY_PRESSE... |
C | /** Converts an integer to an ASCII string with the given radix.
@file itoa.c
@ingroup misclib
@author Christian Dönges <cd@platypus-projects.de>
@note The master repository for this file is at
<a href="https://github.com/cdoenges/misclib">https://github.com/cdoenges/misclib</a>
LICEN... |
C |
#include <stdio.h>
void printfmiddlelind(const char* ap_string, int a_space_count) {
printf("%-*s\n", a_space_count, ap_string);
}
int main(){
int i;
printf("");
for (i = 0; i < 30; i++) printf("-");
printf("\n");
printfmiddlelind("", 29);
printfmiddlelind(" tipsware", 29);
printfmiddlelind("", 29);
prin... |
C | #include<stdio.h>
#include<string.h>
#define W_SIZE 100
int update_largest(int old_value, int new_value){
if(new_value > old_value){
return new_value;
}
return old_value;
}
int main(){
char word[W_SIZE];
int largest = 0, word_count = 0, index = 0;
fgets(word, sizeof(word), stdin);
while(word[in... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.