language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include<sys/select.h>
#include<signal.h>
#include<sys/stat.h>
#include<stdio.h>
#include<sys/ipc.h>
#include<sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include<stdlib.h>
#include<sys/shm.h>
#include <sys/poll.h>
#include <sys/time.h>
#define MAX 9
int shmid,shmid1;
int *no;
int *grp;
int prc=0,gp=0;
int csfd... |
C | //verifie si un domnaine est syntaxiquement correcte
// retourne 1 si correcte et 0 sinon
int check(char *domaine) ;
//argv représente le tableau des paramères du programme
//cette fonction retourne la taille de la liste de domaine à partir argv[pos]
//la fin la liste est localisée soit par la fin du tableau d'argumen... |
C | #include <sys/socket.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <malloc.h>
#include <signal.h>
#include <stdlib.h>
#include <pthread.h>
#define QS_MSGLEN 256
int sfd;
char *buf;
void finish(int sig)
{
close(sfd);
free(buf);
exit(0);
}
int main()
{
sigset_t sigm... |
C | #include<stdio.h>
#include<stdlib.h>
struct node
{
int data;
struct node *next;
};
void insertAtTheBegin(struct node **head_ref, int data);
void bubbleSort(struct node *head);
void swap(struct node *a, struct node *b);
void print(struct node *head);
void insertAtTheBegin(struct node **head_re... |
C | #include <gb/gb.h>
#include <gb/drawing.h>
#include <stdio.h>
void main(){
// start screen (press start to continue)
gotogxy(3,8); // set text start position
gprintf("Press Start...");
waitpad(J_START); // wait for start
gotogxy(3,8); // reset text start position
gprintf(" "); // c... |
C | #include <REGX52.H>
#include "Delay.h"
/**
* @brief 矩阵键盘读取按键键码
* @param 无
* @retval KeyNumber 按下按键的键码值
如果按键按下不放,程序会停留在此函数,松手的一瞬间,返回按键键码,没有按键按下时,返回0
*/
unsigned char MatrixKey()
{
unsigned char KeyNumber=0;
P1=0xFF;
P1_3=0;
if(P1_7==0){Delay(20);while(P1_7==0);Delay(20);KeyNumber=1;}
if(P1_6==0){Del... |
C | /* Enter your solutions in this file */
#include <stdio.h>
int max(int a[],int b ) {
int max_now= a[0];
for(int i=0;i<b ;i++) {
if ( a[i]>max_now) {
max_now= a[i];
}
}
return max_now;
}
int min(int c[],int d) {
int min_now= c[0];
for(int i=0;i<d ;i++) {
i... |
C | /*
** list.c for in /home/simoni_w/projet/teck2/Ftrace/Ftrace
**
** Made by
** Login <simoni_w@epitech.net>
**
** Started on Sat Jun 29 16:53:18 2013
** Last update Sat Jun 29 16:53:18 2013
*/
#include "stack.h"
t_head *stack_init()
{
t_head *stack;
stack = malloc(sizeof(t_head));
stack->size =... |
C | #include <stdio.h>
int main()
{
int a = 10, b = 20;
if(a <= b)
{
printf("Hello World!");
}
printf("This line will always be printed\n");
return 0;
}
|
C | #include <stdio.h>
#include <string.h>
#include <errno.h>
#include <pthread.h>
#include <stdlib.h>
#include <signal.h>
int quitflags;
sigset_t mask;
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
static void *thr_fn(void *arg)
{
int err, signo;
for( ; ; ){... |
C | //Program to convert the binary number to decimal number
#include<stdio.h>
#include<math.h>
int main()
{
long int a,d=0;
int r,i=0;
printf("Enter the binary number : ");
scanf("%d",&a);
while(a>0)
{
r=a%10;
if(r!=0&&r!=1)
{
printf("\nWrong Input\nBinary number should consist only 0 and 1.... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <linux/sched.h>
#include "main.h"
#define PAGE_MAP_MASK 0x0000FF8000000000
#define PDPT_MASK 0x0000007FC0000000
#define PDE_MASK 0x000000003FE00000
#define PTE_MASK 0x00000000001FF000
#define PAGE_OFF_MASK 0x0000000000000FFF
void test_... |
C | #include <stdio.h>
int main() {
long long int a, b;
scanf("%lld %lld", &a, &b);
printf("%lld\n", a+b);
printf("%lld\n", a-b);
printf("%lld\n", a*b);
printf("%lld\n", a/b);
printf("%lld\n", a%b);
printf("%.2lf\n", (float)a / (float)b);
}
|
C | #include<stdlib.h>
#include<stdio.h>
#include<string.h>
/*
This program reads a string input from a file "badfile" and copys that string into a buffer
size 517 then into another buffer thats only size 18. This overflow vulnerability can be easily
exploited by the user. Our goal is to create the file "badfile" so... |
C | /* FILE NAME - app.c */
#include "mld.h"
#include <memory.h>
#include <stdlib.h>
#include <stdio.h>
/* EMPLOYEE STRUCTURE */
typedef struct emp_
{
char emp_name[30];
unsigned int emp_id;
unsigned int age;
struct emp_ *mgr;
float salary;
} emp_t;
/* STUDENT STRUCTURE */
typedef struct student_
{
char stud_name[... |
C | /*
** EPITECH PROJECT, 2018
** zappy
** File description:
** Client exit related functions
*/
#include "graphical_commands.h"
#include "containers.h"
#include "entity.h"
#include "game.h"
/// Removes a player from the list of players
// `list_t *players`: the adress of the list_t *players pointer in game_t
// `play... |
C | #include <stdio.h>
#include <stdlib.h>
#define x 3
int main()
{
/// Como funciona un array.
/* int datos [50];
for(int i=0;i<x;i++)
{
printf("Ingrese la edad del alumno: ");
scanf("%d",&datos[i]) ;
}
*/
/// maximo y minimo
int datos[5];
for(i= 0; i < x... |
C | #include<stdio.h>
#include<stdlib.h>
void reverseWords(char* s);
int main(void)
{
char ch[]= "Let's take LeetCode contest";
reverseWords(ch);
puts(ch);
return 0;
}
void reverseWords(char* s) {
int index=0;
int count=0,count1=-1,i=0;
while(s[count]!='\0')
{
count++;
}
... |
C | #include "utili.h"
/*---------------ʱӳ----------------*/
void delay (uint us)
{
while(us--);
}
void delay1 (uint ms)
{
int i,j;
for(i=0;i<ms;i++)
for(j=0;j<1000;j++)
;
}
//ַ
uchar strlen(uchar *s)
{
uchar len = 0;
while(*s++) len ++;
return len;
}
double buf2double() //c... |
C | #include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/wait.h>
int main ()
{
FILE *fd;
fd = fopen ("file.txt", "w+");
pid_t pid;
int status;
pid = fork ();
if (pid > 0) {
wait (&status);
printf ("Parent Process \n");
printf ("%d \n", getpid ());
fputs ("Lakshmi", fd);
fclose (fd)... |
C | /*
3. Uma empresa de engenheiros necessita melhorar o seu trabalho tornando-o mais eficaz, pensando em resolver esse
problema você foi contratado para criar um programa para calcular a área de um terreno em forma de quadrado. Faça
um programa que receba os diâmetros dos lados de um terreno em metros, calcule e mostr... |
C | /* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */
#include <linux/bpf.h>
#include <linux/if_ether.h>
#include <linux/in.h>
#include "bpf_helpers.h"
#include "bpf_endian.h"
/* NOTICE: Re-defining VLAN header levels to parse */
#define VLAN_MAX_DEPTH 10
#include "../common/parsing_helpers.h"
#define VLAN_VID_M... |
C | /*
* File: util.h
* Author: Maurits
*
* Created on 26 september 2012, 21:55
*/
#include "util.h"
#include "serial.h"
#include <string.h>
// Alternative gets() implementation. Reads from the USART and outputs the characters into
// the specified array until one of two conditions arises:
// 1) The given buffer... |
C | #include "stm32f0xx.h" // Device header
/**
* Set System Clock Speed to 48Mhz
*/
void setToMaxSpeed(void);
/**
* Initialized the timer 2 as a down counter triggering from the ETR pin
* Also enables the update interrupt for this timer
* @param upToValue number of counts to issue and iterrupt
*/
... |
C | #include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv) {
// Initialize the MPI environment
MPI_Init(NULL, NULL);
// Find out rank, size
int world_rank;
MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);
int world_size;
MPI_Comm_size(MPI_COMM_WORLD, &world_size);
// We are assuming at least 2 p... |
C | #include <stdio.h>
#include <stdlib.h>
int v;
int opcount;
void swap(int ans[], int a, int b)
{
int temp = ans[a];
ans[a] = ans[b];
ans[b] = temp;
}
void permute(int arr[][v], int ans[], int l,int *min, int finans[])
{
opcount++;
if(l==v)
{
int sum = 0;
for(int i=0; i<v; i++)
sum += arr[i][ans[i]];
if(... |
C | #include "my_msg.h"
int main(void)
{
int msgid;
msg_t data;
long int msgtype = 0; //注意1
if(-1==(msgid=msgget((key_t)1234, 0666 | IPC_CREAT))){
fprintf(stderr, "msgget failed with error: %d\n", errno);
exit(EXIT_FAILURE);
}
do{
if(-1==msgrcv(msgid,&data,BUFSIZ,msgtype,0)){
... |
C | #include <stdio.h>
#include<stdlib.h>
//Mr. Santa asks all the great programmers of the world to solve a trivial problem.
//He gives them an integer m and asks for the number of positive integers n, such that the
//factorial of n ends with exactly m zeroes. Are you among those great programmers who can solve this prob... |
C | /* Trasformazione della rappresentazione di un grafo
da una matrice di adiacenze a una lista di successori */
#include <stdio.h>
#include <malloc.h>
struct nodo { /* struttura di un nodo */
char inf;
struct successore *pun;
};
struct successore { /* elemento della lista di succes... |
C | int work(int arr[5][5],int m,int n)
{
int k,t;
if ((m>=0)&&(m<5)&&(n>=0)&&(n<5))
{
for (k=0;k<5;k++)
{
t=arr[m][k];
arr[m][k]=arr[n][k];
arr[n][k]=t;
}
return 1;
}
else
return 0;
}
int main()
{
int i,j,m,n;
int a[5][5];
for (i=0;i<5;i++)
for (j=0;j<5;j++)
s... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strsplit.c :+: :+: :+: ... |
C | /*
NO.198
You are a professional robber planning to rob houses along a street.
Each house has a certain amount of money stashed the only constraint stopping you from robbing each of them is that adjacent houses have security system connected
and it will automatically contact the police if two adjacent hou... |
C | //判断一个数字中二进制中有多少个1
//反复除以2.如果余数是1,就+1
#include <iostream>
using namespace std;
int main(){
int n;
cin >>n;
for (int i = 0;i<n;i++){
int x,ans = 0;
cin >>x;
while(x >0){
ans += x %2;
x /= 2;
}
cout << ans <<endl;
}
return 0;
}
|
C | #include "cclient/api/core/core_api.h"
#include "cclient/api/extended/extended_api.h"
#include <inttypes.h>
#include "iota_client_service/config.h"
#include "iota_client_service/client_service.h"
retcode_t get_iota_node_info(iota_client_service_t *iota_client_service, get_node_info_res_t *node_response) {
retcode... |
C | /*-----------------------------------------------------------------------------------------------------------*/
/* */
/* Copyright (C) 2016 Brite Semiconductor Co., Ltd. All rights reserved. ... |
C | #define _CRT_SECURE_NO_WARNINGS
#define QMAX 100
#include<stdio.h>
#include<math.h>
#include<malloc.h>
#include<locale.h>
#include<time.h>
#include<windows.h>
#include<stdbool.h>
struct queue {
int qu[QMAX];
int rear, frnt;
}queue;
void init(struct queue* q) {
q->frnt = 1;
q->rear = 0;
return;
}
void insert(struc... |
C | /* algo7-7.c ʵ㷨7.16ij */
#define MAX_NAME 5 /* ַ+1 */
#define MAX_INFO 20 /* Ϣַ+1 */
typedef int VRType;
typedef char VertexType[MAX_NAME];
typedef char InfoType;
#include"c1.h"
#include"c7-1.h" /* ڽӾ洢ʾ */
#include"bo7-1.c" /* ڽӾ洢ʾĻ */
typedef int PathMatrix[MAX_VERTEX_NUM][MAX_VERTEX_NUM][MAX_VERTEX_NUM];... |
C | #include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "tabuleiro.h"
// *************** Protótipos de Funções****************
int mostrarMenu();
void jogar(int tabuleiro[][DIMENSAO]);
void terminarJogo(int vencedor);
void realizarJogada(int jogador, int tabuleiro[][DIMENSAO]);
int main(void) {
int tab... |
C | #include "datastructure.h"
#include <stdlib.h>
#include <err.h>
#include <assert.h>
#include <string.h>
int * new_copy_int_array(const int *arr, int len)
{
int *cpy = malloc(len * sizeof(*cpy));
if (cpy == NULL)
err(1, "impossible d'allouer un tableau d'entiers");
memcpy(cpy, arr, len * sizeof(*cpy... |
C | //Standard IO, Standard C library, Math and Similation Header
#include <stdio.h>
#include <stdlib.h>
#include "sim.h"
#include <math.h>
/*
Data Structures: Include BinaryHeap file
*/
#include "heap.h"
// Simulation clock variable and BinaryHeap creation
BinaryHeap* priorityQueue = createHeap();
double Now = 0.0;... |
C | /*
** my_printf.c for in /home/da-pur_c/delivery/PSU/PSU_2016_my_printf
**
** Made by Clem Da
** Login <da-pur_c@epitech.net>
**
** Started on Tue Nov 8 10:24:37 2016 Clem Da
** Last update Thu Nov 16 18:29:03 2017 clem
*/
#include "my.h"
void my_charal(char *str)
{
int i;
i = 0;
while (str[i])
{
... |
C | // token_enums.h
// Copyright (C) 2009 Willow Schlanger
#ifndef token_enums_h__ncc__included
#define token_enums_h__ncc__included
typedef unsigned char U1;
typedef unsigned short U2;
typedef unsigned U4;
typedef unsigned long U8;
typedef signed char S1;
typedef signed short S2;
typedef signed S4;
typedef signed long ... |
C | //
// Created by Jenny on 2017-07-26.
//
#ifndef LINKEDLIST_MPASSWDSORT_H
#define LINKEDLIST_MPASSWDSORT_H
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include "list.h"
/**
* Name: userInfo
* Description: this is the structure of list elements in this laboration.
* @p... |
C | /* Esercizio N 3
Fare la somma dei primi cento numeri */
// Studente: Rossi Edoardo Data:14/11/2016 Classe: 3 INA Numero: 17
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
main()
{
int Somma; // variabile che definisce la somma dei cento numeri
int I; // variabile che definisce il contatore
... |
C | #include "matrix.h"
#include <stdlib.h>
#include <string.h>
#include <math.h>
const mat MAT_UNDEFINED = {0, 0, NULL};
mat allocateMat(unsigned int rows, unsigned int cols)
{
mat ret;
ret.rows = rows;
ret.cols = cols;
ret.elements =mallloc(rows * sizeof(float));
for (unsigned int i = 0; i < rows; i++)
{... |
C | #include <X11/Xlib.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <omp.h>
typedef struct complextype
{
double real, imag;
} Compl;
int main(int argc, char *argv[] )
{
Display *display;
Window window; //initialization for a window
int screen; //which screen ... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct def_Elemento
{
int dato;
struct def_Elemento *sig;
struct def_Elemento *ant;
}TipoElemento;
void InsertaInicio (TipoElemento **Inicio, int numero);
void InsertaFin(TipoElemento **Inicio, int numero);
void ImprimirDerecha(TipoElemento *Inicio);
void ImprimirI... |
C | #include <stdio.h>
int main(void)
{
int sum=0;
int input=0;
int i; /*INDEX */
while(scanf("%d",&input)!=EOF)
{
sum=0;
while(input%2 == 0)
{
input/=2;
sum+=2;
}
for(i=3; i*i<=input && input != 1; i+=2)
{
while(input%... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 10000
typedef struct proizvod{int sifra; int zapremina; char naziv[51];} Proizvod;
typedef struct elem{Proizvod p; struct elem *sl;}Elem;
typedef struct elem1{Elem e; struct elem1 *sl;}Elem1;
Elem *na_kraj(Elem *prvi, Proizvod pp){
Elem... |
C | /****************************************************************************
* caesar.c
*
* Provotorov Daniil
* provotorov.d.i@gmail.com
*
* Cipher text via caesar cipher
*
***************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <cs50.h>
#i... |
C | /**
Ƕ
ǶǶһʱ,ְһ
,main()ⶨ
׳
s=(2^2)!+(3^2)!
˼·:Ƕԭ,һƽsquare
һ׳factorial(׳)
ȵsquareٰsquareֵΪʵΣ
ٵfactorialٷsquareٷ
**/
#include <stdio.h>
int square(int p);
int factorial(int q); //ǰ
void main()
{
int a=2, b=0;
for(a=2; a<=3; a++)
{
b=b+square(a);//square
... |
C | /*Many studies suggest that smiling has benefits. Write a program that produces the
following output:
Smile!Smile!Smile!
Smile!Smile!
Smile!
Have the program define a function that displays the string Smile! once, and have the
program use the function as often as needed.*/
#include<stdio.h>
void smile();
int main(voi... |
C | // hooded cloak by *Styx* to shade eyes for light sensitivity
#include <std.h>
inherit "/std/armour";
void create() {
::create();
set_name("hooded cloak");
set_id( ({ "cloak", "hooded cloak" }) );
set_short("A hooded cloak");
set_long("This is a hooded cloak woven from a dark, dense, soft cloth "... |
C | #include "holberton.h"
#include <stdlib.h>
/**
* *create_array - creates an array of chars, and initializes it with a char
* @size: size of the array
* @c: char to be initialized with
* Return: pointer to array or null
**/
char *create_array(unsigned int size, char c)
{
char *str;
unsigned int i;
if (size =... |
C | #include <stdio.h>
int main()
{
int n,i,count=0,arr[100],n2;
printf("How many numbers? ");
scanf("%d",&n);
printf("\nEnter the numbers : ");
for(i=0; i<n; i++)
{
scanf("%d",&arr[i]);
}
printf("\nEnter the search key : ");
scanf("%d",&n2);
for(i=0;... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h> /* sockaddr, sa_family_t, socklen_t */
#include <netinet/in.h> /* in_port_t, in_addr_t, sa_family_t, sockaddr_in */
#include <pthread.h>
#include "02.data_transfer.h"
#include <fcntl.h> /* File open option */... |
C | /* Copyright Digital Equipment Corporation & INRIA 1988, 1989 */
/* Last modified_on Fri Mar 2 16:49:23 GMT+1:00 1990 by herve */
/* modified_on Mon Feb 19 20:22:20 GMT+1:00 1990 by shand */
/* KerN.c: the kernel written in C */
/*
* Description of types and constants.
*
* Several conventions are u... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int dia, mes, anio;
printf("Ingrese la fecha de Nacimiento (dd/mm/aaaa): ");
scanf("%2d/%2d/%4d",&dia, &mes, &anio);
printf("\n%02d/%02d/%4d",dia, mes, anio);
return 0;
}
|
C | #include <stdio.h>
long power(int base, int exponent);
int main(){
long int answer;
int base,exponent;
printf("Enter base integer: ");
scanf("%d",&base);
printf("Enter exponent integer: ");
scanf("%d",&exponent);
answer=power(base,exponent);
printf("%d raised to the power %d is %ld\n", base, exponent, ... |
C | #include "ping_ka.h"
int main(int argc, char *argv[])
{
int sockfd;
char *ip_addr, *reverse_hostname;
struct sockaddr_in addr_con;
int addrlen = sizeof(addr_con);
char net_buf[NI_MAXHOST];
if(argc!=2)
{
printf("\nFormat %s <address>\n", argv[0]);
return 0;
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_misc.c :+: :+: :+: ... |
C | // given elements in array. add if its even else subtract.
#include <stdio.h>
int f(int *a, int n)
{
if (n == 0) return 0;
if (*a % 2 == 0) // Even
return *a + f(a + 1, n - 1);
else
return *a - f(a + 1, n - 1);
}
int main()
{
int a[] = {12, 7, 13, 4, 11, 6};
printf("%d\n", f(a, ... |
C | /*
* Created: Jan 2016
* Author: hyunsungkim <hyunsungkim@postech.ac.kr>
*/
/**
* Blink LED
*
* This example shows how to handle GPIO. Connect an LED to PB0 with properly valued resistor (e.g. 220 Ohm)
*/
#define F_CPU 8000000UL
#include <avr/io.h>
#include <util/delay.h>
int main(void)
{
DDRB = 0x01; // T... |
C | #include <Date.H>
#include <iostream>
#include <string>
void prettyprint(Date date){
std::string postfix;
if( date.day == 11 || date.day == 12 || date.day == 13) { postfix = "th"; }
else if ( date.day == 1 || date.day == 21 || date.day == 31 ) { postfix = "st"; }
else if ( date.day == 2 || date.day == 22 )... |
C | # include <stdio.h>
void main()
{
int a,b,c;
}
int add (int p,q)
{
}
int subtract (int p,q)
{
return p-q;
}
|
C | #include "global.h"
// used for debugging and tracing execution. see client's ".getDebugCodes()"
xdata u8 lastCode[2];
void sleepMillis(int ms)
{
int j;
while (--ms > 0)
{
for (j=0; j<SLEEPTIMER;j++); // about 1 millisecond
}
}
void sleepMicros(int us)
{
while (--us > 0) ;
}
void ... |
C | #include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
if (argc != 2) {
fprintf(stderr, "usage: io <file>\n");
exit(1);
}
int fd = open(argv[1... |
C | #include <stdint.h>
#include <string.h>
#ifndef BUFFER_H
#define BUFFER_H
typedef struct _buffer {
uint8_t* content;
size_t length; /* amount of buffer used */
size_t capacity; /* total capacity of the buffer */
size_t offset; /* start next read/write here */
} buffer_t;
buffer_t* buffer_init();
... |
C | /*
** EPITECH PROJECT, 2020
** My Defender
** File description:
** Windows related function
*/
#include "function.h"
void give_player_item(item_t item, global_t *g)
{
for (int i = 0; i < 30; i++)
if (g->player.inventory[i].item.init == 0) {
g->player.inventory[i] = item;
return;
... |
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 | #ifndef _GOOG_MACROS_H_
#define _GOOG_MACROS_H_
#include <stdlib.h>
/**
* Determines the minimum of two values.
*
* @param x The first value.
* @param y The second value.
*/
#define goog_min(x, y) (((x) < (y)) ? (x) : (y))
/**
* Determines the maximum of two values.
*
* @param x The first value.
* @param y ... |
C | // CODE FOR AN EXERCISE
/*
I Insere no início.
F Insere no final.
P Remove no final e imprime valor removido.
D Remove no início e imprime valor removido.
V Remove por valor e retorna a quantidade de itens removidos.
E Remove por posição e retorna o valor removido.
T Troca o valor da primeira ocorrencia do item pel... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include "tree.h"
#include "linkedlist.h"
#ifndef QUEUE_H
#define QUEUE_H
// doubly linked list as queue
typedef struct queue {
int size;
Node* head;
Node* tail;
} Queue;
// Creates an empty queue
// returns: an empty queue
Queue* CreateQueue();
// ... |
C | #include <stdio.h>
#include <stdlib.h>
typedef int DATA;
typedef struct node {
struct node* prev;
DATA data;
struct node* next;
} NODE;
typedef NODE* LIST;
int addFirst(NODE** ppnode, DATA Data)
{
NODE* newNode = (NODE*)malloc(sizeof(NODE));
newNode->prev = NULL;
newNode->data = Data;
ne... |
C | #include "client.h"
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <netdb.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <pthread.h>
#define CLIENT_IPADDR "172.21.128.67"
#define SERVPORT 1012
userList cast;
FILE *fp;
pthread_... |
C | #include "vector.h"
inline Vector *NewVector(){
Vector *v;
v = malloc(sizeof(Vector));
v->data = make_SparseVectorMap();
return v;
}
inline void DestroyVector(Vector *v){
kh_destroy(SparseVector, v->data);
free(v);
}
inline uint32_t GetSize(Vector *v){
return v->data->size;
}
inline void... |
C | #include <unistd.h>
void print_memory(const void *addr, size_t size);
int main(void)
{
int tab[10] = {1, 98, 54332, 67, 23, 5, 98, 345, 563, 46};
print_memory(tab, 10);
return (0);
}
|
C | /*
* Copyright (c) 2023 Antmicro <www.antmicro.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __EXT2_BITMAP_H__
#define __EXT2_BITMAP_H__
#include <stdint.h>
#include <stdbool.h>
/* Functions to make operations on bitmaps.
*
* NOTICE: Assumed size of the bitmap is 256 B (1024 bits).
* (Hence,... |
C | #include "cbuf.h"
#include "derp.h"
#include <assert.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
// Open socket and connect to server.
int get_fd(struct in_addr host, unsigned short port)... |
C | #include "edit_str.h"
int edit_str(char* ld_str, char* ed_str, char* tr_str, int ed_length) {
static int pos = 0;
struct pos initPos;
unsigned char ascii, scan;
static int insert = 0; /* 0 => overwrite, 1 => insert */
setcursortype(99);
for (int i = 0; i < (int)strlen(ld_str); i++) putchar(ld_str[i... |
C |
/*
* gcode.h
* Author: pavel
*/
#ifndef GSTRUCT_H_
#define GSTRUCT_H_
// structure for holding the G-code
typedef struct {
char cmd_type[3]; /*command type of the G-code*/
int x_pos; /*goto x position value*/
int y_pos; /*goto y position value*/
int pen_pos; /*pen position(servo value)*/
i... |
C | //RFID Functionality
#ifndef RFID_H
#define RFID_H
#include <SoftwareSerial.h>
#include "tag_db.h"
#define RFID_D9_PIN 4
#define txPin 5
SoftwareSerial rfid = SoftwareSerial( RFID_D9_PIN, txPin );
//SimpleTimer timer;
// Check the number of tags defined
int numberOfTags = sizeof(allowedTags) / sizeof(allowedTags[0]);
i... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_tab_rangecpy.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include "heap.h"
int main()
{
Heap h;
criaHeap(&h);
char opcao;
int num;
do{
scanf("%c",&opcao);
switch(opcao){
case 'I':
scanf("%d\n",&num);
insereValor(&h,num);
break;
... |
C |
#include<stdlib.h>
#include<stdbool.h>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include"statistics.h"
//--------------------------------------------------------
// FUNCTION compare_doubles
//--------------------------------------------------------
static int compare_doubles(const void* a, const void* b... |
C | /* nested array assignments: mixed global/local, int/char arrays */
char y[5];
extern void print_int (int n);
extern void print_string (char s[]);
void main(void)
{
int x[5];
int u;
x[0] = 0; y[0] = 1;
x[1] = 1; y[1] = 2;
x[2] = 2; y[2] = 3;
x[3] = 3; y[3] = 4;
x[4] = 4; y[4] = 55;
u = y[x[y[... |
C | #include<stdio.h>
void main()
{
int i,j,n;
int a[50];
int sum=0;
scanf("%d\t",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
sum=sum+a[i];
}
printf("%d",sum);
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* floorcast.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#define INPUTFILE "projectInput.txt"
int currentTime = 0;
// Shortest Job First
typedef struct hold1{
// data for each waiting process in holding queue 1
struct hold1 * next;
} hold1_t;
// First in First out
typedef struct hold2{
// data for each waiting process in holding q... |
C | #pragma once
#ifndef DEBUG_H
#define DEBUG_H
// 调试日志接口,可以使接入log系统时不用改任何日志既可以使用
#include "common_time.h"
#include <cstdio>
#include <stdarg.h>
static void DebugLog(int log_level, const char *fmt, ...)
{
if (log_level == 5)
{
#ifdef __NO_DEBUG_LOG
return;
#endif
}
char buf[4096] = {0};
va_list ap;
va_start... |
C |
#include <stdio.h>
void shuffle(int *A, int n) {
// shuffle n cards
for(int i = n-1; i >= 1; i--) {
int r = rand() % (i+1); // r = [0, i]
swap(A[i], A[r]);
}
}
|
C | #include<stdio.h>
#include <unistd.h>
int fd[2];
pid_t id;
unsigned char buffer[120];
int main(int argc, char *argv[])
{
pipe(fd);
id=fork();
if(0==id){
close(fd[1]);
read(fd[0],buffer,120);
printf("child:%s\n",buffer);
}
else if(buffer==0)
printf("read error");
else{
close(fd[0]);
w... |
C | /*
* queue.c
*
* Created on: 2017年10月19日
* Author: linzer
*/
#include <queue.h>
/* 私有宏. */
#define QUEUE_EMPTY(head) DCLIST_EMPTY(head)
#define QUEUE_HEAD(head) DCLIST_HEAD(head)
#define QUEUE_TAIL(head) DCLIST_TAIL(head)
#define QUEUE_INIT(node) DCLIST_INIT(node)
#define QUEUE_ADD(head, other) DCL... |
C | #include<stdio.h>
#include<malloc.h>
int max_min(int *arr,int n){
int i,max,min;
max=min=arr[0];
for(i=0;i<n;i++){
if(arr[i]>max){
max=arr[i];
}
if(arr[i]<min){
min=arr[i];
}
}
printf("Maximum Element is : %d\n",max);
printf("Minimum Element is : %d",min);
}
int main()
{
int n,min,*arr,max,i;
scan... |
C | #include "headers/file_reader.h"
int calc_hyperperiod(Process *processes, int no_of_processes)
{
int lcm = processes[0].burst_duration;
int a, b;
for(int i = 1 ; i < no_of_processes ; i++)
{
a = lcm;
b = processes[i].burst_duration;
while(a != b)
{
if (a > b)
a = a - b;
else
b = b - a;
}
... |
C | #include <stdio.h>
#include <pthread.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <sys/wait.h>
#define _POSIX_SOURCE 1
/*
int NB_THREADS = 10;
int somme = 0;
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; // On initialise la donnée mutex.
void* Fils(void *t) // Fonction qui sera convert... |
C | /*
** EPITECH PROJECT, 2018
** MUL_my_hunter_2018
** File description:
** main file of the prog
*/
#include <SFML/Graphics/RenderWindow.h>
#include <SFML/Graphics/Texture.h>
#include <SFML/Graphics/Sprite.h>
#include <SFML/System/Clock.h>
#include <SFML/System/Time.h>
#include <stdlib.h>
#include "./../include/object.... |
C | #define VGA_MEM (unsigned short *)0xb8000
#include "system.h"
unsigned char kbdus[128] =
{
0, 27, '1', '2', '3', '4', '5', '6', '7', '8', /* 9 */
'9', '0', '-', '=', '\b', /* Backspace */
'\t', /* Tab */
'q', 'w', 'e', 'r', /* 19 */
't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\n', /* Enter key */
0, ... |
C | #include <stdio.h>
#include <pthread.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#define THREAD_CREATION_SUCCESS 0
#define THREAD_JOIN_SUCCESS 0
#define EXIT_ERROR 1
#define DECIMAL_CONSTANT 0
#define num_steps 200000000
#define THREAD_NUMBER_TOP_LIMIT 300
#define NO_ERROR 0
struct param{
long l... |
C | #include <stdio.h>
#include "dlinklist.h"
//˫ѭѭ֣֮дʱѭ˫
typedef struct _tag_DoubleLinkList//һϢ
{
DLinkListNode header;//һڵָ
DLinkListNode* slider;//һα
int length;
}TDLinkList;
DLinkList* DLinkList_Create()
{
TDLinkList* tmp = NULL;
int ret = 0;
tmp = (TDLinkList*)malloc(sizeof(TDLinkList));
if (tmp == NULL)
{
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.