language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <signal.h>
#include <unistd.h>
#define PID_FILE "runtime/ramtits.pid"
int main(void)
{
FILE *fp;
char filename[256];
unsigned pid;
sprintf(filename,"%s",PID_FILE);
if ((fp=fopen(filename,"r")))
{
fscanf(fp,"%u\n",&pid);... |
C | #include <stdio.h>
void bubble_sort(int* a, int n) {
int i, j, k;
for (i = 0; i < n - 1; i++)
for (j = 0; j < n; j++)
for (k = 0; k < n; k++)
if (a[k] > a[j]) {
int temp = a[j];
a[j] = a[k];
a[k] = temp;
}
}
int main() {
int n, i;
printf("Введите размер массива");
scanf("%d", &n);
i... |
C | #include<stdlib.h>
#include<stdio.h>
#include<string.h>
#include"files.h"
void rm_defact_func(FILE *fsource, int magicNumber, char *fname)
{
char buf[256];
FILE *fp;
fp = fopen("temp.mgd", "w");
fprintf(fp, "%d\n", magicNumber);
while(fgets(buf, 256, fsource)) {
if(strstr(buf, "-1") == NULL)
fputs(buf, fp... |
C | #include "set.h"
#define CAPACITY_INCR 2
struct _Set {
void **store;
unsigned int capacity;
unsigned int size;
};
bool set_full(Set *set);
Set *set_new()
{
Set *set = (Set *) malloc(sizeof(Set));
set->store = malloc(CAPACITY_INCR * sizeof(void *));
if (!set->store)
return NULL;
... |
C | /* reset.c -- set box 'b' to be invalid */
#include <limits.h>
#include "geom/box.h"
void box_reset(box_t *b)
{
const box_t invalid = { INT_MAX, INT_MAX, INT_MIN, INT_MIN };
*b = invalid;
}
|
C | #include "libmx.h"
int mx_memcmp(const void *s1, const void *s2, size_t n) {
unsigned char *c_dst = (unsigned char *)s1;
unsigned char *c_src = (unsigned char *)s2;
while (n-- > 0)
if (*c_dst++ != *c_src++)
return (*--c_dst - *--c_src);
return (0);
}
|
C | #include<stdio.h>
#include<stddef.h>
#include<unistd.h>
struct mb{
size_t size;
int fr;
struct mb *next;
};
char memory[10000];
struct mb *list = (void*)memory;
void init()
{
list->size = 10000-sizeof(struct mb);
list->fr=1;
list->next= NULL;
}
void split(struct mb *c,size_... |
C | #include <stdlib.h>
#include <stdio.h>
#include <math.h>
double find_perimeter(double area);
int main() {
//printf("hello world this is cake");
int input_cases, i;
double input;
double result;
scanf("%d", &input_cases);
for(i = 0; i < input_cases; i++) {
scanf("%lf", &input);
... |
C | #include <time.h>
#include <stdlib.h>
int *getRandom(){
static int random [10];
srand((unsigned)time(NULL));
for(int i = 0; i < 10; i++){
random[i] = rand();
printf("%d\n", random[i]);
}
return random;
}
int main ()
{
int *random_pointer = getRandom();
for(int i=0; i <... |
C | #include <stdio.h>
#include <stdlib.h>
#define BUFSIZE 1024
// char buf[BUFSIZE];
//int n;
int copy_stdin2out()
{
int n;
char buf[BUFSIZE];
while((n=read(1,buf,BUFSIZE))>0)
{
write(0,buf,n);
}
}
int main()
{
int pd[2], pid;
pipe(pd);
pid = fork();
if (pid == 0)
{ // in child
dup2(pd[1], 0);
... |
C | #include "my_conv.h"
int my_int2dec(char *dst, int v, unsigned n)
{
int i;
if (n == 0)
return 0;
if (v < 0)
{
i = my_uint2dec(dst + 1, (unsigned)(-v), n - 1);
if (i != 0)
{
*dst = '-';
return i + 1;
}
return i;
}
else
... |
C | #include <stdio.h>
#include <stdlib.h>
#include "math2.h"
#include <time.h>
int main ()
{
int opc;
double a, b, c, d;
while (1)
{
puts ("Digite '1' para calcular a area de um quadrado");
puts ("Digite '2' para calcular a area de um trapezio");
puts ("Digite '3' para calcular a area de um... |
C | #include <stdio.h>
#include <stdlib.h>
void birthday(int number)
{
//ռ Ǭ ȭ ϴ
int year = number / 10000;
int month = number % 10000 / 100;
int day = number % 100;
if (year > 17)
printf("19%d %d %d\n", year, month, day);
else if (year > 0 && yea... |
C | /*
* vmm.c
*
* Created on: 09.07.2012
* Author: pascal
*/
/*
* vmm_SysPMMAlloc(): Rueckgabewerte: 1=Kein freier Speicherplatz mehr vorhanden
*/
#include "vmm.h"
#include "pmm.h"
#include "memory.h"
#include "display.h"
#include "paging.h"
#include "stdlib.h"
#include "string.h"
#include "lock.h"
#include ... |
C | /*program to print the strings of the two-dimensional character array*/
#include<stdio.h>
main ( )
{
char arr[5][10] = {
"riti",
"niti",
"kriti",
"kittu",
"nitin"
};
int i;
for ( i=0;i<5;i++)
{
printf ( " base address = %u",&arr[ i] );
printf ( " string = %s\n",arr[ i] );
}
}
|
C | /*
*Author: Vinit
*Platform: Linux
*Hardware: R-Pi 3b+
*Task: Socket client
*
*/
#include<stdio.h>
#include<stdlib.h>
#include<errno.h>
#include<string.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<sys/un.h>
#include<unistd.h>
struct {
int msg_no;
char str[20];
}soc_payload;
void main(int argc,... |
C | #include<stdio.h>
#include<stdlib.h>
#include<errno.h>
#include<string.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#include<sys/wait.h>
#include<fcntl.h>
#include<pthread.h>
#include<sys/time.h>
int tcp, udp;
void * startKelsa(void *threadNum)
{
... |
C | #include <stdio.h>
#include <string.h>
#include <locale.h>
int nxt_blnk(char* str, int pos);
int main()
{
setlocale(LC_CTYPE, "rus");
char text[100] = {0}; //Тестовый текст
int n;
setlocale(LC_CTYPE, "rus");
printf("Введите текст: \n");
gets(text);
printf("Введите номер сим... |
C | /** @defgroup MleCore Magic Lantern Core Utility Library API */
/**
* @file mlExpandFilename.h
* @ingroup MleCore
*
* This file contains function definitions for expanding a
* UNIX-like filename pathcontaining tilde notation and
* environment variables, plus strftime(3) notation
*
* Notations that are supporte... |
C | #include <stdio.h>
void print_array(int* array, size_t size);
void insert_array(int* array, size_t size, int position, int value);
void remove_array(int* array, size_t size, int value);
void search_array(int* array, size_t size, int value);
void update_array(int* array, size_t size, int position, int value);
int mai... |
C | #include<stdio.h>
unsigned long long people[65]={0},clubs[101]={0};
int stack[65],stop=0,club,target;
void find(int now,unsigned long long num){
if(stop)return;
if(now==target){
for(int i=0;i<target;i++)printf("%d\n",stack[i]);
stop=1;
return;
}for(int i=stack[now-1];i<club;i++){
if((num&clubs[i])==0){
st... |
C | #include "holberton.h"
/**
* print_alphabet_x10 - entry
* @a - number
* @counter - the counter
* function void print_alphabet voi
*/
void print_alphabet_x10(void)
{
char a;
char counter;
for (counter = 0; counter <= 9; counter++)
{
for (a = 'a'; a <= 'z'; a++)
{
_putchar(a);
}
_putchar('\n');
}
}
|
C | #include <stdio.h>
02
#include <stdlib.h>
03
04
struct freq
05
{
06
char *x[64];
07
int y;
08
};
09
10
struct freq array1[100];
11
12
int main()
13
{
14
15
FILE * input;
16
int i,j;
17
char tempWord[] ="hello";
18
input = fopen("random.txt","r");
19
... |
C | #include <stdio.h>
#include <stdlib.h>
#include "utils.h"
int main(void)
{
int n;
long long s;
scanf("%lld", &s);
sp_srand(s);
while (scanf("%d", &n) == 1)
{
Node *list = mk_list(n);
Node *u = list;
for (int i = 0; i < n;)
{
long long sum = 0;
int cnt = 1;
while (u && cnt < 100000)
{
sum +... |
C | /*
** EPITECH PROJECT, 2020
** server
** File description:
** teams gestion
*/
#include "server.h"
void init_next_thread(server_t *server, int i, int k, int j)
{
strcpy(server->teams[i].channel[k].thread[j].thread_content, "NULL");
strcpy(server->teams[i].channel[k].thread[j].thread_title, "NULL");
strcpy... |
C | #include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <string.h>
#include <ctype.h>
#define ARG_INPUT_MAXSIZE 1024000
typedef struct seq
{
int64_t *s;
size_t m;
} seq;
typedef struct sseq
{
seq *seq;
size_t n;
} sseq;
typedef struct uintstruct
{
int64_t *fib;
size_t n;
} uintstruct;
size_t str... |
C |
//2:最长公共子序列
#include<stdio.h>
int main(){
int data[100];
int i,j;
int Max[100];
int n,t,k;
printf("请输入n个数");
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&data[i]);
}
for( i=0;i<100;i++){
Max[i]=1; //给每一个序列点作为右端时的最大序列长度为1
}
for( i=1;i<n;i++){
... |
C | // Calculating aggregate and percentage marks
#include <stdio.h>
int main()
{
float ben, eng, cms, phys, math, avg, per, tol;
printf("Enter the marks in Bengali\n");
scanf("%f", &ben);
printf("Enter the marks obtained in English\n");
scanf("%f", &eng);
printf("Entered the marks obtained in Phy... |
C | /*
* main.c
*
* Created on: Sep 13, 2019
* Author: DR. ADEL
*/
#include "keypad.h"
int main(void)
{
DDRC |= 0x0F; /*PORTB first 4 pins are output pins*/
PORTC &= (0xF0); /*PORTB first 4 pins are cleared at the beginning of the program*/
while(1)
{
uint8 ch = KEYPAD_getKeyPressed();
if(ch >= 0 &... |
C | /*
* i2c_eeprom.c
*
* Created: 11.05.2017 08:41:07
* Author: Stud
*/
#include "i2c_eeprom.h"
#include <avr/io.h>
#include <util/delay.h>
/*
MAKRO ersetzt einen Text
*/
#define TWI_BAUD(F_SYS, F_TWI) ((F_SYS / (2*F_TWI)) - 5)
#define TWI_BAUDRATE 100000
#define TWI_BAUDSETTING TWI_BAUD(F_CPU, TWI_BAUDRATE)
//... |
C | /*
* server.c
*
* Created on: 17 ott 2016
* Author: Federico De Laurentiis
*/
#if defined WIN32
#include <winsock.h>
#else
#define closesocket close
#include <sys/socket.h>
#include <arpa/inet.h>
#include <unistd.h>
#endif
#include <stdio.h>
#include <stdlib.h>
void ErrorHandler(char[]);
void ClearWin... |
C | #include<stdio.h>
int gcd(int a, int b)
{
return b==0?a:gcd(b, a%b);
}
int main()
{
int a, b;
while(scanf("%d%d", &a, &b)!=EOF){
printf("%d\n", gcd(a, b));
}
return 0;
}
|
C | /******************************************************************************
*
* Module: ADC
*
* File Name: adc.c
*
* Description: Source file for the ADC driver
*
* Author: Kyrillos Tharwat
*
*******************************************************************************/
#include "adc.h"
... |
C | // _sense.c
// Monk/Kataan ability
// created by Descartes 21 October 1992
// slightly modified by Bohemund 14 January 1994
#include <std.h>
inherit DAEMON;
int cmd_sense(string str) {
object ob;
object *inv;
int i, skip, which, faith;
string what, Class;
mixed *arr;
if(!str) {
notify_... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#define MYPORT 9023 // the port users will be connecting to
#define MAXBUFLEN 512
int main(void)
{
int sockfd;
struct... |
C | #include "matrix.h"
const uint8_t keyboard[4][4] PROGMEM = { {'1', '2', '3', 'F'},
{'4', '5', '6', 'E'},
{'7', '8', '9', 'D'},
{'A', '0', 'B', 'C'}};
#ifdef INTERRUPT
volatile uint8_t led = 0;
ISR(PCINT0_vect)
{
if(!TST_BIT(PINC,PB0))
led = 2;
else if(!TST_BIT(PINC,PB1))
led = 4;
else if(!TST_BIT(PINC,P... |
C | /* ************************************************************************** */
/* */
/* :::::::: */
/* ps_get_dest_distances.c :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
void error(const char *msg) { perror(msg); exit(1); } // Error function used for reporting issue
int main(int argc, char *argv[]){
//declare variables fo... |
C | #include <stdio.h>
#include <stdbool.h>
int main(){
int a = 10;
double b = 10.5;
printf("%lu\n", sizeof(b)); // double : 64 bits
float c = 10.5;
printf("%lu\n", sizeof(c)); // float : 32 bits
char d = 'a';
char e[] = "Easy way to define string";
bool f = false;
int zero = .9999; ... |
C | struct student
{
int num;
int yu;
int shu;
int sum;
} stu[100000];
int main()
{
int n,i;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d %d %d",&stu[i].num, &stu[i].yu, &stu[i].shu);
stu[i].sum=stu[i].shu+stu[i].yu;
}
int k,e;
for(k=0;k<3;k++){
for(i=n-2;i>=k;i--){
if(stu[i].sum<stu[i+1... |
C | #include "../../includes/math_functions_float.h"
#include "../../includes/verify.h"
#include "float_fmod.h"
int main() {
/* REQ-BL-1130:
* The fmod and fmodf procedures shall return x ,
* if the argument x is +-0 and the argument y is not zero.
*/
float x = 0.0f;
float y = __VERIFIER_nondet_float();
i... |
C | #ifndef _RATING_C_
#define _RATING_C_
#include "conn4.h"
#include "rating.h"
#include <stdio.h> /* printf(), fprintf(), scnaf(), fscanf(), FILE */
#include <string.h> /* strcmp() */
#include <stdlib.h> /* malloc() */
#define MAX_NAME_LENGTH 32
/* Use rentry structure */
typedef struct {
char* name;
unsign... |
C | #include <stdio.h>
//structure outside main (like global variable)
struct student
{
//shchar name [10];
char *name;
int ID;
char dept[10];
float CGPA;
};
int main ()
{
//struct student st1 = {"nil shagor", 1234, "CSE", 4.00};
struct student st1;
printf ("\nEnter name, id, department and cgp... |
C |
#include "json_common.h"
#include <stdlib.h>
#include <string.h>
/*
return string from (*b_i)[0] to delimiter,
setup *b_i to next symbol
*/
char* get_msg_from_stream(char** b_i, char* msg_delimiter)
{
char* r_code = NULL;
char* f_i = strstr(*b_i, msg_delimiter);
if (f_i) {
r_code = (char*)calloc(1, f_i-(*b_... |
C | //2016115572
//Kwon Hyeon Su
//https://www.zerocho.com/category/Algorithm/post/584b9033580277001862f16c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int arr_index=0;
typedef struct vertex{
int x;
int y;
int city;
double distance;
struct vertex* next[99];
struct... |
C | #include "declaracoes.h"
/*------------------------------------------------------------------*/
/* FUNCOES AUXILIARES */
/*------------------------------------------------------------------*/
int calcula_pos_matriz(int NT, int p, int t){
return (p*NT)+t;
}
void le_argumentos(int argc, char **argv, paramet... |
C | #include <stdio.h>
int main(void){
int n;
int cnt=1, temp=1;
scanf("%d", &n);
if(n==1){
cnt=1;
}
else{
for(int i=2; i<=n; i++){
if(temp+(cnt-1)*6<i){
cnt++;
temp=i-1;
}
}
}
printf("%d", cnt);
} |
C | #include <stdio.h>
#include <stdbool.h>
#include <math.h>
#include <time.h>
#include "pow.h"
#include "sha256.h"
#define START 25
#define COUNT 5
void check_hash(char *hash, struct proof *proofs, int sequence, int c, clock_t start) {
for (int i = 0; i < c; i++) {
if (proofs[i].found) continue;
int... |
C | /*
Copyright (C) HWPORT.COM.
All rights reserved.
Author: JAEHYUK CHO <mailto:minzkn@minzkn.com>
*/
#include "hwport_ftpd.h"
static void hwport_ftpd_break_signal(int s_signal);
static void hwport_ftpd_dummy_signal(int s_signal);
static void hwport_ftpd_install_signal(void);
static int hwport_ftpd_load_sy... |
C | #include<stdio.h>
#define N 10
int main() {
static int a[N]= {5,4,3,2,1,9,8,7,6,0};
printf("\nThe array is:\n");
for(int i=0; i<N; i++)printf("%5d",a[i]);
for(int i=0; i<N-1; i++) {
int min=i,j;
for(int j=i+1; j<N; j++)
if(a[min]>a[j])min=j;
int tmp=a[min];
a[min]=a[i];
a[i]=tmp;
}
... |
C | int glob_a;
int glob_b = glob_c;
int A() {
int c = 2;
a = c + 2;
c = c + 1;
c = a + 3;
return c;
}
int B() {
int c, s = 0;
for (c = 0; c < 10; c = c + 1) {
if (c == 3) {
int t = c + 1;
s = s + t;
c = c + a + t;
}
}
return s;
}
void C() {
typedef int a;
typedef a c;
t... |
C | //conversion of infix to postfix
#include<stdio.h>
int prec(char);
int main()
{
char stack[15],postfix[30],exp[30];
int i,top=-1,j=0;
printf("Enter the expression in infix:");
scanf("%s",&exp);
for(i=0;exp[i]!='\0';i++)
{
if((exp[i]>=65 && exp[i]<=90) || (exp[i]>=97 && exp[i]<=122))
postfix[j++]=... |
C | /*
========== licence begin LGPL
Copyright (C) 2002 SAP AG
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any ... |
C | /* Name: Philip Hoddinott
Section: 4
Side: A
Date: 2/29/2016
Gain: 2
Port pin: 1.4
File name: hw7.c
Description: This program reads an analog input, it prints the digital value of the A/D conversion and print the input voltage (in millivolts).
The gain is 2, so the max voltage it can measure is 1.2 volts. It ... |
C | //there is an array a with 10 elements,
//and the number is put in order from small to big.
//input x and find it in a,print its index;if none ,print not found.
#include <stdio.h>
int main()
{
int a[10]={0,1,2,3,4,5,6,7,8,9};
int low,high,mid,x,n=10;
printf("input x:\n");
scanf("%d",&x);
low = 0;
high = n-1;
w... |
C | #ifndef __DIJKSTRA_ARRAY__
#define __DIJKSTRA_ARRAY__
#include "graph.h"
#define INFINITY 1000000000
#define NIL -1
typedef struct queue{
int * array;
unsigned int size;
}queue;
/**
* Initialization of the queue.
*
* This function initializes the queue, adding all nodes
* to the queue.array member, ac... |
C | #ifndef _GRAPH_H_
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#define OK 1
#define ERROR 0
#define TRUE 1
#define FALSE 0
#define GRAPH_INFINITY 65535 /* 65535 */
#define Default_Vertex_Size 10 /*ĬϵĶ*/
#define MAXSIZE 10 /* 洢ռʼ */
typedef int Status; /* StatusǺ,ֵǺ״̬룬OK */
typedef char VertexType; /*... |
C | #include<cstdio>
#include<cstring>
using namespace std;
int main()
{
int lena,lenb,i,j,k,t=0;
char a[100500],b[100500];
int aa[100500],bb[100500],c[200500];
memset(c,0,sizeof(c));
scanf("%s %s",a,b);
lena=strlen(a);
lenb=strlen(b);
c[lena+lenb]=10000;
for(i=0;i<lena;i++)
aa[i]=a[i]-'0';
for(i=0;i<lenb;... |
C | //
// main.c
// Cow Beauty
//
// Created by Freddy Roman Cepeda on 11/13/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#include <stdio.h>
#include <limits.h>
#define path "pageant"//"/Users/Freddy/Desktop/USACO/Cow Beauty/Cow Beauty/pageant"
#define MAXSIZE 50
#define MAXQUEUE 10000
typedef s... |
C | /**
* \defgroup unixsimulator Simulation of the Borg API for UNIX like platforms.
*/
/*@{*/
/**
* @file main.c
* @brief Simulator for Unix like platforms.
* @author Martin Ongsiek, Peter Fuhrmann, Christian Kroll
*/
#ifdef OSX_
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif
#include ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lst_planes_to_tab.c :+: :+: :+: ... |
C |
#include <stdio.h>
long long mem[51];
long long foo(long long i){
if(i == 1)
return 1;
if(i == 2){
return 2;
}
if(mem[i] != -1)
return mem[i];
mem[i] = foo(i-1) + foo(i-2);
return mem[i];
}
int main(){
int j;
for(j=0;j<51;j++)
mem[j] = -1;
long long i;
while(1){
scanf("%lli",&i);
if(i == 0){
return 0... |
C | #include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include "ial.h"
int lenght(string *str) //Funkce, která vrací délu řetězce.
{
return str->length; //Vracíme délku řetězce ze struktury string.
}
string copy(string *str, int i, int j) //Funkce vrací podřetězec z řetěz... |
C | /**
* Copyright (c) 2012-2013, Mattias Frånberg
* All rights reserved.
*
* This file is distributed under the Modified BSD License. See the COPYING file
* for details.
*/
#ifndef __BED_H__
#define __BED_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <plinkio/status.h>
#include <plinkio... |
C | #include<stdio.h>
#include<string.h>
int main()
{
char a[100][100];
int i,now = 0, max = 0;
char temp[100];
strcpy(a[0],"http://www.acm.org/");
while(1)
{
scanf("%s",temp);
if(strcmp(temp,"VISIT")==0)
{
scanf("%s",temp);
printf("%s\n",temp);
now++;
strcpy(a[now],temp);
max=no... |
C | // CIS565 CUDA Raytracer: A parallel raytracer for Patrick Cozzi's CIS565: GPU Computing at the University of Pennsylvania
// Written by Yining Karl Li, Copyright (c) 2012 University of Pennsylvania
// This file includes code from:
// Yining Karl Li's TAKUA Render, a massively parallel pathtracing renderer: http://w... |
C | /*
* C H 9 Q 3
* A program contains the following lines. What does it print?
*/
#include <stdio.h>
/* My guess is that it prints Z. */
int main() {
char ch = 'M', *cp;
cp = &ch;
*cp = 'Z';
putchar(ch);
}
/* It prints Z. */ |
C | #include <stdio.h>
#include <math.h>
int main()
{
int i,j,input,sum;
scanf("%d",&input);
for(i=6; i<=input; i+=2)
{
for(j=2,sum=0; j<sqrt(i); j++)
{
if(i%j==0)
sum+=(j+i/j);
}
sum++;
if(sum == i)
printf("%d\n",sum);
}... |
C | /*
* PRACTICA 3 - ejercicio 09
* Realiza un programa que reciba un número y llame a una función que calcule el
* factorial de ese número, posteriormente con el resultado del paso anterior, debe llamar
* a la función fibonacci que calcule la sucesión de números hasta ese. (realizarlo de dos
* formas, una usando fun... |
C |
/** @file array.h
* @brief Array C function prototypes
*
* This file contains prototpyes of functions written
* for Array C/C++ practice problems using C language
* from GeeksForGeeks.
*
* @author Tropical Sun
* @bug No known bugs.
*/
#ifndef _ARRAY_H
#define _ARRAY_H
/** @brief Find sum of eleme... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "funcs.h"
#include <math.h>
#define PI2 6.28
#ifdef _OPENMP
#include <omp.h>
#else
#define omp_get_thread_num() 0
#endif
void dofilt(ImageF * in_re, ImageF * out_re,ImageF * in_im, ImageF * out_im, ImageF * mask) {
int i,j;
... |
C | #include "holberton.h"
/**
* _sqrt_recursion - return the natural square root of a number
* @n: the number to be square rooted
* Return: the value of n square rooted
*/
int _sqrt_recursion(int n)
{
int x = 1, ans;
ans = _sqrt_helper(n, x);
return (ans);
}
/**
* _sqrt_helper - help return the square root of a... |
C | #include <stdio.h>
typedef struct data {
unsigned int day: 5;
unsigned int month: 4;
unsigned int year: 7;
} date;
int main() {
unsigned int day, month, year;
scanf("%d", &day);
scanf("%d", &month);
scanf("%d", &year);
date Date = {day, month, year % 100};
printf("%d.%d.%d", Date.d... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_all_info_we_can_into_array_of_tlines. :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
//#include "adjacent.h"
//Global Declarations
typedef struct list
{
int node;
int x;
int y;
struct list * next;
} Node;
Node * insert_node(Node * head, int n_Val, int x_val, int y_val);
Node * make_node(int n_val, int x_val, int y_val);
void destroy_list(No... |
C | #include<stdio.h>
void f(int b)
{
static int a;
if(b==1)
a += 10;
else
a = 2;
printf("%d\n", a);
}
int main(void)
{
static int a = 1;
f(0);
f(1);
f(1);
} |
C | /*
* main.c
*
* Created: 2018-03-05 8:33:44 PM
* Author : anssk
*/
#define F_CPU 16000000UL
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include "uart.h"
#include "irsensor.h"
#include "Motor.h"
#include "MACROS.h"
/* **************** FUN PROTOTYPES **************** */
/* NORMAL M... |
C | /* LVB
* (c) Copyright 2003-2012 by Daniel Barker.
* (c) Copyright 2013, 2014 by Daniel Barker and Maximilian Strobl.
* Permission is granted to copy and use this program provided that no fee is
* charged for it and provided that this copyright notice is not removed. */
#include <lvb.h>
/* check pow_wrapper cras... |
C | /** @file */
#ifndef __CCL_UTILS_H_INCLUDED__
#define __CCL_UTILS_H_INCLUDED__
#include <gsl/gsl_spline.h>
#define CCL_MIN(a, b) (((a) < (b)) ? (a) : (b))
#define CCL_MAX(a, b) (((a) > (b)) ? (a) : (b))
CCL_BEGIN_DECLS
/**
* Compute bin edges of N-1 linearly spaced bins on the interval [xmin,xmax]
* @param xmin... |
C | #include <stdlib.h>
#include <assert.h>
size_t CountSetBits(int num)
{
size_t counter = 0;
while (0 < num)
{
num = (num & (num -1));
++counter;
}
return counter;
}
int main()
{
assert(2 == CountSetBits(12));
assert(1 == CountSetBits(8));
assert(1 == CountSetBits(4));
assert(2 == CountSetBits(5));
as... |
C | #include "dispatcher.h"
VOID BuildRequestW(LPCWSTR lpszVerb, LPCWSTR lpszObjectName, LPCWSTR *lplpszAcceptTypes, LPCWSTR lpszReferrer, DWORD flags) {
int i = 0;
WCHAR tmp[MAX_PATH*sizeof(WCHAR)];
ZeroMemory(tmp, MAX_PATH*sizeof(WCHAR));
if(flags & 0x00800000) //INTERNET_FLAG_SECURE
wsprintfW(tmp, L"%s https://... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
typedef struct Node{
int num;
struct Node *prox
}node;
int cont,contador=0;
void inicia(node *TO, node *T1);
int compara(char op[]);
node *aloca();
void insereD(node *T);
void insereE(node *T);
node *retiraD(node *T);
node *retiraE(node *T);
void contagem(node ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_env_utils2.c :+: :+: :+: ... |
C | #include <stdio.h>
int main(void) {
int s[4][5];
int i, j, cnt = 0;
for (i = 0; i < 4; i++) {
for (j = 0; j < 5; j++) {
/*
if (i == 0)s[i][j] = i + 1 + j;
else if (i == 1) s[i][j] = 6 + j;
else if (i == 2) s[i][j] = 11 + j;
else s[i][j] = 16 + j;
*/
s[i][j] = ++cnt;
}
}
for (i = 0; i <... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "slice.h"
//resize resizes slices that need to grow, or that should be shrunk
//
//Slices that are at max capacity are expanded.
//Slices that are less than half full are shrunk.
int resize(struct Slice *slice, unsigned int valueSize) {
if(slice-... |
C | #include"LinkList.h"
//ʼ
LinkList Init_LinkList(){
LList* list = (LList*)malloc(sizeof(LList));
if (list == NULL){
return NULL;
}
list->header.next = NULL;
list->size = 0;
return list;
}
//ָλò
void Insert_LinkList(LinkList list, int pos, LinkNode* data){
if (list == NULL){
return;
}
LList* mlist = (LList... |
C | #include <stdio.h>
#include <malloc.h>
#include "Database.h"
#include "../Util/ScanUtil.h"
/*
* Description: lists the manufacturers in the database
* Returns: void
*/
void listManufacturers(DataBase* database) {
for(int i = 0; i < database->amountOfManufacturers; i++){
Manufacturer* manufacturer = datab... |
C | #include <stdio.h>
// count number of spaces, tabs and newlines
main() {
int nc = 0;
char c;
c = getchar();
while( c != EOF ) {
if(c == '\n' || c == ' ' || c == '\t') {
nc++;
printf("The number of each breaks is %d", nc);
c = getchar();
} else {
printf("You entered something di... |
C | #include <xc.h>
#include <delays.h>
#include <plib/timers.h>
#include "buttons.h"
#include "lcd.h"
#define _XTAL_FREQ 8000000
unsigned char pwm_value = 50;
// void PWM1_setDC(unsigned int dutycycle)
// {
// CCPR1L = dutycycle >> 2; // PWM duty cycle - first 8-bits (MSb)
// CCP1CON &= 0xCF; ... |
C | #include <conf.h>
#include <kernel.h>
#include <proc.h>
#include <stdio.h>
#include <lock.h>
#include <sleep.h>
int priority_insert(int lock_index,int pid,int pri,int type)
{
/*if (isbadlock_no(lock_index))
{
kprintf("\nBad Lock ID");
return(SYSERR);
}*/
order_list_t *list = lock_tab[lock_inde... |
C | #include <stdio.h>
// #include <string.h>
int main()
{
char st1[15];
char st2[15];
char c;
int i = 0;
printf("input WHOLE string= \n");
scanf("%s", st1);
printf("input string CHARACTER BY CHARACTER = \n");
while (c != '\n')
{
fflush(stdin); //to refresh or flush address be... |
C | /*
============================================================================
Name : Clase_05.c
Author :
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
============================================================================
*/
#include <stdio.h>... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int A,B,sum=0,i=0,num=0,rest=0,suma=0,opcion=0,c;
printf("Ingrese dos numeros:\n");
scanf("%d",&A);
scanf("%d",&B);
if (A<B)
{
printf("\nQuiere que se realice una multiplicacion? (Eliga un numero)\n\n");
printf("1... |
C | #include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/acct.h>
#include <unistd.h>
#include <fcntl.h>
#include "ssp.h"
#define ACCT_FILE "/var/adm/pacct"
static unsigned long compt2ulong (comp_t num);
int main (void)
{
int fd;
int n;
struct acct acct_data;
if ((fd = open (ACCT_FILE, O_RDO... |
C | #include "mylib.h"
int sum(int *array, int size){
/*********************************
* Sum the Contents of the Array *
*********************************/
int sum=0;
int index;
for(index=0;index<size;index++){
sum =sum + array[index];
}
return sum;
}
|
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 <stdlib.h>
int main(void)
{
int num;
printf("Enter a integer: ");
scanf_s("%d", &num);
if (num % 2 == 0)
printf("%d is even.\n", num);
else
printf("%d is odd.\n", num);
system("pause");
return 0;
} |
C |
#include "helper.h"
int mem_dump(uint8_t *src, int size)
{
int inc=0;
printf("memdump sz%d: \n", size);
while (inc < size) {
printf("%.2x ", *src & 0xff);
if (!((inc+1) % 16)) {
printf(" %d \n", inc+1);
}
inc++;
src++;
}
printf("\n");
re... |
C | #include <stdio.h>
void Cross(int size, char simbol) {
int x, y;
for(y = 0; y < size; y++) {
for(x = 0; x < size; x++) {
if(x == y || x == (size - y - 1))
printf("%c", simbol);
else
printf(" ");
}
printf("\n");
}
return;
}
void EmptyDiamond(int size, char simbol) {
int x, y;
for(y = 0; y < s... |
C | #include <stdio.h>
#define MAX 10000
int inpt(char s[], int lim);
void rmc(char s[], char cln[], int len);
int main () {
int len;
char str[MAX];
// Get input
len = inpt(str, MAX);
// Remove comments
char cln[len];
rmc(str, cln, len);
// Test
printf("\n-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\n%s\n+-+-+-+-+-+-+-+-++... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.