language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
#include "monster.h"
struct monster create_monster(int eyes, int arms, double h, int tails){
struct monster m;
m.numEyes = eyes;
m.numArms = arms;
m.height = h;
m.numTails = tails;
return m;
}
|
C | #include <stdio.h>
#include <stdlib.h>
main(){
int n;
printf("Quantas linhas? ");
scanf("%d",&n);
for(int L=1;L<=n;L++){
for(int c=1;c<=n;c++){
if(L==c){
printf("%d ",L);
}else{
if(L>c){
printf("%d ",c);
}else{
printf("%d ",L);
}
}
}
printf("\n");
}
system("pause");
}
|
C | /*
** smoothness estimation based on
** Forman et al (1995), MRM, 33:636-647
**
** G.Lohmann, Aug. 2007
*/
#include <viaio/Vlib.h>
#include <viaio/VImage.h>
#include <viaio/mu.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define SQR(x) ((x)*(x))
#define ABS(x) ((x) > 0 ? (x) : -(x))
extern int i... |
C | https://blog.csdn.net/lilichang11106/article/details/84069357
1.信号量
#include <linux/semaphore.h>
struct semaphore sem;
sema_init(&sem, count);
void down(struct semaphore *sem) //如果不能获取,切换状态至TASK_UNINTERRUPTIBLE*/
int down_interruptible(struct semaphore *sem)
返回0:成功获得信号量
返回-EINTR:没有获得信号量
void up(struct semaphore *sem);
... |
C | #include<stdio.h>
int value;
void show()
{
printf("\n Value : %d \n",value);
}
void increment()
{
value += 110;
}
int main()
{
show();
value = 112;
show();
increment();
show();
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <glob.h>
#define PAT "/etc/pass*"
int errfunc__(const char *errpath,int errno)
{
puts(errpath);
fprintf(stderr,"ERROR MSG:%s\n",strerror(errno));
return 0;
}
int main(int argc,char **argv)
{
glob_t globres;
int err,i;
err = glob(PAT,0,errfunc__,&globres);
... |
C | #include "functions.c"
#include <stdlib.h>
#include <stdio.h>
int main(){
double omega_g;
omega_g = 1.0;
FILE * integral = fopen("integral_1.0_relglob.dat", "w");
FILE * map = fopen("map_1.0_relglob.dat", "w");
FILE * error = fopen("error_1.0_relglob.dat", "w");
relaksacja_glob(omega_g, ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* list_func.c :+: :+: :+: ... |
C | Ŀ100֮ڵ
#include <stdio.h>
#include "math.h"
#define N 101
main()
{ int i,j,line,a[N];
for(i=2;i<N;i++) a[i]=i;
for(i=2;i<sqrt(N);i++)
for(j=i+1;j<N;j++)
{ if(a[i]!=0&&a[j]!=0)
if(a[j]%a[i]==0)
a[j]=0;}
printf("\n");
for(i=2,line=0;i<N;i++)
{ if(a[i]!=0)
{printf("%5d",a[i]);
line++;}
if(line==10) ... |
C | #include <unistd.h>
void ft_putchar(char c)
{
write(1,&c,1);
}
void ft_putstr(char *str)
{
while (*str)
{
ft_putchar(*str++);
}
}
int main(void)
{
ft_putstr("yoooo");
return (0);
}
|
C | #include<stdio.h>
int main()
{
int a;
printf("Enter your number: ");
scanf("%d",&a);
if((a>>31)==0)
printf("\nPOSITIVE\n");
else
printf("\nNEGATIVE\n");
return 0;
}
|
C | bool
distinct (mongoc_database_t *database)
{
bson_t *command;
bson_t reply;
bson_error_t error;
bool res;
bson_iter_t iter;
bson_iter_t array_iter;
double val;
command = BCON_NEW ("distinct",
BCON_UTF8 (COLLECTION_NAME),
"key",
... |
C | #include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main()
{
short v,c,t,i,n,g,q,r,e,equ_det; /*Declar nine number and an equal determine register.*/
int start_time,end_time; /*Declar register that record start and end running time*/
printf("\n---------------This program is--B9502028--q-crea... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
#include "estructuras.h"
matriz* crearMatriz(int filas, int columnas)
{
matriz* nueva = malloc(sizeof(matriz));
nueva->filas = filas;
nueva->columnas = columnas;
nueva->matriz = malloc(sizeof(int*)*filas);
for (int i... |
C | #include <math.h>
#include <stdio.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#define DIST(xa, ya, xb, yb) sqrt(pow(xa+xb, 2.0f) + pow(ya+yb, 2.0f) )
clock_t start,stop;
void initPoints(int n, int *points){
for (int i=0; i<n; i++){
//points[i*2]=0;
//points[i*2+1]=i;
srand((unsigned int)ti... |
C | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define MAXNUM 700
#define ERROR -999
#define OK 1
struct zhan
{
char *P_ch;
int t;
};
typedef struct zhan *P_shizi;
struct zhan1
{
int *P_num;
int t;
};
typedef struct zhan1 *P_shizi1;
P_shizi create(int m)
{
P_shizi temp;
temp=(P_shizi)m... |
C | /*
** btin_unsetenv.c for 42sh in /home/jeremy/Delivery/PSU_2016_42sh/src/builtins
**
** Made by Jérémy Sid Idris
** Login <jeremy.sid-idris@epitech.eu>
**
** Started on Thu Jan 19 17:49:43 2017 Jérémy Sid Idris
** Last update Thu Jan 19 17:49:43 2017 Jérémy Sid Idris
*/
#include <stdlib.h>
#include <unistd.h>
#inc... |
C | #include <stdio.h>
#include <stdlib.h>
/*Changing all arrays to pointers*/
int
main(int argc, char *argv[])
{
//make everything pointy
int *ages = (int*)malloc(5*sizeof(int));
ages[0] = 23;
ages[1] = 43;
ages[2] = 12;
ages[3] = 89;
ages[4] = 2;
char **names = (char**) malloc(5*sizeof(char *));
names[0] = "A... |
C | #ifndef NFA_H
#define NFA_H
//epsilon transitions
#define EPSILON '\0'
typedef struct transition{
char symbol;
struct stateList* states;
} transition;
typedef struct transNode{
transition* transition;
struct transNode* next;
} transNode;
typedef struct transList{
transNode* head;
} transList;... |
C | // ROT13 Program - encodes a letter used a secret algorithm (hint: it rotates it by 13 characters)
// Written by Jack Renshaw - j.renshaw@student.unsw.edu.au
// 1/04/2016
#include<stdio.h>
#include<assert.h>
char encode(char letter)
{
int ascii = letter; // get the ascii representation of the letter
if(ascii < '... |
C | #include <stdio.h>
#include <time.h>
#include <gsl/gsl_errno.h>
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_odeiv2.h>
typedef struct vdp_params{
double mu;
int count;
int jac_count;
} vdp_params;
int vdp (double t, const double y[], double dydt[], void * params){
// make local variables
vdp_par... |
C | #include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
char *vstrcat(const char *first, ...){
va_list ap;
char *ptr;
int len = strlen(first);
va_start(ap, first);
for(;;){
ptr = va_arg(ap, char*);
if(ptr == NULL){
break;
}
len += s... |
C | #include<stdio.h>
#include<stdbool.h>
#define EPSILON 0.0001
float f(float);
bool check_sign(float, float);
int main()
{
float a, b, c;
int i=0, n, j=0;
printf("Enter the range:\n");
printf("Enter a: ");
scanf( "%f", &a);
printf("Enter b: ");
scanf( "%f", &b);
if(check_sign(f(a), f(b))) {
printf("Incor... |
C | #include <stdio.h>
#include <stdlib.h>
#include "structs.h"
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <sys/mman.h>
#include <time.h>
int main()
{
s_info * info;
int fd=0;
fd=open("../server_mmap/data", 0666);
if(!(fd==-1)){
info=(s_info *)mmap(NULL, 4096, PROT_READ, MAP_SHARED... |
C | /* -------------------------------------------------------------
Machine Science API
(c) Copyright Machine Science, 2007. All rights reserved
Version Date: Mon Dec 17 17:10:43 EST 2007
-----------------------------------------------------------------
==============================================================... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define END 999999
#define BUFFSIZE 512
// variavel global pra controlar linhas lidas do arquivo de log //
int lineCount = 0;
struct Log{
char lineContext[BUFFSIZE];
char timeStamp[15];
char user[30];
char data[BUFFSIZE];
struct Log *next;... |
C |
#include<stdio.h>
int main()
{
/**
* ĸţĿ == ĸţĿ + СĸţĿ
* cow0 0`1ţ
*/
int i = 0;
int year[5] = { 0 };
/** ɼ */
for (i = 0; 0 != year[i - 1]; i++)
{
//scanf("%d", &year[i]);
scanf_s("%d", &year[i]);
}
//ѭʱ i ݣ㣩
/** ݴ */
int inTheEndCows[5] = { 0 }; //ţ
for (int j = 0; j < i-1; ... |
C | #include "unp.h"
#include <netdb.h>
#include <time.h>
int udp_server(const char *host, const char *serv, socklen_t *addrlenp);
int main(int argc, char **argv) {
int sockfd;
if (argc == 2) {
sockfd = udp_server(NULL, argv[1], NULL);
} else if (argc == 3) {
sockfd = udp_server(argv[1], argv[... |
C | #ifdef __ORCAC__
segment "escape____";
#if !defined(TEST)
#pragma noroot
#endif
#pragma optimize 79
//#pragma memorymodel 1
#endif
static struct chars {
unsigned short key;
const char *value;
unsigned short padding;
} table[] = {
#include "chars.h"
};
/*
* specialchar
* handles \(xx escape sequences for specia... |
C | #include <stdio.h>
#include <stdlib.h>
int count = 0, i;
int *dynamic_array = NULL;
int fibonacci(int n){
count++;
if(n < 0)
printf("Term can't be negative");
// Check cache
if(dynamic_array[n] != -1)
return dynamic_array[n];
dynamic_array[n] = fibonacci(n-1) + fibonacci(n-2);
... |
C | #include "libc.h"
#include "display.h"
#include "display_text.h"
// Prints a carriage return on the window
void text_putcr(Window *win) {
if (win->cursor_address == win->end_address) {
text_scroll(win);
}
uint offset = (win->cursor_address - win->start_address) % 160;
win->cursor_address += 160 - offset;
}
// ... |
C | /* Author: Aijaz Ahmad Wani
email :aijazahmad9864@gmail.com
IMCA (SEM-2)
Subject : DATA STRUCTURES*/
//Linear search
#include <stdio.h>
#include <stdlib.h>
#define n 5
int linear_search(int*,int);
int main()
{
int a[n];
int i,search,l;
printf("Enter array elements : ");
for(i=0;i<n;i++)
{
sc... |
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 filas;
int columnas;
printf("Ingrese el numero de filas\n");
scanf("%d", &filas);
printf("Ingrese el numero de columnas\n");
scanf("%d", &columnas);
int matriz1[filas][columnas];
int matriz2[filas][columnas];
int matrizResultado[filas][column... |
C | #include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int sgn(float h)
{
if(h>0)return 1;
else if(h<0) return -1;
else return 0;
}
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
float a,b,c;
scanf("%f%f%f",&a,&b,&c);
float d=(b... |
C | #include "holberton.h"
/**
* main - multiplies two positive numbers, passed in as args
* @argc: int count of number of arguments provided to program
* @argv: double pointer to array with program name and arguments
*
* Return: 0 if successful, exit status of 98 on failure
*/
int main(int argc, char *argv[])
{
u... |
C | //Ȩ
BOOL EnableShutdownPriv(){
HANDLE hToken = nullptr;
TOKEN_PRIVILEGES tkp = {};
BOOL bRet = FALSE;
do{
// Get a token for this process.
if (!OpenProcessToken(GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
break;
if (!Lo... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAX_SIZE 100
int main(int argc, char const *argv[])
{
char *filename = "test.txt";
FILE *pfile = fopen(filename,"r");
char *str = NULL;
str = (char *)malloc(50 * sizeof(char));
if(str)
{
while(fgets(str, MAX_SIZE - 1, pfile) != NULL){
print... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdarg.h>
#include <netinet/in.h>
#include <unistd.h>
#include <limits.h>
#include <signal.h>
#include <poll.h>
#include "server.h"
#include "client.h"
#include "chatroom.h"
#include "file_entry.h"
#include "msg_handlers.h"
#include "status.h"
#inclu... |
C | #include "../../../test_common.h"
#include <signal.h>
void runSuccess() {
sigset_t set[3];
sigorset(&set[0], &set[1], &set[2]);
}
void runFailure() {
sigset_t set[3];
sigorset(NULL, &set[1], &set[2]);
}
void runFailure1() {
sigset_t set[3];
sigorset(&set[0], NULL, &set[2]);
}
void runFailure... |
C | #include<stdio.h>
int main()
{
int a,b,c,s=0,r,n;
scanf("%d",&n);
while(n--)
{
scanf("%d%d%d",&a,&b,&c);
a+=b;
for(;a>c-1;)
{
r=a%c;
s+=a/c;
a=(a/c)+r;
}
printf("%d\n",s);
s=0;
}
return 0;
} |
C | #include <stdio.h>
#include <string.h>
void sorteio (char * s, int sor)
{
int i,x,j;
j = strlen(s);
srand( (unsigned)time(NULL) );
for (i=1; i<=sor; i++)
{
x = rand() % j;
if (s[x]==' ') continue;
if (s[x]>=65 && s[x]<=90)
{
s[x]=(int) s[x] + 32;
... |
C | /******************************************************************************/
/**
@file
@author Kris Wallperington
@brief Implementation of an in-place, recursive quicksort written by the author.
@copyright Copyright 2016
The University of British Columbia,
IonDB Project Contributors (see AUTHORS.md)
@par
... |
C | #include <stdio.h>
#include <limits.h>
int main( void )
{
int charBits = sizeof(char) * CHAR_BIT;
int unSignCharBits = sizeof(unsigned char) * CHAR_BIT;
int intBits = sizeof(int) * CHAR_BIT;
int unSignIntBits = sizeof(unsigned int) * CHAR_BIT;
int longBits = sizeof(long) * CHAR_BIT;
int unSignLongBits = s... |
C | #include <assert.h>
#include <stdlib.h>
#include <pthread.h>
#include "array.h"
typedef struct array
{
void** array_elements;
size_t array_capacity;
size_t array_count;
pthread_rwlock_t rwlock;
} array_t;
/*private section*/
size_t array_find_first_private(array_t* array, const void* element, size_t start_pos);
... |
C | #include<stdio.h>
#include<stdlib.h>
int main ( void )
{
int newline = 1;
int ch;
int line = 1;
while(( ch = getchar()) != EOF )
{
/* 如果是一个新的行就打印行号 */
if(newline != 0)
{
printf("%d:",line);
newline = 0;
}
/* 如果遇到一个换行符表明是一个新的行 */
if( ch == '\n')
{
line++;
newline = 1 ;
}
putchar(... |
C | #include "Set.h"
#include "number.h"
int main()
{
// *******************************************
//
// THIS main, which is what you'll be responsible
// for completing for both the characteristic vector
// AND List approach.
//
// *******************************************
Set sets... |
C | #include "bathroomSim.h"
void *individual(void *arg) {
pinfo *m = (pinfo *) arg;
//intialize variables needed for stats
int min_wait = m->min;
int max_wait = m->max;
int avg_wait = m->avg;
min_wait = 999999999; //intialize to a large number
max_wait = 0;
avg_wait = 0;
int trip = m->loopcount;
... |
C | #include <stdio.h>
#include <limits.h>
main()
{
static const int LIMIT = 128;
static const int LENGTH = 64;
int r;
int i;
FILE *x_file = fopen("x.txt", "w");
FILE *y_file = fopen("y.txt", "w");
FILE *z_file = fopen("z.txt", "w");
srand(time(NULL));
for (i = 0; i < LENGTH; i++)
{
int... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAXN ((int)1e5)
char stk[MAXN+10];
int N;
int sp;
void push(char c){
stk[++sp] = c;
}
void pop(){
sp--;
}
char top(){
return stk[sp];
}
int empty(){
return sp == 0;
}
int size(){
return sp;
}
int Solve(char* w){
memset(stk, 0, s... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* conv_o.c :+: :+: :+: ... |
C | #include <stdio.h>
int main() {
int su;
printf("정수 0~6 사이 숫자 입력 ==> ");
scanf("%d", &su);
switch(su) {
case 0 : printf("Sunday\n"); break;
case 1 : printf("Monday\n"); break;
case 2 : printf("Tuesday\n"); break;
case 3 : printf("Wednesday\n"); break;
case 4 : printf("Thursday\n"); break;
case 5 : printf("Frid... |
C | #include "lists.h"
/**
* _strlen - Count the length of a string.
* @s: String.
* Return: Length.
*/
int _strlen(char *s)
{
int c;/*Counter of characters*/
for (c = 0; s[c]; c++)
{
;
}
return (c);
}
/**
* add_node - Add a new node at the beginning of a list_t list.
* @head: Pointer to pointer head of the l... |
C | //Wesley Smith
//9-20-19
//Lab 3 Interest Calculator
#include <stdio.h>
#include <math.h>
/* This program will take a user input value for
* an initial amount borrowed, annual interest rate
* and number of payments to simulate a customized
* loan amortization table*/
double calculate(double p, double i, double pa... |
C | #include "holberton.h"
/**
* print_diagonal - Prints diagonal lines
* @n: line long parameter
* i: parameter
* j: parameter
*/
void print_diagonal(int n)
{
int i, j;
if (n > 0)
{
for (i = 0; i < n; i++)
{
j = 0;
while (j < i)
{
_putchar(32);
j++;
}
_putchar('\\');
_putchar('\n');
}
}... |
C | #include <stdio.h>
int main()
{
long a,b,i1,i2,n1,n2;
scanf("%ld %ld",&a,&b);
for (i1=1;i1<=1000000;i1++)
{
//printf("A");
if(a%i1==0&&b%i1==0)
n1=i1;
}
for (i2=1;i2<=1000000;i2++)
{
//printf("B");
if(i2%a==0&&i2%b==0)
{
n2=i2;
b... |
C | #include <stdio.h>
#include <stdlib.h>
#include <assert.h>
typedef struct element element;
struct element
{
int val;
element *next;
element *previous;
};
// declarations des fonctions
element *cons_list();
void add_fst_list(element *L, int v);
void add_lst_list(element *L, int v);
int isempty_list(element... |
C | #pragma once
/*
Logic For Chord Finder:
There is an array of 12 elements, for each note in the 12-tone scale:
[ A, A#, B, C, C#, D, D#, E, F, F#, G, G#]
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
Major Third: notes[index+4] % 12
Minor Third: notes[index+3] % 12
Chords based on triads (each triad is based on t... |
C | #include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv) {
int cont;
cont = (argc-1);
printf("Olá, %s\n", argv[1]);
printf("Número de entradas: %d\n", cont);
return 0;
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ast_constructor.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<stdlib.h>
int main()
{
int i, n, sum=0;
printf("Enter a Number to check a Perfect ");
scanf("%d",&n);
for(i=1;i<n;i++)
{
if(n%i==0)
{
sum=sum+i;
}
}
if(n==sum)
{
printf("number %d is a perfect number", n);
}
... |
C | #include<stdio.h>
#include<conio.h>
int main()
{
int num,rem,
printf("enter a number:");
scanf("%d",&num);
temp=num;
while(temp!=0)
{
rem=temp%10;
rev=rev*10+rem;
temp=temp/10;
}
if(rev==num)
{
printf("yes");
}
else
{
printf("no");
}
return 0;
}
|
C | #include <stdio.h>
void print1(int *ptr, int rows);
int main(void)
{
int one[] = {0,1,2,3,4}; //각 배열의 요소를 각 인덱스의 값으로 초기화
printf("-------김규빈 2019038053-------\n");
printf("one = %p\n", one); //one의 이름의 값 출력
printf("&one = %p\n", &one); //one의 주소 출력
printf("... |
C | #include "holberton.h"
/**
* cap_string - function that capitalizes all words of a string
* @c : the distination
* Return: Always 0 (success)
*/
char *cap_string(char *c)
{
int i, j, k, m;
char x[] = " \n\t,.:\"(){}?!";
for (i = 0; c[i] != '\0'; i++)
;
for (m = 0; x[m] != '\0'; m++)
;
for (j = 0; j < i; j++)
{
for (k... |
C | // All Pairs Shortest Path by Floyd Warshall
// Shortest path from every vertex to every other vertex
#include <stdio.h>
int g[101][101];
int d[101][101];
void way (int i, int j)
{
if (!d[i][j])
return;
int k = d[i][j];
way (i,k);
printf ("%d ", k);
way (k, j);
}
int main ()
{
int n,m;
int a,b,x;
int i... |
C | #include<stdio.h>
#include<stdlib.h>
//Estrutura do Nó
struct no{
int info;
struct no *prox;
}typedef no;
//Função Busca
int busca(no *l, int elem, no **pre ){
no *aux;
(*pre) = NULL;
aux = l;
while(aux != NULL && elem> aux->info){
(*pre) = aux;
aux = aux->prox;
}
i... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include "mergeSort.h"
#define length 50000
// chronometer
time_t begin, end;
void testMergeSort(){
int array[length];
initialization(array, length); // initialize array with 'length' randoms values
printf("Initial array : \n");
... |
C | #include<stdio.h>
void main()
{
int n;
int i=0;
int rev = 0;
int temp,rem;
printf("enter the 6 digit no\n");
scanf("%d",&n);
temp == n;
while(n!=0)
{
rem = i%10;
rev = (rev*10)+rem;
i=i/10;
}
if(temp == rev)
{
printf("palindrome\n");
}
else
{
printf("not a palindrome\n");
}
}
|
C | #include <stdio.h>
void crash()
{
char *empty = NULL;
for(int i = 0; i < 100000; i++) {
printf("%c", empty[i]);
}
}
int main(int argc, char *argv[])
{
int age = 100;
int height = 72;
printf("I am %d years old.\n", argv);
printf("I am %d inches tall.\n", height);
crash();
... |
C | #include "libft_tests.h"
#include <ctype.h>
int test_isprint()
{
char *str = "\0\n\31 <~\127";
int i;
i = 0;
while (i < 7)
{
if (isprint(str[i]) != ft_isprint(str[i]))
{
printf(RED);
printf("[K0] : ");
if (str[i] == 0)
printf("Your isprint does not work for c = \\0\n");
else if (str[i] < 32 ... |
C | #include<stdio.h>
int main(){
char s1[]="ABC",s2[10];
int i;
for(i=0;i<10;i++){
s2[i]=s1[i];
if(s1[i]=='\0'){
break;
}
}
printf("s2[]=%s\n",s2);
return 0;
} |
C | #include <iostream>
#include <vector>
using namespace std;
// Cuenta el número de soluciones
int sol = 0;
// función de visualización del tablero
void mostrarTabuleiro(vector<vector<int> > & tab, int N)
{
for(int i = 0; i < N; i++)
{
for(int j = 0; j < N; j++)
{
if(tab[i][j] == 1)
cout << "R\t";
else... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main (void){
FILE *listadecidades;
FILE *listaatualizada;
char caracter;
char linha[30];
listaatualizada = fopen("cidades.txt", "w");
listadecidades = fopen("city.list.json", "r");
if (listadecidades == NULL){
puts("Hou... |
C | /**
* @file bb_printf.c
* @author bbernard
*
* @date 27 mai 2014
*/
#include "bbclib.h"
#include "uart-foo.h"
#define _prbuffer_len 32
/* globals to spare stack usage. */
static char _format_filler = ' ';
static int _format_len = -1;
static char _int_buffer[_prbuffer_len + 1];
static uint32_t _format_value = ... |
C | #include <stdio.h>
#include <string.h>
int main()
{
char s1[4][100], s2[4][100], s3[4][100];
int i;
for (i = 0; i < 4; i++)
{
printf("\nEnter the details for vehicle-%d:-\n", i + 1);
printf(" Enter the vehicle type: ");
// scanf("%[^\n]",s1[i][100]);
gets(s1[i]);
... |
C | #ifndef UTILS_H
#define UTILS_H
#include "strutture.h"
//! Legge un numero da console
/*! @param message testo opzionale da mostrare
* @param ntype il tipo di numero da acquisire
*/
auto getNumberFromConsole(string message="", char nType='u') -> unsigned int
{
string input = "";
cout << message;
getline(cin, in... |
C | #include <stdio.h>
#include "vfs.h"
#include "vfs_fatfs.h"
#include "ff.h"
#include "time.h"
#include "osdep_service.h"
ff_disk_drv disk = {0};
// return drv_num assigned
int FATFS_RegisterDiskDriver(ll_diskio_drv *drv)
{
unsigned char drv_num = -1;
if (disk.nbr < _VOLUMES) {
drv->drv_num = disk.nbr; // record ... |
C | #include "server.h"
char * rootDir; //Root directory
int servPort; //Server port
int commPort; //Command post
pthread_mutex_t mtx; //Mutex to lock queue
pthread_cond_t cond_nonempty; //Condition signaling that the queue is nonempty
Queue * queue; //Queue with pending requ... |
C | /* Serial line operations
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
Written by Stephane Carrez (stcarrez@worldnet.fr)
This file is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version ... |
C | #include <stdio.h>
int main(void)
{
int height = 100;
int low = 1;
int guess = (low + height) / 2;
printf("Pick an integer from 1 to 100.I will try to guess ");
printf("it.\nRespond with a y if my guess is right and with");
printf("\na l if my guess is larger, a s if my guess is smaller.\n");
printf("Uh...is yo... |
C | #include "search_algos.h"
/**
* linear_search - Calls function
* @array: pointer to the first element of the array
* @size: is the number of elements in array
* @value: is the value to search for
* Description: Function that searches for a value in an
* array of integers using the Linear search algorithm.
* Ret... |
C | #include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>
int main(){
/*
int x=1;
fork();
fork();
wait(NULL);
printf("%d\n",getpid());
printf("%d\n",x);
*/
int x;
x=0;
if(fork()==0){
x=1;
}
else{
wait(NULL);
}
printf("pid = %d, x = %d", getpid(),x);
return 0;
} |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_3d_coord.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<omp.h>
long num_steps=10000000;
double steps;
#define num_threads 4
main()
{
int i;
double pi,sum[num_threads],step;
step=1.0/(double)num_steps;
omp_set_num_threads(num_threads);
#pragma omp parallel reduction(+:pi)
{
double x;
int id=omp_get_thread_num();
#pragma omp for
for(i=id;i<nu... |
C | #include "push_swap.h"
t_stack *take_string(char **av)
{
int i;
char **str;
t_stack *head;
t_stack *tmp;
t_stack *new;
i = 0;
head = NULL;
str = ft_strsplit(av[1], ' ');
check_digit_string(str);
if (!ft_strlen(str[0]))
exit(EXIT_FAILURE);
tmp = create_list(ft_atoi_swp(str[0], &head));
head = tmp;
whil... |
C | /*=========================================================================*//**
@file strftime.c
@author Daniel Zorychta
@brief Time formation functions.
@note Copyright (C) 2015 Daniel Zorychta <daniel.zorychta@gmail.com>
This program is free software; you can redistribute it and/or modify
... |
C | #include <stdio.h>
int main()
{
int true = 1;
while (true != 0)
{
printf("Enter a lower case letter:\n");
char c;
c=getchar();
while ((getchar()) != '\n');
if (c >= 'a' && c <= 'z')
{
printf("%c\n", c-32);
true = 0;
}
else if (c >= 'A' && c <= 'Z')
{
printf("Yo... |
C | #ifndef CLIP_H
#define CLIP_H
#include "drawing.h"
#include "font.h"
#include "boolean.h"
typedef int OutCode;
extern int xmin;
extern int ymin;
extern int xmax;
extern int ymax;
extern int CLIP_WIDTH;
extern int CLIP_HEIGHT;
extern const int INSIDE; /* 0000 */
extern const int LEFT; /* 0001 */... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
typedef struct Tree{
int label;
char slice;
double width;
double height;
double x;
double y;
struct Tree *left;
struct Tree *right;
}Tree;
typedef struct _lnode {
Tree * tree;
struct _lnode *next;
}lnode;
Tree * a;
FILE * Open(cha... |
C | #include "libft.h"
void ft_memdel(void **ap)
{
if (ap != NULL && *ap != NULL)
{
free(*ap);
*ap = NULL;
}
}
/* int main()
{
// char s[] = "pika pika";
// ft_memdel(&s);
// printf ("s", )
char *s;
s = (char*)malloc(sizeof(char) * 10);
for (int i = 0; i < 10; i+... |
C | #include<stdio.h>
int main() {
printf("This statement should get printed!\n");
goto label1;
printf("This statement should not get printed :(\n");
label1:
printf("This again will get printed!\n");
return 0;
}
|
C | #include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "broker.h"
#include "util.h"
typedef enum msgType {
DATA_FOR_ME,
WAKEUP_FOR_ME,
SHUTDOWN_FOR_ME,
RECVING,
IDLE
} msgType;
/*
* So that the broker loop can terminate ... |
C | #include<stdio.h>
int main() {
float num,num1,num2;
printf("Find the biggest number\n");
printf("Please input first number: ");
scanf("%f",&num);
printf("Enter second number: ");
scanf("%f",&num1);
printf("Enter third number: ");
scanf("%f",&num2);
if (num>num1&&num>num2)
{
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "windows.h"
//------------------------------------------宣告------------------------------------------
int flag = 0;
float height, //身高
weight, //體重
need_weight, ... |
C |
/* Copyright (c) Mark J. Kilgard, 1994. */
/* This program is freely distributable without licensing fees
and is provided without guarantee or warrantee expressed or
implied. This program is -not- in the public domain. */
/* This test makes sure that if you post a redisplay within a
display callback, anot... |
C | /* ************************************************************************** */
/* LE - / */
/* / */
/* fct.c .:: .:/ . .:: ... |
C | #include <string.h>
#include <stdio.h>
#include <switch.h>
//See also libnx hid.h.
int main(int argc, char **argv)
{
consoleInit(NULL);
printf(CONSOLE_ESC(1;1H) "Press PLUS to exit.");
// Main loop
while(appletMainLoop())
{
//Scan all the inputs. This should be done once for each frame
... |
C | #include "shell.h"
#include <stdio.h>
#include <stdlib.h>
/**
* __free_list_full - frees list_t and all contained pointers
* @head: linked list , list_t
*/
void __free_list_full(list_t *head)
{
list_t *hold = NULL;
while (head != NULL)
{
hold = head;
head = head->next;
/* printf("EXITMEMORY: %s\n", (char ... |
C | #include <stdio.h>
#include <time.h>
#include <inttypes.h>
#include <stdbool.h>
void decompose(uint32_t n);
// Digits of a number
int main(int argc, char* argv[]) {
uint32_t num;
while (true) {
printf("Please input a number: ");
char str[50];
if (fgets(str, 50, stdin) == NULL) {
printf("\n");
... |
C | #include <cs50.h>
#include <stdio.h>
/*
* Author: Lionel Ngoubou
* Purpose: Greet a user by his name.
*/
int main(void)
{
// Prompt user for their name
string name = get_string("What is your name\n");
printf("Hello, %s\n", name);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.