language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include "../projects.h"
/*
ѧѧšɼѧžΪ10ַַɼΪ0100
*/
typedef struct student {
char name[20];
char ID[20];
int score;
} Stu;
void ranking() {
//ʼ
int max = 0;
int maxNum = 0;
int min = 100;
int minNum = 0;
int n = 0;
int i = 0;
//ѧʼѧϢ
scanf("%d", &n);
if (n == 0) {
exit(0);
}
Stu **students = (Stu **)mal... |
C | #include <cairo.h>
#include <math.h>
#include <stdlib.h>
#include "SDL.h"
#include "core.h"
struct meteor meteors[METEOR_MAX];
struct meteor_type meteor_types[METEOR_TYPE_MAX] = {
0, 3, 1/32.0, 12, 1/2.0, 4/1.0,
0, 4, 3/32.0, 3, 3/8.0, 1/2.0,
0, 8, 3/16.0, 1, 1/8.0, 1/8.0
};
struct polygon {
int... |
C | /* ez: interpreter */
#include <stdio.h>
#include "ez.h"
#include <setjmp.h>
#define mkvar(p,flag) (v.v_type = T_VAR, v.v_x = flag, v.v_addr = (int) (p), v)
#define xsp fp->f_sp
#define top fp->f_vals[xsp]
#define xpush(v) if (++xsp < sizeof(fp->f_vals)/sizeof(struct value))\
fp->f_vals[xsp] = v; else err("stack over... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* check_input.c :+: :+: :+: ... |
C | #include "myWebServer.h"
#include <stdlib.h>
#include <netdb.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <signal.h>
#include <string.h>
int response_header (int fd, char *ext, int csd){
char buff[100];
memset(buff,'\0... |
C | #include <stdlib.h>
#include <stdio.h>
The functions stat(), fstat(), lstat() are used to get the file status. Here are their prototypes
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
int stat(const char *file_name, struct stat *buf); int fstat(int file_desc, struct stat *buf);
int lstat(con... |
C | #include "sdvbs_common.h"
/********************************
Author: Sravanthi Kota Venkata
********************************/
F2D * horzcat(F2D *a, F2D *b, F2D *c) {
F2D *out;
int rows = 0, cols = 0, i, j, k, c_1, c_2, r_3, c_3;
c_1 = a->width;
cols += c_1;
c_2 = b->width;
cols += c_2;
r_3 = c->heig... |
C | //
// Header.h
// Weekly Task 5
//
// Created by Nguyen Le Khanh Ngoc on 03/11/2020.
// Copyright © 2020 Nguyen Le Khanh Ngoc. All rights reserved.
//
#ifndef Header_h
#define Header_h
//functions get input from user
void getInt (int *num, char order[]);
void getFloat (float *num, char order[]);
//1. Calculates th... |
C | /**********************************************************
*
* unittest1.c
*
* CS 362 - Software Engineering II
* Gillian Ayers
*
* Test for whoseTurn function in dominion.c
* Function:
* int whoseTurn(struct gameState *state) {
* return state->whoseTurn;
* }
*
* References:
* Card information taken from ... |
C | //
// array_stack.c
// data-structure
//
// Created by determination on 2018/9/4.
// Copyright © 2018年 determination. All rights reserved.
//
#include "array_stack.h"
bool initStack_AS(ArrayStackPtr stack)
{
stack->data = (DataType_AS *) malloc(sizeof(DataType_AS) * STACK_INIT_SIZE);
if (!stack->data) {
... |
C | #include <stdio.h>
#include "holberton.h"
/**
* main - prints holberton
*
* Description: prints holberton
* Return: returns 0
*/
int main(void)
{
char str[] = "Holberton\n";
int i = 0;
while (i < 10)
{
_putchar(str[i]);
i++;
}
return (0);
}
|
C | #include<stdio.h>
int main()
{
float loan_amount,rate, monthly_payment,balance;
printf("Enter amount of loan:");
scanf("%f",&loan_amount);
printf("\nEnter interst rate:");
scanf("%f",&rate);
printf("\nEnter monthly payment:");
scanf("%f",&monthly_payment);
loan_amount+=(loan_amount*rate/(100*12))-monthly_paymen... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include "testcases.h"
void *buff;
unsigned long nr_signals = 0;
#define PAGE_SIZE (4096)
/*
* placeholder-3
* implement your page replacement policy here
*/
/*
* placeholder-2
* implement your signal handler here
*/
in... |
C | #include <stdio.h>
int main()
{
unsigned x, y, result;
int p, n;
// scanf_s("%d %d %d %d", &x, &p, &n, &y);
x = 1250;
p = 2;
n = 3;
y = 4750;
result = setbits(x, p, n, y);
printf("The result is : %d\n", result);
}
unsigned setbits(unsigned x ,int p,int n,unsigned y) {
ret... |
C | #include<stdio.h>
int main()
{
int testcase,i;
scanf("%d",&testcase);
for(i=0;i<=testcase;i++)
{
char character;
scanf("%c",&character);
if(character>='a')
{
printf("Alphabet\n");
}
else if(character>='A')
{
printf("Alphabet\n");
}
else
{
printf("No");
}
}
}
|
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <pthread.h>
#include <signal.h>
#include <unistd.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/ip.h>
#include <netinet/in.h>
#define MAGIC_CONST 5
#define THREADS 3
int port_num;
char*... |
C | // En el ejercicio anterior, ocurría que se sobreescribían los valores en el arreglo numbers, lo cual impedía el funcionamiento correcto de la intencionalidad del código.
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
typedef struct {
int finished;
size_t worker_count;
size_t nu... |
C | //Tutorials By Rabia Alhaffar,Created To Be Free
//Started On 9/January/2020
//GameBox Series - Part 1(With Raylib And C)
//https://www.raylib.com
//Tutorial 9 - Miscs
#include <raylib.h>
#include <stdlib.h>
//Variables To Store In System!!!
//C Is Number Of Rects To Draw!!!
typedef enum { C = 0 } StorageData;... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
char *repetir(int n, char *s) {
const size_t largo = strlen(s);
char *r = malloc((n * largo + 1) * sizeof(char));
if (r == NULL) {
return NULL;
}
for (size_t i = 0; i < n; i++) {
strcpy(r + (i * largo), s);
}
retur... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* xml_validity.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
void erreurSystemeFin(const char* msg,int valeur_retour)
{
perror(msg);
exit(valeur_retour);
}
main()
{
int nbreProc=10;
int i=0;
pid_t tab_fils[nbreProc];
pid_t pid;
int status;
for(i; i < nbreProc ; i++)
{
switch (tab_fils[i]=fork()) {
... |
C | #include <stdio.h>
void triplepointeur(int *pointeursurnombre)
{
*pointeursurnombre *= 2; // Multiplie la valeur du nombre par 2
}
int main() {
int A=8; // création de la variable A
int B=2; // création de la variable B
int* ptr=NULL; // création du pointeur
ptr=&A; // met l'addresse de A dans mon pointeur
prin... |
C | #include <stdio.h>
#include <omp.h>
#include <math.h>
#include "treeNode.c"
#include "gen_points.c"
#include "point_operations.c"
int n_dims = 0;
long node_id = -1;
node_t* build_tree(double** pts, long n_points){
if (n_points < 2){
return createNode(pts[0], 0.0);
}
long* furt... |
C | #include <stdlib.h>
#include "bs1d_std.h"
#include "error_msg.h"
#define PRECISION 1.0e-7 /*Precision for the localization of FD methods*/
static void restriction(int l,double *d,double *u,double *f,double alpha,double beta,double gamma)
{
int nl1,nl,i;
double *Aux;
nl=pow(2, l+1)-1;
nl1=pow(2,l)-1;
Aux... |
C | #include<stdio.h>
int func(int *p) {
p++;
*p = 42;
return *p;
}
int main(void) {
int v[] = {1, 2, 3, 4, 5}, i;
char s[] = "Bettina", *p;
scanf("%d", v + 1);
for (i = 0; i < 5; i++) printf(" %d", v[i]);
printf("\n");
printf("%d\n", func(v));
printf("%d\n", *v);
for (i = 0; i < 5; i++) printf(" %... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct sP{
char nome[20];
int id;
}processo;
typedef struct sCell{
processo info;
struct sCell *prox;
}celula;
typedef struct sC{
int tamanho;
celula *prox;
}cabecalho;
cabecalho *criarCabecalho(){
cabecalho *c = (cabecalho*)malloc(sizeof(ca... |
C | #include <avr/io.h>
#include <util/delay.h>
/* initialize all variables */
int BLINK_DELAY_MS = 140;
int BLINK_DELAY_MS_FAST = 70;
int ROUND = 0;
int X = 0;
/* same time for on & off */
void blink (int DELAY)
{
blink(DELAY,DELAY);
}
/* diffent time on & off */
void blink (int ON,int OFF)
{
/* set pin 5 high to t... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ellipsoid.c :+: :+: :+: ... |
C | #include<stdio.h>
int main()
{
int n,x,i,s1=0,s2=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&x);
if(x%2==0)s2++;
else s1++;
}
if(s1%2==0)printf("%d",s2);
else printf("%d",s1);
return 0;
}
|
C | /*
* =====================================================================================
*
* Filename: main.c
*
* Description:
*
* Version: 1.0
* Created: 05/15/2014 11:59:09 PM
* Revision: none
* Compiler: gcc
*
* Author: 斯人 (www.imsiren.com), imsiren@16... |
C | //Use por ejemplo el ejercicio 1a) y cree una variable global de tipo entero inicializada a 0.
//Haga que cada hijo aumente en uno el valor de esa variable global y que el padre imprima el
//resultado final. ¿Qué ocurre? Correcto, su valor no se modifica porque los hijos son procesos
//nuevos que no comparten memoria. ... |
C | /*---------------------------------------------------------------------------------
* FileName:Painter.c
* author:doodlesomething@163.com
* date:10-29-2014
* version:1.0
* description:Painter POJ-2709 solved by Greedy Algorithm
* more:使用贪心算法解决即可,这里是选择最大的优先处理
-------------------------------------------------------... |
C | /*! \file include/conio.h
\brief console input / output (Simulator)
\author Markus L. Noga <noga@inrialpes.fr>, Thomas Roeblitz <roeblitz@informatik.hu-berlin.de>
\warning Display updates are realized exclusively by lcd_refresh()
\par Display positions
Digit display positions are denumerate... |
C | #include <stdio.h>
#include <string.h>
#include <math.h>
int main() {
int a , b;
while(scanf("%d%d", &a , &b) != EOF){
int i , flag = 0 , blank = 0;
for(i = a ; i <= b ; ++i){
int temp = i , j , pows = 0 , num[7] , sum = 0;
while(temp > 0){
num[pows] = te... |
C | //
// main.c
// cTicTacToe
//
// Created by Aakash Chitroda on 4/9/20.
// Copyright © 2020 Aakash Chitroda. All rights reserved.
//
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#define ROW_SIZE 3
#define COL_SIZE 3
#define INITIAL_VALUE '_'
uint8_t matrix[ROW_SIZE][COL_SIZ... |
C | #include<stdio.h>
int stack[20];
int top=-1;
void push(int x)
{
stack[++top]=x;
}
int pop()
{
if(top==-1)
return -1;
else
return stack[top--];
}
void main()
{
char exp[20];
char ch;
int result;
printf("Enter the Expression:");
scanf("%s",exp);
for(int i=0;exp[i]!='\0';i++)
... |
C | //Use of an array as the argument of a function
int a[3][4];
int f (int[3][4] b){
int res=0, i, j;
for (i=0; i<3; i++)
for (j=0; j<4; j++)
res = res + b[i][j];
return res;
}
void main(){
int b[3][4];
int i=10, j=400;
for (i=0; i<3; i++)
for (j=0; j<4; j++)
b[i][j] = i*4+j;
for (i=0; i<3; i++)
fo... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include "linkedList.h"
int main()
{
node_t * list = NULL;
loadList(&list);
//print(list);
int *option = (int*)malloc(sizeof(int));
printf("Select an option: \n");
printf("1.- Print the list. \n");
printf("2.- Print the old... |
C | #include <stdio.h>
int numS[101];
int t, n, i, j, k;
int factor(int num){
int faC = 0;
if(numS[num] > 0) return numS[num];
for(int cnt = 1; cnt <= num; cnt++){
if(num % cnt == 0){
if(numS[cnt] > 0){
faC = numS[cnt] + 1;
numS[num] = faC+1;
... |
C | #include<stdio.h>
int mystrend(char *s,char *p);
main()
{
char a[122]="abhilash",b[433]="lash";
printf("%d",mystrend(a,b));
}
int mystrend(char *s,char *p)
{
int sl=0,pl=0;
while(*s!='\0'){
++sl;
*++s;
}
while(*p!='\0'){
*++p;
++pl;
}
while(pl>0){
if(*--p==*--s)
--pl;
else
return 0;
}
retur... |
C | #include "sockets.h"
SOCKET SocketServeur(int port) // utilisation des méthides "socket()" et "bind()"
{
SOCKET sock;
SOCKADDR_IN sin = { 0 };
printf("Création socket serveur ...");
sock = socket(AF_INET, SOCK_STREAM, 0);
if(sock == INVALID_SOCKET)
{
perror("socket()");
exit(1);
}
sin.sin_addr.s_... |
C | #include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include "列表.h"
void 打印列表(char **数组){
int 甲;
for(甲 = 0;数组[甲];甲++){
printf("%s",数组[甲]);
}
printf("\n");
}
int main(){
列表T 列表1,列表2,列表3;
char **串1 = (char **)malloc(100 * sizeof(char *));
列表1 = 列表初始化();
列表1 = 列... |
C | #include<stdio.h>
#include<stdlib.h>
/**
* Choses a pivot element then puts every element less than pivot on its left, greater ones to its right
* Takes An array of elements and the boundary indexes for the element
* returns the pivot's sorted position
*/
int partitionFast(int A[], int low, int high){
// fo... |
C | #include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
//cpu information
typedef struct CPU_OCCUPY{
char name[20];
unsigned int user;
unsigned int nice;
unsigned int system;
unsigned int idle;
}CPU_OCCUPY;
//mem info
typedef struct PACKED{
char name[32];
unsigned long total;
char name2[32];
unsigned lo... |
C | #include "calllib.h"
int caloriesValue(call_reason_t reason)
{
int calories = 0;
switch(reason){
case PIZZA:
calories = 2269;
break;
case BURGER:
calories = 354;
break;
case LASAGNE:
calories = 344;
break;
case FRIES:
... |
C | /* 3310ҺʾC51Գ 2004/07/31/BD2YA
ӽϣ Pin Signal Description Port
1:VDD Power Input. Logic supply voltage range VDD to GND : 2.7 to 3.3 V
2:SCLK Serial clock. Input for the clock signal: 0.0 to 4.0 Mbits/s.
3:SDIN Serial data. Input for the data line.
4/C Mode Select. To select either command/address or data inpu... |
C | /*************************************************************************
> File Name: maxthread.c
> Author: Robin
> Mail: chou_robin@163.com
> Created Time: 2016年07月11日 星期一 19时22分09秒
************************************************************************/
#include<stdio.h>
#include<pthread.h>
#include<stdlib.... |
C | // *****************************************************************************
// timerisr.c
//
// Timer 0 Interrupt Service Routine
//
// entered when Timer0 RC compare interrupt asserts (200 msec period)
// blinks LED2 (pin PA2)
//
// Author: James P Lynch May 12, 2007
// ******************... |
C | #include <xinu.h>
#include <string.h>
struct groupQueueEntry groupQueue[NPROC];
void groupQueueEnqueue(char *groupName)
{
if(groupQueueHead == -1 && groupQueueTail == -1)
{
groupQueueHead = 0;
groupQueueTail = 0;
int i;
groupQueue[groupQueueTail].groupName[GROUPLEN-1] = NULLCH;
for(i = 0; i < GROUPLEN-1 &... |
C | #include <stdio.h>
#include <stdlib.h>
#include "calc.h"
int varletter, sp = 0, k = 0, l = 0;
double val[MAXVAL];
int main()
{
int type;
char s[MAXOP];
double op2;
while ((type = getop(s)) != EOF)
{
switch (type)
{
case NUMBER:
push(atof(s));
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* is_valid_functions.c :+: :+: :+: ... |
C | char[][] YUVtoRGB(short CbY, short CrY)
{
//First RGB by using Y from CbY
char R1 = 1.164*( (CbY&0x00FF) - 16)
+ 1.596*( ((CrY>>8)&0x00FF) - 128);
char G1 = 1.164*( (CbY&0x00FF) - 16)
- 0.813*( ((CrY>>8)&0x00FF) - 128)
- 0.391*( ((CbY>>8)&0x00FF) - 128);
char B1 = 1.164*( (CbY&0x00FF) - 16)
+ 2.018*( ((... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "fft_rec.h"
int main()
{
const int input_size = 32768;
srand(time(NULL));
double* mem_buf = (double*) malloc( 6 * input_size * sizeof(double));
double* input_re = mem_buf;
double* input_img = mem_buf + input_size;
double* output_re = mem_b... |
C | #include "holberton.h"
/**
* more_numbers - prints numbers 0 - 14 10 times
*/
void more_numbers(void)
{
int loop1;
int loop2;
for (loop1 = 0; loop1 < 10; loop1++)
{
for (loop2 = 0; loop2 <= 14; loop2++)
{
if (loop2 > 9)
{
_putchar('1');
}
_putchar((loop2 % 10) + 48);
}
_putchar('\n');
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
typedef struct ponto
{
int x, y;
} Ponto;
typedef struct pessoa
{
char nome[100];
Ponto p;
} Pessoa;
typedef struct CentroM
{
int x, y;
} CentroM;
Pessoa *alimentar(Pessoa *pessoas, int *n)
{
pessoas = (Pessoa *)calloc(*n, sizeof(P... |
C | /*
** EPITECH PROJECT, 2018
** PSU_my_printf_2018
** File description:
** modified functions for printf
*/
#include "../my.h"
#include "my_printf.h"
unsigned int p_uputnbr(unsigned long long int n, char const * const base)
{
int b = my_strlen(base);
unsigned int digits = 0;
if (n < 0) {
my_putcha... |
C | #include <stdio.h>
int recursive(int tab[],int search,int taille,int min,int max,int middle){
int find=0;
printf("\n");
while((min<max)||(find=0)){
middle=((min+max)/2);
if(tab[middle]==search){
printf("%d=%d\n",tab[middle],search);
find=1;
printf("positif\n");
return 0... |
C | #include <stdio.h>
#include <mpi.h> //Include MPI library
int main(int argc, char *argv[])
{
//Initialize MPI - create all available processes
MPI_Init(&argc, &argv);
//Variables to store communicator size and rank number
int nproc, irank;
//Check communicator size
MPI_Comm_size(MPI_COMM_WORLD, &nproc)... |
C | //c(n,r)=n! / (r!*(n-r)!)
#include<stdio.h>
#include<conio.h>
int main()
{
int result,i,n,r,factn=1,factr=1,diff,factd=1;
printf("enter n : ");
scanf("%d",&n);
printf("enter r : ");
scanf("%d",&r);
diff=n-r;
for(i=1;i<=n;i++)
{
factn*=i;
}
for(i=1;i<=r;i++)
{
factr*=i;
}
for(i=1;i<=diff;i++)
{... |
C |
#include "fileman.h"
unsigned long filesize( FILE* file )
{
char c = getc( file );
int i = 0;
while( c != EOF )
{
i++;
c = getc(file);
}
return i;
}
char* fileToString( FILE* file, unsigned long* len )
{
*len = filesize( file );
char *ret = malloc( (*len)+1 );
fs... |
C | #include<stdio.h>
int main()
{
int p,q,r,s;
printf("Enter the first integer\n");
scanf("%d", &p);
printf("Enter the second integer\n");
scanf("%d", &q);
printf("Enter the third integer\n");
scanf("%d", &r);
printf("Enter the fourth integer\n");
scanf("%d", &s);
if (r > 0 &&... |
C | /*#include "thread_counter.h"
#include "csapp.h"
THREAD_COUNTER *tc;
void* incrementFunction();
void* decrementFunction();
void* waitForZero();
int main(int argc, char* argv[]) {
pthread_t thread1,thread2, thread3;
tc = tcnt_init();
pthread_create(&thread1, NULL, incrementFunction, NULL);
pthread_creat... |
C | #include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <stdio.h>
#include <signal.h>
#include <time.h>
#include <string.h>
#include <errno.h>
#include <stdbool.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "common.h"
timer_t controlTimerId;
struct itimerspec timeUntilControl;
char diagnosticPa... |
C | /* testc - Test adpcm coder */
#include "adpcm.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
struct adpcm_state state;
#define NSAMPLES 1000
char abuf[NSAMPLES/2];
short sbuf[NSAMPLES];
int main() {
FILE* loop_wrap=NULL;
long loop_wrap1, loop_wrap2;
int n;
if ((loop_wrap=fopen("_fi... |
C | #include "libft.h"
void *ft_memset(void *s, int c, size_t n)
{
while (s && n > 0)
{
*(int*)s = c;
s++;
n--;
}
return (s);
}
|
C | #include <stdio.h>
int main()
{
char string[81];
int i, num = 0, word = 0;
char c;
gets(string);
for (i = 0; (c = string[i] != '\0'); i++)
{
if (c == ' ')
word = 0;
else if (word == 0)
{
word = 1;
num++;
pr... |
C | /*
** print_percent.c for print_percent in /home/bongol_b/ProjetsPerso/my_printf/src
**
** Made by Berdrigue Bongolo-Beto
** Login <bongol_b@epitech.net>
**
** Started on Sat Jul 2 00:13:30 2016 Berdrigue Bongolo-Beto
** Last update Fri Jul 8 20:53:57 2016 Berdrigue Bongolo-Beto
*/
#include "my_printf.h"
int pr... |
C | #include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
int main(){
pid_t pid = fork();
int ret;
if (pid == -1) {
printf("errore\n");
exit(-1);
} else if (pid == 0) {
// child: client_prova
#ifdef __linux__
ret=system("xterm -hold ./client_prova");
... |
C | #include<stdio.h>
#include<string.h>
int main()
{
int i,j,k=0,l=0,count = 1;
char s[1024],temp[1024],temp2[1024];
printf("enter the string \n");
scanf("%[^\n]",s);
int len = strlen(s);
for(i=0;i<= len;i++)
{
temp[k++]=s[i];
if(s[i] == ' ' || s[i] == '\0')
{
temp[i] = '\0';
for(j=i+1;j<=len;j++)
... |
C | #include <stdio.h>
#include <string.h>
#define N 30
void test(int *pA);
int main() {
int a;
int *pA;
char name[N];
char *pC;
a = 1;
pA = &a;
printf("a = %d\n", *pA);
test(pA);
printf("a = %d\n", *pA);
strcpy(name, "AAA AAAA");
pC = name;
while( *pC != '\0') {
... |
C | #include <stdio.h>
enum dat_type {integer, longint, longlong, floating, doublefloat, longdouble, string};
typedef enum dat_type DatType;
void print_DataType(DatType data)
{
switch (data)
{
case integer:
printf("type of argument(s) needed: int\n");
break;
case longint:
printf("type of a... |
C | #include<stdio.h>
float cuadrados(float h);
int main(){
float x,x2;
printf("introduce un numero\n");
scanf("%f",&x);
x2=cuadrados(x);
printf("El cuadrado de %f es %f\n",x,x2);
return 0;
}
float cuadrados(float h){
return (h*h);
}
|
C | //
// Programa para demonstrar o "Problema Fundamental da Prog. Concorrente"
//
// Baseado inteiramente no programa de exemplo 3, capítulo 3 do livro
// "Programação Multithreaded em ambiente Windows NT© - uma visão de Automação"
//
// Autores: Constantino Seixas Filho/ Marcelo Szuster
//
#include <windows.h>
#incl... |
C | #include "core/storage.h"
#include "core/util.h"
#include <assert.h>
#include <string.h>
#include <math.h>
int storage_read(storage_t *storage, void *buf,
uint64_t offset, uint32_t bytes)
{
return storage->ops->read(storage->ops_data, buf, offset, bytes);
}
int storage_read_unaligned(storage_t *st... |
C | #include "types.h"
#include "user.h"
#include "param.h"
int main(void)
{
/* int pid = fork();
if(!pid)
{
sleep(10000);
exit();
}
if(pid)
{
printf(1, "Parent is sleeping\n");
wait();
printf(1, "Parent woken up\n");
for(;;);
}
exit();*/
int pid = getpid();
printf(1, "entering sleep\n");
if(setprio... |
C | /**
* @file tree.c
* @brief Functions for generating trees in a graph
* @author Dominique LaSalle <lasalle@cs.umn.edu>
* Copyright 2013-2014, Dominique LaSalle
* @version 1
* @date 2013-08-06
*/
#ifndef BOWSTRING_TREE_C
#define BOWSTRING_TREE_C
#include "tree.h"
#include "graph.h"
/******************... |
C | /*
** EPITECH PROJECT, 2019
** CPE_lemin_2019
** File description:
** file_error.c
*/
#include "my.h"
#include "lemin.h"
#include "struct.h"
#include <stddef.h>
#include <stdbool.h>
bool file_error_2(int nbr, file_t *graphic, char *str)
{
list_t *tmp;
char *end;
way_t *way;
if (!(tmp = graphic->finis... |
C | #include <stdio.h>
int main(int argc, const char * argv[])
{
char a[100];
while(scanf("%100[^\n]s", a) != -1)
{
getchar();
printf("%s\n",a);
}
return 0;
}
|
C | /******************************************************************************
Objetivo: hacer un arreglo apuntadores a cadenas de caracteres que almacene
palabras y su ocurrencia.
*******************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <st... |
C | #include "stack.c"
int main(int argc, char* argv[]) {
stack_init();
printf("Taille : %d\nVide ? %d\n", stack_size(), stack_is_empty()); // Affiche 0, 1
stack_push(26);
stack_push(2);
stack_push(-20);
stack_push(0);
printf("Pile : ");
stack_display(); // Affiche 26 2 -20 0
printf("Taille : %d\nVide ? %d\nTop :... |
C | /* File : queue.h */
/* Definisi ADT Queue dengan representasi array secara eksplisit dan alokasi dinamik */
/* Model Implementasi Versi III dengan circular buffer */
#include "boolean.h"
#include "queue.h"
#include <stdio.h>
#include <stdlib.h>
/* ********* Prototype ********* */
boolean IsEmptyQueue (Queue Q)
/* Men... |
C | /*************************************************************************
@Author: wanghan
@Created Time : Sat 01 Apr 2017 11:31:09 PM CST
@File Name: builtin_return_address.c
@Description:
************************************************************************/
#include <stdio.h>
//typedef void (*p)(int) pfun_... |
C | #include <stdio.h>
// Esta funcao calcula recursivamente o n-esimo termo de Fibonacci.
// Recebe um inteiro positivo n e devolve o valor calculado.
long long fibonacciRecursivo (int n){
if(n == 1){
return 0;
}
else if(n == 2){
return 1;
}
else{
return fibonacciRecursivo(n-1... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <math.h>
int main(int argc, char * argv[])
{
long long int part1_sum = 0;
long long int part2_sum = 0;
char * line;
while (!feof(stdin)) {
// When this loop condition is not met we started parsing on an
// empty line (the f... |
C | #include<stdio.h>
// Structure to represent a min heap node
struct heapnode
{
int vert;
int dist;
};
struct heur
{
int source;
int destin;
int h_score;
};
/*
ASTAR
*/
struct open_list_heapnode
{
int gscore;
int fscore;
int vert;
};
// Structure to represent a min heap
struct minheap
{
int heapsize; // N... |
C |
#ifndef KINGFISHER_UEFI_STDINT_H
#define KINGFISHER_UEFI_STDINT_H
typedef unsigned long long uint64_t;
typedef unsigned long uint32_t;
typedef unsigned short uint16_t;
typedef unsigned char uint8_t;
typedef long long int64_t;
typedef long int32_t;
typedef short int16_t;
typedef char int... |
C | /* penrose-legacy.h: legacy Penrose tiling functions.
*
* Provides an interface with which to generate Penrose tilings
* by recursive subdivision of an initial tile of choice (one of the
* four sets of two pairs kite/dart, or thin/thick rhombus).
*
* You supply a callback function and a context pointer, which is
... |
C | #include <stdio.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <stdlib.h>
#include <errno.h>
#include <time.h>
#include "common.h"
int request_count;
int nb_client;
struct timespec diff(struct timespec start, struct timespec end)
{
struct timespec temp;
if ((end.tv_nse... |
C | #include "stdio.h"
#include "../headers/memory.h"
#include "../headers/tree.h"
extern int lineno;
TERM* makeTERMnot(TERM* term){
TERM* t;
t = NEW(TERM);
t->lineno = lineno;
t->kind = notK;
t->val.notT = term;
return t;
}
TERM* makeTERMabsolute(EXP* expression){
TERM* t;
t = NEW(TERM);
t->lineno = l... |
C | /*
* arch/sh/mm/tlb-urb.c
*
* TLB entry wiring helpers for URB-equipped parts.
*
* Copyright (C) 2010 Matt Fleming
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/
#include <linux/mm.... |
C | #include <stdlib.h> // para srand
#include <time.h> // para time
#include "faux.h"
#define MIN 1
#define MAX 100
#define SIZE 10
// prototipos //puntero a funcion, que es funcion de compracion. fcomp es el nombre del puntero NO DE LA FUNCION
void bubble_sort(int *p, int len, int (*fcomp)(i... |
C | #define _GNU_SOURCE
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <stdlib.h>
#include <ctype.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
//#include "log.h"
//#include "error_hdr.h"
#include "config_util.h"
int get_config_string(char *pInFileName,char *pInSection... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "SOIL.h"
#include "image_data.h"
#include "output_data.h"
int main(int argc, char **argv)
{
Img pic;
if (argc == 1)
{
printf("loader [img]\n");
exit(1);
}
const int widthBlock = 4;
const int heightBlock = 5;
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <string.h>
#include <pthread.h>
#define MAX_THREAD 1
int **matriz1;
int **matriz2;
int **matrizF;
int m;
int test = 0;
void *multiplicacao(void *o){
int atual = test++;
int max = m;
int soma = 0;
m = max * (atual + ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
int my_rand(int min, int max)
{
srand((unsigned)time(NULL)); //utilisation d'une valeur alatoire
return (int)(min + (max - min) * (float)rand() / (float)RAND_MAX);
}
int main() {
int max = 100, min = 0;
int compteur = 1, nom... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(){
char linha[80];
printf("Digite uma frase de ate 80caracteres: ");
//scanf("%s", linha);
gets(linha);
char * substr = strtok(linha, " ");
printf("\n");
while(substr != NULL){
printf(" %s\n", substr);
substr =... |
C | #include "includes.h"
void soundHandler(void){
if(musicEnabled && Mix_PlayingMusic() == 0){ // If the last playing song has ended
char songNames[5][25] = {{"Space Industry"},
{"Saturn's Graveyard"},
{"Falling Star"},
... |
C | #ifndef __TOKEN_H
#define __TOKEN_H
#include "common.h"
#include "object.h"
#include "str.h"
typedef struct
{
// this has to be an exact copy
str_t str;
} stoken_t;
// immutable from str_t
typedef struct
{
instance_t obj;
// allocated size+1 for data
size_t size;
// data follows, this is for ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* print_s.c :+: :+: :+: ... |
C | #include<stdio.h>
void computeTotient(int n);
int MAX = 10001;
int phi[10002];
int main(){
computeTotient(MAX);
int t = 0;
scanf("%d",&t);
while (t-- > 0) {
int n =0;
scanf("%d",&n);
long long int H=0;
long long int sum=0;
for (int i=1; i<=n; i++) {
sum=sum+phi[i];
}
for (int ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.