language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* rt_get.c :+: :+: :+: ... |
C | //
// Created by cubazis on 25.05.18.
//
#include <string.h>
#include <ctype.h>
#include "task.h"
/** The stub function
* just to demonstrate how to work with ck_assert
* please look for test case for stub function in test_task.c
*/
int stub(void)
{
return 42;
}
/** The array_changer function
* just to demo... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lib/mongoose.h"
#include "lib/jerry-api.h"
#include "lib/jerry-port.h"
struct mg_mgr mgr;
struct mg_connection *c;
struct mt_response_object {
const char *content;
int length;
unsigned int status_code;
} mt_resp;
static void ev_handler(struct... |
C | #include<stdio.h>
#include<string.h> //strlen
#include<sys/socket.h>
#include<arpa/inet.h> //inet_addr
#include<unistd.h> //write
#include<stdlib.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include "ext.h"
#include "reader.h"
#include "garbledcircuit.h"
#include <time.h>
#include <i... |
C | #define PRINT(int) printf( "int = %d ", int)
main()
{
int x=03,y=02,z=01;
PRINT (x | y & ~z);
PRINT (x & y && z);
PRINT (x ^ y & ~z);
} |
C |
#include "DelaunayTable.Geometry.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include <assert.h>
#define nCase (1)
#define nDim (4)
static const size_t N = 100+1;
static const double x_min = -6.0;
static const double x_max = +6.0;
static inline double range(
const size_t i,
const siz... |
C | #include <stdio.h>
#include <stdlib.h>
int main(void)
{
FILE *fp;
double d = 12.23;
int i = 101;
long l =123023L;
if((fp=fopen("test", "wb+"))==NULL) {
printf("Невозможно открыть файл.\n");
exit(1);
}
fwrite(&d, sizeof(double), 1, fp);
fwrite(... |
C | /*
** EPITECH PROJECT, 2017
** event
** File description:
** All that involve event managing
*/
#include <SFML/Graphics.h>
#include <time.h>
#include "structs.h"
#include "function.h"
#include "my.h"
//Display the mouse and highlight the buttons
void display_mouse(game_t *game)
{
sfSprite *sprite1 = game->sprites[33... |
C | /***************************************************************
Copyright (c) Charles Childers
**************************************************************/
/*
| 001 | Data Stack Underflow |
| 002 | Data Stack Overflow |
| 003 | Address Stack Underflow |
| 004 | Address Stack Overflow |
| 005 | Inval... |
C | /*
** EPITECH PROJECT, 2017
** bootstrap
** File description:
** bootstrap my screen saver
*/
#include <SFML/Graphics.h>
#include <SFML/System.h>
#include <SFML/Window.h>
#include <SFML/Window/Export.h>
#include "my.h"
#include <math.h>
#include <stdlib.h>
#include <unistd.h>
info_t *ini_info(void)
{... |
C | #include <stdio.h>
#include <stdlib.h>
#include <limits.h>
int cmpfunc(const void *a, const void *b)
{
return (*(int*)a - *(int*)b);
}
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n,p;
unsigned int min=INT_MAX;
scanf("%d",&n);
int arr[n];
for(int i=0; i<n; i++)
{
scanf("%d",&arr[i]);
}... |
C | #include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include "funciones.h"
#define C 20
int obtenerEspacioLibre(EPersona lista[])
{
int i;
for(i=0;i<C;i++)
{
lista[i].estado=0;
lista[i].edad=0;
lista[i].dni=0;
}
}
void alta (EPersona lista[])
{
int i,j;
long int ... |
C | #include <stdio.h>
#include <string.h>
int main () {
char str[127];
char *pstr;
char sy,msy;
int len=0, i, count=0,maxcount=0;
puts("Enter string:");
fgets(str,127,stdin);
pstr=str;
len=strlen(pstr)-1;
for (i=0;i<len;i++) {
if ( pstr[i+1] == pstr[i] )
{
sy=pstr[i];
count++;
}
else {
if (count>maxcount)
{
msy=sy;
maxc... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
int main(int argc, char *argv[])
{
pid_t pid,wpid;
int status;
pid = fork();
if(pid==0)
{
printf("---child,my id = %d,going to sleep 10s\n",getpid());
sleep(10);
printf("---------------child die------------... |
C | //RTC Dummy 1.0 2017-01-23 // Fin:
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
char RtcFechaHora[7]; // "AAMMDDHHmmSSDS", [3]=HH=Hora(0-23)
// cada caracter es un ... |
C | #include <stdio.h>
int sum_and_diff (int a, int b, int *res, int *prod, float *div)
{
int sum;
sum = a + b;
*res = a - b;
*prod = a * b;
*div = a / b;
printf("Location of div = %d\n",&div);
printf("Value of div = %f\n",*div);
return sum;
}
void main (void)
{
int a = 9;
int b = 2;
int diff;
int prod;
float div;
prin... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
#define MAX_LINE 128
#define TRUE 0
#define FALSE 1
static int getLine(char *input, char **toks, char *tok);
static void printError();
static void insertProcess(int process);
static void exitProgram()... |
C | /* prints bases and quals */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <bam.h>
#ifndef BAM_CIGAR_SHIFT
#define BAM_CIGAR_SHIFT 4
#endif
#ifndef BAM_CIGAR_MASK
#define BAM_CIGAR_MASK 0xf
#endif
int main(int argc,char** argv)
{
int i;
uint8_t *s, *t;
bam_header_t *header;
bamFile in ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int checkList[700] = {0};
char *text;
int acc = 0;
int cur = 1;
int line = 1;
void nextLine()
{
while (text[cur] != '\n')
cur++;
cur++;
//line++;
}
void startLine()
{
cur--;
while (text[cur] != '\n')
cur--;
cur++;
}
void prevLine()
{
while (t... |
C | #include "prototipos.h"
#define T 10 //Definir un valor que luego va a ser un remplazado en el codigo
//(constante)Elemento de la programacion que va a valer el mismo valor, toda la vida del programa.
int main()
{
int vectorDeNumeros[T]= {10,-5,10,-6,-1,-4,10,5,4,-6};
int i;
int opcion;
... |
C | /*
*Name - Nikhil Ranjan Nayak
*Regd No - 1641012040
*Desc - Dispense Change
*/
#include<stdio.h>
#include<math.h>
void cal_change(double ,int*, int*, int*, int*);
void main()
{
int dollars, quaters = 0, dimes = 0, nickels = 0, pennies = 0;
double amount_paid , amount_due, amount_change, coin_change;
... |
C |
#include <stdio.h>
#include "common.h"
static int cb_update_tips(const char *ref, const git_oid *old, const git_oid *new)
{
char *hex;
fprintf(stderr, "%s:\t", ref);
hex = git_oid_allocfmt(old);
fprintf(stderr, "%s -> ", hex);
free(hex);
hex = git_oid_allocfmt(new);
fprintf(stderr, "%s\n", hex);
free(hex)... |
C | #ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <string.h>
#define REQUEST_MSG_SIZE 1024
#define REPLY_MSG_SIZE... |
C | #include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include "udp.h"
#include "mfs.h"
#include "server.h"
int image_fd;
Bitmap_t Inode_BitMap;
Bitmap_t Data_BitMap;
Inode_t *inode_table;
Block_t *data_region;
int main(int argc, char *argv[])
{
if(argc != 3){
fprintf... |
C | #include <stdio.h>
#include <stdlib.h>
struct node
{
int data;
struct node *next;
};
void insert(struct node **head_ref, int new_data)
{
struct node *new_node = (struct node*)malloc(sizeof(struct node));
struct node *last= *head_ref;
new_node->data = new_data;
new_node->next = NULL;
if(*head_ref == N... |
C | /*
* SPECS
* ----------------------------
* Segregated (explicit) lists. Each list is maintained in an ascending order.
*
* VITAL STATISTICS
* -----------------
* Minimum block size: 24 bytes
*
*
* ANATOMY OF BLOCKS:
*
* size of header = 4 bytes
* size of footer = 4 bytes
* size of next free block ptr = ... |
C | /*
* openmp_problem.c
*
* Created on: Dec 10, 2013
* Author: ricardo
*/
#include <stdio.h>
#include <stdlib.h>
#include <omp.h>
#include "omp_implementations.h"
void delay(int delayTimes);
void Dynamic(int timeDelay,int nowait){
int id,i;
double initTime,finalTime,result;
omp_set_num_threads(4);
... |
C | #include <stdio.h>
int main(){
int A,B;
scanf("%d%d",&A,&B);
if(A==B){
printf("%d",A+B);
}else if(A < B){
printf("%d",B+(B-1));
}else{
printf("%d",A+(A-1));
}
}
|
C | #include <limits.h>
#include <string.h>
#include "FirstCProgram.h"
/*Iterates through the list of elements,
* and determines if the current element is
* less than the current min. Returns the
* maximum if the array is empty.
*/
int smallest(int elements[], int size) {
int i;
int min = INT_MAX;
if (size <= 0)... |
C | /*
** EPITECH PROJECT, 2019
** my_print_params
** File description:
** Task 04
*/
int my_putstr(char const *c);
void my_putchar(char c);
void *my_print_params(int argc, char **argv)
{
int i = 0;
while (i != argc) {
my_putstr(argv[i]);
my_putchar('\n');
i++;
}
}
int main(int argc,... |
C |
#include <stdio.h>
#include <stdlib.h>
unsigned gateL[3][3] =
{ { 0, 0 ,0 },
{ 0, 0 ,0 },
{ 0, 0 ,0 } };
unsigned gateR[3][3] =
{ { 0, 0 ,0 },
{ 0, 0 ,0 },
{ 0, 0 ,0 } };
unsigned initL = 0;
unsigned initR = 0;
static inline
void calc_gate(unsigned iL, unsigned iR, unsigned *oL, unsigned *oR)
{
*oL ... |
C | #include <stdio.h>
int fib(int n){
int f[n];
f[0] = 0;
f[1] = 1;
for(int i =2;i<n;i++){
f[i] = f[i-1] + f[i-2];
}
return f[n-1];
}
int main(){
int n;
printf("Enter a number\n");
scanf("%d",&n);
printf("the fib of %d is %d\n",n,fib(n));
return 0;
} |
C | #include<stdio.h>
int main()
{
int i,k,j,large,small,m=0,n=0,o;
int arr[100];
printf(" how many elements to be in array =");
scanf("%d",&o);
printf("Enter the elements\t");
for (i=0;i<o;i++)
scanf("%d",&arr[i]);
printf(" array before interchanged=");
for (i=0;i<o;i+... |
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 | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* lst_triangle.c :+: :+: :+: ... |
C | /*
內容宣告:
以下程式碼由 李翼全 提供
練習題
使用者輸入半徑
求圓面積 和 圓周長
求到 小數點第二位
*/
/*
#include <stdio.h>
#include <math.h>
int main(){
float rad;
printf("請輸入半徑: ");
scanf("\n%f",&rad);
float area = 3.14*rad*rad;
float circle = 2*3.14*rad;
//printf("圓面積為:%.2f\t 圓周長為:%.2f",3.14*pow(rad,2.0),2*3.14*rad);
... |
C | /**
* @file include/kernel/int.h
* Kernel operations for enabling and disabling interrupts.
* @author Conlan Wesson
*/
#ifndef __INCLUDE_KERNEL_INT_H_
#define __INCLUDE_KERNEL_INT_H_
/**
* Enable interrupts.
*/
static inline void sti(){
asm volatile("sti");
}
/**
* Disable interrupts.
*/
static inline void ... |
C | #include <stdio.h>
int main(void){
int num, cont;
float media;
scanf("%d", &num);
cont = 1;
media = num;
while(num >= 0){
scanf("%d", &num);
cont++;
media = media + num;
}
printf("%.2f\n", (media - num) / (cont -1));
return 0;
} |
C | //***************************************************************---C76-->|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
/* Created by Manoj Soni on Thursday, October 10, 2019 */
/* Description: Static and Global Variables in Recursion */
// TODO: Explain why there is a difference between the outputs
int ... |
C | #include "hash.c"
#define ENCRYPTION_ROUNDS 12
#define initialize_state(a, b, c, d, t, iv, key, extra_data, extra_data_size)({\
WORDSIZE hash_output[8];\
hash_function(extra_data, extra_data_size, hash_output);\
load_register(a, hash_output, 0);\
load_register(b, hash_output, 4);\
load_register(t, ... |
C | #include "protos.h"
#define nb_max_antecedent 3 // une tâche a au maximum nb_max_antecedent
int max_tab(int *tab, int nelt)
{
int i, maxv;
maxv = tab[0];
for( i = 1 ; i < nelt ; i++ )
{
if (tab[i] > maxv)
{
maxv = tab[i];
}
}
return maxv;
}
struct table *read_data(ch... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include "func.h"
Status InitList_Sq(pSqList L)
{
//һյԱ
Status Result = Error;
L->elem = (ElemType *)malloc(LIST_INIT_SIZE * sizeof(ElemType));
if (!L->elem) //洢ռʧ
exit(OverFlow);
L->length = 0; //ʼձΪ 0
L->listsize = LIST_INIT_SIZE; //ʼһ洢ռС
Result = ... |
C | /**
* @file
* Contains function declarations for Semantic Analysis of a move list and associated utility functions.
*
* @author Santhosbaala RS
* @copyright 2012 64cloud
* @version 0.1
*/
#ifndef SEMANTIC_ANALYZER
#define SEMANTIC_ANALYZER
#include "ssandef.h"
#include "bitboard.h"
#include "offsetboard.h"
#in... |
C | /**
* \author CHARARA Othmane
* \date 12/04/2016
* \version 1.0
* \brief Déclaration de la structure Menu et en-tête des fonctions
*/
#ifndef __menu__
#define __menu__
#include "bouton.h"
#include "listeChoix.h"
#include "jauge.h"
/**
* \brief Structure qui permet de créer un menu graphique
* \details La struct... |
C |
#include "inttree.h"
int main(int argc, char *argv[])
{
struct rb_root root;
struct int_rb_node *ze_root = NULL, *ze_pred = NULL;
struct rb_node *prev = NULL;
inttree_init_tree(&root);
rb_insert(&root, 1);
rb_insert(&root, 12);
rb_insert(&root, 25);
rb_insert(&root, 9);
rb_insert(&root, 6);
ze_root = rb_en... |
C | #include<stdio.h>
void main(){
int n, i, j, f = 0;
printf("Enter size: ");
scanf("%d", &n);
for(i = 0; i<n; i++){
for(j = 0;j<=i;j++){
f++;
if(i%2 != 0){
printf("%d", f);
}else{
printf("%d", (f+i-j*2));
}
}... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* print_digit_type.c :+: :+: :+: ... |
C | /*
* paths.c
*
* Created on: 28.05.2017
* Author: pascal
*/
#include "assert.h"
#include "string.h"
#include "stdlib.h"
#include "path.h"
bool path_isRelative(const char *path)
{
assert(path != NULL);
if(path[0] == '/')
return false;
return true;
}
bool path_elementIsValid(const char *element)
{
re... |
C | #include<stdio.h>
float main()
{
float x,y,a;
x=10.5;y=5.5;
a=xশ্রy;
printf("Result of the expression is:%f",a);
return 10.50;
}
|
C | /* version 0.2 (PM, 12/5/19) :
La discussion est un tableau de messages, couplé en mémoire partagée.
Un message comporte un auteur, un texte et un numéro d'ordre (croissant).
Le numéro d'ordre permet à chaque participant de détecter si la discussion a évolué
depuis la dernière fois qu'il l'a affichée.
La discussio... |
C |
#ifndef __LOGGER_H__
#define __LOGGER_H__
typedef enum {
wbLogLevel_unknown = -1,
wbLogLevel_OFF = 0,
wbLogLevel_FATAL,
wbLogLevel_ERROR,
wbLogLevel_WARN,
wbLogLevel_INFO,
wbLogLevel_DEBUG,
wbLogLevel_TRACE
} wbLogLevel_t;
struct st_wbLogEntry_t {
int line;
char * msg;
uint64_t time;
const char * fun;... |
C | #include<iostream>//http://stackoverflow.com/questions/17761704/suffix-array-algorithm
#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
struct suffix
{
int index;
int rank[2];
};
bool comp(struct suffix r1,struct suffix r2)
{
if (r1.rank[0] == r2.rank[0])
{
if (r1.rank[1] < r2.... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "../libdartv2i2c/dartv2i2c.h"
void delay(float dt) {
unsigned int idt;
idt = ( unsigned int) (dt*1000000.0);
usleep(idt);
}
int main(int argc, char *argv[]) {
int leftEnc, rightEnc;
int status;
float batlvl;
float distFront, distBack, d... |
C | #include <stdio.h>
#include "funcoes_auxiliares.h"
void sort(int *array,int n){
int aux;
int temp;
for (int i=1;i<n;i++){
temp = i;
while( ( *(array+temp-1) > *(array+temp) ) && (temp>=0) ){
aux = *(array+temp);
*(array+temp) = *(array+temp-1);
*(array+temp-1) = aux;
temp--;
}
}
}
int main(int arg... |
C | //
// Created by Ritik garg on 07-09-2020.
//
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
#include <netinet/in.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#define PORT 9099
int main()
{
int sock =0; // file descriptor
struct sock... |
C |
/*******************************************************************
* Recommended compiler options: *
* -v -O3 -march=native -funroll-loops *
* 250 million integers in the range [-2147483647,2147483647] 2.42s *
* 100 million integers in the range [-2147483647,2147483647] 0.98s *
************************************... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
#include "EstruturasDeDados.h"
// TODO: INICIALIZAÇÃO DOS TAD
tTree * createTree(tQuadrante quad) {
tTree * tree = malloc(sizeof (tTree));
tree->quadtree = quad;
return tree;
}
tPonto createPoint(int x, int y) {
tPonto *... |
C | /*
Nome: Mônica Emediato
#Its job is to initiate communication with a server that is passively waiting to be contacted
Para a implementação dos códigos, foram utilizados um main para o cliente, um
main para o servidor e uma biblioteca “files.h” que o servidor utilizou para tratar as
mensagens.
*/
#include <stdio.h>
... |
C | int incr(int a) {
return a + 1;
}
int main() {
int a = 2;
a = (1+2) + incr(a+1);
return a;
} |
C | #include "draw.h"
void DrawPic32(uint32 x, uint32 y, uint32 width, uint32 height, uint8* image)
{
backbuffer_t* mem = Vid.BackBuffer + (Vid.BufferWidth * y + x); // move to first pixel
for (uint32 i = 0; i < height; i++)
{
for (uint32 j = 0; j < width; j++)
{
if (*image != 0xFF)
{
backbuffer_t color... |
C | #include <stdio.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/wait.h>
#include <unistd.h>
#include <stdlib.h>
int main()
{
int sum=0;
int count=0;
int shmid,status;
int *a,*b;
int inp;
pid_t pid1=1,pid2=1;
int pfd1[2];
pipe(pfd1);
pid_t ppid=getpid();
inp=getchar();
while(inp!=10){
if (getpid... |
C | #include <unistd.h>
#include <stdio.h>
#include <sys/wait.h>
#include <string.h>
int main(int argc, char **argv) {
int fork_ret, exec_ret, i;
for(i = 1; i < argc; i++) {
fork_ret = fork();
if(fork_ret == 0) {
printf("filho - %d e vou executar o comando - %s\n\n", getpid(), argv[i... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* execute_pipes.c :+: :+: :+: ... |
C | /*
Vishnu Kamaraju
77vishnu.k@gmail.com
*/
/*
The key is 26 characters long and only contains alphabets. This means A-Z alphabets assign themselves to the exact same position
in the key. For example, if
Key: VCHPRZGJNTLSKFBDQWAXEUYMOI
Then A corresponds to V, B to C, C to H, and so on.
To achieve this output, simply a... |
C | #include <stdio.h>
#include <math.h>
int main(){
int x, i, p;
i = 0;
printf("Digite o número desejado: ");
scanf("%d", &x);
for(i; i <= 10; i++){
p = pow(x, i);
printf("%d\n", p);
}
}
|
C | #include<stdio.h>
int a[101];
int b[100];
void merge(int l,int m,int h)
{
int l1,l2,i;
for(l1=l,l2=m+1,i=l;l1<=m && l2<=h;i++)
{
if(a[l1]<=a[l2])
b[i]=a[l1++];
else
b[i]=a[l2++];
}
while(l1<=m)
b[i++]=a[l1++];
while(l2<=h)
b[i++]=a[l2++];
for(i=l;i<=h;i++)
a[i]=b[i];
}
void sort(int l,int h)
{... |
C | //
// Created by Александр Баташев on 02.12.16.
//
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include "algorithms.h"
/**
* Классическая пузырьковая сортировка
* @param arr Массив значений для сортировки
* @param n Длина массива
*/
void bubble_sort(int *arr, i... |
C | //#include <stdio.h>
//#include <stdlib.h>
//
//int main(void)
//{
// //λĶʼ
//
// int arry_2d[2][3]={ {2,5,4},{6,9} }; //23 δֵԪĬΪ0,ʹöϵԿֵ
// //ʱϵвУҪöϵһУ
// //int arry[2][2]={1,2,3,4} ʼҲ
// printf("%d\n", sizeof(arry_2d) / sizeof(arry_2d[0][0])); //ʾĸ
// printf("%p,%p,%p,%p,%p,%p\n", &arry_2d[0][0], &... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "recdata.h"
typedef struct {
int* n_userdata;
int** i_userdata;
double** r_userdata;
int* n_itemdata;
int** i_itemdata;
double** r_itemdata;
int binary;
} recdata_simple_args_t;
int recdata_simple_userdata_size(int uid, vo... |
C | #include <iostream>
using namespace std;
//二叉树的结构
// Definition for binary tree
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution {
public:
//任意一条路径上的最大值
int maxPathSum(TreeNode *root) {
... |
C | #include <stdio.h>
#include<string.h>
int main(void)
{
char a[37],b[69];
int i,k;
printf("enter the string");
scanf("%s",a);
printf("enter the k values");
scanf("%d",&k);
for(i=0;i<k;i++)
{
b[i]=a[i];
}
printf("%s",b);
return 0;
}
|
C | #include <stdio.h>
#include <cs50.h>
#include <stdlib.h>
void cambio(void);
int numero;
int main(void){
numero = 12;
printf("El numero es %d\n",numero);
cambio();
printf("El numero es %d\n",numero);
return 0;
}
void cambio(void){
numero = 2;
} |
C | //Marcus Vinícius Souza Fernandes - 19.1.4046 - BCC201-61P
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define T 50
#define TA 100
typedef struct{
char nomecomida[T];
double peso;
double cal;
} Dieta;
Dieta *lerarquivo(int *n);
int main()
{
int n, cont;
double maior=0.00;
Dieta *ler= lera... |
C | #include <stdlib.h>
#include <stdio.h>
#include <time.h> // needed for initializing srand
int main() {
// Allows you to generate random number
srand(time(NULL));
// Allows user to specify the original array size, stored in variable n1.
printf("Enter original array size:");
int n1 = 0;
scanf("... |
C | /*
- Numerical Gradient decent reinforcment PID Tuning
*/
#include <stdio.h>
#include <stdlib.h>
#include <linux/i2c-dev.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
#include <math.h>
#include <sys/time.h>
#include <pigpio.h>
#include <string.h>
#include <assert.h>
#include "Sensors.h"
#include "... |
C | #include<stdio.h>
int main()
{
int m,i;
printf("Enter a Number\n");
scanf("%d",&m);
for(i=0; i<m; i++)
{
printf("Hello\n");
}
return 0;
}
|
C | //autorzy: XYZ
#include <iostream>
#include <string>
using namespace std;
// wazny komentarz
// Oblicza sum podanych liczb
//----------------------------
string dodaj(string & x, string & y)
{
string z;
int p,w,i,j,k,n;
i = x.length();
j = y.length();
n = i; if(j < i) n = j;
p = 0;
z = "";
for(k ... |
C | #include "lib/header.h"
int main(int argc, char *argv[]) {
if(argc != 2) {
fprintf(stderr, "Usage: %s <port>\n", argv[0]);
exit(1);
}
int listen_fd;
int clients[FD_SETSIZE];
int client_maxi = 0;
int max_fd;
memset(clients, 0xFF, sizeof(clients));
struct sockaddr_in listen_addr;
memset(&listen_addr, 0, ... |
C | #include <stdio.h>
int main(void)
{
char c,d;
c='d';
d=c;
printf("d=%c\n",d);
return 0;
}
|
C | /*Lucas Botoni de Souza
04) Faa um programa que leia dois nmeros inteiros e os escreva em ordem crescente.*/
#include<stdio.h>
#include<stdlib.h>
main()
{
int x, y;
printf("digite o primeiro numero: \n");
scanf("%d", &x);
printf("digite o segundo numero: \n");
scanf("%d", &y);
if (... |
C | #include "makeTable.h"
void initTable() {
makeTablePoint();
}
int dispTable(int player, int no) {
if (player == SENTE) return senteTable(no);
else if (player == GOTE) return goteTable(no);
return 0;
}
int senteTable(int no) {
int line, col;
int lineP = 0, colP = 0;
printf(" ");
for (line = 0; l... |
C | /*
* binary_tree_node_queue.h
*
* Created on: Mar 7, 2017
* Author: Negin Mortazavi
*/
#ifndef BINARY_TREE_NODE_QUEUE_H_
#define BINARY_TREE_NODE_QUEUE_H_
#include "binary_tree_node.h"
#include <stdbool.h>
/**
* A struct representing a BinaryTreeNodeQueue.
*/
typedef struct _BinaryTreeNodeQueue{
int s... |
C | #include <stdio.h>
int up(int *arr, int n){
int res = 0;
int swap = 0;
int i,j;
for (i=0; i<(n-1); i++){
for(j=(i+1); j<n; j++){
int check = 0;
if(arr[i] > arr[j]){
swap = arr[i];
arr[i] = arr[j];
arr[j] = swap;
check = 1;
}
if(check == 1){
... |
C | #define _BSD_SOURCE
#include <pthread.h>
#include <string.h>
#include <unistd.h>
#include "display.h"
#include "racer.h"
// A converter from milliseconds to microseconds
#define MILLI_SEC_TO_MICRO_SEC 1000
/// global max wait time between each movement
static long waitTime;
/// sets the wait time each racer should m... |
C | /*
* client.c
*
* Created on: Feb 25, 2012
* Author: davisl
*/
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "dkp.h"
const int STR_SIZE = 128;
int usage(char* progName);
int main(int argc, char *argv[]) {
if (argc < 2) {
return usage(argv[0]);
}
int sock = dkp_connect(argv[1])... |
C | #include <stdio.h>
int main()
{ int n;
scanf("%d",&n);
int a[n],nodd=0,neven=0;
for(int i=0;i<n;i++){
scanf("%d",&a[i]);
if(a[i]%2==0)neven++;
else nodd++;
}
neven+=nodd/2;
nodd=nodd%2;
while(neven>1){
neven=(neven+1)/2;
... |
C | #include<stdio.h>
#include<conio.h>
int lcstr(char *,char*,int,int);
int max(int a,int b);
int max(int a,int b){ return ((a > b) ? a : b);}
void main () {
char str1[20],str2[20];
int len1,len2,cl;
printf("Enter str1:" );
gets(str1);
printf("Enter str1:" );
gets(str2);
len1 = strlen(... |
C | /*
** EPITECH PROJECT, 2017
** test_main.c
** File description:
** A main test file
*/
#include <criterion/criterion.h>
const char *str = "Hello world";
const int len = 11;
Test(utils, returns_a_float)
{
cr_assert(my_float(6625), 66.25);
}
Test(utils, returns_a_floatV2)
{
cr_assert_eq(98775, 98.775);
}
Test(utils,... |
C | #include <stdio.h>
int CheckPalindrome(char * str, int len)
{
int i;
for(i=0; i<len/2; i++)
{
if(str[i]!=str[len-(i+1)])
{
return 0;
}
}
return 1;
}
int main(void)
{
char str[50];
int strLen=0;
printf("문자열 입력: ");
scanf("%s", str);
while(str[strLen]!='\0')
strLen++;
if(CheckPalindrome(str... |
C | #include <stdio.h>
#include <stdlib.h>
#include <signal.h>
void ignore(int signum) {
printf("ignore signal %d\n", signum);
}
int main() {
if (signal(SIGABRT, ignore) == SIG_ERR) {
printf("cannot catch signal %d\n", SIGABRT);
return 1;
}
abort();
printf("after abort\n");
}
|
C | /*
* clTable.h
*
* Representation of Cluster Neighbour Table.
*/
#ifndef CLTABLE_H_
#define CLTABLE_H_
// Data types for a Cluster Neighbour Table
typedef enum{RELAX, ACTIVE, DEAD} State_t;
struct CTableEntry {
Node *node_; // Address of node
double distance_to_me_;
double distance_to_BS_;
// Energy can be ex... |
C | #include<stdio.h>
#define MOD 1000000007
long long mod(long long a1, long long b1)
{ return (a1%b1+b1)%b1; }
long long expo(long long base, long long exp) {
long long res=1;
while(exp>0) {
if(exp%2==1) res=(res*base)%MOD;
base=(base*base)%MOD;
exp/=2;
}
return res%MOD;
}
int main(... |
C | #include"lazy.h"
int step = 0;
int move(char a, char b)
{
step++;
printf("move %c to %c\n", a, b);
return 0;
}
int hanno(int tomove,char a,char via, char b){
if(tomove==1){
move(a, b);
return 0;
}
hanno(tomove - 1, a, b, via);
move(a, b);
hanno(tomove - 1, via, a, b);
... |
C | #include<stdio.h>
void ft_ultimate_ft(int *********nbr);
int main(void)
{
int x;
ft_ultimate_ft(&&&&&&&&x);
printf("%d", x);
return 0;
}
|
C | void taskFour(void) {
char originalText[1000];
char key[26];
printf("\nPlease enter text to be decrypted:\n");
scanf (" %[^\n]%*c", originalText);
printf("\nPlease enter the encryption key used in capitals:\n(E.g.: QWERTYUIOPASDFGHJKLZXCVBNM)\n");
scanf(" %[^\n]%*c", key);
... |
C | #include "a_nm_1.h"
// euler numbers of first kind
// / n \
// \ m /
//
// alike stirling numbers, catalan numbers, binomial coefficients and other
// animals of the mathematical zoo, euler numbers mean something in combinatorics: they
// represent the number of permutations with exactly m ascents of a set of size n
/... |
C | /* write_int, write_char, pointer '*', '&' test */
int main(){
int *a;
int b;
int bb;
char *c;
char d;
char dd;
b = 10;
write_int(*a); /* 0 */
write_string("\n");
write_int(b); /* 10 */
write_string("\n");
write_int(bb); /* 0 */
write_string("\n====================\n");
a = &b;
write_int(*a); /* 1... |
C | #include "../push_swap.h"
int ft_strncmp(const char *s1, const char *s2, size_t n)
{
unsigned long i;
unsigned char *casted_s1;
unsigned char *casted_s2;
casted_s1 = (unsigned char *)s1;
casted_s2 = (unsigned char *)s2;
i = 0;
if (n == 0)
return (0);
while (casted_s1[i] == casted_s2[i] && casted_s1[i]
&& ... |
C | #include <GL/GL.h>
#include <GL/GLU.h>
#include <GL/glut.h>
#include <Windows.h>
#include <stdio.h>
void DDA(int x0, int y0, int xn, int yn)
{
int dx = xn - x0;
int dy = yn - y0;
int step = max(abs(dx), abs(dy));
float x_inc = dx / (float)step;
float y_inc = dy / (float)step;
float x = x0;
float... |
C | #include "sock-lib.h"
#define MAXDATASIZE 4096/* mxima cantidad de bytes que puede recibir en una transaccin*/
int main (int argc, char * argv[])
{
int sockfd; /* File Descriptor del socket por el que el
servidor "escuchar" conexiones*/
char frase[255];
int sockdup;
int numbytes;/*Contendr el... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.