language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /*
Parallel computing: OpenMP method
based in the serial programme bitonic.c
Project 1,HMMY Nov 2017
Despina-Ekaterini Argiropoulos 8491
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <omp.h> //include for openMP
struct timeval startwtime, endwtime;
double seq_time... |
C | #ifndef MATHPARSER_MAIN_H
#define MATHPARSER_MAIN_H
/*
* MACROS
*/
#define RPN_STACK_SIZE 64 /* implicit stack size for RPN evaluation */
#define SY_OP_STACK_SIZE 32 /* implicit stack size for Shunting-Yard evaluation */
#ifndef M_PI /* i.e. MSVS case */
#define M_PI 3.14159265 /* math... |
C | /**************
Author: Kimberly Tom
Project 2: File Transfer System
Description: Server side code written in C. This program can send a list of files in a server's directory to a client or send a file to a client.
This program uses TCP connection to transfer data.
CS372 Intro To Computer Networks
Last Modified:... |
C | #include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
int wlock (int fd, off_t start, off_t len,
int wait) {
struct flock lock;
lock.l_type = F_WRLCK;
lock.l_whence = SEEK_SET;
lock.l_start = start;
lock.l_len = len;
lock.l_pid = -1;
return fcntl (fd, wait ? F_SETLKW ... |
C | /*
** Made by Jérémy Cochoy
*/
#ifdef __sun__
# include <stropts.h>
# include <fcntl.h>
#else /* !__sun__ */
# include <sys/fcntl.h>
#endif /* !__sun__ */
#include <unistd.h>
#include <stdlib.h>
#include <term.h>
#include <termios.h>
#ifndef TIOCGETA
# define TIOCGETA TCGETS
#endif /* !TIOCGETA */
#ifndef TIOCSETA
#... |
C |
#include <stdio.h>
#include <math.h>
#include "metrics.h"
#include "utils.h"
static float LIGHTSPEED = 1;
Vector v(float x, float y) {
return (Vector) { x = x, y = y };
}
Vector integrate(int delta_time, Vector diff, Vector base) {
return v(
delta_time * diff.x + base.x,
delta_time * diff.y... |
C | #include <stdio.h>
#include <string.h>
int main()
{
FILE *fp;
char ivir[25];
int index;
fp=fopen("onsatir.txt","w");
strcpy(ivir,"Bu bir örnek satirdir.");
for(index=1;index<=10;index++)
fprintf(fp,"%s Satir no: %d\n",ivir,index);
fclose(fp);
}
|
C | #include <signal.h>
#include <stdlib.h>
#include <stdio.h>
int main() {
printf("sigkill: %d\n", kill(1, SIGKILL));
printf("sigint: %d\n", kill(1, SIGINT));
return 0;
}
|
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 | #include <stdio.h>
#include <math.h>
#include <fenv.h>
void calc(int arr, char *mode, float val[10]){
fesetround(arr);
float somme=0.0;
for(int i=0;i<10;i++)
somme+=fabs(val[i]);
printf("somme=%20.18e pour %s\n",somme,mode);
}
int main (void){
float val[10];
printf("Entrez 10 valeurs positives\n");
for(... |
C | #include <stdio.h>
//a more succinct version: copy input to output (version 2)
int main(){
int c;
while((c = getchar()) != EOF)
putchar(c);
}
/*
The while gets a character, assigns it to c, and then tests whether the character
was the end-of-file signal. If it was not, the body of the while is execu... |
C | /* main.c - Foundation math test - Public Domain - 2013 Mattias Jansson / Rampant Pixels
*
* This library provides a cross-platform foundation library in C11 providing basic support data types and
* functions to write applications and games in a platform-independent fashion. The latest source code is
* alway... |
C | /*Instruções:
1. E/S: tanto a entrada quanto a saı́da de dados devem ser “secas”, ou seja,
não devem apresentar frases explicativas. Siga o modelo fornecido e apenas
complete as partes informadas (veja o exemplo abaixo).
2. Identificadores de variáveis: escolha nomes apropriados.
3. Documentação: inclua cabeçalho, come... |
C | #ifndef GESTIONLISTESIMPLE_H_INCLUDED
#define GESTIONLISTESIMPLE_H_INCLUDED
#include "GestionTableau.h"
/**
* \struct TLS_Produit
* \brief Type caractrisant un produit dans la gestion par liste simplement chain
*
*TLS_Produit est un type pour la gestion des produits
*/
struct TLS_Produit
{
char Nom[50];
... |
C | #include <stdio.h>
#include <stdlib.h>
void drawTriangle()
{
/* Printing a triangle shape. */
printf(" /|\n");
printf(" / |\n");
printf(" / |\n");
printf("/___|\n\n");
}
|
C | #include <stdio.h>
// (*) include lexical analyser header
#include "utf16/UTF16Lex.h"
int
main(int argc, char** argv)
{
bool BigEndianF = (argc < 2 || (strcmp(argv[1], "BE") == 0));
const char* file_name = BigEndianF ? "example-utf16be.txt" : "example-utf16le.txt";
... |
C | #include<stdio.h>
int main()
{
int m,r,n,count=0,sum=0;
printf("\n enter the interger \n");
scanf("%d",&n);
m=n;
while(m!=0)
{
count=count+1;
r=m%10;
printf("%d",r);
sum=sum+r;
m=m/10;
}
printf("number of digits in:%d is %d \n",n,count);
... |
C | /*
* CS214 Assignment 4
*
* Jonathan Lee (jl1424)
* Niharika Nagar (nn164)
*
*/
#include "search.h"
#include "utils.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
int isFile(char *fileName){
struct stat s;
if(stat(fileName, &s) == 0){
if(s.st... |
C | #include "holberton.h"
/**
* print_last_digit - print the last digit of a number
*
* @a: int is a
*
* Return: a
*/
int print_last_digit(int a)
{
int b = a % 10;
int c;
if (b > 0)
{
c = b;
}
else if (b < 0)
{
c = b - b * 2;
}
else
{
c = 0;
}
_putchar(c + '0');
return (c);
}
|
C | #pragma once
struct sPosition
{
/* data */
int _x;
int _y;
};
sPosition addPosition(sPosition a, sPosition b);
void setPosition(sPosition to, sPosition from);
bool samePostion(sPosition a, sPosition b);
enum eDirection
{
eNorth,
eNorthEast,
eSouthEast,
eSouth,
eSouthWest,
eNo... |
C | /*
nxMyDB - MySQL Database for ioFTPD
Copyright (c) 2006-2009 neoxed
Module Name:
Debugging
Author:
neoxed (neoxed@gmail.com) Aug 3, 2009
Abstract:
Debugging utility functions.
*/
#include <base.h>
#include <debug.h>
#ifdef DEBUG
/*++
IsCriticalSectionOwned
Determines if the critical section i... |
C | #include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<string.h>
#define RANGE 100
int* arrGen(int size);
static int binarySearchHelp(int *arr,int low,int high,int key);
int binarySearch(int *arr,int len,int key);
void printArray(int *arr,int len);
int main(int argc, char **argv){
if(argc<2){
p... |
C | #include<stdio.h>
int main()
{
double A,B,C,n=3.14159,v,w,x,y,z;
scanf("%lf%lf%lf",&A,&B,&C);
v = 0.5*A*C;
w = n*C*C;
x = 0.5*(A+B)*C;
y = B*B;
z = A*B;
printf("TRIANGULO: %0.3lf\n",v);
printf("CIRCULO: %0.3lf\n",w);
printf("TRAPEZIO: %0.3lf\n",x);
printf("QUADRADO: %0.3lf\n"... |
C | #include<stdio.h>
void sorting(int* a) {
for (int i = 0; i < 10; i++) {
for (int j = i; j < 10; j++) {
if (a[i] < a[j]) {
int tmp = a[i];
a[i] = a[j];
a[j] = tmp;
}
}
}
}
int main()
{
long long n;
int a[10];
scanf("%lld", &n);
for (int j = 0; j < 10; j++) a[j] = -1;
int i = 0;
while (1) ... |
C | /*
Autore: Shekhawat Karni Singh
Data: 13/11/2019
ES_01 :
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
struct El{
char* valore;
struct El* next;
}El;
bool controlloStringa(char cifra[]);
struct El* pop(struct El** head);
void push(struct El** head, stru... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strjoin.c :+: :+: :+: ... |
C |
#include<stdio.h>
#include<math.h>
int main(){
int n=1;
double s=0;
double x=0.0000000001;
while (x<100000000000000)
{s+=(((exp((2*M_PI*x))-1)/(exp((2*M_PI*x))+1))*(1/x - x/(pow(n,2)+pow(x,2))))*x;
x=x+0.00000001;
}
printf("%lf",s);
return 0;
}
|
C | /*
* socker.c
* Create a file "socketfile" in the current directory of type socket.
*/
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <string.h>
main()
{
int s = socket(PF_UNIX,SOCK_STREAM,0);
struct sockaddr_un name;
name.sun_family = AF_UNIX;
strcpy(name.sun_path,"socketf... |
C | #include <stdio.h>
int main()
{
int arr[] = {100,22,12,1,23,4,7,8,3,5};
int size = sizeof(arr)/sizeof(int);
for (int i = 1; i <= size-1; i++)
{
for(int m = 0; m < size-i;++m)
{
int temp = 0;
if (arr[m] > arr[m+1])
{
temp = arr[m];
arr[m] = arr[m+1];
arr[m+1] = temp;
}
}
}
for (int i ... |
C | #include <inttypes.h>
#ifndef __CLIST_H__
#define __CLIST_H__
/**
* Opaque structure representing a circular list.
*/
typedef struct _CList CList;
/**
* CList initializer value (empty list)
*/
#define CLIST_INITIALIZER ((CList *)NULL)
/**
* Shallow destruction of a circular list
*/
void clist_destroy(CList *... |
C | /*
** EPITECH PROJECT, 2018
** cpp_d02a_2018
** File description:
** tests_list_is_empty.c
*/
#include <criterion/criterion.h>
#include <stdlib.h>
#include "simple_list.h"
Test(list_is_empty, null)
{
cr_assert_eq(TRUE, list_is_empty(NULL));
}
Test(list_is_empty, one)
{
node_t elem1 = {0, NULL};
cr_asser... |
C | #ifndef __TOOLS_H__
#define __TOOLS_H__
#include <stdint.h>
#include <stdbool.h>
/* This file contains some useful things which uses in project */
/* soft_delay - simple software delay */
inline void soft_delay(volatile uint16_t N)
{
volatile uint8_t inner = 0xFF;
while (N--) {
while (inner--);
}
return;
}
/... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* display.c :+: :+: :+: ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* parse_type.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
int buscarChar( char caracter, char vec[], int tam);
int main()
{
char x[5]= { 'a', 'e', 'i', 'o', 'u'};
int esta;
esta = buscarChar('a', x, 5);
if( esta == -1){
printf("No esta\n");
}
else{
printf("El caracter esta en el indice %d\n",... |
C | #include <stdio.h>
/*) 4 ű -> 3 ű
->2 ű -> 1 ű
N-1 پ!!POINT
) ϴ 3 ðܾ*/
void HanoiTowerMove(int num, char from, char by, char to);
int main(void) {
HanoiTowerMove(3, 'A', 'B', 'C');
return 0;
}
void HanoiTowerMove(int num, char from, char by, char to) {
if (num == 1) {
printf("1 %c %c ̵\n", from, to... |
C | #include "unity.h"
#include <rubiks_cube.h>
#define PROJECT_NAME "RubiksCubeSolver"
/*function prototype*/
void _is_i_j_k_valid(void);
void _isIndexValid(void);
void _isPositionValid(void);
void _getSize(void);
void _getPosition(void);
void _getLocation(void);
void _get_index(void);
void _isNodeValid(void);
void _isR... |
C | #include <stdio.h>
int average(int n1, int n2, int n3);
int main()
{
int num1, num2, num3, avg;
printf("enter first number: ");
scanf("%d", &num1);
printf("enter second number: ");
scanf("%d", &num2);
printf("enter the third number: ");
scanf("%d", &num3);
avg=average(num1, nu... |
C | #define XOPEN_SOURCE 700
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <semaphore.h>
#include <signal.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <string.h>
#include <errno.h>
#include <pthread.h>
#define N 5
int sum, flag = 0;
pthread_mute... |
C | #include <stdio.h>
#define MONTHS 12
int main(void) {
int day[MONTHS + 1] = {0, 31, 28, 31,
30, 31, 30, 31,
30, 31, 30, 31};
int input;
printf("今日は何月ですか? >");
scanf("%d", &input);
printf("すると今月は%d日までだから、", day[input]);
if (day[input] == 31) {
// 「株式会社... |
C | #include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{ int x,y,i=0;
int pr[20]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
scanf("%d %d",&x,&y);
for(i=1;;i++)
if(x==pr[i])
break;
if(y==pr[i+1])
printf("YES");
else
printf("NO");
return 0;
}
|
C | /* This is a round robin scheduler for up to THREAD_MAX threads that
* wipes out sched_one and sched_two to make sure that the library
* isn't using those pointers. Since the most likely place for the
* library to do that is tid2thread(), we check each thread's tid
* each time next() is called.
*/
#include "lwp.... |
C | #include <stdio.h>
int b() {
return 6;
}
int a(int i) {
b();
if (i > 5) {
return i + 4;
} else {
return i + 8;
}
}
int main() {
a(8);
for (int i = 0; i < 10; i++) {
a(i);
}
a(24);
return 0;
}
|
C | #include "catch2/catch_test_macros.hpp"
#include "scoped_map.h"
namespace {
SCENARIO("ScopedMap handles binding in scopes", "[ScopedMap]") {
GIVEN("A ScopedMap<int>") {
ScopedMap<int> map;
WHEN("empty") {
THEN("Lookup works, but returns empty optional") {
REQUIRE(!map.Lookup("foo"));
}
... |
C | #include <stdio.h>
#define N 6
int main(void) {
int i, j, key;
int a[] = { 8,2,4,9,3,6 };
for (j = 1; j < N; j++) {
key = a[j];
i = j - 1;
while (i >= 0 && key < a[i]) {
a[i + 1] = a[i];
a[i] = key;
i--;
}
}
for (i = 0; i < N; i++) {
printf("%d", a[i]);
}
getch();
return 0;
} |
C |
#include <stdio.h>
#include <stdlib.h>
#include "listUtil.h"
TList
listaAscendente(TList l)
{
if(l == NULL || l->tail == NULL)
{
return l;
}
if(l->tail->elem <= l->elem)
{
TList aux = l->tail;
l->tail = l->tail->tail;
free(aux);
l = listaAscendente(l);
return l;
}
l->tail = listaAscendente(l->ta... |
C | #include <stdio.h>
/**
* main - Entry point
*
* Return: Always 0 (Success)
*/
int main(void)
{
int a;
int b;
int c;
int j;
a = 1;
b = 2;
j = b;
do {
c = a + b;
a = b;
b = c;
if (c % 2 == 0)
j = j + c;
if (c <= 4000000)
continue;
else
break;
} while (c < 4000000);
printf("%d\n", j);
return (0);
}
|
C | #include <stdio.h>
#define MAXL 1000
#define SHIFTL 30
#define MOSTL 60
int getLine(char oneline[],int maxl);
void getsub(char oneline[],int cl,char subline[]);
extern int strindex(char [],char[]);
int main(void){
int c,d;
char oneline[MAXL];
char subline[]="sub";
while((c=getLine(oneline,MAXL))>0){
if((d=strin... |
C | #include <signal.h>
#include "tlpi_hdr.h"
static void
sigHandler(int sig)
{
// 实际上由于 std buf 是 static 的,在 signal hander 中使用不安全(不可重入)
printf("Ouch!\n");
}
int main(int argc, char *argv[])
{
int j;
void (*oldHandler)(int);
// disposition
oldHandler = signal(SIGINT, sigHandler);
if (oldHandl... |
C | #include<stdio.h>
#include<pthread.h>
#include<unistd.h>
#include<time.h>
pthread_mutex_t e1,e2;
int rcount = 0;
int count,n,writerno=1,readers = 0,Data;
void *reader();
void *writer();
int lwr;
int hir;
int number;
int main()
{
printf("number of reader and writer :");
scanf("%d",&n);
printf("write the higher param... |
C | /*
* Trafic des trains sur une ligne avec plusieurs sections a voie unique
*/
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <ligne_stdio.h>
#define TAILLE_MARQUES 26
#define trafic_attente() sleep(1)
/* Variables partagées*/
lign... |
C | #include "sort.h"
void insert_sort(int array[],size_t length) {
for (size_t i = 1;i < length;i++) {
for (size_t j = 0;j < i;j++) {
if (array[i] < array[j]) {
swap(&array[i], &array[j]);
}
}
}
}
|
C | #include <stdint.h>
extern int main(void);
void reset_handler(void)
{
//symbols defined in linker script
extern uint32_t _mydata_lma_start;
extern uint32_t _mydata_vma_start;
extern uint32_t _mydata_vma_end;
extern uint32_t _mybss_vma_start;
extern uint32_t _mybss_vma_end;
//note that for the varia... |
C |
//when u find the page then hit
//when there is no page avaialble in main memory then page fault
//find the page fault ratio and page hit ratio
//consider the 3 memory blocks
#include<stdio.h>
int search(int a, int * p, int l)
{
int temp=0;
while(temp<l)
{
if(a==*(p+temp))
{
return temp;
}
temp+=1;
}
... |
C | #include <stdio.h>
void init_arr(int (*arr)[2])
{
int i,j,cnt=1;
for( i=0; i<3; i++)
{
for( j=0; j<2 ; j++)
{
arr[i][j] = cnt++;
}
}
}
void print_arr(int (*arr)[2])
{
int i,j;
for(i=0;i<3;i++)
{
for(j=0;j<2;j++)
{
printf("arr[%d][%d] = %d\n",i,j,*(*(arr+i)+j)); // *(*(arr+i)+j) == arr[... |
C | #include <stdio.h>
#include <stdlib.h>
#include "ListBaseQueue.h"
void QueueInit(Queue *pq)
{
pq->front = NULL;
pq->rear = NULL;
}
int QIsEmpty(Queue *pq)
{
if (pq->front == NULL)
return TRUE;
else
return FALSE;
}
void Enqueue(Queue *pq, Data data)
{
Node *newD... |
C | /* $OpenBSD: failedlogin.c,v 1.19 2021/10/24 21:24:16 deraadt Exp $ */
/*
* Copyright (c) 1996 Todd C. Miller <millert@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permiss... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_checkflags.c :+: :+: :+: ... |
C | #include "holberton.h"
/**
* print_number - print numbers
* @n: first parameter
*
* Description: depends on integer n passed
* Return: Always(0) Success
*/
void print_number(int n)
{
if ((n < 0) && (n >= -9))
{
_putchar('-');
_putchar((n * -1) + '0');
}
else if (n <= -10)
{
_putchar('-');
_putchar(((... |
C | /**
* \file expelliarmus.c
* \brief Méthode de l'objet expelliarmus_t
* \author Comte Clément
* \version 1
* \date 17 avril 2021
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "../../../lib/player.h"
#include "../../../lib/expelliarmus.h"
static void deplacement(expe... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstnew.c :+: :+: :+: ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* calculate.c :+: :+: :+: ... |
C | #include "unix_api.h"
#define MAX_PATH_LEN 1024
#define CP_R (1<<('r'-'a'))
#define IS_SET_R(x) ((x)&CP_R)
//解析argv参数
void parse_input(int argc,char **argv,char *src_path,char *dest_path,int *flags)
{
for(int i=1;i<argc;i++){
if(argv[i][0]=='-'){ //以-开头,代表选项
for(int j=1;j<strlen(argv[i])... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define MAX 10
#define MAX_TRANS 5
#define NUMBER_OF_BLOCKS 1000
#define NUMBER_OF_TRANSACTIONS (NUMBER_OF_BLOCKS*MAX_TRANS)
int realcustomercount = 0 ;
int count = 0 ;
int buffer2[NUMBER_OF_TRANSACTIONS] ;
// void write();
int main()
{
... |
C | /*Program for implement round_robin process sheduling*/
#include<stdio.h>
struct p
{
int pno;
int bt,wt,tat,st;
}p1[20];
void main()
{
int n,i,tq,temp,count,sq;
float twt,ttat,awt=1.0,atat=1.0;
printf("enter the number of processes:");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("enter the name of ... |
C | #include <stdio.h>
#include <math.h>
//make sure sure you use -lm when compiling
int main()
{
double tubwidth;
double tubdepth;
double length;
double width;
double shallowdepth;
double deepdepth;
double deependL;
double shallowendL;
double walkinL;
double length3;
char id;
/*
while(1)
{
printf("Wo... |
C | #ifndef __LJS_TOKEN_ARRAY__
#define __LJS_TOKEN_ARRAY__
#include "array.h"
#include "token.h"
typedef array<Token> TokenArray;
static inline void savetoken (TokenArray & tok_arr, TokenType t)
{
tok_arr.start[tok_arr.index].type = t;
++ tok_arr.index;
}
static inline void savetoken_boolean (TokenArray & tok_... |
C | /*!
* int signalfd(int fd, sigset_t* mask, int flags);
*
* int fd: 创建一个signalfd的时候,指定为-1,修改的时候需要指定一个有效的signalfd
* sigset_t* mask: 信号掩码
* int flgas: 标志位 SFD_CLOEXEC, SFD_NONBLOCK
* 和使用fcntl来设置一样
* SFD_CLOEXEC == fcntl(fd, F_SETFD, FD_CLOEXEC);
* SFD_NONBLOCK == fcntl(fd, F_SETFL,... |
C | #include "sorting.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
void printArray2(long * arr, int size)
{
int i;
for (i = 0; i < size; i++)
{
fprintf(stdout, "%ld\n", arr[i]);
}
fprintf(stdout, "\n");
}
long min(long a, long b)
{
if (a < b) return a;
else return b;
}... |
C | #include <stdio.h>
#include "fila2.h"
int main(void)
{
int i, elem;
float conteudo;
Fila2 *f;
f = fila2_cria();
printf("\n Digite o numero de elementos da fila2: ");
scanf("%d", &elem);
for (i = 1; i <= elem; i++)
{
printf("\n Digite um elemento da fila2 a ser inserido no final da fila:... |
C | #include <stdio.h>
#include <pthread.h>
pthread_mutex_t count_lock = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t condition_var = PTHREAD_COND_INITIALIZER;
int count = 0;
#define MAX 10
void * odd_number(void* argc)
{
while(1) {
pthread_mutex_lock(&count_lock);
if (count % 2 != 0) {
pthread_cond_wait( &condition_v... |
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
long get_fibbonachi_via_cycle(int number);
long get_fibbonachi_via_recursion(int number);
void power(int number, int source, int target);
int main()
{
int number = 0;
scanf("%d", &number);
printf("%ld", get_fibbonachi_via_cycle(number));
return 0... |
C | /* ************************************************************************** */
/* */
/* :::::::: */
/* ft_find_room.c :+: :+: ... |
C | #include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "linked_list.h"
//helper function 1
int listsize(struct song_node *n){
if(n == NULL) return 0;
return 1 + listsize(n->next);
}
//helper function 2
struct song_node * find_node(struct song_node *n, int index){
struct song_node *f... |
C | #include<stdio.h>
struct numbers
{
int x,y;
};
int main()
{
int i,j;
scanf("%d",&i);
float r;
struct numbers a[i];
for(j=0;j<i;j++)
{
scanf("%d %d",&a[j].x,&a[j].y);
if(a[j].y==0)
printf("divisao impossivel\n'");
else
{
r=((float)a[j].x/(float)a[j].y);
printf("... |
C | #ifndef _CTL_LIST_H
#define _CTL_LIST_H
/**
* ΪListУʹmallocڴռ䣬Ҫرעڴй©
*/
#include "ctl.h"
typedef struct LIST_NODE {
void *data; //ָýڵ
struct LIST_NODE *next; //ָһڵ
}ListNode;
typedef struct CTL_LIST{
ListNode *root; //ָͷָ
size_t typeSize; //иԪռֽ
int num; // Ԫصĸ
}CTLList;
... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct node
{
int data;
struct node *next;
}link;
link *head;
link *addatend(link *ptr, int data);
void display(link *head);
void addatbeg(link **ptr, int data);
void addatpos(link *ptr, int data, int pos);
link *delbeg(link *head);
void delend(link *head);
void... |
C | #include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<sys/wait.h>
#include<string.h>
#include<ctype.h>
#include<fcntl.h>
int main ()
{
for(;;)
{
printf("myshell@bogon:");
fflush(stdout);
char buf[1024];
int read_size = read(1,buf,sizeof(buf)-1);... |
C | /*
============================================================================
Name : ex5c.c
Author : Martim Silva
============================================================================
*/
#include <stdio.h>
#include <stdlib.h>
extern int CAPICUA(int num);
int main(void)
{
int ... |
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 | #include<stdio.h>
int main()
{
int n,a,b=0,i;
scanf("%d",&n);
for(i=5;i>0;i--)
{
a=n/i;
b=b+a;
n=n-(i*a);
}
printf("%d\n",b);
return 0;
}
|
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
//#include <sys/time.h>
#define MESSAGE_SIZE_PER_LINE 4+1
#define BUFSIZE 102
#define ENCODED_FILE_SIZE 15360
char * decode(char* line){
const char delm[2] = ",";
char *token,*message;
int i = 0;
message = malloc(MESSAGE_SIZE... |
C | #include "nheadf.h"
main()
{
stud temp;
list L1;
poslist pl;
L1=Initialize();
pl=initialize();
position p=L1;
pos2 p1=pl;
int x,ch,val,c=0,c1=0;
char stuname[20];
do
{
printf("\n\nEnter choice");
printf("\nStudent List\n1.Insert\n2.Delete\n3.Printlist\n4.Insert\n5.Delete\n6.Printlist\n7.Printposition\n")... |
C | /*
** EPITECH PROJECT, 2020
** 108trigo
** File description:
** cosh and sinh
*/
#include "trigo.h"
void compute_sinh(matrix_t *m)
{
double stock = 0;
double stock1 = 0;
for (int i = 0; i != m->rows; i++)
for (int j = 0; j != m->rows; j++)
m->id_matrix[i][j] = m->res_matrix[i][j];
... |
C | #include <stdio.h>
#include <stdlib.h>
#define SIZE 10
void main()
{
int pass, i, hold, x = 1;
int a[SIZE] = { 2, 6, 4, 8, 10, 12, 89, 68, 45, 37 };
int break_control = 0;
puts("Data items in original order");
for (i = 0; i < SIZE; ++i)
{
printf("%4d", a[i]);
}
for (pass = 1; pass < SIZE; ++pass)
{
... |
C | /* $begin sbufc */
#include "../../io/csapp.h"
#include "sbuf.h"
/* Create an empty, bounded, shared FIFO buffer with n slots */
/* $begin sbuf_init */
void sbuf_init(sbuf_t *sp, int n)
{
sp->buf = Calloc(n, sizeof(int));
sp->n = n; /* Buffer holds max of n items */
sp->front = sp->r... |
C | //
// str9.c
// CL
//
// Created by 조유빈 on 06/12/2018.
// Copyright © 2018 조유빈. All rights reserved.
// 직사각형의 왼쪽 아래의 좌표(x, y)와 오른쪽 위의 좌표(x2, y2)를 저장할 수 있는 구조체 자료형을 만들고 두 개의 직사각형 자료를 입력받아 두 직사각형을 포함하는 최소의 직사각형 자료를 구하여 구조체 변수에 저장하고 출력하는 프로그램을 작성하시오. 단, 모든 입력값은 100을 넘지 않는다.
//1 1 6 5
//2 0 7 3
#include <stdio.h>
st... |
C | #include <stdio.h>
int strends(char *, char *);
int main()
{
char *s = "ababacdegould";
char *t = "dls";
char *z = "uld";
printf("strends(s, t): %d\n", strends(s, t));
printf("strends(s, z): %d\n", strends(s, z));
return 0;
}
int strends(char *s, char *t)
{
int slen,tlen;
slen = tlen = 0;
while(*(s + slen... |
C | #include<stdio.h>
#include<conio.h>
int main()
{
int n, c;
//rand() is used to get random numbers
printf("Ten random numbers in 1 to 100\n");
for (c=1;c<=10;c++)
{
n=rand()%100+1;
//rand()%100 gives random value in between 0 to 99
printf("%d\n",n);
}
re... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "student.h"
/* Given the student values, initialize a structure,
and return a pointer to the struct */
Student *makeStudent(char name[16], int age, float gpa)
{
Student *newStudent = (Student *) malloc(sizeof(Student));
strcpy(newStudent ... |
C | #ifndef _map_h_
#define _map_h_
#define EMPTY_ENTRY(e) (!(e)->x && !(e)->y && !(e)->z && !(e)->w)
#define MAP_FOR_EACH(map, entry) \
for (unsigned int i = 0; i <= map->mask; i++) { \
Entry *entry = map->data + i; \
if (EMPTY_ENTRY(entry)) { \
continue; \
}
#define END_MAP_FOR_... |
C | #include <stdio.h>
float areaOfCircle(float radius)
{
float area;
area = radius*radius*3.14;
return area;
}
int main()
{
float i;
for (i=3.5; i<13; i++)
{
printf("area: %f, radius: %f\n", areaOfCircle(i), i);
}
}
|
C | #include<stdio.h>
int main()
{
int a[5] = {1,2,3,4,5};
printf("* a[0] = %d\n", *a);
// printf("* a[%d] = %d\n", 1, *(a++)); // a++ doesnt work, bcz a++ -> a = a + 1. Cannot overwrite a.
printf("* a[%d] = %d\n", 4, *(a+4));
add(a,5);
return 0;
}
int add(int b[], int n)
{
printf("* b[0] = %d\n", *b);
printf("* b... |
C | #include<stdio.h>
main()
{
int i=1,x;
while(i<=5)
{
printf("enter a number");
scanf("%d",&x);
if(x>0)
break;
i++;
}
i==6?printf("ends normally"):printf("break applied");
}
|
C | //
// mail_regex.h
// socket_tcp
//
// Created by Tiko on 12/16/18.
// Copyright © 2018 Tiko. All rights reserved.
//
#ifndef mail_regex_h
#define mail_regex_h
#include <regex.h>
int mail_path(const char* str){
const char* pattern="([0-9A-Za-z\\-_\\.]+)@([0-9a-z]+\\.[a-z]{2,3}(\\.[a-z]{2})?)";
regmatch_t... |
C | /*
* Copyright (c) 2014, Justin Crawford <Justasic@gmail.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose
* with or without fee is hereby granted, provided that the above copyright notice
* and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "A... |
C | #include <stdio.h>
#include <stdlib.h>
//#include <iomanip.h>
void printArray(int *);
void selection(int *);
void insertion(int *);
void bubble(int *);
void shell(int *);
void randArray(int, int*);
void testSelectionSort(void);
void testInsertionSort(void);
void testBubbleSort(void);
void testShellSort(void);
static ... |
C | /* vim: set tabstop=4:softtabstop=4:shiftwidth=4:noexpandtab */
/**************************************************************************
*
* ROUTINE
* polefilt
*
* FUNCTION
* Direct form all-pole filter
*
* SYNOPSIS
* subroutine polefilt(a, n, z, xy, len)
*
* formal
*
* data I/O
* name type type function
*... |
C | /**
* Platform I2C access management.
*
* Before accessing an I2C, it must first be reserved and later released
* again so other components could use it.
*
* Make no assumptions about the configuration of the I2C when receiving it
* and perform any initialization from scratch each time.
*
* Copyright Thinnect ... |
C | /*
* main.c
* Tail
*
* Created by Nikki Chumakov on 28/01/2017.
*
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.