language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include "huffman_node.h"
#include "heap.h"
#include <assert.h>
huffmanTree construire_arbre_codes(unsigned int *distrib)
{
Heap* tas=createEmptyHeap();
for (int i = 0; i < 257; i++)
if (distrib[i]!=0)
insert(tas,createLeaf(distrib[i],i));
while(tas->size!=1){
if (tas->size==2)
return addT... |
C | #include "graph.h"
/*
* 按行输入 第一行输入 0 2 3 0 0
* 就是说第一个节点和第二个节点边的权重为2
* 第三个之间的边权重为3
* 其他无边
*
*/
GRAPH* init_graph(int num)
{
GRAPH *g = (GRAPH *)malloc(sizeof(GRAPH));
g->node_num = num;
g->edge_num = 0;
g->n = (NODE *)malloc(sizeof(NODE)*num);
int tmp = 0;
for(tmp;tmp < num;tmp++)
{
g->n[tmp].vi = tmp+1... |
C | /* getlogin.c - an implementation of the `getlogin(3)` library function.
*
* The `getlogin(3)` function returns the username of the user currently
* logged in in the controller terminal of the calling process. Therefore,
* it fails for daemon processes.
*
* This is accomplished by checking the name of the termina... |
C | #include <stdio.h>
#include <stdbool.h>
#define STACK_SIZE 100
/* external variables */
char contents[STACK_SIZE];
int top = 0;
bool underflow = false, overflow = false;
void make_empty(void);
bool is_empty(void);
bool is_full(void);
void push(char ch);
char pop(void);
void stack_overflow(void);
void stack_underflow... |
C | /** Demonstration of how to use a bit field, accessing just selected bits in a larger
value, as if they are a little integer. */
#include <stdio.h>
#include <stdlib.h>
// Increment just bits 8 - 11, returning the resut, with the
// remaining bits left unchanged.
unsigned short increment8to11( unsigned short s )
{... |
C | #include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/ipc.h>
#include<sys/shm.h>
#include<string.h>
#define SHMSZ 100
int main()
{
int shmid;
key_t key;
key=1234;
char *shm,*s;
if((shmid=shmget(key,SHMSZ,IPC_CREAT|0660))<0)
{
perror("shget");
exit(1);
}
//attach the process2 to this shm
if((shm=shmat(... |
C | #include <stdio.h>
#include <stdlib.h>
struct node_t {
int data;
struct node_t *next;
};
struct list_t {
struct node_t *head;
};
struct list_t init_list() {
struct list_t result = { NULL };
return result;
}
struct node_t* init_node(int item) {
struct node_t *result = malloc(
sizeof(s... |
C | #include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
#include<pthread.h>
void *thread_run(void *arg)
{
while(1){
printf("I am %s, pid : %d ,my thread id is %p\n",(char*)arg,getpid(),pthread_self());
sleep(1);
int a = 1 / 0;
}
}
int main()
{
pthread_t tid;
//你新创建的线程id就会放在tid中
pthread_creat... |
C | /*********************
* TCP SOCKET TEST 3
* ******************/
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <math.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <er... |
C | #ifndef __JSON_H__
#define __JSON_H__
/**
* \file json.h
* \brief Module contenant les primitives et les structures permettant l'écriture et la lecture de fichier JSON.
* \author GALBRUN Tibane
* \version 0.3
* \date 5 Mars 2019
*/
#include <stdio.h>
#include <stdlib.h>
#include <erreur.h>
/* Primitives de créat... |
C | //Program for DFS using C
#include<stdio.h>
#include<stdlib.h>
//Array to store visited nodes
int v[7]={0,0,0,0,0,0,0}; //7 denotes the no. of vertex
void dfs(int arr[][7],int cur)
{
//Print the visited node
printf("\n%d",cur+1);
//Update visited count
v[cur]=1;
//Find adjacent unvisited nodes
... |
C | #include "arvbb.h"
Arv* arvore_cria(void) {
return NULL;
}
Arv* arvore_insere(Arv* a, tipoItem v) {
if (arvore_busca(a, v) == 1)
return a;
if (a == NULL) {
a = (Arv*) malloc(sizeof (Arv));
strcpy(a->palavra.nome, v.nome);
a->esq = a->dir = NULL;
} else if (strcmp(v.no... |
C | #include "stdio.h"
void main()
{
int a,i,b,c[10]={10,20,30,40,50};
printf("\nEnter number position");
scanf("%d",&a);
printf("\nEnter number to insert");
scanf("%d",&b);
for(i=4;i>=a-1;i--)
{
c[i+1]=c[i];
}
c[a-1]=b;
printf("All numbers are\n");
for(i=0;i<6;i++)
{
printf("%d\t",c[i]);
}
}
|
C | #include <stdio.h>
#include "stack.h"
#include <stdlib.h>
#include <assert.h>
int empty( struct node** top)
{
return(*top== NULL); // jesli pusta true
}
void push(char i, struct node ** top)
{
struct node *new_node = malloc (sizeof (struct node));
new_node->val=i;
new_node->next=*top;
*top=new_node;
}
int pop(st... |
C | #include <stdio.h>
int main(int argc, char** argv)
{
printf("the char size is %ld\n",sizeof(char));
printf("the short size is %ld\n",sizeof(short));
printf("the int size is %ld\n",sizeof(int));
printf("the long size is %ld\n",sizeof(long));
printf("the float size is %ld\n",sizeof(float));
print... |
C | #include <stdio.h>
#include <sys/stat.h>
#include <string.h>
#include <dirent.h>
//#define NULL 0
#define PROC_DEV_PATH "/proc/dev"
int main(int argc, char ** argv)
{
DIR *pDir;
struct dirent *pEnt;
struct stat fstat;
pDir = opendir (PROC_DEV_PATH);
if(!pDir) {
fprintf(stdo... |
C | #include<stdio.h>
#include<string.h>
void main()
{
char b[100],a[100];
printf("Enter the string 1");
scanf("%s\n",&a);
printf("\nEnter the string 2");
scanf("\n%s",&b);
printf("\n%s%s",a,b);
}
|
C | #include <stdio.h>
#include <stdlib.h>
int main( void ){
// fprintf( stdout, "Hello, World %p\n", stdout );
int size = -13 * sizeof( char );
void* hello = malloc( size );
fprintf( stdout, "%p %p\n", &hello, hello );
free( hello );
return 0;
}
|
C | #include <stdio.h>
#include "kiss_fft.h"
#include "kiss_fftr.h"
kiss_fft_cpx *copycpx(float *mat, int nframe) {
int i;
kiss_fft_cpx *mat2;
mat2 = (kiss_fft_cpx *) KISS_FFT_MALLOC(sizeof(kiss_fft_cpx) * nframe);
kiss_fft_scalar zero;
memset(&zero, 0, sizeof(zero));
for (i = 0; i < nframe; i++) {... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
static bool hash[101]={false};
struct Node {
int data;
struct Node* next;
};
struct Queue {
struct Node *front;
struct Node *rear;
struct Node *curr;
int capacity,size;
};
struct Node* newNode(int value)
{
struct Node* temp = (st... |
C | #include "image.h"
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
int main(int arg_count, char **args)
{
if(arg_count == 4)
{
pid_t wpid;
int status = 0;
struct image input = make_image_from_file(args[1]);
struct image output = make_image(input.type, input.row_count, inp... |
C | #include "serial.h"
#include "schedule.h"
#include "state.h"
#include <timer.h>
#include <peripherals\switches\switch.h>
#include <peripherals\potentiometer\pot.h>
#include <peripherals\rgb_led\rgb_led.h>
#include <shell.h>
void init_shell();
void check_peripherals();
void init_peripherals();
int main(void) {
in... |
C | #include "computer.h"
#include "online.c"
///Function Name : selec
///Description : To select mode of shopping
///Input Params : start,order,soft,wake
///Return : void
void selec(COMPUTER* start,ORDER* order,SOFTWARE* soft,QUEUE* wake)
{
int choice,chh;
system("cls");
printf(" ... |
C | #include "uart.h"
// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
// flag register bits
#define TXFE (1 << 7)
#define RXFF (1 << 6)
#define TXFF (1 << 5)
#define RXFE (1 << 4)
#define BUSY (1 << 3)
#define CTS (1 << 0)
// dr register bits
#define OE (1 << 11)
#define BE (1 << 10)
#defin... |
C | // Sequência espelho
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
main()
{
int num1, num2, testes, i, j = 0;
char numChar[5];
scanf(" %d", &testes);
for(testes; testes > 0; testes--)
{
scanf(" %d%d", &num1, &num2);
for(i = num1; i <= num2; i++)
{
sprintf(numChar, "%d", ... |
C | //
// main.c
// DS_HW2_Dijkstra
//
// Created by GONG, YI-JHONG on 2015/11/20.
// Copyright © 2015年 GONG, YI-JHONG. All rights reserved.
// NOTE: There is a known issue for reading large input.
#include <stdio.h>
#define MAX_GRAPH 2048
#define INF MAX_GRAPH * MAX_GRAPH
#define TRUE 1
#define FALSE 0
int cost[MA... |
C | #include <stdio.h>
int main(int argc, char *argv[]){
FILE * myarquivo;
char texto;
if(argc < 2){
printf("Por favor, informe o nome de arquivo que deseja ler como parametro do programa.");
exit(1);
}
myarquivo = fopen(argv[1], "r");
if(myarquivo == NULL){
pri... |
C | /***
*time.c - get current system time
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* defines _time32() - gets the current system time and converts it to
* internal (__time32_t) format time.
*
***********************************************************************... |
C | #include <stdio.h>
#include <stdlib.h>
//A C example about or statements
int main() {
char answer;
printf("Do you like bagels? (Y/N)?: \n");
scanf(" %c", &answer);
if((answer == 'Y') || (answer == 'N')) {
printf("Great me too!");
} else{
printf("Aww you suck.");
}
re... |
C | //
// Created by kenhuang on 19-10-20.
//
#ifndef type_H
#define type_H
typedef long (* Function)();
typedef unsigned char boolean; /* Boolean value type. */
typedef unsigned long int uint32; /* Unsigned 32 bit value */
typedef unsigned short uint16; /* Unsigned 16 bit value */
typedef uns... |
C | #include "adc.h"
#include <avr/io.h>
void adc_setup(void) {
// No interrupts (should be already off)
// The ADC voltage reference is selected by writing the REFS[1:0] bits in the ADMUX register
//ADMUX &= ~(1 << REFS1) & ~(1 << REFS0); // VCC (3.4v) used as analog reference, disconnected from PA0 (AREF)
... |
C | // Questão 6) [SEMANA01_q06.c] Escreva um programa em C que receba um número inteiro o imprima por
// extenso em inglês.
// Entrada: um número inteiro de 0 a 9.
// Saída: Uma linha contendo o número por extenso no idioma inglês
// #include <stdio.h>
// int main(){
// int num;
// scanf("%i",&num);
// switch(num){... |
C | #include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <wait.h>
#include <stdlib.h>
int main(int argc, char **argv) {
pid_t pid, werr;
int err;
int status = 0;
if (argc < 2) {
err = printf("error - not enough arguments; usage: %s prog_name\n", argv[0]);
exit(-1);
}
... |
C | /*
* Copyright (C) 2015 University of Oregon
*
* You may distribute under the terms of either the GNU General Public
* License or the Apache License, as specified in the LICENSE file.
*
* For more information, see the LICENSE file.
*/
/*
*/
/* circ: Approximates object with circle */
#include "imagemath.h"
... |
C | #include <stdio.h>
#include <stdlib.h>
/*
Write a program that prints the numbers 1 to 4 on the same line.
Write the program using the following methods.
a) Using one printf statement with no conversion specifiers.
b) Using one printf statement with four conversion specifiers.
c) Using four printf statements.
Exercis... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fdf_color.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<pwd.h>
#include<sys/stat.h>
#include<sys/types.h>
#include<dirent.h>
#include<errno.h>
#include<string.h>
#include <netdb.h>
#include <sys/param.h>
#include <sys/wait.h>
#include <sys/dir.h>
#include <grp.h>
#include <time.h>
#include <locale.h>
#include ... |
C | #include <stdio.h>
int main()
{
int a = 2;
int b = 0;
int tic1 = 0;
int tic2 = 0;
int fi[6] = {0, 0, 0, 0, 0, 6};
int ec[7] = {0, 0, 0, 0, 0, 0, 6};
while (a != 0)
{
/* code */
printf("Please type 1 for “first class”\n");
printf("Please type 2 for “economy”\n");
... |
C | #define VexNum 10 //顶点个数
#define MAX 36
#define MAXedg 30
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
//linux下的清屏函数,windows下是system("clr")
void clrscr()
{
system("clear");
}
typedef enum
{
DG,DN,UDG,UDN
}GaphKind;//{有向图,有向网,无向网}
typedef int AdjMatrix[MAX][MAX]; //邻接矩阵数组
//矩阵图结构体
typede... |
C | int maxArea(int* height, int heightSize) {
int i, j, max, tmp;
i = 0;
j = heightSize - 1;
max = 0;
while(i<j) {
tmp = (height[i]<height[j]?height[i]:height[j]) * (j-i);
if (tmp > max) {
max = tmp;
}
if (height[i] < height[j]) {
i++;
} else {
j--;
}
}
return max;
}... |
C | #include<stdio.h>
#include<math.h>
int decimaltooctal(int decimalnumber);
int main()
{
int decimalnumber,R;
printf("\nenter a decimal no.");
scanf("%d",&decimalnumber);
R=decimaltooctal(decimalnumber);
printf("\noctal of %d =%d",decimalnumber,R);
return 0;
}
int decimaltooctal(int decimal... |
C | /* Name: main.c
* Author: <insert your name here>
* Copyright: <insert your copyright message here>
* License: <insert your license reference here>
*/
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <util/twi.h>
#include "button.h"
#include "i2cmaster.h"
#include "rtc.h"
// Ports ... |
C |
#include <stdio.h>
#include "gyro.h"
int main()
{
int success = gyro_init();
if (!success) {
return 1;
}
int dx, dy, dz;
int count = 0;
while (1) {
if (gyro_ready()) {
gyro_read(&dx, &dy, &dz);
count++;
if (1) {
printf("%8d %8d %8d %s\n", dx, dy, dz,
gyro_overrun() ? ... |
C | /*
Q:给定两个数组X和Y,元素都是正数。请找出满足如下条件的数对的数目:
1. x^y > y^x,即x的y次方>y的x次方
2. x来自X数组,y来自Y数组
假设数组X的长度为m,数组Y的长度为n,最直接的暴力法,时间复杂度为O(m*n),但这样的话,并不需要都是正数这个条件的。
那么,我们该如何优化呢?x^y>y^x,对于x和y来讲,有什么规律呢?该如何发现呢?
这里其实有规律的,大多数的条件下,当y>x的时候,x^y>y^x,但是有一些例外,1,2,3,4几个数,需要特殊的考虑,
比如2^4=4^2。这个大家可以通过在纸上写写画画来得到,相对繁琐,我们就不进一步分析了。
我们可否对... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include "getline2.h"
int main() {
const int max = 8;
char line[max];
float balance = 0;
while (1) {
printf("Type deposit, check or exit > ");
getline2(line, max);
if (strcmp(line, "deposit") == 0) {
printf("How much? > ");
getline2(line, max);... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* darray_create.c :+: :+: :+: ... |
C | #include "disk.h"
#include "disk-array.h"
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include <string.h>
// Global variables
int verbose = 0;
int level, strip, disks, blockSize; //strip is strip size
struct disk_array * diskArray;
// Error Message for input
void err... |
C | #include<stdio.h>
int main()
{
int t;
long long int x,y,z,a,n,d,i,term;
scanf("%d",&t);
while(t--)
{
scanf("%lld%lld%lld",&x,&y,&z);
n = (2*z)/(x+y);
d = (y-x)/(n-5);
a = x - (2*d);
printf("%lld\n",n);
for(i=0;i<n;i++)
{
... |
C | /*
** func_hexa_tab.c for corewar asm in /home/meuric_a/CPE_2014_corewar_ODD/asm
**
** Made by Alban Meurice
** Login <meuric_a@epitech.net>
**
** Started on Tue Apr 7 12:04:16 2015 Alban Meurice
** Last update Sun Apr 12 21:51:23 2015 Moisset Raphael
*/
#include <stdlib.h>
#include "my.h"
#include "asm.h"
int **... |
C | #include <stdio.h>
#include <stdlib.h>
//#include "iks_grammar.h"
#include "iks_tree.h"
#include "iks_stack.h"
#include "iks_ast.h"
#include "iks_types.h"
static inline void __scope_init(scope_t *scope) {
//scope->st = new_iks_stack();
scope->st = new_iks_dict();
scope->next_addr = 0;
}
scope_t *new_scope() {
sco... |
C | #ifndef TRIVARIATE_POLY_H
#define TRIVARIATE_POLY_H
#include "biv_rationalfns.h"
//AS AN IMPORTANT STRAY FROM THE USUAL:
//trivariate polynomials will be defined with coeffs that are !!rational!! bivariate polys...
//wrt to this arctan stuff we're working in K(a,b)[x] so K(a,b) a field should have quotients...
//when... |
C | #include "philo.h"
void free_clean_mutex(t_all *all, t_philo *philos)
{
int i;
i = 0;
while (i < all->nb_of_philos)
{
pthread_join(philos[i].philo_thread, NULL);
i++;
}
i = 0;
while (i < all->nb_of_philos)
{
pthread_mutex_destroy(&all->forks[i]);
i++;
}
pthread_mutex_destroy(&all->... |
C | int main()
{
int n,i;
int m[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
scanf("%d",&n);
for(i=0;i<7;i++)
{
if((n+i)%7==5)
{
n=(1+i)%7;//??????
break;
}
}
//printf("first Friday=%d\n",n);
int e=13;
for(i=0;i<12;i++)
{
e=e+m[i];
//printf("%d\n",e);
if(e%7==n)
... |
C | #include <stdio.h>
void print_largest_two(int *array,int size){
int largest01 = 0;
int largest02 = 0;
for (int i = 0 ; i < size; i++){
if(array[i] > array[i+1]){
largest01 = array[i];
}
if(array[i+1] > array[i]){
largest01 = array[i+1];
}... |
C | //*****************************************************************************
// Luke Hsiao
// 4 May 2015
// Interface for displaying the clock
//
// Details:
// Note that the area of the touchscreen will be displayed and scaled usering
// these regions:
// +--+---+---+---+---+---+---+---+---+--+
// | | | ... |
C | //
// quicksort.h
// lab11
//
// Created by zwpdbh on 8/16/16.
// Copyright © 2016 Otago. All rights reserved.
//
#ifndef quicksort_h
#define quicksort_h
#include <stdio.h>
extern void quicksort(int *arr, int lowIndex, int highIndex);
int partition(int *arr, int lowIndex, int hightIndex);
void swap(int *x, int *y... |
C | #include<stdio.h>
#include<conio.h>
void main()
{
int inter;
float p,r,n;
clrscr();
printf("Enter principle amount:\n");
scanf("%f",&p);
printf("Enter no.of years:\n");
scanf("%f",&n);
printf("Enter rate of interest:\n");
scanf("%f",&r);
inter=(p*n*r)/100;
printf("Simple Interest=%d",inter);
getch();
}
... |
C | /*
BATCH NO. 27
Mayank Agarwal (2014A7PS111P)
Karan Deep Batra(2014A7PS160P)
*/
#include <stdlib.h>
#include <string.h>
#include "token.h"
tokeninfo* makeToken(char* tokenname, char* lexeme, int linenumber)
{
tokeninfo* temp = (tokeninfo*)malloc(sizeof(tokeninfo));
int l = strlen(tokenname);
temp->tokenname = (cha... |
C | #include "xsal.h"
#include "xsal_i_assert.h"
#include "xsal_i_time.h"
#include "xsal_i_message_queue.h"
SAL_Message_T* SAL_I_Pend_Message_Timeout(
SAL_Message_Queue_T* queue,
uint32_t timeout_ms)
{
SAL_I_Time_Spec_T time1;
bool wait_for_msg = true;
SAL_Message_Queue_Node_T* msg;
SAL_Message_Queue_No... |
C | #include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <stdint.h>
#include <string.h>
#define CHECK_ERROR(condition,message) \
do {if (condition) { \
fprintf(stderr, "%s:%d:%s: %s\n",__FILE__,__LINE__,__func__,message); \
exit(EXIT_FAILURE); \
}}while(0)
#define CHECK_ERRNO(condition, message) ... |
C | #include <stdio.h>
#include <string.h>
int main() {
char A[101], B[201];
int i, j;
gets(A);
for (j = 0,i = 0; i < strlen(A); ++i) {
putchar(A[i]);
switch(A[i]) {
case 'a' : { printf("pa"); } break;
case 'i' : { printf("pi"); } break;
case 'u' : { printf("pu"); } break;
case 'e' : { printf("pe"); }... |
C | #include <stdio.h>
#include <conio.h>
#include <math.h>
int main()
{
int n, sum;
printf("n = ");
scanf("%d",&n);
while (n>0)
{
sum+=n%10;
n=n/10;
}
printf("sum = %d", sum);
return 0;
} |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* workshop.c :+: :+: :+: ... |
C | /*! @file
@brief
mruby/c Fixnum and Float class
<pre>
Copyright (C) 2015-2018 Kyushu Institute of Technology.
Copyright (C) 2015-2018 Shimane IT Open-Innovation Center.
This file is distributed under BSD 3-Clause License.
</pre>
*/
#include "vm_config.h"
#include "opcode.h"
#include <stdio.h>
#includ... |
C | //Lucas Eduardo Nogueira Gonalves, 122055 (Integral)
#include <stdio.h>
#include <stdlib.h>
void Imprimevetor(int n, int *vet) /* funo de impresso */
{
int i;
for (i = 0; i < n; i++)
printf("%d ", vet[i]);
printf("\n"); /* pula uma linha */
}
int EncontraMaior(int n, int *vet) /* funo ... |
C | #include <string.h>
#include <stdlib.h>
#include "dberror.h"
#include "expr.h"
#include "tables.h"
// implementations
RC
valueEquals (Value *left, Value *right, Value *result)
{
if(left->dt != right->dt)
THROW(RC_RM_COMPARE_VALUE_OF_DIFFERENT_DATATYPE, "equality comparison only supported for values... |
C | #include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <stdio.h>
#include <list.h>
#include "animate.h"
#include "dbg.h"
#include "flags.h"
#include "sprite.h"
#include "gfx.h"
Sprite *create_sprite(char *id, char *path, int frames, SDL_Rect *size, SDL_Rect *mask, void *animation)
{
Sprite *sprite = malloc(siz... |
C | /* version where reders can read all items in a row
/* they dont wait for consumer */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
#include <sys/shm.h>
#include <time.h>
#include <errno.h>
#include <sys/types.h>
#include <signal.h>
#include <semaphore.h>
#include <pthread.h>
#defin... |
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 | /* Parsing: Evaluating Arithmetic Expressions
=================================================================
Description: Given a infix expression in a string, the parser
evaluates the string and reports errors if the
parsing fails or the evaluation causes a division by
... |
C | /* cx17-ap6.c */
#include "stdio.h"
#include "malloc.h"
#define CLASS(type)\
typedef struct type type; \
struct type
#define CTOR(type) \
void* type##New() \
{ \
struct type *t; \
t = (struct type *)malloc(sizeof(struct type));
#define FUNCTION_SETTING(f1, f2) t->f1 = f2;
#define END_CTOR return (void*)t; };... |
C | #include <stdio.h>
/**
* 两个读线程读取数据,一个写线程更新数据
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#define READ_THREAD 0
#define WRITE_THREAD 1
int g_data = 0;
pthread_rwlock_t g_rwlock;
void *func(void *pdata)
{
int data = (int)pdata;
while (1) {
if (READ_THREAD == d... |
C | #include <stdio.h>
#include "math.h"
int main()
{
int v[20], i, j, maiorIndice;
int maiorDiferenca, auxiliar;
for(i=0;i<20;i++)
{
printf("Digite um valor para o vetor:\n");
scanf("%d",&v[i]);
}
for(i=0;i<20;i++)
{
printf("%d\n",v[i]);
}
maiorInd... |
C | #include <stdio.h>
int main(){
char c = 'g';
int i = 10;
long l = 1;
char *cp = &c;
int *ip = &i;
long *lp = &l;
printf("*cp (oct): %o\t*cp (hex): %x\n", cp, cp);
printf("*ip (oct): %o\t*ip (hex): %x\n", ip, ip);
printf("*lp (oct): %o\t*lp (hex): %x\n", lp, lp);
printf("The a... |
C | /**
* @file port/mswin/gettime.h
* @copyright 2021 Andrew MacIsaac
* @remark
* SPDX-License-Identifier: BSD-2-Clause
*
* @brief Port implementation to obtain time on Windows platforms.
*/
#ifndef PORT_MSWIN_GETTIME_H_
#define PORT_MSWIN_GETTIME_H_
#include "ll_internal.h"
#if HAVE__FTIME_S
... |
C |
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <assert.h>
// See "man strlcpy"
#include <bsd/string.h>
#include <string.h>
#include "hashmap.h"
// using pair functions from lecture
void
free_pair(hashmap_pair* pp)
{
if (pp) {
free(pp->key);
free(pp);
}
}
int
hash(char* ... |
C | /*
* File Name: file_read4.c
* Create Date: 2016年12月05日 星期一 11时20分13秒
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct readFF
{
int num;
char str[15];
struct readFF *next;
};
int
main ()
{
return 0;
}
void
readed ()
{
FILE *fp = NULL;
fp = fopen ();
if (NULL != fp)
{
int ... |
C | #include "ncurses.h"
/*
A_NORMAL нормальный, переустановка всего остального
A_STANDOUT наиболее яркий режим
A_UNDERLINE подчеркивание
A_REVERSE обратное изображение
A_BLINK мигание
A_DIM тусклый или полуяркий режим
A_BOLD жирный шрифт
A_ALTCHARSET использование альтернативной символьной таблицы
A_INVIS невид... |
C | #include <logger.h>
#include <stdarg.h>
#include <stdint.h>
#include <string.h>
#include <kernel.h>
#include <serial.h>
#define PR_LJ 0x01
#define PR_CA 0x02
#define PR_SG 0x04
#define PR_64 0x08
#define PR_32 0x10
#define PR_WS 0x20
#define PR_LZ 0x40
#define PR_FP 0x80
#define PR_BUFLEN 32
int string_format(const... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* errors_free_close.c :+: :+: :+: ... |
C | /*
* Program demonstrating the use of execl()
*/
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
extern int errno;
int main()
{
char buf[50];
int retVal;
int pid;
printf("The actual pid %d : %d \n",getpid(),getppid());
pid=fork();
if(pid==0)
{
printf("Child pid %d",getpid());
pri... |
C | #include "typedefs.h"
#include "tm4c123gh6pm.h"
#include "DIO.h"
#define HWREG(x) (*((volatile unsigned long *)(x)))
enum Dio_LevelType {
STD_LOW = 0 , STD_HIGH = 1
};
uint8 DIO_ReadPort(uint8 port_index , uint8 pins_mask)
{
switch (port_index)
{
case 0 :
return GPIO_PORTA_DATA_R & pins_mask;
break... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_hex2int.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
int main() {
int pipe;
char * myfifo = "/tmp/myfifo";
mkfifo(myfifo, 0666);
char inputQuery[100] = {'\0'};
char result[3600];
char control;
while (1) {
// clean input
f... |
C | #include <stdio.h>
#include <stdlib.h>
void funcionBienvenida(char * nombre);
void funcionDespedida (char* nombre);
void fDelega(void(*punteroFuncion)(char* elDato),char * nombre);
//void funcionDespedidaSin(char* nombre);
///void funcionBienvenidaMas(char* nombre);
int main()
{
fDelega(funcionBienvenida... |
C | #include<stdio.h>
int main ()
{
int N1, N2, N;
scanf ("%d.%d", &N1, &N2);
N = (N1*100)+N2;
printf("Notes:\n");
printf("%d note of TK 100.00\n", N/10000);
N = N % 10000;
printf("%d note of TK 50.00\n", N/5000);
N = N % 5000;
printf("%d note of TK 20.00\n", N/2000);
N = N % 2000;... |
C | /**
* This file contains the search engine backend, for compilation to
* webassembly. This code uses the page data and the prefix tree stored in
* search.h, which are generated during the Python build process, to provide
* the actual search functionality.
*/
#include "search.h"
#define NULL 0
#define WORDS_MAX 6... |
C | #include "binary_trees.h"
/**
*binary_tree_insert_right - Inserts a node as the right-child of another node
*@parent: is a pointer to the node to insert the right-child in
*@value: is the value to store in the new node
*Return: A pointer to the new node
*/
binary_tree_t *binary_tree_insert_right(binary_tree_t *pa... |
C | #include "linkedlist.h"
#include <stdio.h>
#include <stdlib.h>
/* reference solution provided with assignment description */
void ll_show(ll_node *list) {
ll_node *ptr = ll_head(list);
putchar('[');
while(ptr) {
if (ptr->prev) printf(", ");
if (ptr == list) putchar('*');
printf("%d"... |
C | #include <stdio.h>
int ischar(char c){
int r;
r=-1;
if((c>='A') && (c<='Z')) r=1;
if((c>='a') && (c<='z')) r=1;
return(r);
}
int main(){
char s[1024];
int sl,i,H,A[256];
while (gets(s)){
sl=strlen(s);
for(i=0;i<256;i++)
... |
C | #ifndef _DLIST_H_
#define _DLIST_H_
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stdbool.h>
#define DataType int
typedef struct DListNode
{
struct DListNode *prev;
DataType data;
struct DListNode *next;
}DListNode;
typedef struct DList
{
DListNode *first;
DListNode *... |
C | #include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <malloc.h>
enum SymbolCodes
{
// Перечесление кодов символов для функции ввода строки
BACKSPACE_KEY = 8,
START_CHAR_RANGE = 32,
END_CHAR_RANGE = 126
};
enum OperationsCodes
{
// Перечисление кодов операций для организации главног... |
C | #include "DHT.h"
#define DHTPIN 8 // what pin we're connected to
#define DHTTYPE DHT11 // DHT 11
DHT dht(DHTPIN, DHTTYPE);
void setup () {
Serial.begin(9600);
dht.begin;
}
void loop() {
if (Serial.available()) {
int ch = Serial.read();
if ( ch == '1' ) {
float h = dht.readHumidity();
... |
C | #include <stdio.h>
#include <string.h>
void main(void)
{
char livro[128] = "Este texto será perdido com a cópia";
strcpy(livro, "Programação C/C++");
printf("Nome do livro: %s\n", livro);
}
|
C | /*
** create.c for create.c in /Users/taing_k/Desktop/octo/taing_k
**
** Made by TAING Kevin
** Login <taing_k@etna-alternance.net>
**
** Started on Fri Jan 22 16:05:20 2016 TAING Kevin
** Last update Fri Jan 22 16:05:46 2016 TAING Kevin
*/
#include "libmy.h"
#include "struct.h"
void createMap(void)
{
t_maze m... |
C | #include "test-squash.h"
struct BoundsInfo {
SquashCodec* codec;
uint8_t* compressed;
size_t compressed_length;
};
static void*
squash_test_bounds_setup(MUNIT_UNUSED const MunitParameter params[], void* user_data) {
struct BoundsInfo* info = munit_new (struct BoundsInfo);
info->codec = squash_get_codec (mun... |
C | /*
rvore binria
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct pessoa{
char nome[25];
int idade;
char endereco[50];
struct pessoa *esquerda, *direita;
}pessoa;
pessoa *criaPessoa(char nome[25], int idade, char endereco[50]);
void insereArvore( pessoa **raiz, pess... |
C | #define _POSIX_C_SOURCE 199309L
#include <stdio.h>
#include <stdlib.h>
#include "sift.h"
#include <time.h>
/********************************
Author: Sravanthi Kota Venkata
********************************/
void normalizeImage(F2D *image) {
int i;
int rows;
int cols;
int tempMin = 10000, tempMax = -1;
row... |
C | /*Instruction: int solveMeFirst(int a, int b);
where,
a is the first integer input.
b is the second integer input
Return values
sum of the above two integers
Sample Input
a = 2
b = 3
Sample Output
5*/
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int solveMeFirst(int a, int b) {
// ... |
C | #include <stdio.h>
short map[2005][2005];
int main() {
int m, n;
int x, y, i, j;
while (1) {
scanf("%d %d", &n, &m);
if (n == 0 && m == 0) {
return ;
}
scanf("%d %d", &x, &y);
memset(map, 0, sizeof(map));
for (i = 0; i < n; i++) {
getchar();
for (j = 0; j < m; j++) {
if (getchar() == '*')... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.