language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #ifndef QUEUE_H
#define QUEUE_H
typedef struct _queue_object{
void* object;
struct _queue_object* next;
}queue_object;
/**
* @param new_object pointer to some object you want to add into the FIFO queue
* @param queue the pointer to a queue you want to add the obejct to
* @return 0 if everything was fine
... |
C | /**************************************************************************
**
** bezier3.h
** Author : ericjang
** Created: 6/14/2014
**
** General-purpose cubic bezier curve. Smooth enough for most purposes.
** This forms the mathematical primitive of a path.
**
*********************************************... |
C | /***************************************************************************
(c) 1998, Joseph L. Thorley
All rights reserved
History: 31/7/98
****************************************************************************/
#ifndef _TLEAFSET_H
#define _TLEAFSET_H
#include "TClassTypes.h"
#include "TSortable.h"
#inc... |
C | /*
Ejercicio 1.19
Escriba una funcin reverse(s) que invierta la cadena de caracteres s.
sela para escribir un programa que invierta su entrada, lnea a lnea
*/
#include <stdio.h>
#define MAXLINE ((unsigned int)1000) /* tamao mximo de la lnea de entrada */
int intGetline(char line[], int maxline);
void reverse(char ... |
C | #include "nuphasedaq.h"
#include <stdio.h>
#include <stdlib.h>
// read_reg spidev byte0 byte1 byte2 byte3
int main(int nargs, char ** args)
{
uint8_t bytes[4];
int i,status;
nuphase_dev_t * dev;
if (nargs < 6)
{
printf("Usage: read_reg spidev");
return 1;
}
//no interrupt, no locking... |
C | #include<stdio.h>
#include<conio.h>
void main()
{
float tb,gb,mb,kb,byte;
printf("\n Ingrese un valor expresado en Terabyte:\n\n\t");
scanf("%f",&tb);
gb=tb*1024;
mb=gb*1024;
kb=mb*1024;
byte=kb*1024;
printf("\n %f terabyte equivale a:\n\n %f gigabyte \n\n %f megabyte... |
C | #ifndef NJSON_H_
#define NJSON_H_
typedef enum { false, true } bool;
typedef struct _Njson {
char* key;
void* value;
void (*print_nj)(void* this, FILE* out);
unsigned size_type;
unsigned count_elem;
bool is_array; // Se utiliza para imprimir
} Njson;
Njson* njson_init(Njson* this, char* key, void... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fo_input_mouse.c :+: :+: :+: ... |
C | #ifndef HASHMAP_H_INCLUDED
#define HASHMAP_H_INCLUDED
#include <stdlib.h>
typedef struct NC_vararray NC_vararray;
typedef struct NC_dimarray NC_dimarray;
/** Hashmap structure (forward declaration) */
struct s_hashmap;
typedef struct s_hashmap NC_hashmap;
/** Creates a new hashmap near the given size. */
extern NC_h... |
C | #include <stdio.h>
#include <stdlib.h>
int p=1;
int f=1;
int main()
{
float e(int x,int n);
int x;
int n;
printf("enter the power of exponential: \n");
scanf("%d",&x);
printf("enter number of terms to be used in series: \n");
scanf("%d",&n);
printf("value of exponential = %f \n",e(x,n));
}
float e(int x,int n)
{
fl... |
C | #include <stdlib.h>
#include "game/game_state.h"
#include "game/scenes/credits.h"
#include "utils/allocator.h"
#include "video/video.h"
typedef struct credits_local_t {
int ticks;
} credits_local;
void credits_input_tick(scene *scene) {
game_player *player1 = game_state_get_player(scene->gs, 0);
ctrl_ev... |
C | #include <stdio.h>
int main(void) {
int a,b,c;
a = 1;
b = 2;
c = b + a;
printf("%d",c);
}
|
C | #include "ͷ.h"
void queueInit(Queue* q)
{
//ʼն
q->_front = q->_rear = NULL;
q->_size = 0;
}
QNode* creatNode(QDataType data)
{
QNode* node = (QNode*)malloc(sizeof(QNode));
node->_data = data;
node->_next = NULL;
return node;
}
//β
void queuePush(Queue* q, QDataType data)
{
QNode* node = creatNode(data);
//ն
... |
C | #include <stdio.h>
#include <stdlib.h>
int main(){
float liczba1, liczba2;
int wyb;
printf("Podaj pierwsza liczbe: ");
scanf("%f", &liczba1);
printf("Wybierz rodzaj dzialania:\n");
printf("1 - dodawanie\n");
printf("2 - odejmowanie\n");
printf("3 - mnozenie\n");
printf... |
C | #include<stdio.h>
main()
{
int n,i,k,z;
printf("Enter size of array. : ");
scanf("%d%d",&n,&k);
z=n+k;
int a[n], a1[k], a2[z];
printf("Enter value in first array.:\n");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
printf("Enter value in second array.:\n");
for(i=0;i<k;i++)
scanf("%d",&a1[i]);
for(i=0;i<z;i++){
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* style_handler.c :+: :+: :+: ... |
C | #ifndef ANTISOUND_FIFO_H
#define ANTISOUND_FIFO_H
#include <stdlib.h>
#include <stdbool.h>
typedef struct FIFO
{
int id;
void* data;
struct FIFO* next;
struct FIFO* tale;
}fifo_t;
/*
* initializes struct FIFO and returns pointer to fifo_t
*/
fifo_t* antiSound_fifo_initializeFifo();
/*
* remo... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_formatd.c :+: :+: :+: ... |
C | #include<stdio.h>
int main() {
/* code */
int year = 2020;
if((year % 4 == 0 && year % 100 != 0)|| year % 400 == 0)
printf("its leap year\n");
else
printf("NOT LEAP year\n");
}
|
C | #include <stdio.h>
#include <conio.h>
int main(){
int n;
int aSay=0,bSay=0,cSay=0,dSay=0,fSay=0;
printf("Harf notlarini giriniz:\n");
printf("Cikis icin EOF karakterini giriniz:\n");
while((n=getchar())!=EOF){
if(n=='A'||n=='a'){
aSay++;
}
else if(n=='B'||n=='b'){
bSay++;
}
else... |
C | #include <stdio.h>
#include <stdlib.h>
int is_abundant(int n) {
int sum = 0;
for (int i = 2; i <= n/2; i++) {
if (n % i == 0) {
sum += i;
if (sum > n) {
return 1;
}
}
}
return 0;
}
int main() {
int n = 1;
int count = 0;
wh... |
C | /*
author: James Ross
note: if you found it, ask before using it for something other than bowling.
thx :D
handles the flow of the game in a single player instance as described in
singleplayer.h
filename: singleplayer.c
*/
/* headers */
#include "singleplayer.h"
#inc... |
C | #ifndef __LCD_BMP_H
#define __LCD_BMP_H
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdint.h>
#define RGB(r,g,b) (((r>>3)<<11)|((g>>2)<<5)|(b>>3))
typedef unsigned char BYTE;//1 byte
typedef unsigned short WORD;//2 byte
typedef unsigned long DWORD;//4 byte
/*************... |
C | void initialize(agent_struct *agent, int action_index){
int row; /*Starting positions for the scan area*/
int column;
row = (int)(40 * ((double)rand()/(double)RAND_MAX));
column = (int)(40 * ((double)rand()/(double)RAND_MAX));
agent->field[1] = row;
agent->field[2] = column;
agent->field[3] = 4;... |
C | #include<stdio.h>
#include<string.h>
#define LINES 100 /* max lines to be sorted */
main() /* sort input lines */
{
char *lineptr[LINES]; /* pointers to text lines */
int nlines; /* number of input lines read */
if ((nlines = readlines(lineptr, LINES)) >= 0) {
sort(lineptr, nlines);
writelines(lineptr, ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <unistd.h>
#include <string.h>
#include <strings.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <pthread.h>
#include <assert.h>
#include <sys/stat.h>
#include <sys/sendfile.h>
#include <fcntl.h>... |
C | #include <stdio.h>
# define MONEDAS 5
float monedas[] = {5, 1, 0.50, 0.20, 0.10};
int solucion[MONEDAS] = {0, 0, 0, 0, 0};
int main(){
int i;
float devolucion;
float precio_prod;
float dinero_recibido;
// Valida input
while(1){
printf("Precio del producto: ");
sca... |
C | /**
* A morse code to english translator that uses the command line for input
*
* @author Wolfe, Conrad
* @assignment ICS 212 Assignment 15
* @date March 13, 2018
*/
#include <stdio.h> //io stuff
#include <string.h>... |
C | #include <string.h>
#include <stdio.h>
void lshift(int *a, int n) {
memmove(a+n, a, 4*sizeof(int));
memset(a, 0, n*sizeof(int));
}
int main() {
int a[] = {1, 2, 3, 4, 0, 0, 0, 0, 0};
int i;
lshift(a, 0);
for (i=0; i < sizeof(a)/sizeof(int); ++i)
printf("%d ", a[i]);
printf("\n");... |
C | #include <stdlib.h>
#include <stdio.h>
#include "fizz.h"
/* Add function signatures here */
int main(int argc, char **argv) {
/* Start your code here */
int n;
printf("What is the number that you want to calculate:\n" );
scanf("%d", &n);
fizzBuzz(n);
return 0;
}
|
C | #include<stdio.h>
int adjlist[10][10],stack[100],queue[100],visited[10];
int front =0; int rear = -1;
int top = -1;
int n;
int main()
{
printf("enter the number of nodes: ");
scanf("%d",&n);
int choice;
while(1)
{
printf("\n1) Create an adjacency list for the graph\n2) BFS\n3) DFS\n4) Exit\n");... |
C | #include<stdio.h>
#include<math.h>
void main(){
float a=0,b=2*M_PI,x,delta_x=1.e-2;//0.001
printf("\tx\t\te^-x\t\t(e^-x)\'\n");
x = a;
while(x<b){
printf("%10.2f\t%10.2f\t%10.2f\n",x,exp(-x),/*-exp(-x));*/(-exp(-x+delta_x)+exp(-x))/delta_x);
x += delta_x;//x = x + delta_x;
}
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include "mascotas.h"
#include "ac_getFunciones.h"
#include "menus.h"
#include "funciones_adicionales.h"
#include "razas.h"
int getEmptySlotRaza(e_Raza vec[],int size)
{
int lugar = -1;
int flag = 0;
for (int i = 0;... |
C | #include "common.h"
#include "descriptor_tables.h"
#include "monitor.h"
#include "syscall.h"
static void gdt_set_gate(unsigned int,unsigned int,unsigned int,unsigned char,unsigned char);
static void write_tss(unsigned int num, unsigned short ss0,unsigned int esp0);
extern void tss_flush();
void init_gdt();
gdt_entry gd... |
C | #ifndef ITEM_H
#define ITEM_H
#include "player.h"
#include <stdlib.h>
struct player;
typedef void (*effect)(struct player*);
enum _item_type;
struct item;
struct actionable;
struct weapon;
struct consumable;
struct potion;
typedef enum item_type {
actionable_type,
weapon_type,
consumable_type,
pot... |
C | //
// Copyright (C) BlockWorks Consulting Ltd - All Rights Reserved.
// Unauthorized copying of this file, via any medium is strictly prohibited.
// Proprietary and confidential.
// Written by Steve Tickle <Steve@BlockWorks.co>, September 2014.
//
#include "ErrorHandling.h"
#include "TimedEvents.h"
#include "BoardSu... |
C | void ft_sort_int_tab(int *tab, int size)
{
int aux;
int i;
i = 0;
while (i < size)
{
if (tab[i] > tab[i+1])
{
aux = tab[i];
tab[i] = tab[i+1];
tab[i+1] = aux;
i = -1;
}
i++;
}
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "../pfa-src/interface_mm.h"
#include "../pfa-src/db_manager.h"
struct AllData * init_AllData(void)
{
struct AllData * d;
d = malloc(sizeof(struct AllData));
d->id_party = INIT_VAR_INT;
d->mod.name = NULL;
d->bot.id = INI... |
C | /*
* Author: Cobbliu
* Email: cobblau@gmail.com
*/
/*
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.
Note: You can only move either down or right at any point in time.
*/
/*
* Hint:
* F[i][j] = min(F[i-1][... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define N 100
int
comp_func (const void *c1, const void *c2)
{
int i1 = *(int *)c1;
int i2 = *(int *)c2;
return i1 - i2;
}
void
fyshuffle(int* v, int n)
{
srand((unsigned)time(NULL));
for (int i = 0; i < n; i++) {
v[i] = i;
}
for (int i = n... |
C | #include <stdint.h>
#include "lab1.h"
void TurnOff(void) {
volatile unsigned short delay = 0;
RCGCGPIO |= 0x1020; // Enable PortF(led3, 4) and PortN(led1, 2) GPIO
delay++; // Delay 2 more cycles before access Timer registers
delay++; // Refer to Page. 756 of Datasheet for info
GPIODIR_F = 0x11; // Set PF0, PF4 t... |
C | #include<stdio.h>
void array_invert(void){
unsigned short i, j;
float aux, my_array[20];
for(i = 0; i < 20; i++){
scanf("%f", &my_array[i]);
}
j = 20;
for(i = 0; i < 10; i++){
aux = my_array[i];
my_array[i] = my_array[j-1];
my_array[j-1] = aux;
j--;... |
C | #include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <time.h>
#define MAXIMUS 10 //̴С
#define SLARY 10000
#define PLAYERS 4
int p[MAXIMUS][MAXIMUS];//洢Ϣ
char buff[MAXIMUS * 3 + 1][MAXIMUS * 6 + 1] = { 0 };//
int wi=0, wj=0;//ǰд뻺λ
char* showText="̣";
char* showAnwser="Ϸʼո·";
char* ti... |
C | #ifndef RBT_H
#define RBT_H
#include "..\Utilities\utils.h"
#define RED 0
#define BLACK 1
#define UNVISITED 0
#define VISITED 1
#define FREE 1
typedef struct rbt_node rbt_node_t;
typedef struct rbt rbt_t;
struct rbt_node{
void* data;
unsigned int colour: 1;
unsigned int visited: 1;
int frequency;
... |
C | #include <stdio.h>
#include <stdlib.h>
#include "List.h"
void PrintList(list *list){
node *curNode = list->listHead;
unsigned int id = 1;
// Viene verificato se la lista non è vuota
if(curNode == NULL){
fprintf(stderr,"Errore: impossibile stampare la lista\n");
exit(EXIT_FAILURE);
}
while(curNode != NULL)... |
C | /*
** EPITECH PROJECT, 2018
** my_rpg_2017
** File description:
** draw_inventory
*/
#include <stdint.h>
#include "render_window.h"
#include "render.h"
#include "inventory.h"
#include "xml.h"
#include "nb_utils.h"
static void draw_droped_items(win_t *win, inventory_t *inventory)
{
for (uint8_t i = 0; i < (NB_ITEMS ... |
C | /*
** EPITECH PROJECT, 2018
** mdr
** File description:
** mdr
*/
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <string.h>
#include <signal.h>
#include <fcntl.h>
#include "serveur.h"
... |
C | #include <stdio.h>
#include <windows.h>
#include <string.h>
#define length 50
#define k_length 8
void Init();
void Encry();
void Decry();
int Playfair()
{
while (1)
{
Init();
}
return 0;
}
void Init()
{
int answer;
printf(">>Playfairȣ α<<\n");
printf("ȣȭ(0), ȣȭ(1), (2) : ");
scanf("%d", &answer);
sy... |
C | #include<stdio.h>
int main()
{
int i=1,n;
printf("inter the limit:-");
scanf("%d",&n);
abc:
printf("%d\n",i);
i+=1;
if (i<=n)
{
goto abc;
}
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "LinkedList.h"
#include "bicicletas.h"
#include "parser.h"
#include "utn_lemos.h"
int controller_List(LinkedList* pArrayList)
{
int retorno=-1;
int tam=ll_len(pArrayList);
eBicicleta* auxBike;
if(pArrayList!=NULL)
{
if(ll_isEm... |
C | /*
* File: queue.c
* Author: THE MASTER
*
* Created on April 26, 2018, 11:40 AM
*/
#include "config.h"
#include "queue.h"
/*
*
*/
void q_add_cmd(uint8_t cmd)
{
queue[++q_index];
}
void q_clear()
{
}
bool q_is_empty()
{
return true;
}
uint8_t q_read(uint8_t index)
{
uint8_t i = 0;
... |
C | #include "libmorse.h"
const char morse_table[45][MORSE_LENGTH] PROGMEM = {
"._._._", // .
"_.._.", // /
"_____", // 0
".____", // 1
"..___", // 2
"...__", // 3
"...._", // 4
".....", // 5
"_....", // 6
"__...", // 7
"___..", // 8
"____.", // 9
"___...", /... |
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 | // Implements a dictionary's functionality
#include <stdbool.h>
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include "dictionary.h"
#include <string.h>
#include <strings.h>
// Represents a node in a hash table
typedef struct node
{
char word[LENGTH + 1];
struct node *next;
}
node;
// Number of ... |
C | //
// Created by miguelchauca on 05/05/19.
//
#include "listaMemoria.h"
void *serealizarDataMemoria(st_memoria *memoria, size_t *size_buffer) {
st_size_memoria sizeMemoria;
sizeMemoria.ip = strlen(memoria->ip) + 1;
sizeMemoria.puerto = strlen(memoria->puerto) + 1;
sizeMemoria.numero = sizeof(memoria->... |
C | #include <stdio.h>
#include <string.h>
// Pedro Antonio Estévez Pérez
// Ejercicio 9
/* Realizar una función que reciba por parámetro dos cadenas de caracteres
* y debe concatenar la segunda a la primera. El programa principal imprimirá
* el resultado de la concatenación.*/
/* Para pasar cadenas de car... |
C | #include <stdio.h>
/**
*int_index - function that searches for an integer
*@array: array pointer to int
*@size: number of element in the array
*@cmp: pointer to a function that receives an int
*Return: int
**/
int int_index(int *array, int size, int (*cmp)(int))
{
int el;
int index;
if (array != NULL && cmp ... |
C | #include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include "capnp_c.h"
#include "demo.capnp.h"
#define TRANSFER_LENGTH_MAX (4096)
#define ASSERT_EQ(x, y) do {if(x == y) { } else {printf("Fatal error, Function:%s Line:%d\n", __func__, __LINE__);for(;;) {} }} while(0)
#define EXPECT_BASE(true) \
do { \
pr... |
C | #ifndef JOB_LIST_H
#define JOB_LIST_H
#include <stdlib.h>
#include <stdio.h>
typedef struct list_element
{
int val;
char* command;
char* stat;
struct list_element* next;
} list_element;
typedef enum
{
LIST_OKAY,
LIST_EMPTY,
LIST_HEAD_NULL,
LIST_ELEMENT_NOT_FOUND
} LIST_STATUS;
struct... |
C | #include "ArrayEmployees.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
int menuEmp()
{
int opcion;
system("cls");
printf("--------Menu de opciones ABM--------\n\n");
printf("1. ALTAS\n");
printf("2. MODIFICAR\n");
printf("3. BAJA\n");
printf("4. INFORMAR\n... |
C | #include <stdio.h>
#include <string.h>
#define MAX 8
int main(){
int n;
char jogador1[MAX], jogador2[MAX];
scanf("%d", &n);
while(n > 0){
setbuf(stdin, NULL);
scanf("%s", &jogador1);
setbuf(stdin, NULL);
scanf("%s", &jogador2);
if(strcmp(jogador1, jogador2) == 0)... |
C | #include <netdb.h>
#include <unistd.h>
#include <errno.h>
#include "fastcommon/logger.h"
#include "fastcommon/hash.h"
#include "fastcommon/shared_func.h"
#include "keyword_hashtable.h"
#include "server_global.h"
#include "wordsegment.h"
#define MAX_KEYWORD_CHARS 16 //Note: an english word as a char
int word_segme... |
C | #include<stdio.h>
int main()
{
int a[100],N,i,e;
printf("鳤\n");
scanf("%d",&N);
printf("\n");
for(i=0;i<N;i++)
{
scanf("%d",&a[i]);
}
printf("Ԫ\n");
scanf("%d",&a[N]);
N++;
for(i=0;i<N;i++)
{
printf("%d ",a[i]);
}
printf("\n");
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.c :+: :+: :+: ... |
C | #ifndef RIO_H
#define RIO_H
/* RIO -- Robust I/O, 减少低字节IO时用户态和内核态的切换 */
#include <string.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/errno.h>
#include <stdio.h>
#include <event2/event.h>
#define RIO_BUFSIZE 4096
typedef struct _Rio{
int rioFd; //与缓冲区绑定的文件描述符的编号
size_... |
C | #include <stdio.h>
int main()
{
int n;
while(1)
{
long long int ans[80]={0};
scanf("%d",&n);
if(n==0)
break;
for(int i=0;i<=n;i++)
{
if(i<=2)
ans[i]=i;
else
ans[i]=ans... |
C | // markov chain estimation of pi
// ahc : andy c.
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "markov_pi.h"
#define TRIAL_COUNT 500000
int main()
{
int i, hits = 0;
double pi;
Posn ctr;
ctr.x = ctr.y = 0.5;
for (i=0; i<TRIAL_COUNT; i++) {
Posn p = getPosn();
if (dist(p,ctr) ... |
C | #include "key.h"
#include "delay.h"
//
//ذֵ
//mode:0,֧;1,֧;
//0ûκΰ
//1WKUP WK_UP
//ע˺Ӧȼ,KEY0>KEY1>KEY2>WK_UP!!
uint8_t KEY_Scan(uint8_t mode)
{
static uint8_t key_up=1; //ɿ־
if(mode==1)key_up=1; //֧
if(key_up&&(KEY0==0||KEY1==0||KEY2==0||WK_UP==1))
{
delay_ms(10);
key_up=0;
... |
C | #include <stdio.h>
void printArray(const int []);
int main(void)
{
int iNumbers[3] = {2, 4, 6};
printArray(iNumbers);
} // end main
void printArray(const int num[]) // pass by reference, but read-only
{
int x;
printf("\nArray contents are: ");
for (x = 0; x < 3; x++)
{
printf("%... |
C | #include <stdio.h>
main(){
char *s = "#include <stdio.h>%cmain(){%c%cchar *s = %c%s%c;%c%cint i = %i;%c%cchar file[10] = %cSully_X.c%c;%c%cwhile (i >= 0){%c%c%cfile[6] = 48 + i;%c%c%cfprintf(fopen(file, %cw%c), s, 10, 10, 9, 34, s, 34, 10, 9, i, 10, 9, 34, 34, 10, 9, 10, 9, 9, 10, 9, 9, 34, 34, 10, 9, 9, 10, 9, 10, 10... |
C | /*OS homework1-1 Finding the highest value */
#include <stdio.h>
#include <pthread.h>
#include <stdlib.h>
#define INF 1000000
int arr[10][10];
int maxs[30];
int blocknum[10];
int result;
int x[9] = { 0, 0, 0, 3, 3, 3, 6, 6, 6};
int y[9] = { 0, 3, 6, 0, 3, 6, 0, 3, 6}; //arr[x[blocknum + i]][y[blocknum + j]]) (0<=... |
C | //quick utility to adjust keyboard backlight brightness on Asus UX32VD
//assumes range 0-3
#include <stdio.h>
#include <fcntl.h>
#define PATH "/sys/class/leds/asus::kbd_backlight/brightness"
#define MAX '3'
int main(int argc, char* argv[]) {
if(argc < 2) {
return -1;
}
int brightness = open(PATH,... |
C | #ifndef FILE_WAITVERBOSE_H
#define FILE_WAITVERBOSE_H
#include <syscall.h>
#include <errno.h>
// Comme wait mais imprime sur stderr un message clair.
// valeur renvoyée:
// -1: pas de processus fils.
// >0: le processus # s'est terminé.
int waitendverbose(int*status)
{
int ret,etat;
int thid=syscall(SYS_g... |
C | #include <stdio.h>
int main()
{
char*cptr = NULL;
float*fptr = NULL;
double*dptr = NULL;
int*iptr = NULL;
printf("Pointer to character takes %d bytes\n",sizeof(cptr));
printf("Pointer to float takes %d bytes\n",sizeof(fptr));
printf("Pointer to double takes %d bytes\n",sizeof(dptr));
printf("Po... |
C | /**
* eCow-logic - Embedded probe main firmware
*
* Copyright (c) 2016 Saint-Genest Gwenael <gwen@agilack.fr>
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2 as published by the Free Software
* Foundation. (See COPYING.GPL for details.)
*
* This fi... |
C | #include <stdio.h>
#include <stdlib.h>
struct node
{
int num;
struct node *next;
};
void create(struct node **);
void display(struct node *);
int survivor(struct node **, int);
int main()
{
struct node *head = NULL;
int survive, skip;
create(&head);
printf("The persons in circular list a... |
C | #include "monty.h"
/**
* pall - Print all values in the stack
* @stack: Double pointer to the top of the stack
* @n_line: The line of the file the command was found
*/
void pall(stack_t **stack, unsigned int n_line)
{
stack_t *tmp;
(void) n_line;
tmp = *stack;
while (tmp != NULL)
{
printf("%d\n", tmp->n);... |
C | #ifndef VM_H
#define VM_H
#include <math.h>
#define VM_PI 3.14159265358979323846264338327950288
#define VM_PI_2 1.57079632679489661923132169163975144
#define VM_PI_4 0.785398163397448309615660845819875721
#define VM_PIf ((float)VM_PI)
#define VM_PI_2f ((float)VM_PI_2)
#define VM_PI_4f ((float)VM_PI_4)
/*... |
C | #ifndef __MSCHEDULER_H__
#define __MSCHEDULER_H__
#include "../kernel1/OSDefine.h"
#include "mList.h"
#include "task.h"
#define TASK_COUNT_MAX 512
#define TASK_RUNNINGTIME_MAX 20
#define TASKPOOL_ADDRESS 0x2d000
#define TASK_FLAGS_RUN 0x0001 //실행중인 태스크
#define TASK_FLAGS_END 0x0002 //종료 ... |
C | #include"milibreria.h"
/** f1 = fila inicial y c1= columna inicial
f2= fila final y c2 columna finalD
*/
/// valida el movimiento del peon
int mov_peon(char tablero[TAM][TAM], int f1, int c1,int f2,int c2, int setup)
{
/*verificacion si la casilla destino esta en las diagonales
superiores i... |
C | /** @file BIL105 Spring 2016 HomeWork 1
*
* A program that produces random numbers by two different
* methods. First method is MID-PRNG and the second one is
* LSD-PRNG. User chooses one of the methods the create number.
*
* @author
*
* Name: Yunus Güngör
*
* Student no: 150150701
*
* Date: ... |
C | #include "my.h"
void string_formatting(char* first_name, char* last_name, int age){
printf("Hello, my name is %s %s, I'm %d.", first_name, last_name, age);
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include "ryujilib.h"
/* (C) 1992 Ryuji Suzuki (JF7WEX) */
static unsigned char
RCS_ID[] = "$Header: rjslib.cv 1.1 92/09/17 04:11:26 jf7wex Exp $";
/* strtoke() is like strtok(). */
char *
strtoke(char *src, const char *sep)
{
register char const *r;
reg... |
C | #include <stdio.h>
#include <stdlib.h>
int main() {
FILE* fp1;
FILE* fp2;
FILE* fpad;
unsigned int header[138];
unsigned int data1[179916];
unsigned int data2[179916];
int ctr;
fp1 = fopen("enc1.bmp","r");
fread((void*)header, 1, 138, fp1);
fread((void*)data1, 1, 179916, fp1);
f... |
C | #include "buffer.h"
#include "exit.h"
#include "strerr.h"
#define puts2(s) buffer_puts(buffer_2,s);
void strerr_warn(const char *x1,const char *x2,const char *x3,const char *x4,const char *x5,const char *x6,const struct strerr *se)
{
strerr_sysinit();
if (x1) puts2(x1);
if (x2) puts2(x2);
if (x3) puts2(x3);
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strsplit.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "Item.h"
#include "pq.h"
#define N 20
int main(void) {
int i;
PQ a, b;
srand(time(NULL));
a = PQinit();
b = PQinit();
for (i = 0; i < N; ++i) {
PQinsert(a, (rand() % N));
}
PQcopy(a, b);
while (!PQempty(b)) {
printf("%i ", PQdelma... |
C | #include "../../testing.h"
#include "avltree.h"
#define STATIC_ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a)))
static int compare_total_count = 0;
#define RESET_COUNTS() \
do { \
compare_tota... |
C | /*
* Marcel Kredzel - M00540191
* Operating Systems Project 1 - Shell
*/
#ifndef MYSHELL_H_
#define MYSHELL_H_
#include "utility.c"
// change directory
// in: new directory
extern void cmd_cd(char *directory);
// clear shell
// no input/output
extern void cmd_clr(void);
// list directory contents
// in: directo... |
C | #include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <time.h>
#include "game_structs.h"
#include "deps/socket.h"
#include "deps/cJSON.h"
#include "deps/uthash.h"
#include "deps/levenshtein.h"
// Parsing JSON variables
category_t* category_hash... |
C | /*
*
*Author: Chas Shipman
*CS201
*Assignment 0
*Anderson
*Due: 1/30/18
*
*
*This file acts as
*an abstract singly-linked
*data structure.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "sll.h"
typedef struct node{
void *value;
struct node *next;
} NODE;
struct sll{
void (*... |
C | #include "barman.h"
//Global variables
int closed;
//States
int *clients_states;
int **barman_states;
int *bottle_states;
int nb_barman;
int nb_client;
int nb_bottles;
Choice_bottles *client_choices;
//Condition
pthread_cond_t cv_all_barmans;
pthread_cond_t *cv_clients;
pthread_cond_t *cv_barmans;
pthre... |
C | /**
* @file cod.c
* @brief ficheiro com funções para ler os ficheiros .COD
* @author Emanuel João Conceição Lopes <2140825@student.estg.ipleiria.pt>
*/
#include "cod.h"
#include "errors.h"
#include "common.h"
#include "debug.h"
#include "memory.h"
/**
* @brief Abrir ficheiro cod
*
* @param path - caminho do ficheir... |
C | /*
* Name: Matthew Olsen
* Lab: Lab 4 Lexical Analysis
* Date: 02/20/18
*/
#include "scanner.h"
/*
* SUBMIT THE FSM!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
*/
TOKEN *ungottenToken = NULL; // used by parser
//
// return token to the input, so it can b... |
C | #include <stdio.h>
#include <string.h>
#define dim 50
int main ()
{
char ingreso [dim];
printf ("Hola Mundo\n");
printf ("Escriba algo: \n");
gets(ingreso);
printf ("%s",ingreso);
return(0);
}
|
C | //һĶƵλżλ
//#define _CRT_SECURE_NO_WARNINGS
//#include <stdio.h>
//void print_binary(int n)
//{
// int ret = n;
// int i = 0;
// printf("żλΪ");
// for(i = 16; i > 0; i--)
// {
// printf("%d ", n & 1);
// n = n >> 2;
// }
// printf("\n");
// printf("λΪ");
// for(i = 16; i > 0; i--)
// {
// ret=ret >> 1;
// printf("%d... |
C | /*
* lesson12.2.c
*
* Write a program that declares an integer array of size 20, and then with a loop,
* initializes all of its values to random numbers between 50 and 100.
* You can use the rand() function from stdlib.h to generate an arbitrary int,
* and then mod it by m to fall within the range 0 to m-1. ... |
C | /* gcc -lpthread | -pthread */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <pthread.h>
#define MSG_SIZE 1024
struct msg_stru {
char msg1[MSG_SIZE], msg2[MSG_SIZE], msg3[MSG_SIZE];
}; /* global variable */
static void *runner1(void *);
static void *runner2(void *);
in... |
C | /*
* LowlevelGraphicsTestMain.c
* baselib
*
* Created by Martin on 8/15/10.
* Copyright 2010 __MyCompanyName__. All rights reserved.
*
*/
#include <allegro.h>
#include "Common.h"
#include "SystemGraphics.h"
#include "ZoneAllocator.h"
#include "WadFile.h"
#include "FixedPointNumber.h"
#include "StaticGraphic... |
C | /*
* @Date: 2020-05-06 15:18:47
* @LastEditors: litelte
* @LastEditTime: 2020-05-06 16:02:05
* @FilePath: /CProject/zju_c/week4PatTask/12.c
* @Description: 兔子繁衍问题&斐波那契数列问题
* 题目链接:https://pintia.cn/problem-sets/13/problems/444
*/
/*
* 斐波那契数列数列
* 1,1,2,3,5,8,13......
*/
#include <stdio.h>
int main(int ar... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.