language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
int arrequal(int arr1[], int arr2[], int size){
int inc;
for (inc = 0; inc <= size; inc++){
if (arr1[inc] == arr2[inc]) {
return 1;
}
else {
return 0;
}
}
}
int main(void){
int size;
scanf("%d", &size);
... |
C | #include <stdio.h>
#include <cs50.h>
const int ouncesPerMinute = 192;
const int bottleCapacityOunces = 16;
int main(void) {
printf("Minutes: ");
int minutes = get_int();
printf("Bottles: %i\n", minutes * ouncesPerMinute / bottleCapacityOunces);
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include "cofo.h"
#define True 1
#define False 0
typedef struct _dados_{
char nome[30];
int idade;
int NumFilhos;
float salario;
int cpf;
}dados;
int CompCPF(void*cpf, void *pessoa){
int *key;
dados *p;
key = (int*)cpf;
printf("\nkey:%i",key);
p = (dados*)pessoa;
prin... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
puts(getenv("PATH"));
int res = setenv("PATH", "hahaha", 0);
if(res == -1)
{
perror("set PATH");
exit(-1);
}
//system("echo $PATH");
puts(getenv("PATH")); //not overwrite old path.
//int setenv(const char *name, c... |
C | #include<stdio.h>
int main()
{
int a[100],i,j,n,store[100]={0};
printf("Enter the range\n");
scanf("%d",&n);
int isprime=0;
int c=0;
for(i=2;i<=n;i++)
{
isprime=0;
for(j=2;j<=i/2;j++)
{
if(i%j==0)
{
isprime++;
}
}
if(isprime==0)
{
store[c]=i;
c++;
}
}
printf("The twin pr... |
C | #include <stdio.h>
#include <string.h>
void main () {
float valor;
char estado[2];
printf(">>> Valor: R$");
scanf("%f", &valor);
printf(">>> Estado: ?\b");
scanf("%s", estado);
if (strstr(estado,"MG")) {
printf("[MG] Preço + Imposto: %0.4f\n", valor+(valor*0.07));
} else if (strstr(estado,"SP")) ... |
C | #include <avr/io.h>
#include <avr/interrupt.h>
unsigned long t0 = 0, us = 0, us_pom = 0;
int fi = 1;
int smer = 1;
ISR(TIMER0_COMPA_vect)
{
us++;
us_pom++;
if(us_pom == 1000)
{
us_pom = 0;
if(smer == 1)
{
if(fi < 255)
fi++;
else
smer = 0;
}
else
{
if(fi > 0)
fi--;
else
sm... |
C | #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#define MAXOP 100
#define NUMBER '0'
#define MAXVAL 100
int getOp(char []);
void push(double);
double pop(void);
int main(){
int type;
double operand;
char s[MAXOP];
printf("atof(\"123\") = %f\n", atof("123") );
printf("executing main f... |
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 | bool _isValidBST(struct TreeNode* root, long mn, long mx){
if(!root)
return true;
if(root->val <= mn || root->val >= mx)
return false;
return _isValidBST(root->left, mn, root->val) && _isValidBST(root->right, root->val, mx);
}
/**
* Definition for a binary tree node.
* struct Tr... |
C | #include <stdio.h>
#include <stdlib.h>
/*
The sum of the squares of the first ten natural numbers is,
1^2 + 2^2 + ... + 10^2 = 385
The square of the sum of the first ten natural numbers is,
(1 + 2 + ... + 10)^2 = 552 = 3025
Hence the difference between the sum of the squares of the first ten natural numbers and the ... |
C | /*
** stuct.c for in /home/rousse_k/Projet02/quete1
**
** Made by ROUSSE Kevin
** Login <rousse_k@etna-alternance.net>
**
** Started on Fri Oct 10 11:48:10 2014 ROUSSE Kevin
** Last update Sat Oct 11 11:37:15 2014 ROUSSE Kevin
*/
#include "header.h"
#include <stdlib.h>
t_cmd cmd[13] =
{
{"attack", attack},... |
C |
int fac(int n)
{
if(n < 1)
return 1;
return n * fac(n - 1);
} // fac()
int main()
{
int a, b, c = 4;
a = fac(c);
b = fac(3);
return a + b;
} // main()
|
C | // Ping-pong a counter between two processes.
// Only need to start one of these -- splits into two, crudely.
#include <inc/string.h>
#include <inc/lib.h>
envid_t dumbfork(void);
void
umain(int argc, char **argv)
{
envid_t who;
int i;
// fork a child process
who = dumbfork();
// print a message and yield to t... |
C | /** @file */
#ifndef __CCL_F3D_H_INCLUDED__
#define __CCL_F3D_H_INCLUDED__
#include <gsl/gsl_spline.h>
#include <gsl/gsl_interp2d.h>
#include <gsl/gsl_spline2d.h>
CCL_BEGIN_DECLS
/**
* Struct for accelerated linear interpolation.
*/
typedef struct {
int ia_last; /**< Last index found */
double amin; /**< Mini... |
C | #include <stdio.h>
#include <math.h>
void chooseTask(void);
int gcd(int x, int y);
float absoluteValue(float x);
float squareRoot(float x);
int main()
{
// Declare variables
int task = 0;
int x, y;
float z;
float result;
// Choose which calculation task to perform
while (task == 0) {
... |
C | #ifndef __TYPE__
#define __TYPE__
#include <stdlib.h>
typedef unsigned char U8 ;
typedef unsigned short U16 ;
typedef unsigned int U32 ;
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)>(b))?(b):(a))
#define ABS(a) MAX(a,0)
typedef struct Node{
struct Node* next;
void* data;
}Node;
typ... |
C | #include <stdio.h>
int cases;
int k;
int num[1001];
int gcd(int a,int b){
int r;
while(b!=0){
r=a%b;
a=b;
b=r;
}
if(a==1)return 1;
return 0;
}
void handle(){
num[1]=3;
num[2]=5;
int i,j;
for(i=3;i<=1000;i++){
num[i]=num[i-1]+2; //printf("heer\n");
for(j=2;j<i;j++){
if(gcd(i,j)!=0) num[i]+=2;
}
... |
C | /*
** my_power_it.c for my_power_it in /home/platel_k//projet/piscine/Jour_05
**
** Made by kevin platel
** Login <platel_k@epitech.net>
**
** Started on Fri Oct 7 11:20:59 2011 kevin platel
** Last update Fri Oct 7 11:32:13 2011 kevin platel
*/
int my_power_it(int nb, int power)
{
int nbr_return;
nbr_retu... |
C | //Aluno: Darmes Araujo Dias
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
int number_rolls;
int algorithm_of_the_game(int *vector, int limits[][2], int index, int size);
int main(){
char file_name[100];
int vector[400] = {0,};
int limits[20][2] =
{
... |
C | #include <stdlib.h>
#include <string.h>
#include <stdio.h>
typedef struct
{
char id[16];
char name[128];
} Tcont;
Tcont *loadFromFile(Tcont *agenda, char *arquivo, int *c){
int j;
char vetor[100][100];
int valor;
arquivo = fopen("agenda.txt", "a");
if(arquivo == NULL){
... |
C | /* Author: Aidan
* Date: June, 8, 17
* File: File Info
* Description: deals with file_info struct
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include "file_info.h"
extern int v;
//prototypes
int set_struct_file_type();
int resi... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "structs.h"
#include "commonFunctions.h"
#include "quicksort.h"
#include "comparisonFunctions.h"
int GT(BaseType a1, BaseType a2) {
if (a1.seqX > a2.seqX)
return 1;
else if(a1.seqX < a2.seqX)
return 0;
if (a1.diag > a2.diag)
return 1;
retur... |
C | // Declare what kind of code we want
// from the header files. Defining __KERNEL__
// and MODULE allows us to access kernel-level
// code not usually available to userspace programs.
#undef __KERNEL__
#define __KERNEL__
#undef MODULE
#define MODULE
#include <linux/kernel.h> /* We're doing kernel work */
#include <l... |
C | // A program to write integers to output, in base b, the first argument
// (c) 2019 Andrew Thai
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
void putBase(int b, int n) {
if (n >= b) putBase(b,n/b);
int nextChar = n%b + '0';
//account for gap between '9' and 'A'
if (nextChar > '9') {
nex... |
C | #include <stc/cptr.h>
#include <stc/cmap.h>
#include <stc/cstr.h>
#include <stdio.h>
typedef struct { cstr_t name, last; } Person;
Person* Person_from(Person* p, cstr_t name, cstr_t last) {
printf("make %s\n", name.str);
p->name = name, p->last = last;
return p;
}
Person* Person_make(Person* p... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "sitte.h"
int main()
{
FILE* file = fopen("C:\\prog\\lab2\\sitte\\dayk.txt.txt","r");
if (file == NULL)
{
printf("hERROR!");
return 0;
}
fseek(file, -2, SEEK_END);
int n = ftell(file);
printf("n = %d\n", n);
... |
C | #include "game_basis.h"
double wtime()
{
static int sec = -1;
struct timeval tv;
gettimeofday(&tv, NULL);
if (sec < 0) sec = tv.tv_sec;
return (tv.tv_sec - sec) + 1.0e-6*tv.tv_usec;
}
void delay(int t)
{
usleep(t * 1000);
}
void game_ready(uint16_t *map){
memset(map, 0, FILESIZE);
d... |
C | /*************************************************************************
* PROGRAMMER: Tomer Barak
* FILE: doublelinked code
* DATE: 02-07-2019 16:18:05
*******************************************************************************/
#include <stdio.h> /* printf ... |
C | /* routines to do useful things with filenames */
/* the routines a written so that they may be nested to any level during */
/* a call, BUT the result of calling a routine is not guaranteed after */
/* any further, non-nested calls to the routines */
/* the routines included are: */
/* NameRoot : string -> string *... |
C | /* @(#) Simple sorting methods. */
#include <sys/types.h>
#include <stdint.h>
/* Exchange two values. */
static inline void
swap(long *v1, long *v2)
{
long tmp = *v1;
*v1 = *v2;
*v2 = tmp;
}
void
selection_sort(long *val, size_t num)
{
size_t i = 0, j = 0, min = 0;
if (num < 2) return;
for (i = 0; i < num; ... |
C | #include "../includes/Interpretador.h"
#define MaxInter 30
#define MAXFILEPATH 100
void printsList(GList *tabela) {
TABLE temp = NULL;
GList *tab = tabela;
for(;tab->next;tab = tab->next) {
temp = tab->data;
printf("\"%s\",",getVar_name(temp));
}
temp = tab->data;
pri... |
C | #include<stdio.h>
int main(){
//we want to know how many prime numbers we have until n;
int n,i,j,p,q=0;
printf("enter your number please = ");
scanf("%d",&n);
for (i=2;i<=n;i++){
p=0;
for (j=2;j<=n;j++){
if (i%j==0 && i!=j){
p=1;
break;
}
}
if (p==0)
q++;
}
printf("tedad adad avval ta n = %d",... |
C | #include "gotoonebot.h"
#include <stdlib.h>
typedef struct Et_gotoone
{
Joueur qui_suis_je;
arbre_mnx mon_jeu;
}gotoone_interne;
/**
* \brief initialise une IA basée sur la structure de donnée Minimax
* \param qui_est_ce // l'identité de l'IA
*/
gotoone gotoone_init(Joueur qui_est_ce)
{
gotoone Le_gotoone = ... |
C |
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <assert.h>
#define SCHEME_CREATE_MAIN
#define SCHEME_ASSERT_STDOUT_IS_PIPED
#define SCHEME_FUNCTION read_dem
#include "scheme.h"
FILE * pFile = NULL;
long lSize;
char * buffer = NULL;
size_t result;
struct Col... |
C | /*
* Opdracht 0 - X
*
* Maarten Paauw <s1094220@student.hsleiden.nl>
* s1094220
* INF3C
*/
#include <avr/io.h>
#include <util/delay.h>
// #include <stdlib.h>
// Genereer een random nummer tussen 1 en 6.
// int dobbel () {
// return rand() % 6 + 1;
// }
void initADC () {
ADMUX |= (1 << REFS0); ... |
C | #include <stdlib.h>
#include <stdio.h>
void readFile(char *path);
// Main program
int main(int argc, char *argv[]) {
if (argc == 1) {
printf("No filename provided\n");
return 0;
} else if (argc >= 2) {
for (int i = 1; i < argc; ++i) {
readFile(argv[i]);
}
return 0;
}
}
void readFile(char *path) {
FI... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line.c :+: :+: :+: ... |
C | #include "testUtils.h"
#include "stack_using_link_list.h"
#include <stdlib.h>
Stack *start;
typedef char String[256];
void setup(){
start = create_link_list();
}
void test_for_create_Stack(){
ASSERT(NULL == start->head);
ASSERT(0 == start->size);
}
//========================Integer===========... |
C | #include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main(){
int number;
srand(time(0));
number = rand() % 100 + 1;
// printf("%d", number);//
int guess,nguess;
nguess = 1;
do
{
printf("enter the guess\n");
scanf("%d", &guess);
if(guess<number){
printf("higher... |
C | /*
* File: main.c
* Author: Robert N.
*
* Created on 11 listopada 2015, 12:44
*/
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
/*
* build: gcc -I/usr/include -L/usr/lib64 main.c -lpthread
*/
const int SIZE = 800;
const int SIZE_2 = 5; // 800/150 = 5
const int MAX_PEOPLE_I... |
C | #include<stdio.h>
void main()
{
int a[5][5],i,j,n;
printf("enter the matrix rangei,j");
scanf("%d%d",&i,&j);
for(i=0;i<4;i++)
{
for(j=0;j<4;j++)
{
scanf("%d",&a[i][j]);
}
}
for(i=0;i<4;i++)
{
printf("%d",a[i][4]);
}
for(i=0;i<4;i++)
{
printf("%d",a[i][3]);
}
fo... |
C | // Author: Anthony Huynh
// Class: CS 344 - Operating Systems
// Project: Program 3 - smallsh
// Date Due: 11/20/2019
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <signal.h>
#define PROMPT_RE... |
C | /*
pcspkr - listen to pcm sound over the internal pc speaker
Written in 2014 by <Ahmet Inan> <xdsopl@googlemail.com>
To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any w... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_itoa.c :+: :+: :+: ... |
C | /**
* Malloc Lab
* CS 241 - Spring 2019
*/
#pragma once
typedef struct _alloc_stats_t {
unsigned long long max_heap_used;
unsigned long memory_uses;
unsigned long long memory_heap_sum;
} alloc_stats_t;
#ifdef CONTEST_MODE
// timeout in contest modes in seconds
#define TIMER_TIMEOUT 30
// Memory Limit... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_args.c :+: :+: :+: ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_put_pixel_to_image.c :+: :+: :+: ... |
C | // Write a C program to find the area of parallelogram
#include <stdio.h>
int main()
{
float b,h,area;
printf("Enter base & height of parallelogram\n");
scanf("%f %f",&b,&h);
area=b*h;
printf("Area of the parallelogram is %f",area);
}
/*Output:
Enter base & height of parallelogram
4 5.5
Area of the par... |
C | #include <stdlib.h> /* exit func */
#include <stdio.h> /* printf func */
#include <fcntl.h> /* open syscall */
#include <getopt.h> /* args utility */
#include <sys/ioctl.h> /* ioctl syscall*/
#include <unistd.h> /* close syscall */
#include <string.h>
#include <stdint.h>
#include <ctype.h>
#include ... |
C | #include <stdio.h>
int m, n; //m is length of x sequence, n is length of y sequence
char x[110];
char y[110];
float gap_p, mis_p;
float opt[110][110];
char x_r[110], y_r[110] = { 0, };
//x_r is optimal alignment of x sequence, y_r is optimal alignment of y sequence.
typedef struct {
int r;
int c;
}visited;
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main () {
int s=0,aux,trocas,cont,l,n,trem[51];
scanf("%d",&n);
while (n>0){
scanf("%d",&l);
for(cont = 0;cont<l;cont++){
scanf("%d",&trem[cont]);
}
trocas = 1;
while (trocas > 0){
trocas = 0;
for (... |
C | /*
* EEPROM.c
*
* Created: 22-12-2020 23:42:49
* Author: ahmed
*/
#include "EEPROM.h"
void EEPROM_write(u16 Address, u8 Data)
{
while(EECR & (1<<EEWE));
EEAR = Address;
EEDR = Data;
EECR |= (1<<EEMWE);
EECR |= (1<<EEWE);
}
u8 EEPROM_read(u16 Address)
{
while(EECR & (1<<EEWE));
EEAR = ... |
C | #include <stdio.h>
#include <math.h>
int main() {
// https://www.mathscareers.org.uk/article/calculating-pi/
// https://en.wikipedia.org/wiki/Leibniz_formula_for_%CF%80#Notes
long double pi;
long double num = 0.0;
long double sign = 1.0;
long long n;
int i;
// ask for number of reps
printf("\nEnter th... |
C | /*******************************************************************************
* *
* FILE: testScanner.c *
* *
* PURPOSE: Driver program to test sca... |
C | /* LC-2K Instruction-level simulator */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define NUMMEMORY 65536 /* maximum number of words in memory */
#define NUMREGS 8 /* number of machine registers */
#define MAXLINELENGTH 1000
// Basic struct
typedef struct stateStruct {
int pc;
int mem[NUMMEMORY];
i... |
C | /*
* _2_LED_3_.c
*
* Created: 2018-04-11 오전 9:37:26
* Author: 17
*/
#define F_CPU 14745600L
#include <avr/io.h>
#include <util/delay.h>
int main(void)
{
uint8_t ledData; DDRA=0xff; ledData=0x7f;
while(1)
{
PORTA=ledData;
_delay_ms(500);
ledData=ledData>>1;
ledData=ledData|0b10000000;
if(ledData==0x... |
C | /* Test: strncpy.c
Simple test of strncpy
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
int main(argc,argv)
int argc;
char **argv;
{
char *a = "This is a long string";
char *b = "short";
char *c = "abcde";
char *d;
d = strncpy( a, b, 10 );
if( d != a )
return 10;
... |
C | #include<stdio.h>
int main()
{
int character;
printf("Enter the character:");
scanf("%ch",&character);
if(('A'&&'Z')||('a'&&'z'))
{
printf("Alphabet");
}
else
{
printf("not");
return 0;
}
}
|
C |
#define EE_DEVICE_ADDR 0xA0
#define SDA PIN_C13
#define SCL PIN_D9
#define IIC_READ 1
//--------------------------------------------------------------------------
void IIC_Delay(void)
{
delay_us(2);
}
//--------------------------------------------------------------------------
void init_i2c(void)
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
/*
* [Basic Idea] Use DP
*/
typedef unsigned int pos_value_t;
typedef unsigned long tree_length_t;
typedef struct dp_table_entry {
tree_length_t dpe_min_tree_length;
pos_value_t dpe_x;
pos_value_t dpe_y;
} dp_table_entry;
#... |
C | /*subfile: polygn.c ********************************************************/
/* */
/* This software was developed at the National Institute of Standards */
/* and Technology by employees of the Federal Government in the */
... |
C | void get_axes(VEC3F wp1, VEC3F wp2, VEC3F wp3, VEC3F tp1, VEC3F tp2, VEC3F tp3, VEC3F *A, VEC3F *B, VEC3F *C)
{
VEC3F wd1, wd2, wd3, td1, td2, td3;
VEC3F wn = NORMALIZED_VEC3F(vec3f_normal(wp1, wp2, wp3)), tn = vec3f(0.0, 0.0, 1.0);
tn.z = fabs(tn.z);
float k;
wd1 = VEC3F_DIFF(wp1, wp2);
wd2 = VEC3F_DIFF(wp2, w... |
C | //**************************************************//
//**This Header File is used in combination********//
//**with a dynamic Library and must be rewritten**//
//**if you want to use it for another purpose****//
//**********************************************//
//******************************************//
... |
C | #include "holberton.h"
#include <stdlib.h>
/**
* _strdup - Returns pointer to copy of string given as param
* @str: Source string
*
* Return: NULL if insufficient memory, ptr to new string otherwise
*/
char *_strdup(char *str)
{
char *new_str;
int i;
int length = 0;
if (!str)
return (NULL);
for (i = 0; s... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#define FLAGSIZE 64
/* gcc rand_word.c -zexecstack -fno-stack-protector -o ctf_binary -m32 */
/* V1: always chooses the same "random" word and format str vuln */
char* choose_random_word(const char *filename) {
FILE *f;
size_t l... |
C | /*
Author: Pakkpon Phongthawee
LANG: C
Problem: Rhombus
*/
#include<stdio.h>
int main(){
int i,j,input,n,m;
scanf("%d",&input);
for(i=0;i<=input/2;i++){
for(j=i;j<input/2;j++){
printf(" ");
}
for(j=0;j<i*2+1;j++){
printf("*");
}
printf("\n");
... |
C | #include <stdlib.h>
#include <stdio.h>
int factorial(int n)
{
if (n == 0)
return 1;
return n * factorial(n - 1);
}
int main(int argc, char **argv)
{
int n = atoi(argv[1]);
printf("factorial(%d) = %d\n", n, factorial(n));
}
|
C | #include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#inc... |
C | /* C Programming A Modern Approach
* Chapter 5
* Exercise 2
*
*Asks the user for a 24-hour time, then displays the time in 12-hour form.
*
* Author: Alex Perkins
* Dat... |
C | #include<stdio.h>
unsigned replace_byte(unsigned x,unsigned char b,int i);
int main()
{
unsigned x=0x12345678;
char b=0xab;
printf("%#x\n",replace_byte(x,b,0));
printf("%#x\n",replace_byte(x,b,2));
return 0;
}
unsigned replace_byte(unsigned x,unsigned char b,int i)
{
x&=~(0xff<<(i*8));
x+=((int)b)<<i*8;
return... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <pthread.h>
#define ORDER 9
typedef enum{false, true}bool;
typedef struct{int x; int y;}point;
int matrix[ORDER][ORDER];
int emptys_size;
point* emptys;
bool volatile foundSolution;
bool volatile finishProgram;
int volatile id_first;
int convertChar... |
C | 3.6 Loops - Do -While
itoa : 숫자를 문자로 변환하는 프로그램
#include <stdio.h>
//함수정의 : 정수n과 문자형배열s를 인자로 가지고 있는 itoa함수
void itoa (int n, char s[])
{
//변수 i는 do문의 인덱스 값으로 시작 위치값을 알려준다
//변수 sign는 변환하고자 하는 정수값을 가지고있다
int i, sign;
// 배열개수n을 sign에 저장시킨 값이 0보다 작으면 -n을 n에 저장시켜라
// 음수이면 양수로 만든다
if ((sign = n) < 0)
n = -n;
// i의 시작... |
C | /*
COMPILE WITH -lreadline
you'll also need to install libreadline-dev
*/
#include "hash-table.h"
#include <stdio.h>
#include <stdlib.h>
#include <readline/readline.h>
#include <readline/history.h>
int _main(table t)
{
char *line, *instr, *key, *val;
node *n;
while ((line = readline("> ")) != NULL)
... |
C | #include "holberton.h"
/**
* reverse_array - Short description, single line
* @a: Description of parameter n
* @n: Description of parameter n
* Return: 0
*/
void reverse_array(int *a, int n)
{
int i = n - 1, j = 0, tmp = 0, tmp2 = 0;
for ( ; i > (n / 2); i--, j++)
{
tmp = a[i];
tmp2 = a[j];
a[i] = tmp2;
a[j... |
C | #include <stdio.h>
#include <stdlib.h>
int main() {
int i =10;
int *ptr_i = &i;
int **ptr_pi = &ptr_i;
printf("The value at pointer of i is : %d\n",*ptr_i);
printf("The address at pointer of i is %u \n", ptr_i);
printf("The value of pointer of pointer of i at 2* is : %d\n",**ptr_pi);
printf... |
C | #include "kernel/param.h"
#include "kernel/types.h"
#include "kernel/stat.h"
#include "user/user.h"
#include "kernel/fs.h"
#include "kernel/fcntl.h"
#include "kernel/syscall.h"
#include "kernel/memlayout.h"
#include "kernel/riscv.h"
//
// Tests xv6 system calls. usertests without arguments runs them all
// and userte... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main(){
int loop=0;
FILE * file;
char filename[255];
char str[1024];
printf("Veuillez introduire le nom de fichier\n");
scanf(" %[^\n]",filename);
file = fopen(filename,"w");
if(file != NULL){
fclose(file);
... |
C | #include <unistd.h>
#include <stdio.h>
int main(void)
{
int pid;
pid = get_plog_size();
printf("returned: %d\n",pid);
return 0;
}
|
C | #include<stdio.h>
int main() {
//&연산자 &(주소값을 계산할 데이터)
/*int* p;
int a;
p = &a;
printf("%p", p);*/
/*int a;
a = 2;
printf("%p", &a);*/
/*int* p;
int a;
p = &a;
printf("포인터 p에 들어 있는 값 : %x \n", p);
printf("int 변수 a 가 저장된 주소 : %x \n", &a);
printf("int 변수 a 가 저장된 주소 : %x \n", &a+1);*/
//*연산자의 이용
//in... |
C | /*Escreva uma função que dado dois números retorne o maior.*/
int main(void) {
int a, b;
printf ("Digite um número:\t");
scanf ("%d", &a);
printf ("Digite outro número:\t");
scanf ("%d", &b);
if (a > b){
printf ("%d é maior", a);
}else{
if ( b > a){
printf ("%d é maior", b);
}else{
p... |
C | #include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
void *print_message_func( void *ptr );
int main()
{
pthread_t thread1, thread2;
const char *msg1 = "Thread 1";
const char *msg2 = "Thread 2";
int ret1, ret2;
ret1 = pthread_create( &thread1, NULL, print_message_func, (void *)msg1);
if (ret1) {
fprin... |
C | #include<stdio.h>
#include<conio.h>
#include<alloc.h>
struct node
{
int data;
struct node *next;
};
struct node *temp,*start,*head=0;
int n;
int ch;
void main()
{
void cr();
void printlist();
while(1)
{
printf("\n\t\t\t MENU");
printf("\n \t\t----------");
printf("\n 1.CREATE NODE");
printf("\n 2.PRINTlIST");
printf("... |
C | #include<stdio.h>
#include<stdlib.h>
#include"mckp.h"
int P_inc,C_inc;
int main(void){
int i;
Fraction *t_profit;
Vector **R;
structures_init();
DP_prepare();
DP_solve();
R = MCKP_prepare();
solve(R);
if( debug )printf("\n----------------------------Problem Solved!-----------------... |
C | #include "util.h"
enum
{
DT_UNKNOWN = 0,
# define DT_UNKNOWN DT_UNKNOWN
DT_FIFO = 1,
# define DT_FIFO DT_FIFO
DT_CHR = 2,
# define DT_CHR DT_CHR
DT_DIR = 4,
# define DT_DIR DT_DIR
DT_BLK = 6,
# define DT_BLK DT_BLK
DT_REG = 8,
# define DT_REG DT_REG
DT_LNK = 10,
# define DT_LNK DT_L... |
C | /*
* thread.c
*
* Created on: Apr 27, 2018
* Author: j.zh
*/
#include "thread.h"
#include "lteLogger.h"
// -------------------------------
int ThreadCreate(void* pEntryFunc, ThreadHandle* pThreadHandle, ThreadParams* pThreadParams)
{
#ifdef OS_LINUX
if (pThreadHandle == 0 || pEntryFunc == 0) {
... |
C | bool isPalindrome(char* s) {
char *start = s, *end = s;
if (*s == '\0')
return 1;
while (*(end+1) != '\0')
end++;
while (start <= end){
if (!(*start >= '0' && *start <= '9') && !(*start >= 'A' && *start <= 'Z') && !(*start >= 'a' && *start <= 'z')){
start++;
continue;
}
if (!(*end >= '0' && *e... |
C | /*
* dio.c
*
* Created on: Aug 30, 2020
* Author: H
*/
#include "avr/io.h"
#include "../Infra_Structure/AVR_Reg.h"
#include "../Infra_Structure/Common_Macros.h"
#include "../Infra_Structure/Std_Types.h"
#include "DIO.h"
#include "Dio_Cfg.h"
//#define NULL 0
#ifndef NULL
#define NULL ((void *) 0)
#endif
/*_... |
C | #ifndef IO_H
#define IO_H
#include <stdint.h>
inline void io_outb(uint16_t port, uint8_t val)
{
asm volatile(
"outb %0, %1\n"
:
: "a"(val), "Nd"(port)
);
}
inline void io_outw(uint16_t port, uint16_t val)
{
asm volatile(
"outw %0, %1\n"
:
: "a"(val), "Nd"(port)
);
}
inline voi... |
C | #include <stdio.h>
#include <conf.h>
#include <kernel.h>
#include <proc.h>
int c=0, sp=0;
extern struct pentry proctab[NPROC];
void printprocstks(int priority) {
printf("void printprocstks\(int priority\)\n");
for (c=0; c < NPROC; c++) {
if (priority < proctab[c].pprio) {
printf("Process [%s]\n", proctab[c].pna... |
C | #include "lists.h"
/**
* get_dnodeint_at_index - finds the nth node of a linked list
*
* @head: pointer to head of list
* @index: index of node to get
* Return: node at index
*/
dlistint_t *get_dnodeint_at_index(dlistint_t *head, unsigned int index)
{
dlistint_t *temp;
unsigned int i;
for (temp = head, i = 0;... |
C | //ref: http://www1.cts.ne.jp/~clab/hsample/Math/Math5.html
#include <stdio.h>
#include <math.h> /* exp( )pow( )で必要 */
double CalPois(double a, double n);
double Fact(double n);
void test(void);
/* a分間にn回起きる確率(ポアッソン分布)を計算する */
double CalPois(double lambda, double k)
{
return (exp(-lambda) * pow(lambda, k) / F... |
C | /*
** EPITECH PROJECT, 2020
** load_crosshair
** File description:
** load crosshair in sprite
*/
#include "my.h"
void load_crosshair(window_t *window)
{
sfIntRect pos = {0, 0, 140, 140};
sfTexture *t_cross = sfTexture_createFromFile("assets/crosshair.png", &pos);
window->s_crosshair = sfSprite_create();... |
C | #pragma once
#ifndef NETWORKCOMMANDS_H
#define NETWORKCOMMANDS_H
#include "Drawing.h"
#pragma region structures
static enum command_ids
{
SHUTDOWN = 0,
REGISTER,
LOGIN,
NEW_SOLO_GAME,
NEW_DUO_GAME,
NEW_MOVE,
REGISTER_OK,
REGISTER_ERROR,
LOGIN_OK,
LOGIN_ERROR,
GAME_BEGIN,
GAME_END,
MOVE,
MOVE_HIT,
MOV... |
C | #include<stdio.h>
#include<stdlib.h>
#include<signal.h>
#include<sys/types.h>
#include<unistd.h>
#include "consulta.h" //include the typedef of Consulta, defined in file consulta.h
int waiting_list = 0;
int n;
int verificar_ficheiro_pedido_consultas_existe(){
FILE *file;
file = fopen("PedidoConsulta.txt", ... |
C | #include <stdio.h>
int main()
{
int xValue = 5;
int yValue = 3;
int result = xValue * yValue % 14 + yValue;
int smallResult = 10 - yValue;
printf("the result is: %i \n", result);
printf("the small result is: %i \n", smallResult);
return 0;
}
|
C | #include <stdio.h>
int main ( ) {
//prompt for input and gets the key from the terminal
int note;
int i;
printf("Enter a note (in pitch-class number,: 0 - 11): ");
scanf("%d", ¬e);
if (note < 0) {
printf("Only positive number.\nEnter a note again (0 - 11): ");
scanf("%d", &no... |
C | #include <assert.h>
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include "osstate.h"
#include "command.h"
#include "commands.h"
#include "datecmds.h"
/* Print out localtime in the current date format. */
HANDLECOM(date) {
/* Time values. */
t... |
C | /*
** EPITECH PROJECT, 2020
** NWP_myteams_2019
** File description:
** logout
*/
#include "mylib.h"
#include "command.h"
void c_logout_ctrlc_exec(server_t *server, client_t *client,
char *uuid, char *name)
{
uuid = client->user->uuid_str->to_str(client->user->uuid_str);
name = client->user->name->to_str(clie... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<unistd.h>
#include <unistd.h>
#include <sys/wait.h>
char *commands[] = { "cd", "help", "exit"}; //Commands to be searched in bin
//Iterate through commands to see what user is asking for
int check_command(char **args){
for(int commandNumber = 0; ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.