language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | // Filename: peterson_yieldlock_memoryfence.c
// Use below command to compile:
// gcc -pthread peterson_yieldlock_memoryfence.c -o peterson_yieldlock_memoryfence
#include<stdio.h>
#include<pthread.h>
#include "mythreads.h"
int flag[2];
int turn;
const int MAX = 1e9;
int ans = 0;
void lock_init()
{
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_init_convert.c :+: :+: :+: ... |
C | /* ************************************************************************** */
/* */
/* :::::::: */
/* push_swap.h :+: :+: ... |
C | #include "hashMap.h"
#include <assert.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
/**
* Allocates a string for the next word in the file and returns it. This string
* is null terminated. Returns NULL after reaching the end of the file.
* @param file
... |
C | #include <stdio.h>
int inRange(int value)
{
int mask = (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6); //* this is 00000001111100
mask = ~mask;
value = value & mask;
return value;
}
int main()
{
int a;
a = 276; //*this is 1 0001 0100
printf("%i", inRange(a));
return 0;
}
|
C | #include <stdio.h>
#include <string.h>
int main()
{
char str1[100],str2[100],c[100];
gets (str1);
gets (str2);
int i,j,k,sum=0;
if(strlen(str1)>strlen(str2))
{
strcpy(c,str2);
strcpy(str2,str1);
strcpy(str1,c);
}
for (i=0;i<strlen(str1);i++)
{
for (j=0... |
C | /**
* @file tri_bulle.c
* @author Louis MORAND, Benoit ARQUILLIERE
* @brief Faire le tri d'un tableau donné en paramètre par bulle
* @version 2
* @date 2021-10-09
*
* @copyright Copyright (c) 2021
*
*/
#include <stdio.h>
#include "tri_bulle.h"
/**
* @brief Faire le tri d'un tableau donné en paramètre par... |
C | /*
* (C) 2015 Key Zhang
* @buildin.c
* @Feature: To run buildin commands like : cd pwd clr ...
*/
#include "buildin.h"
#include <stdio.h>
#include <string.h>
#include <dirent.h>
#include <errno.h>
#include <time.h>
/*Help string*/
char *Help[]={
"help:"
};
/*get file stat*/
int stat(const char *path, struct st... |
C | #include "ft_init_terminal.h"
int ft_init_terminal(struct termios *orig_termios, struct termios *new_termios)
{
char *term_name;
int ret;
if ((term_name = getenv("TERM")) == NULL)
return (-1);
ret = tgetent(NULL, term_name);
if (ret == -1)
{
printf("Could not access to the termca... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct PilhaNo cabeca;
typedef struct Pilha little;
struct PilhaNo {
little * primeiro;
};
struct Pilha {
int numero;
little * priximaLista;
};
cabeca* inicializarLista(void){
cabeca * novoNo = (cabeca*) malloc(sizeof(cabeca));
novoNo -> primeiro... |
C | #include<stdio.h>
#include<stdlib.h>
#include <sys/time.h>
double rtclock()
{
struct timezone Tzp;
struct timeval Tp;
int stat;
stat = gettimeofday (&Tp, &Tzp);
if (stat != 0) printf("Error return from gettimeofday: %d",stat);
return(Tp.tv_sec + Tp.tv_usec*1.0e-6);
}
#define size 10000
#define NT 8
int A[size][size];
i... |
C |
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv) {
char* text = NULL;
size_t size = 0;
ssize_t len = getline(&text, &size, stdin);
if (len > 0) {
if (text[len - 1] == '\n') {
text[len - 1] = '\0';
len = len - 1;
}
char lastLetter ... |
C | #include <stdio.h>
#include <dirent.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "autil.h"
#include "util.h"
//char cryptokey[]=DEFAULTTABLE;
char cryptokey[]="aBcDeFgHiJkLmNoPqRsTuVwXyZ";
void CryptoKey(char* usrkey)
{
int cryptokeylen = strlen(cryptokey);
int ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* replace_alias.c :+: :+: :+: ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* env.c :+: :+: :+: ... |
C | #include <stdio.h>
int main(int arg, char *argv[]){
int n;
const int m=100;
n=5;
printf("%d\n",n);
n=10;
printf("%d\n",n);
printf("%d\n",m);
n=n+5;
printf("n=10 %d\n",n);
n=n-10;
printf("%d\n",n);
n=n*3;
printf("%d\n",n);
n=n/2;
printf("%d\n",n);
n=n%2;
printf("%d\n",n);
return 0;
}
|
C | /* Example - To copy a structure to another structure */
# include <stdio.h>
# include <string.h>
struct date
{
char month[6];
int day,year;
};
void main(void)
{
struct date tomorrow={"March",1,2011},yesterday, today;
/* copying element by element basis */
strcpy(today.month,tomorrow.month);
today.day=tomorro... |
C | /* Given a binary tree, compute its "maxDepth" -- the number of nodes along the longest path from the root node down
* to the farthest leaf node
*
* 4
* / \
* 2 5
* / \ / \
* 1 3 4 7
* / \
* 6 8
* \
* 9
*/
#include<stdio.h>
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* loop_hook.c :+: :+: :+: ... |
C | #include <stdio.h>
#include<math.h>
int main(void) {
int i,t;
scanf("%d",&t);
for(i=0;i<t;i++)
{
int a,b,c,d,e,f,g;
scanf("%d %d %d %d",&a,&b,&c,&d);
e=(a+c-b)/2; //apples
f=(a+b-c)/2; //mangoes
g=(b+c-a)/2;
printf("\n%d %d %d",e,f,g);
}
/... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "IntList.h"
IntList createIntList() {
IntList list;
/*
list.size = 0;
*/
return list;
}
void initialiseIntList(IntList * intList) {
memset(intList, 0, sizeof(IntList));
/*
intList->size = 0;
*/
}
int fillIntList(IntList * intList) {
int i;... |
C | #include <sys/time.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <stdio.h>
int ft_strlen(char *s)
{
int i;
i = 0;
while (s[i] != '\0')
++i;
return (i);
}
void ft_putchar(char c)
{
write(1, &c, 1);
}
int ft_error(char *str)
{
write(2, str, ft_strlen(str));
return (0);
}
void ft_p... |
C | //EXERCICIO 4 DA AULA 3
#include <stdio.h>
int main () {
float deposito , depMaisRend;
printf("Por favor, digite o valor depositado no mes na poupanca:\n");
printf("Deposito = ");
scanf("%f" , &deposito);
depMaisRend = deposito + ( ( deposito * 0.7 ) / 100 );
printf("\nApos um mes de rendimentos tera %f... |
C | /*
* ===========
* Filename: buildin_command.c
* Author: Yuanhang Shao
* ===========
*/
#include "myshell.h"
int buildin_command(char *command, char **parameters)
{
extern struct passwd *pwd;
if(strcmp(command, "exit") == 0)
{
printf("\n");
exit(0);
}
else if(strcmp(command, "help") == 0)
{
printf("T... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <memory.h>
char *trim( char *) ;
void main()
{
char line[50] ;
char *ip ;
char *cp = line ;
char *tmp = "bifurcate_ip = 172.30.10.27 " ;
strcpy( cp, tmp ) ;
printf("%s\n", cp ) ;
cp = strchr(cp, '=');
printf("strchr. %s... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include "queueandlist.h"
void init(list *l){
l->head = (node *)malloc(sizeof(node));
l->tail = (node *)malloc(sizeof(node));
l->head = NULL;
l->tail = NULL;
l->len = 0;
}
void insert(list *l, int pos, int x){
node *tmp, *p;
int i;
/* handle errors on position */
if(po... |
C | /*****************************************************************/
/* Class: Computer Programming, Fall 2019 */
/* Author: ù�аa (put your name here) */
/* ID: 108820001 (your student ID here) */
/* Date: 2019.10.15 (put program development started... |
C | #include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#define MAX 10
/* =======================================
* FACULDADE DE CINCIAS SOCIAIS APLICADAS
* ATIVIDADE DE AED - PLANO CARTESIANO
* ALUNO: EULER MAGNO DE OSMAR JNIOR
* MATRCULA: 14321 DATA: 24/06/2019
* ===============================... |
C | /*
* This program prints array which represents a BST in sorted order
*
* Output
* ------
*
* 1 2 3 4 5
*
*
* Author: @pyav
*/
#include <stdio.h>
#define SUCCESS 0
/* Print in sorted order */
void print_sorted(int arr[], int low, int high)
{
if (low > high)
return;
print_sorted(arr, (low * 2) + ... |
C |
#include <libdevice/keymap.h>
KeyMapping *keymap_lookup(KeyMap *keymap, Key key)
{
for (int i = 0; i < keymap->mappings_count; i++)
{
if (keymap->mappings[i].key == key)
{
return &keymap->mappings[i];
}
}
return NULL;
}
|
C | #ifndef Sega2PS2_h
#define Sega2PS2_h
#include <SegaController.h>
typedef struct {
word button;
String mnemonic;
bool isExtendedKey;
byte ps2ScanCode;
byte ps2SpecialScanCode;
} button;
// For a list of PS/2 scan codes, see: <https://web.archive.org/web/20180202062621/http://www.computer-engineering.org/ps... |
C | #include <stdio.h>
int main()
{
int input;
printf("Masukkan umur\t: ");
scanf("%d",&input);
printf("Tahun Lahir\t: ");
printf("%d\n",2020-input);
return 0;
}
|
C | #include<stdio.h>
#include<math.h>
int isprime(long long int n)
{
int i;
for(i=3;i*i<=n;i+=2)
if(n%i==0)
return 0;
return 1;
}
int main()
{
int i,cnt=0;
long long int n;
for(i=2;1;i++)
{
n=pow(2,i)-1;
if(isprime(n))
{
printf("%d\n",... |
C | /*!
* \author: Alan Ernesto González Barrios
* \date 2019-03-20
* \mainpage Practica 3
* \section Programa 1
* Seccion de la modificacion numero 1 de la practica 3
* \warning declaration on getpid
* \section Programa 2
* Seccion de la modificacion numero 2 de la practica 3
* \warning declaration on getpi... |
C | #include <unistd.h>
/**
* _putchar - print char with stdout
* @ch: char to print
* Return: Output.
*/
int _putchar(char ch)
{
static int contador;
static char buffer[1024];
if (ch == -1)
{
contador = 0;
return (0);
}
if (ch == -2 || contador == 1024)
{
write(1, buffer, contador);
contador = 0;
}
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include <sys/wait.h>
int main (int argc, char **argv)
{
if(!fork()) { // child B, forked by A
printf("Child B id: [%d] and its Parent A id: [%d] \n", getpid(),getppid());
if(!fork()){ // child E, forked by... |
C | #include "SurveySim.h"
/*
*太阳帆板可旋转,计算一定旋转角度范围内,帆板法线的范围
*/
void get_solar_normal_30(double px, double py, double pz, double nx, double ny, double nz,double* n30, double* n30_) {
double angle=PANEL_TRANSE_ANGLE/57.29577951;
double a = cos(angle);
double b = sin(angle);
double p = sqrt(px*px+py*py+pz*pz)... |
C | #include<stdio.h>
#include<conio.h>
int main()
{
char str[40];
printf("enter the number");
intrlen;
len=lenstr[str];
if(len%2!=0)
{
str=[(len-1)/2]='*';
}
else
{
str=[len/2]='*';
str=[(len/2)-1]='*';
}
printf("%s",str);
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <pthread.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/un.h>
#include <arpa/inet.h>
#define TRUE 1
#define SocPath "File"
void * Recieve_data(void * sockI... |
C | #ifndef F2_POLY_H
#define F2_POLY_H
#include <stdio.h>
#include <inttypes.h>
#include "arithm.h"
typedef uint64_t f2_poly_t;
typedef uint8_t f2_deg_t;
// l'ordre des coefficients polynômiaux est du poids fort au poids faible.
#define F2_VARN 'X'
#define LEN (sizeof(f2_poly_t) << 3)
// Pour pouvoir tirer un polynôme a... |
C | // Created by Fouad Aoude
// Copyright Fouad Aoude 2020
#include <stdio.h>
#include <conio.h>
//#include <curses.h>
#include <string.h>
#include <stdlib.h>
int displayMenu(int);
void login(char *, char *, int*, FILE *);
int userInterface(int *, char *, char *, FILE *);
void createAccount(char *, char *, int *, FILE ... |
C | #include "lists.h"
<<<<<<< HEAD
/**
* add_dnodeint_end - adds a new node at the end of a list.
=======
/**
* add_dnodeint_end - adds a new node at the end of a listint_t list.
>>>>>>> 74d1789039337fcdfc2badf178e8c103c26091cd
* @head: dlistint_t
* @n: int
* Return: number of nodes.
*/
dlistint_t *add_dnodeint_end... |
C | #include "holberton.h"
#include <stdlib.h>
/**
* create_array - Print the char array
* @size: Store the size
* @c: Store char
*Return: Ptr char
*/
char *create_array(unsigned int size, char c)
{
char *t;
unsigned int i;
if (size == 0)
{
return (NULL);
}
t = malloc(sizeof(char) * size);
if (t == NULL)... |
C | //a structure can contain other structures.
#include <stdio.h>
struct coord {
int x, y;
};
struct rectangle {
struct coord topleft, bottomrt;
int base, height, area;
} box1;
int main( void ) {
//user input this:
printf("top left x: ");
scanf("%d", &box1.topleft.x);
printf("top left y: ");
scanf("%d", &box1.to... |
C | #include <stdio.h>
long long fib_helper(long long n, long long *values, int nvalues)
{
if (values[n] != -1) {
return values[n];
}
else {
long long y1 = fib_helper(n-1, values, nvalues);
long long y2 = fib_helper(n-2, values, nvalues);
values[n] = y1 + y2;
return valu... |
C | #include <stdlib.h>
#include "test_buffer.h"
rt_buffer_t *buffer_init() {
rt_buffer_t *buffer = calloc(1, sizeof(rt_buffer_t));
buffer->size = 1024;
buffer->bytes = malloc(buffer->size);
return buffer;
}
void buffer_reset(rt_buffer_t *buffer) {
buffer->used = 0;
}
void buffer_grow(rt_buffer_t *... |
C | /*
** EPITECH PROJECT, 2019
** lemin
** File description:
** error handling
*/
#include "../../include/my.h"
int not_good_input(char *s)
{
int i = 0;
char **buf;
int nbr_ants = 0;
int rooms = 0;
int connections = 0;
if (!s)
return (1);
buf = my_str_to_wordtab(s, '\n');
for (; b... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<errno.h>
#include<sys/sem.h>
#include<sys/ipc.h>
#include<sys/types.h>
#include<sys/shm.h>
#define shmsize 10 //shared memory size(to store varible readcount in this case)
#define shmkey 222 //key used for shared memory creation
char*... |
C | #include<stdio.h>
int main(void) {
int Number, Counter = 0;
printf("How many natural numbers do you want to print?");
scanf("%d", &Number);
printf("The first %d natural numbers are", Number);
for(Counter = 1; Counter <= Number; Counter++) {
printf(" %d", Counter);
}
printf(".");
return 0;
} |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* raycast.c :+: :+: :+: ... |
C | #include <stdio.h>
// version 1
// arguments: counter, valuables[]
// int main(int argc, char *argv[])
// {
// int i;
// for (i = 1; i < argc; i++) {
// printf("%s%s", argv[i], (i == argc) ? "" : " ");
// }
// printf("\n");
// return 0;
// }
// version 2
int mai... |
C | /*
* File: squareTensorField.c
*
* MATLAB Coder version : 3.1
* C/C++ source code generated on : 12-May-2016 09:08:19
*/
/* Include Files */
#include "rt_nonfinite.h"
#include "squareTensorField.h"
/* Function Definitions */
/*
* SQUAREDTI Input is an MxNx3x3 (4D) or MxNxPx3x3 (5D) te... |
C | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<limits.h>
#define scan1(a) scanf("%d",&a)
#define scan2(b,c) scanf("%d %d", &b, &c)
#define scan3(d,e,f) scanf("%d %d %d", &d, &e, &f)
#define pn() printf("\n");
#define print1(a) printf("%d\n", a)
#define print2(a,b) printf("%d %d\n", a, b)
#define print... |
C | #include <stdio.h>
int gcd(int u, int v) {
int temp;
while (v != 0) {
temp = u % v;
u = v;
v = temp;
}
return u;
}
int lcm(int u, int v) {
int gcd(int u, int v);
return u * v / gcd(u, v);
}
int main(void) {
int lcm(int u, int v);
printf("10 和 15 的最小公倍数:%i\n... |
C | #include<stdio.h>
#include<pthread.h>
pthread_mutex_t mutex;
pthread_cond_t cond;
void * thread1(void * arg) {
pthread_cleanup_push(pthread_mutex_unlock,&mutex);
while(1) {
printf("thread1 running\n");
pthread_mutex_lock(&mutex);
pthread_cond_wait(&cond,&mutex);
printf("thread1 applied the conditio... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* reso.c :+: :+: :+: ... |
C | //
// main.c
// CSC362-Programming-Assignment4
//
// Created by Andrew Smiley on 3/22/16.
// Copyright © 2016 Andrew Smiley. All rights reserved.
//
#include <stdio.h>
int main(int argc, const char * argv[]) {
int input, sumOfFactors, closeness,currentFactor;
sumOfFactors = 0;closeness=0;input=2;currentFa... |
C | /*
write by buffer
*/
#include <stdio.h>
#include <stdlib.h>
int main(void) {
FILE *rfp, *wfp;
char buf[BUFSIZ];
int n;
if((rfp = fopen("190120.txt", "r")) == NULL) {
perror("fopen : .txt");
exit(1);
} // fopen for read
if((wfp = fopen("190120.out", "w")) == NULL) {
perror("fopen : .out");
exit(... |
C |
#include "fonctions.h"
/*chaque fonction correspond a un type d'objet. La fonction est appel chaque fois qu'une ligne representant ce type d'objet est rencontr, et elle cr le struct correspondant et l'enregistre dans tabGroupes ou (*tabObjets)*/
/***********************************************************************... |
C | #include <stdlib.h>
#define NAME "xjs" //mod.h define NAME would not work
#include "mod.h"
#undef NAME
#define NAME "xjs" //it would be warned redefined without undef
int testStack(int);
int main()
{
struct names myName = {
.firstname="xu",
.lastname="jiashu"
};
printf("%s %s\n", myName.firs... |
C | #include <stdio.h>
int main(void)
{
char str[1000], *st;
int f;
scanf("%s", str);
st = str;
f = 0;
while(1)
{
if(st[0] == 0){
printf("\n");
break;
} else if(st[0] == 'w' && st[1] == 'u' && st[2] == 'b')
{
st = st+3;
continue;
} else {
if(f == 1) printf(" ");
while... |
C | #include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
int main()
{
int fd;
fd = open("guo1", O_WRONLY | O_CREAT | O_TRUNC, 0666);
#if 0
close(1);
dup(fd);
#endif
dup2(fd, 1);
printf("guohaomeng\n");
close(fd);
return 0;
}
|
C | #define BIT_SET(a,b) ((a) |= (1<<b))
#define BIT_CLEAR(a,b) ((a) &= ~(1<<b))
#define BIT_FLIP(a,b) ((a) ^= (1<<b))
#define BIT_CHECK(a,b) (!!((a) & (1<<b)))
#include <stdio.h>
#include <stdlib.h>
int main()
{
int number,position;
printf("Enter a number :");
scanf("%d",&number);
printf("\nposition ");
scanf("%d",&... |
C | #include "binaryheap.h"
//judge whether the BinaryHeap is full or not , also 1 or 0
int isFull(BinaryHeap bh)
{
return bh->size == bh->capacity - 1 ? 1 : 0 ;
}
//judge whether the BinaryHeap is empty or not , also 1 or 0
int isEmpty(BinaryHeap bh)
{
return bh->size == 0 ? 1 : 0 ;
}
void swap(Elemen... |
C | #include<stdio.h>
void heapSort(int n,int A[])
{
int k;
for(int i=n-1;i>0;i--)
{
for(int j=k=i;j>=0;j--)
{
if(A[k]<A[j])
k=j;
} void swapi(int &a,int &b)
{
int temp;
temp=a;
a=b;
b=temp;
}
swapi(A[k],A[i]);
}
}
int main()
{
int A[5]={4,3,2,8,1};
heapSort(5,A);
for(int o=... |
C | #include "basic_operators.h"
uint8_t multiply_by_X_classic(uint8_t a)
{
return (a << 1) ^ ((a >> 7) * GF_2_8_module);
}
__m256i multiply_by_X_vector(__m256i a)
{
// _mm256_cmpgt_epi8 - Compare packed 8-bit integers in a and b for greater-than
__m256i mask = _mm256_cmpgt_epi8(_mm256_setzero_si256(), a);
... |
C | #include<stdio.h>
#include<conio.h>
int main()
{
int a,b,i,d,c=0;
scanf("%d %d",&a,&b);
for(i=a+1;i<b;i++)
{
for(d=1;d<=i;d++)
{
if(i%d==0)
{
c++;
}
}
if(c==2)
{
printf("%d",i);
}
}
return 0;
}
|
C | /*1. Develop a C program to perform operations (+,*,-, / and %) on two whole numbers. Identify
suitable data types to represent the numbers and resultant values*/
#include<stdio.h>
int main()
{
int a,b,modu;
float quotient;
int sum,diff,product;
printf("Enter any two numbers\n");
scanf("%d%d",&a,&b);
sum = a + b... |
C | /**
* C Program to accept the array in server, find an element in client and display result in server
* 2 way communication using 2 pipes
* @author Shivaprasad Bhat
* @date 17-12-2020
*/
#include "../Headers/headers.h"
#define READ 0
#define WRITE 1
int main()
{
int _pipe1[2], _pipe2[2], _read, _write;
i... |
C | //
// Created by vladworldss on 03.08.18.
//
#include <stdio.h>
#include <string.h>
#include "Item.h"
#include "Stack.h"
int main(int argc, char** argv){
printf("ex4_2 starting...\n");
char* a = argv[1];
int N = strlen(a);
stack_init(N);
for(int i=0; i<N; i++){
if (a[i] == PLUS){
... |
C | #include<stdio.h>
#include<stdlib.h>
/* para gerar casos de teste */
void gera(int max)
{
int i, k;
srandom(234556); /* para o que server :) */
for(i=0;i<max;i++) {
k=random()%3;
if (k==0) printf("a\n");
if (k==1) printf("c\n");
if (k==2) printf("t\n");
}
printf("#\n");
exit(0);
}
#... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: ... |
C | //=============================================================================
//
// NAbZ[W [clear.h]
// Author : shotaro kanamaru
//
//=============================================================================
#ifndef _CLEAR_H_
#define _CLEAR_H_
#include "main.h"
//***********************************************... |
C | #include <stdio.h>
#include <highgui.h>
#include <cv.h>
#define WIDTH 640
#define HEIGHT 480
int main(int argc, char **argv)
{
int key=0, hist_size = 256, hist_height = 100;
float r=0, range[]={3,128};
float* ranges[]={range};
double area=0;
CvScalar s;
CvCapture *capture = NULL;
IplImage *frameImage;
... |
C | #include <stdio.h>
#include <stdlib.h>
void print(char**, int);
void printint(int**, int,int);
void step(int**, int, int);
void find_path(int**, int, int, int, int, int, int);
int main(int argv, char* argc[]) {
if (argv == 1) {
printf("input the maze file! ./maze <mazefile>\n");
return 1;
}
... |
C | #include <stdio.h>
int main(void) {
int num, start;
while (1) {
fputs("Ȧ (1), ¦ (2) : ", stdout);
scanf("%d", &num);
if (num != 1 && num != 2) {
puts("߸ ԷԴϴ. 1 Ǵ 2 Էϼ.");
}
else
break;
}
/* if (num == 1) {
for (int i = 3; i <= 9; i += 2) {
for (int j = 1; j <= 9; j++) {
printf("%d X %d = %... |
C | #include <stdio.h>
#include <unistd.h>
main()
{
char *tmp;
char command[1024];
unsigned int size;
void *res;
int i = 0;
sprintf(command, "mv top1.log /tmp/tmp1.log");
fprintf(stderr,"\"%s\" is ready", command);
system(command);
fprintf(stderr,"\"%s\" is complete", command);
exit(0);
}
|
C | /**********************************************************
*file name :parser.h
*describe : do parser transcode works
*copyright :written by dempkwok
*time : 2013.6.10
**********************************************************
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "... |
C | //
// Created by trov on 10.09.2019.
//
#include "../scanner.h"
int main() {
FILE *fp;
fp = fopen("C:/Users/trov/CLionProjects/C-Lexical-Analyzer/tests/value.txt", "r"); // read mode
if (fp == NULL) {
perror("Error while opening the file.\n");
exit(EXIT_FAILURE);
}
int i =0;
... |
C | // Justin Ventura & Blaine Mason
// COSC420 Lab 3: matrix.h
#ifndef MATRIX_H
#define MATRIX_H
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<mpi.h>
// NB: the A here needs to be a struct, not a pointer!
#define INDEX(A,i,j) A->cols*i + j
// now can do A.data[INDEX(A,i,j)]
// use the... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_itoa.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <string.h>
#include "ASA.h"
#include "AnalisadorLexico.h"
#include "AnalisadorSintatico.h"
#include "GerenciadorErro.h"
#include "Visitante.h"
#include "AnalisadorSemantico.h"
#include "VisitanteRI.h"
#include "CanonizadorRI.h"
#include "Gerador.h"
/** \brief Destri objetos alocados durante... |
C | /*
** EPITECH PROJECT, 2018
** handle_size.c
** File description:
** handle size
*/
#include "malloc.h"
#include "show_alloc_mem.h"
size_t get_block_size(void)
{
return (compute_pagesize(sizeof(data_info_t)));
}
size_t compute_pagesize(size_t size)
{
size_t new_size = size;
size_t page_size = getpagesize... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <stdint.h>
/*
,
. ,
.
*/
typedef enum
{
Tarif_1,
Tarif_2,
Tarif_3,
Tarif_4
}TarifPhone;
typedef struct
{
char NameAbonent[50];
char PhoneNumber[10];
char TimeSpeek[50];
TarifPhone Tf;
}SpeekPhoned... |
C | #include "core/game.h"
#include "core/draw.h"
#include "core/event.h"
/*
* Let's please use documentation
* above the function rather than
* inside it
*/
void update(struct game *g, Uint32 delta);
/*
* The entry point
*/
int main(void)
{
struct game g;
game_init(&g);
game_set_render_func(&g, render);
game_... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* large.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
int main(){
char nome[50], sexo;
int idade;
idade = 0;
printf("Digite seu Nome, sexo e idade:\n");
gets(nome);
scanf(" %c",&sexo);
scanf("%d", &idade);
if(sexo=='F' || sexo=='f' && idade < 25){
printf("%sACEITA\n",nome);
}
else{
printf("NAO ACEITA\n", nome);
}
retu... |
C | #include<stdlib.h>
#include<stdio.h>
#include<string.h>
#include "Productions.h"
#include "../Analyizer/AnalyzerCaller.h"
#include "../DataType/LinkedList.h"
#include "../Analyizer/Print_Tokens/PrintHandler.h"
char expected[];
void statement_tail(){
if(match(7, 6) == 0){ // else
analyzerCaller(return... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* do_sufix_prefix.c :+: :+: :+: ... |
C | #include "raylib.h"
#include <stdio.h>
#include <unistd.h>
static const int screenw = 380;
static const int screenh = 320;
void main() {
int delay = 10000;
InitWindow(screenw, screenh, "image manipulation");
// void DrawText(const char *text, int posX, int posY, int fontSize, Color color);
SetTargetFPS(60);
ClearB... |
C | //THURSDAY
/* Larisa Andrews, Section T, 12/10/15 */
#include <stdio.h>
#include <string.h>
#include <ctype.h>
/*
Pre: The original plaintext phrase with spaces is passed in.
The function searches for a space. When found,
the spece is removed by shifting all remaining elements
in the array one space to the left. ... |
C | #include <stdio.h>
#include <limits.h>
#include "min_list.h"
int iter_minimum(struct node* head);
int recursive_minimum(struct node* head);
int main(int argc, char *argv[]) {
struct node *head = args_to_list(argc, argv);
printf("Minimum is %d\n", iter_minimum(head));
printf("Minimum is %d\n", recursive_... |
C | /* string25.c */
#include<stdio.h>
#include<stdlib.h>
int main()
{
char str[30];
printf("qing shuru nin xiangyao de shouji mingcheng: ");
scanf("%s", str);
printf("wo xiang mai yitai %s de shouji\n", str);
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "graph.h"
void AddNode(Graph* graph, char* val);
void AddGridNode(Graph* graph, char* val, Vec2 position);
void AddUndirectedEdge(Graph* graph, Node* first, Node* second);
void RemoveUndirectedEdge(Graph* graph, Node* first, Node* se... |
C | #include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#define INFINITY INT_MAX
typedef enum {WHITE, GRAY, BLACK} COLOR;
typedef enum {LIST, MATRIX} graphType;
typedef struct graphNode{
int node;
int pred;
void* info;
COLOR color;
//list adj;
}graphNode;
typedef struct graphMatrix{
int*... |
C | #include"../../include/logger.h"
#include<stdio.h>
int main(void)
{
logger *log;
char* filename="demo.log";
log_level level=DEBUG;
setup_logger(&log,filename,level);
if(log!=NULL)
{
printf("logger:info\nfilename: %s level: %d\n",log->filename,log->level);
fclose(log->fp);
remove(log->filename);
return 0;... |
C | #include <unistd.h>
#include <stdio.h>
#include "smalloc.h"
sm_container_ptr sm_first = 0x0 ;
sm_container_ptr sm_last = 0x0 ;
sm_container_ptr sm_unused_containers = 0x0 ;
// Task 2-1
void sm_container_split(sm_container_ptr hole, size_t size)
{
sm_container_ptr itr = 0x0 ;
sm_container_ptr remainder = hole->data... |
C | #pragma once
///Analog channels (on the 4051)
/*#define aCharged_N 6
#define aCharged_P 2 //also Pwr
#define aCharging_N 3
#define aCharging_P 1
#define aUnderV 0
#define aUnused 4*/
enum aChannels {aCharged_PalsoPwr=6, aCharged_N=2, aCharging_N=3, aCharging_P=1, aUnderV=0, aUnused=4};
/* get here to send voltage... |
C | // RUN: %clang_dfsan -fno-sanitize=dataflow -O2 -fPIE -DCALLBACKS -c %s -o %t-callbacks.o
// RUN: %clang_dfsan -O2 -mllvm -dfsan-event-callbacks %s %t-callbacks.o -o %t
// RUN: %run %t FooBarBaz 2>&1 | FileCheck %s
// Tests that callbacks are inserted for store events when
// -dfsan-event-callbacks is specified.
#inc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.