language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include<stdio.h>
#include<conio.h>
#include<string.h>
#include<ctype.h>
#define max 40
void push(char e);
int priority(char op);
void infixToPostfix(char *exp, char *result);
int evaluatePostfix(char *result);
char pop();
char peek();
void emptyStack();
char stack[50];
int top = -1;
void main()
{
char exp[40];
... |
C | /*
setfcomment - Set the Finder comment of file(s)
Copyright (C) 2003 Sveinbjorn Thordarson <sveinbt@hi.is>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the... |
C | /** @file SDTDCMotor.h
@defgroup dcmotor SDTDCMotor.h: Electric motors
Physically informed model for the synthesis of electric motor sounds.
Electric motors exploit magnetic induction to convert electric energy
into mechanical energy. An ideal electric motor should be perfectly silent.
In practice, however, rotors are... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* sort_stack.c :+: :+: :+: ... |
C | #ifndef __SYSTEM_CFG_H__
#define __SYSTEM_CFG_H__
#include "src/model/kernel/cfg.h"
#include "src/model/device/cfg.h"
#include "src/model/system/core.h"
/**
* \brief System configuration
*/
struct SystemCfg_t
{
char name[SYSTEM_NAME_MAX_LENGTH];
size_t memory_size;
struct KernelCfg_t* base_cfg;
/... |
C | #include <stdio.h>
#include <stdlib.h>
#include <locale.h>
int main(void){
setlocale(LC_ALL,"");
FILE *file;
file = fopen("string2.txt", "r");
if(file == NULL){
printf("No foi possvel abrir o arquivo.\n");
getchar(); //pausar
exit(0); //sair do programa.
}
//criar varivel
char frase[100];
//Ret... |
C | #include<stdio.h>
int main(){
int t,n,m,i,j,deg[2000],flag,cnt4,cnt3,cnt2,cnt,x,y,cntx,k;
scanf("%d",&t);
k=0;
while(t--){
scanf("%d %d",&n,&m);
k++;
memset(deg,0,sizeof(deg));
cnt4=cnt3=cnt2=cnt=cntx=0;
for(i=0;i<m;i++){
scanf("%d %d",&x,&y);
... |
C | #include <iostream>
void swap(int &i, int &j)
{
int tmp = i;
i = j;
j = tmp;
}
int main(int argc, char** argv)
{
int a = 5;
int b = 10;
swap(a, b);
std::cout << "a = " << a << " ; b = " << b << std::endl;
return 0;
}
|
C | #ifndef PROGRAM_H
#define PROGRAM_H
#ifndef SV_H
#include <D:\ProjectKTLT\sources\entities\SV.h>
#endif
#ifndef HP_H
#include <D:\ProjectKTLT\sources\entities\HP.h>
#endif
#ifndef DIEMTHI_H
#include <D:\ProjectKTLT\sources\entities\DIEMTHI.h>
#endif
#ifndef CPA_H
... |
C | typedef struct Student
{
char ALL[100];
struct Student *pNext;
struct Student *pPrev;
}Stu;
int main(void)
{
Stu *pRoot=(Stu *)malloc(sizeof(Stu));
Stu *pNow=pRoot;
pRoot->pPrev=NULL;
for(;;)
{
gets(pNow->ALL);
if(strcmp("end",pNow->ALL))
{
pNow->pNext=(Stu *)malloc(sizeof(Stu));
pN... |
C | #include <stdio.h>
#include <stdlib.h>
int main(void) {
float media[9];
int i, ref;
for (i = 0; i <= 5; i++){
if (i < 2){
ref = i + 1;
printf("Digite a nota da NP%d do aluno 1: ", ref);
scanf("%f", &media[i]);
} else if (i > 1 && i < 4){
ref = i - 1;
printf("Digite a nota da... |
C | #include <stdio.h>
#include <stdlib.h>
struct Queue
{
int F;
int R;
int *p;
int length;
};
void Create(struct Queue *q,int L){
q->p = (int *)malloc((L+1)*sizeof(int));
q->F=0;
q->R=0;
q->length = L+1;
}
void EnQ(struct Queue *q,int L){
if((q->R+1)%q->length == q->F){
//Queue is full
... |
C | #pragma once
#include <conio.h>
#include <math.h>
#include <stdio.h>
# include <stdlib.h>
# include <time.h>
# include "public.h"
typedef struct
{ // structure pays de forme rectangle
int xo, yo, longueur, hauteur, nb_voisins=0; //xo, yo: coordonnes mini du rectangle
int color = 0; ... |
C | #include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>
#include<sys/types.h>
#include<sys/stat.h>
#include <fcntl.h>
#include<string.h>
#include<time.h>
int main(){
int fd[2];
pipe(fd);
dup2(0,fd[0]);
dup2(1,fd[1]);
while(1){
char string[255]="";
char cmds[255]="";
char*m=... |
C | //Listing 18.11 Using strstr() function to seach for one string within another; page 473
//Probably the most useful of all the string search functions
#include <stdio.h>
#include <string.h>
int main(void)
{
char *loc, buf1[80], buf2[80];
//input the strings
printf("Enter the string to be searched...")... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "prototypes.h"
//Renvoie un int avec le nombre de differences sur une ligne de fichier
int differences(char *question, FILE* questions){
int differences = 0, longueur_chaine = 0, i = 0;
int ii = 0;
int caractere = 0, fin = 0; //D... |
C | #ifndef _DS_CHARPTER05_H_
#define _DS_CHARPTER05_H_
/*************************************************************************************************/
// Ľ
#define BTREE_HAVE_PARENT 0
typedef struct treenode* tlink;
tlink tlink_new_tnode(int item_size, void* pitem); // ȡһڵ㣬pitemָitemڵ
void tlink_get_item... |
C | #include <stdio.h>
int main(void) {
int array_of_integers[10], *ptr_of_array, *ptr_of_first_element;
int i;
ptr_of_array = array_of_integers;
ptr_of_first_element = &array_of_integers[0];
for (i = 0;i < 10; i++)
*(ptr_of_array++) = i;
for (i = 0; i < 10; i++)
printf("%d\n", *(ptr_of_first_element + i));
... |
C | /**
* Button reading functions
*
* Author: Bruce Fletcher
* Licence: http://creativecommons.org/licenses/by/3.0/
*/
#include <avr/io.h>
#include "timer.h"
#include "buttons.h"
static volatile uint8_t suppress_aux_button;
void buttons_init()
{
DDRC &= ~((1<<DDC1)|(1<<DDC2)|(1<<DDC3)); // hat switch input p... |
C | #include <stdlib.h>
#include "queue.h"
Queue* new_queue(void) {
Queue *ret = calloc(1, sizeof(Queue));
if(!ret)
return NULL;
return ret;
}
int enqueue(Queue *queue, void *data, size_t size) {
if(!queue || (queue->nnodes_ == QUEUE_MAXSIZE))
return -1;
// Store the copy of ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_sorted_list_insert.c :+: :+: :+: ... |
C | #include <stdio.h>
#define MAX 100000
int top = -1, stack[MAX];
int empty()
{
if (top <= -1) return 1;
return 0;
}
int full()
{
if (top >= MAX)return 1;
return 0;
}
void push(int n)
{
if (!full())stack[++top] = n;
}
void pop()
{
if (!empty()) stack[top--];
}
int main(void)
{
int n, i, a, sum = 0;
scanf("%d", &n... |
C | //
// main.c
// problem1
//
// Created by Dcalsky on 15/10/31.
// Copyright © 2015年 Dcalsky. All rights reserved.
//
#include <stdio.h>
int main(int argc, const char * argv[]) {
double sum, reciprocals[5], num[5];
int i;
for(i = 0; i < 5; ++i){
scanf("%lf", &num[i]);
reciprocals[i] = 1... |
C | /**
** Max Mitchell and Jack Burns
**
** bitpack.c
** Feb 27 2020
** Purpose: STUB
**/
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
#include <assert.h>
#include "bitpack.h"
#include <math.h>
#include "except.h"
Except_T Bitpack_Overflow = { "Overflow packing ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
struct list{
double data;
struct list* next;
};
void sumA();
void sumB();
//入力するデータはデータセットの例と同じものを使用
void main(){
sumA();
sumB();
}
void sumA(){
double* p;
int n;
int i;
double sum = 0;
printf("function a\n");
printf("... |
C | #include <stdio.h>
int main(void) {
printf("Hello, world\n");
printf("Hello, youngnam\n");
printf("Bye, youngnam\n");
printf("I'm hungry\n");
printf("Bye, git\n");
return 0;
}
|
C | /*********************************************************************************
名称:对学生信息表的基本操作
功能:
构造一个空的线性单链表
销毁线性单链表
将线性单链表重置为空表
判断线性单链表是否为空,若为空表,则返回TRUE,否则返回FALSE
返回线性单链表中数据元素个数
用e返回线性单链表中第i个元素的值
返回线性单链表中满足某种关系的元素的位序
返回线性单链表中某元素的前驱
返回线性单链表中某元素的后继
在表线性单链表插入元素
删除线性单链表中某元素
依次对线性单链表中每个元素调用某函... |
C | #include "monty.h"
/**
* swap_top - Function that print value at the top of the stack
* @h: head of linked list
* @line_number: Number of line
* Return: void
**/
stack_t *swap_top(stack_t **h, unsigned int line_number)
{
int minimun = 2, lenght;
stack_t *tmp = *h;
lenght = dlistint_len(*h);
if (lenght < min... |
C | /*
** listString_replace.c for lib in /home/flavian.gontier/Tek1/C_Prog_Elem/PSU_2016_minishell2/src/lib/list/listString
**
** Made by flavian gontier
** Login <flavian.gontier@epitech.eu@epitech.net>
**
** Started on Fri Apr 07 22:46:54 2017 flavian gontier
** Last update Sat Apr 08 11:56:18 2017 flavian gontier
... |
C | #include "rog.h"
#include "utils.h"
void addPositionYX(int** frontier, int frontierCount, int y, int x)
{
frontier[frontierCount][0] = y;
frontier[frontierCount][1] = x;
}
int checkNeighbour(int y, int x)
{
char temp = mvinch(y,x);
if(temp == '.' || temp=='|' || temp=='+' || temp == '-')
return FALSE;
else
... |
C | #define _POSIX_C_SOURCE (200112L)
#include <pthread.h>
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include "schd.h"
#include "watchdog_so.h"
enum flag
{
ON = 0,
OFF
};
int g_GRACE = 0;
int g_COUNT_GRACE = 0;
int g_DNR_FLAG = OFF;
uuid_t g_GRACECHECKUUID = {0};
scheduler_t... |
C | #include <assert.h>
#include <stdlib.h>
#include "list.h"
#include "common.h"
static uint16_t values[256];
static void splice(struct list_head *head,
struct list_head *front,
struct list_head *back)
{
while (1) {
struct listitem *a = list_first_entry(front, struct l... |
C | #include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <errno.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <netdb.h>
#include <string.h>
#include <wchar.h>
#include <locale.h>
#define CERC 0x25EF
#define GOL 0x2800
#define ROSU "\033[1;31m"
#define VERDE "\033[0;32m"
... |
C | #include <stdio.h>
int foo1(int a, int b);
int foo1(int a, int b)
{
if (a>b)
return(a);
else
return(b);
}
int main(int argc, char **argv)
{
typedef struct A {
int a;
int b;
} _A;
_A var;
var.a=1;
printf("%d\n", foo1(var.a, var.b));
return(0);
}
|
C | /* Write a program to determine the ranges of char, short, int, and long variables
both signed and unsigned, by printing appropriate values from standard headers
and by direct computation. Harder if you compute them: determine the ranges of
the various floating-point types. */
#include <stdio.h>
#include <limits.h> ... |
C | * Semaphores are represented by the type "sys_sem_t" which is typedef'd
* in the sys_arch.h file. Mailboxes are equivalently represented by the
* type "sys_mbox_t". Mutexes are represented by the type "sys_mutex_t".
* lwIP does not place any restrictions on how these types are represented
* internally.
*
* @defg... |
C | #ifndef __FRODO_H__
#define __FRODO_H__
#include<stdio.h>
#include<malloc.h>
#include<stdlib.h>
/*////////////////////////////
// Author: Latty7, CuddleSabe/
*/////////////////////////////
typedef struct matrix
{
int row,cow;
double **matrix;
}Matrix;
Matrix* MatrixMultiply(Matrix *a, Matrix *b) //˷
{
int i,j... |
C | #include <stdlib.h>
#include<stdio.h>
#include "funciones.h"
#include<math.h>
int main()
{ float x,y,resultado;
char seguir='s';
int opcion=0;
while(seguir=='s')
{ printf("\n");
printf("CALCULADORA Vladimir Moreyra\n");
printf("-----------Menu-------------\n");
... |
C | #include <unistd.h>
void write_comb(int i, int j, int k, int l);
void ft_print_comb2(void)
{
int i;
int j;
int k;
int l;
i = '/';
while (i++ < '9')
{
j = '/';
while (j++ < '9')
{
k = (j > i && j == '9') ? i + 1 : i;
l = (j > i && j == '9') ? '/' : j;
while (l++ < '9' && k <= '9')
{
write... |
C | #include<stdio.h>
#include<stdlib.h>
int main()
{
FILE *search, *delete, *insert, *output;
search = fopen("search.csv","r");
delete = fopen("delete.csv","r");
insert = fopen("insert.csv","r");
output = fopen("output.csv","w");
int temp = 0, i, j;
int out[3][1000] = {{0}};
while(fscanf(search, "%d", &temp) != E... |
C | #include <msp430.h>
#define CLOCKWISE 0
#define COUNTERCLOCKWISE 1
/* -------------------------------------------- *
next_led(int direction)
Arguments:
- direction - CLOCKWISE or COUNTERCLOCKWISE
Returns: the next LED in sequence in the given direction
- unsigned int - lower byte maps to Port 2 pins
... |
C | #include <stdio.h>
int main(int argc, char **argv)
{
int n;
printf("Vnesite n : \n");
scanf("%d", &n );
/*
* (Naravno stevilo n vedno preberemo od uporabnika)
* 1. program, ki izpise vse 5-te potence med 1 in n
* (n vnese uporabnik)
*
*/
for( int i=1; i*i*i*i*i < n ; ++i )
printf(... |
C | #include <stdio.h>
#include <stdlib.h>
#include <enet/enet.h>
#include <sys/time.h>
#include <server/config.h>
#include <server/server.h>
#define TICKS_PER_SECOND 60
int init_network();
void terminate_network();
int main(int argc, char** argv)
{
server_t *server;
struct timeval last_time, current_time;
unsigned ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* print_ants.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct mainmemory
{
int* frame;
};
struct secondchance
{
int *scbit;
int pointer;
};
struct secondchance* createsc(int si)
{
struct secondchance* s=(struct secondchance*)malloc(sizeof(struct secondchance));
s->pointer=0;
s->... |
C | #include "point.h"
#include "new.h"
#include "base.h"
struct Point
{ const void *base;
int x,y;
};
static void * Point_ctor (void * _self, va_list * app)
{ struct Point *self = _self;
self ->x = va_arg(* app, int);
self ->y = va_arg(* app, int);
return self;
}
static void Point_draw (const void * _self)
{... |
C | /*
Implementação Arvore Multiplos filhos
*/
#ifndef ARVORE_MULT
#define ARVORE_MULT
#include <stdlib.h>
#include <stdio.h>
#define T 3
//estrutura da arvore
struct est_arv_mf{
int valores[T];
struct est_arv_mf *filhos[T+1];
int contador;
};
typedef struct est_arv_mf tipo_arv_mf;
//prototipos
tipo_arv_mf ... |
C | #include <stdio.h>
int main(void)
{
int n, x, sum, max, min;
double res;
while (scanf("%d", &n) != EOF)
{
sum = 0, max = 0, min = 32767;
for (int i = 0; i < n; i++)
{
scanf("%d", &x);
sum += x;
min = x < min ? x : min;
max = x > ma... |
C | //version 1.0
//problem: in show_into, process of time_t is error
#include <stdio.h>
#include <stdlib.h>
#include <utmp.h>
#include <fcntl.h>
#include <unistd.h>
#define SHOWHOST
void show_info(struct utmp *utmpfd);
//show info: version 1.0
void show_info(struct utmp *utmpfd)
{
printf("% -8.8s", utmpfd->ut_name);
... |
C | //在中国68是吉利数字,4不是吉利数字!
//我能够快速实现了! 加油!
/*interface*/
/*interface implementation*/
/*client*/
#include<stdio.h>
#define N 50+1
int main() {
//n是偶数?
//想法直接按要求实现就可以!
int n;
scanf("%d",&n);
char ticket[N];
scanf("%s",ticket);
int i;
int sum_left=0;
int lucky_left=1;
for(i=0; i<n/2; i+... |
C | /*
** loadtab.c for loadtab in /home/barthe_g/rendu/CPE/CPE_2014_bsq
**
** Made by barthelemy gouby
** Login <barthe_g@epitech.net>
**
** Started on Fri Jan 16 16:13:51 2015 barthelemy gouby
** Last update Sun Jan 18 22:21:01 2015 barthelemy gouby
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#define HDR_LEN 20
int main(int argc, char *argv[]) {
if (argc != 2) {
fprintf(stderr, "Usage: %s <filename>\n", argv[0]);
exit(1);
}
FILE * fp = fopen(argv[1], "wb");
if (!fp) {
fpri... |
C | /* Bergson matches */
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#define bm_min( arg1, arg2 ) ( arg1 < arg2 ) ? arg1 : arg2
#define bm_rndcomput( arg1 ) round ( pow( ( 1 + pow( 5, 0.5 ) ) / 2, arg1 ) / pow( 5, 0.5) )
/* I18n strings */
#define STR_ERR_WRPL "\nError: wrong player in tur... |
C | #include <stdio.h> // Versão recursiva do algoritmo que verifica parenteses numa string. Autor: Henrique Colodetti Escanferla.
int main()
{
int cont=0, i=0;
char s[30];
scanf("%s", s); // Le string do teclado
while(cont>=0 && s[i]!='\0')
{
switch (s[i])
{
case '\0': break 2;
case '(': ... |
C | #include <stdlib.h>
#include <memory.h>
#include <stdio.h>
#include "Contract.h"
Contract* createContract(int id, char* description,int amount, char* creationDate){
Contract* aux = malloc(sizeof(Contract));
aux->id = id;
aux->description = strdup(description);
aux->creationDate = strdup(creationDate);... |
C | #include <math.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#define NEARZERO 0.0000000001
#define TRUE 1
#define FALSE 0
/*
=========================
=== CLASS DEFINITIONS ===
=========================
*/
/* 'bytevecnb' arrays of bytes concatenated into a single array *... |
C | #include "process_info.h"
#include "Auxiliares.h"
#include <stdlib.h>
/**
* Initialize the process.
* Takes as inputs the process pid and its start time.
* Returns the new process_info.
*/
process_info createProcessInfo(int pid, time_t startTime){
process_info process = (process_info) xmalloc(sizeof(struct proces... |
C | #pragma once
//Screen size
const int FIELD_WIDTH = 1024;
const int FIELD_HEIGHT = 768;
bool implementParticleSwaps = true;
enum ParticleType
{
PT_Nothing = 0,
PT_Wall,
PT_Sand,
PT_Water,
PT_Oil,
PT_TOTAL
};
const int ParticleUpdateCounters[PT_TOTAL] = {0, 0, 1, 1, 1};
const int ParticleMaxS... |
C | #include "cs.h"
int main(void)
{
int sockfd = -1;
int ret = -1;
struct sockaddr_in server_addr = {0};
//char send_buf[60], recv_buf[60];
struct PACKET send_buf = {0};
//һһsocketļIPv4, TCP
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if(sockfd < 0)
{
perror("socker");
return -1;
}
printf("socketfd = %d.\n... |
C | #include "command.h"
#include "client.h"
#include "util.h"
/* extern global variables init */
char *handlelist[] = {
"QUIT",
"PORT",
"PASV",
"RETR",
"STOR",
"LIST"
};
int (*handler[])() = {
&handle_quit,
&handle_port,
&handle_pasv,
&handle_retr,
&handle_stor,
&handle_list
};
/* command's met... |
C | /* Ev sekli cizen program */
#include<stdio.h>
// Evin catisini cizen fonksiyon.
void catiyi_ciz( void )
{
printf( " /\\ \n" );
printf( " / \\ \n" );
printf( " / \\ \n" );
printf( " / \\\n" );
printf( "----------\n" );
}
// Evin katini cizen fonksiyon.
// sol ve sag degiskenleri fonksiyon
// ... |
C | //Refaça o problema da questao 04 sem o uso de outras variáveis que
//não x e y.
#include<stdio.h>
void main(){
int x, y;
printf("Informe o valor de X: ");
scanf("%d", &x);
printf("Informe o valor de Y: ");
scanf("%d", &y);
x = x^y;
y = x^y;
x = x^y;
printf("Valor do X: %d\n", x);
printf("Valor do Y: %d... |
C | #include <stdio.h>
#include <stdlib.h>
#define SIZE 8
int bitoint(char * text);
int main(void)
{
char number[SIZE];
fgets(number,SIZE,stdin);
printf("%d",bitoint(number));
}
int bitoint(char * text)
{
int number;
int exp=1;
int new_number=0;
number=atoi(text);
int test=number;
while(test!=0)
{
if (test%10>1... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <semaphore.h>
#include <limits.h>
int main(int argc, char *argv[])
{
char posix_sem_name[NAME_MAX];
if (argc != 2) {
printf("%s [SEM_NAME]\n", argv[0]);
exit(EXIT_F... |
C | #include "monty.h"
/**
* nopFunc - Does nothing
* @stack: Start of the stack
* @line: Line Number
*
* Return: void
*/
void nopFunc(stack_t **stack, unsigned int line)
{
(void) stack;
(void) line;
}
/**
* swapFunc - Swaps the top two nodes in the stack
* @stack: Start of the stack
* @line: Line number
*
... |
C | /*
** EPITECH PROJECT, 2017
** my_rpg_2017
** File description:
** (enter)
*/
#include "my.h"
#include "rpg.h"
void set_area_values(char *encounter, char *x, char *y, game_t *game)
{
AREA_COOR_X = my_getnbr(x);
AREA_COOR_Y = my_getnbr(y);
AREA_ENCOUNTER = my_getnbr(encounter);
for (int y = 0; y != TILE_TAB_Y; y++... |
C | /*
** EPITECH PROJECT, 2019
** 103cipher
** File description:
** decrypt messages
*/
#include "my.h"
float **create_message_matrix_dec(int matrix_sqrt, char *message)
{
int line_nbr = get_line_nbr_dec(matrix_sqrt, message);
float **message_m = malloc(sizeof(float *) * line_nbr);
char **split = split_numbe... |
C | #include<string.h>
#include<stdlib.h>
#include<stdio.h>
#include "QuickSort.h"
int partitionInt (int arr[], int low, int high)
{
int temp, j;
int pivot = arr[high]; // pivot
int i = (low - 1); // Index of smaller element
for (j = low; j <= high- 1; j++)
{
// If current element is small... |
C | #ifndef INCLUDE_COMMON_H_
#define INCLUDE_COMMON_H_
#include "types.h"
//向指定端口读一个byte
void outb(uint16_t port, uint8_t value);
//向指定端口写一个字节
uint8_t inb(uint16_t port);
//向指定端口写一个字
uint16_t inw(uint16_t port);
//从指定端口读长度为n字节的内容
void port_read(uint16_t port, void *buf, int n);
//向指定端口写长度为n字节的内容
void port_write(uint... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stddef.h>
#include "entry.h"
#include "hashtable.h"
#define HASHSIZE 101
static int table_size = 0;
static struct nlist *hashtab[HASHSIZE];
unsigned hash(char *s){
unsigned hashval;
for(hashval = 0; *s != '\0'; s++)
hashval = *s + 31 * hashval... |
C | /*
** check.c for check in /home/boulat_m/rendu/Projets/minishell
**
** Made by Mickael BOULAT
** Login <boulat_m@epitech.net>
**
** Started on Tue Nov 4 17:08:03 2014 Mickael BOULAT
** Last update Sun Nov 30 11:24:27 2014 Mickael BOULAT
*/
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <... |
C | #include<stdio.h>
#define AFFICHE_UNITE(i) \
if (i == 1) printf("un"); \
if (i == 2) printf("deux"); \
if (i == 3) printf("trois"); \
if (i == 4) printf("quatre"); \
if (i == 5) printf("cinq"); \
if (i == 6) printf("six"); \
if (i == 7) printf("sept"); \
if (i == 8) printf("huit"); \
if (i == 9) printf("neuf"); \
if (... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* rev_wstr.c :+: :+: :+: ... |
C | // 日本語
#include <stdint.h>
#include <assert.h>
struct WWAudioSampleBuffer {
/// @param aBuff new[]で割り当てたメモリを渡して下さい。
WWAudioSampleBuffer(uint8_t *aBuff, int aBytesPerFrame, int64_t aTotalBytes) {
buff = aBuff;
bytesPerFrame = aBytesPerFrame;
totalBytes = aTotalBytes;
... |
C | //========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Shared code for parsing / searching for characters in a string
// using lookup tables
//
// $Workfile: $
// $Date: $
// $NoKeywords: $
//===========================================================================//... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>
//int main()
//{
// double a = 5.0 / 2; // 21
// printf("%f", a);
// return 0;
//}
//int main()
//{
//
// int a = -1;
// //>> -λ
// //ƶǶλ
// //10000
// int b=a >> 1;
// printf("%d", b);
//
// return 0;
//}
//int main()
//{
// int a = -1;
// ... |
C | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE122_Heap_Based_Buffer_Overflow__c_CWE193_wchar_t_cpy_22b.c
Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_CWE193.label.xml
Template File: sources-sink-22b.tmpl.c
*/
/*
* @description
* CWE: 122 Heap Based Buffer Overflow
* BadSource: Allocate memory for ... |
C | #ifndef _ASM_IA64_SPINLOCK_H
#define _ASM_IA64_SPINLOCK_H
/*
* Copyright (C) 1998-2003 Hewlett-Packard Co
* David Mosberger-Tang <davidm@hpl.hp.com>
* Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
*
* This file is used for SMP configurations only.
*/
#include <linux/compiler.h>
#include <linux/kernel.... |
C | /*
* Lib_Param.c
*
* Created on: Aug 13, 2015
* Author: ctoncanier
*/
/*******************************************
* I N C L U D E *
********************************************/
#include "Lib_Param.h"
/*******************************************
* D E F I N E *
*****... |
C | #include <stdio.h>
#include <stdlib.h>
#include "list.h"
#include "set.h"
int main()
{
int match(int *key1,int *key2)
{
if(*key1 == *key2) return 1;
return 0;
}
Set setTest1,setTest2,setTest3;
ListElmt *set1;
// setTest1->match = match;
int a[]={1,2,3,4,5,6,7,8,9... |
C | /*
* pwm.c
* CSE325 Embedded Microprocessor Systems Spring 2015 - Project 3
* Peter Tueller (ptueller@asu.edu)
*/
#include "support_common.h"
#include "pwm.h"
void pwmInit() {
MCF_GPIO_PANPAR &= ~0xD0; //Clear bits 4 6 and 7, to set 3 pins to GPIO mode
MCF_GPIO_DDRAN |= 0xD0; //Set bits 4 6 and... |
C | /*When interest compounds q times per year at an annual
rate of r% for n years, the principal p compounds to an
amount a as per the following formula a = p (1+r/q)^nq
Write a program to read 10 sets of p, r, n & q and calculate
the corresponding as.*/
#include<stdio.h>
#include<math.h>
int main()
{
int i;
float q,... |
C | #include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include "variadic_functions.h"
/**
* _printchar - Here this function will print a character
* @printallfun: This is the list we've created using va_list
*/
void _printchar(va_list printallfun)
{
printf("%c", va_arg(printallfun, int));
}
/**
* _printinteg... |
C | #include <flub/util/color.h>
#include <flub/util/parse.h>
#include <GL/gl.h>
typedef struct _utilCtx_s {
int inited;
flubColor3f_t colorTable[256];
} utilCtx_t;
utilCtx_t g_utilCtx = {
.inited = 0,
};
void _utilQCColorCodeTableInit(void) {
int k, red, green, blue, n;
unsigned i... |
C | /*************************************************************************
> File Name: 01swap.c
> Author: AnSwEr
> Mail: 1045837697@qq.com
> Created Time: 2015年10月07日 星期三 12时40分43秒
************************************************************************/
/*
* 把一个0-1串进行交换,计算最少交换次数
*/
#include<stdio.h>
#include... |
C | #include <stdio.h>
#include <signal.h>
#include <unistd.h>
int a;
// Rotina de tratamento de sinais
void treatHUP(int sinal) {
a = 0;
}
// Processo.
void main() {
signal(10, treatHUP);
printf("Meu pid eh %i\n", getpid());
while(1) {
printf("Valor de a = %i\n", a);
a++;
sleep(3);
}
}
|
C | ////////////////////////////////////////////////////////////////////////////////
// Comments
// Tests out what happens when the shift value is 0.
// Nothing! Great!
// ...I was worried that C might do something crazy here...
////////////////////////////////////////////////////////////////////////////////
// Librarie... |
C | #ifndef __KV_STORE__
#define __KV_STORE__
#include <stdbool.h>
#include <pthread.h>
#include "kvconstants.h"
/* KVStore defines the persistent storage used by a server to store <key, value> entries.
*
* Each entry is stored as an individual file, all collected within the
* directory name which is passed in upon in... |
C | #include<stdio.h>
#include<malloc.h>
// ***** Circular Queue ******
//Global Declaration Section
//Structure called Node
struct Node
{
int value;
struct Node *next;
}*front=NULL,*rear=NULL;
int queueSize;
int currSize=-1;
//Function Declaration
void enqueue(int);
void dequeue();
void printQueue... |
C | #include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <string.h>
#include <time.h>
#include <errno.h>
#include <unistd.h>
int num_passengers, capacity, T, num_sim;
int queue[11], cur_time[11], roller_passenger[11];
int count;
pthread_mutex_t mutex_time[11];
pthread_mutex_t mutex_queue;
pthread_mutex_t m... |
C | #include <stdio.h>
/*
写一个C表达式,在下列描述的条件下产生1,而在其他情况下得到0.假设X是int类型。
代码应该遵循位级整数编码规则,另外还有一个限制,你不能使用相等(==)和不相等(==)测试。
注: 我没有利用题目中提及到的“有符号数的右移是算术右移”这一条件来实现,因为书中前面也提到“C语言标准并没有明确定义对于有符号数应该使用哪种类型的右移----算术右移或者逻辑右移都可以”,所以我这里尝试另一种方法。
*/
int main(int argc, char const* argv[])
{
int x;
//A. x的任何位都等于1
// !(x+1)
printf... |
C | #include <stdlib.h>
#include <stdio.h>
/*funcion para comparar dos elementos del arreglo*/
int comparacion(const void *i, const void *j) {
return *(int *)i - *(int *)j;
}
int main(void) {
int i;
int tam;
/*definimos el tamaño del arreglo*/
printf("Ingrese el tamanho del arreglo: ");... |
C | int f_open_file(char *f_name, char **str)
{
int fop;
int i;
fop = open(f_name, O_RDONLY);
if (fop != (-1))
f_read_file(fop, str);
else
{
i = 0;
while (f_name[i] != '\0')
{
write(1, &f_name[i], 1);
i++;
}
write(2, ": No such file or directory\n", 28);
}
return (fop);
}
void f_read_file(int f... |
C | #include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <ctype.h>
int pipe_count=0, fd;
static char* args[512];
char input_buffer[1024];
char *cmd_exec[100];
int flag, len;
char cwd... |
C | #ifndef _ALICALCSW_H_
#define _ALICALCSW_H_
#include <stdint.h>
#include "aliCost.h"
/* defines the matrix datatype and methods for Smith-Waterman
sequence alignment.
In order to implement Altschul-Erickson the cell and matrix
types will need to be modified, but all function prototypes
should remain the... |
C | /**
* @file ic_dir.nix.h
* @author impworks
* Platform-specific method definitions for ic_dir class.
*/
/**
* Recursively copies items in the directory.
* @param from Source path.
* @param to Destination path.
* @return Success flag.
*/
bool ic_dir::copy_r(const char *from, const char *to)
{
}
/**
* Recurs... |
C | #include "chat_server.h"
namespace server
{
int ChatServer::Start(const std::string& ip,short port)
{
sock = socket(AF_INET,SOCK_DGRAM,0);
if(sock < 0)
{
perror("socket");
return 1;
}
sockaddr_in server_addr;
server_addr.sin_family = AF_INET;
server_addr.sin_addr.s_addr = in... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
int main(int argc, char const *argv[])
{
//通过dup函数复制一个文件描述符
int fd;
//du执行后返回值文件描述符的文件描述符中最小可用文件描述符
fd = dup(1);
printf("fd = %d",fd);
//由于dup函数将这个1复制了一份,所... |
C | /* Demo of Two-Phase Commit Service
**
** This example uses the two-phase commit service
** to perform a simultaneous update on two servers.
** In this example, one of the servers participating
** in the distributed transaction also functions as
** the commit service.
**
** In this particular example, the same ... |
C | /*
* mm_alloc.c
*
* Stub implementations of the mm_* routines.
*/
#include "mm_alloc.h"
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
struct metadata {
size_t size;
int free;
struct metadata *next;
struct metadata *prev;
};
struct metadata *start = NULL;
struct metadata *last... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.