language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
int main()
{
int number;
printf("%p", &number); // Macbook: 0x7ffeeb521728
int number2;
printf("\n%p", &number2); // Macbook: 0x7ffeeb521724
int number3;
printf("\n%p", &number3); // Macbook: 0x7ffeeb521720
return 0;
} ... |
C | /*
** EPITECH PROJECT, 2018
** lemipc
** File description:
** game
*/
#include "lemipc.h"
int game_is_valid(player_t *player)
{
int nb_team_1 = 0;
int nb_team_2 = 0;
for (int x = 0; x < MAP_SIZE; x++) {
if (player->segment[x] == '1')
nb_team_1++;
if (player->segment[x] == '2')
nb_team_2++;
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* new_fun_for_stack_a3.c :+: :+: :+: ... |
C | #include<stdio.h>
void swap(int* a, int* b)
{
int temp;
temp=*a;
*a=*b;
*b=temp;
}
void bubblesort(int a[],int n)
{
int i;
int j;
for(i=0; i<n-1; i++)
{
for(j=0; j<n-i-1; j++)
{
if(a[j]>a[j+1])
{
swap(&a[j],&a[j+1]);
}
}
}
}
void print(int a[],int n)
{
int i;
for(i=0; i<n; i++)
{
pri... |
C | #include "wsp.h"
#include <math.h>
#include <string>
#include <fstream>
#include <sstream>
#include <vector>
/************/
/*** Main ***/
/************/
std::ofstream output_file;
int main(int argc, char *argv[]){
int rows{-1}; // counting rows, must be less than num to start
int num{0}, dim, i, j, num_wsp;
do... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "word.h"
#include "grammar.h"
#include "error.h"
int main() {
freopen("testfile.txt", "r", stdin);
freopen("error.txt", "w", stdout);
c = getchar();
getsym();
if (program() < 0) {
printf("compile error\n");
}
return... |
C | // Takes 2 1-D Histograms and a 2-D Histogram and creates a nice layout with
// The 2-D histogram surrounded by the 1-D Histograms
// This works by taking an image of the Y-Axis Histogram and then rotating it by 90˚
// Then displays it next to the 2-D histogram
//
// Call by running:
// CombineHistograms(<args>);
//
//... |
C | #include <stdio.h>
#include <stdint.h>
#include <unistd.h>
#include <sys/types.h>
#include <arpa/inet.h>
void eliminar(FILE** file) {
uint16_t currNum;
fread(&currNum, sizeof(uint16_t), 1, *file);
while (!feof(*file)) {
fseek(*file, -2*sizeof(uint16_t), SEEK_CUR);
fwrite(&currNum, sizeof(... |
C | #include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
int x,y,i;
void angle(int p,int k)
{
setcolor(15);
circle(x-35,y-45,100);
circle(x-35,y-45,101);
circle(x-35,y-45,102);
for(i=0;i<100;i++)
{
setcolor(15);
arc(x-35,y-45,p,k,i-10);
}
}
void a1()
{
setcolor... |
C | #include "client_stdio.h"
#include <sys/ioctl.h>
#include <sys/types.h>
#include <signal.h>
void replace_lr(char* str)
{
char* p = str;
while(*p != '\0')
{
if(*p == '\r') *p = '\n';
p++;
}
}
void ignore_handler(int sig)
{
}
void dshell_run(Client* client, const char* sh)
{
int shell_to_app[2] = {0};
... |
C | #include "monty.h"
/**
* pop - delete node at given index.
* @stack: head of the doubly linked list.
* @line_number: line number.
* Return: void.
*/
void pop(stack_t **stack, __attribute__((unused)) unsigned int line_number)
{
stack_t *delete_node = NULL;
if (!stack || (*stack == NULL))
{
dprintf(STDERR_F... |
C | /*Create macros so that the matrices are stored in row-major order*/
#define A(i, j) a[(i) * lda + (j)]
#define B(i, j) b[(i) * ldb + (j)]
#define C(i, j) c[(i) * ldc + (j)]
/*Routine for computing C=A*B + C*/
void AddDot(int, double*, int, double*, double*);
void my_MMult(int m, int n, int k, double* a, int lda,
... |
C | #include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
#include "functions.h"
#define BUFFER_SIZE 8096
#define WEB_ROOT "/var/www/html"
// Colors definition
#define RED "\x1b[31m"
#define GREEN "\x1b[32m"
#define YELLOW "\x1b[33m"
#define BLUE "\x1b[34m"
#defi... |
C | /*******************************************
Statement - Arithmetic Operation of two number
Code By - Nishan Lamichhane
Visit my Website - http://nisanlamichhane.com.np
********************************************/
#include <stdio.h>
#include <conio.h>
void main()
{
int a, b, c, d ,e ,f, g;
float h, i;
clrscr(... |
C | #include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <time.h>
#include <sys/wait.h>
int main(int argc, char *argv[]){
pid_t ret;
int i, j, counter;
int pid[20];
int status;
if(argc != 2){
fprintf(stderr, "Usage : %s <num>\n",argv[0]);
exit(EXIT_FAILURE);
}
c... |
C | #include "DIO.h"
void DIO_vSetPinDir ( INT8U u8Port, INT8U pin, ePinDir eDir )
{
switch(u8Port)
{
/*======== port A =========*/
case 'A':
if( eDir == eOutput )
SET_BIT(DDRA,pin);
else if( eDir == eInput)
CLR_BIT(DDRA,pin);
break ;
/*======== port B =========*/
case 'B':
if( eDir == eOutp... |
C | // Strings are usually ordered in lexicographical order. That means they are ordered by comparing their leftmost different characters. For example, because . Also because . If one string is an exact prefix of the other it is lexicographically smaller, e.g., .
//
// Given an array of strings sorted in lexicographica... |
C | // My first solution
int lengthOfLongestSubstring(char * s){
// Make a letter map to count the occurrence of the different ASCIIs
int LetterCounter[128] = {0};
int ans = 0;
char *first = s;// Point to the start of the string
char *last = s;// Interger value of this is the ASCII value of the charact... |
C | #include <mpi.h>
#include <pthread.h>
#include <unistd.h>
#include "types.h"
#include "global.h"
#include "state.h"
#include "communication.h"
void mpi_send(int message, int tag, int to) {
lock_state(state);
MPI_Send(&message, 1, MPI_INT, to, tag, state->comm);
unlock_state(state);
}
void mpi_sync_send(i... |
C | #include "ch3.c"
#include "ch2.c"
int main(int argc, char *argv[]){
FILE *fp;
int ret;
int i;
if((fp=fopen("./text1.txt","w"))==NULL)
perror("open failed!\n");
for(i=1; i<argc; i++){ //write all the string, xunhuanxieru
ret = fwrite(*argv,strlen(argv[i]),strlen(argv[i]),fp);
printf("%d : %s\n",ret, argv[i])... |
C | #include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<sys/fcntl.h>
#include "qdbmp.h"
#define byte unsigned char
#define dword unsigned int
#define word unsigned short int
#pragma pack (1)
//4 Bytes per each pallete color
typedef struct {
unsigned char rgbBlue,
rgbGreen,
... |
C | #include <system.h>
//Main
void main()
{
gdt_install(); //Setup processor driver
idt_install(); //Setup Interrupt and Exception access
isr_install(); //Setup exception handler
irq_install(); //Handle device interrupts/events
timer_install(); //Setup timer
keyboard_install(); //Setup keyboard
//video_in... |
C | #include <stdio.h>
#include <stdlib.h>
#include "lex.h"
/*
* General categories in string format used for printing
*/
const char* category_names[] = {
"IDENT",
"KEYWORD",
"OPERATOR",
"INTCONST",
"REALCONST",
"PUNCTUATION",
"STRING",
"COMMENT"
};
/*
* Specific categories in string forma... |
C | int main(){
int n;
char DNA[1000][260];
scanf("%d",&n);
for(int j=0;j<n;j++){
scanf("%s",&(DNA[j]));
}
int pd=0,m;
for(int t=0;t<n;t++){
pd=strlen(DNA[t]);
for(m=0;m<pd-1;m++){
if(DNA[t][m]=='A'){
printf("T");
}
else if(DNA[t][m]=='T'){
printf("A");
}
else if(DNA[t][... |
C | //
// Created by Johan Chevet on 6/9/21.
//
#include "../include/push_swap.h"
t_lst *new_elem(int nb)
{
t_lst *elem;
elem = malloc(sizeof(t_lst));
if (elem == NULL)
exit (1);
elem->nb = nb;
elem->pos = -1;
elem->prev = NULL;
elem->next = NULL;
return (elem);
}
void add_back(t_lst **lst... |
C | #include<stdio.h>
int main()
{
int n,last;
printf("\n Enter Last Number : ");
scanf("%d",&last);
printf("\n Even Number List :\n ");
n=2;
while(n<=last)
{
printf(" %d",n);
n=n+2;
}
return0;
}
|
C | #include<stdio.h>
#include<string.h>
#include<iostream>
#include<queue>
#include<algorithm>
#include<string>
#include<map>
#define ll long long
#define mmset(a,b) memset(a,b,sizeof(a))
using namespace std;
const int N = 200;
const int M = 20005;
int n;
struct node
{
int to,w,next;
node ()
{
};
node (int p_to,... |
C | /*
Functions to handle dices and rolling of these
Author: Niklas Hedlund
Date: 2010-10-31
*/
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "ui.h"
//initialize the random number generator
void initDice(){
srand((int)time(NULL));
}
//randomizing a number between 1 and 6
int rollDice(){
... |
C | #include "vector.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#define VECTOR_DEFAULT_INITIAL_CAP 4
#define ALLOC(size) ALLOCATOR_ALLOC(vector->allocator, (size))
#define REALLOC(ptr, size) ALLOCATOR_REALLOC(vector->allocator, (ptr), (size))
#define FREE(mem) ALLOCATOR_FREE(vector->allocator, (mem))... |
C | #include <stdio.h>
#include <stdlib.h>
int main(void)
{
double * ptr = NULL;
ptr = (double *) realloc(ptr, sizeof(double));
free(ptr);
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: ... |
C | #define principal 5000.00
#define period 10
#include<stdio.h>
main()
{
int year;
float amount,value,inrate;
amount=principal;
inrate=0.11;
year=0;
while(year<=period)
{
printf("%2d %8.2f\n",year,amount);
value=amount+inrate*amount;
year=year+1;
amount=value;
... |
C |
/*
*
* The input is from right to left.
* The rightmost byte is the least significant byte.
* The leftmost byte is the most significant byte.
*/
#ifndef SPECK_H
#define SPECK_H
#define SPECK_BLOCK_SIZE (64)
#define SPECK_WORD_SIZE (32)
#define SPECK_A (8)
#define SPECK_B (3)
#def... |
C |
#include <SDL2/SDL.h>
#include "libft.h"
#include <stdlib.h>
int main(int argc, char *argv[])
{
SDL_Window *window = NULL;
int statut = EXIT_FAILURE;
if(0 != SDL_Init(SDL_INIT_VIDEO))
{
ft_printf("Erreur SDL_Init : %s", SDL_GetError());
goto Quit;
}
window = SDL_CreateWindow("... |
C | #include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
struct packetdata
{
int sequence_num;
int ack;
int ackseq;
int bytes_in_packet;
int fin;
int finack;
int stop;
char data[900];
};
struct p... |
C | /*
** EPITECH PROJECT, 2018
** check_succes
** File description:
** sokoban
*/
#include "my.h"
void game_on(var_t *var, pos_t *pos, WINDOW *sokoban)
{
clear();
if (LINES < var->lines || COLS < var->longer)
check_window_size(sokoban, var, pos);
else
game_boucle(var, pos);
refresh();
}
... |
C | #include<stdio.h>
#include<stdlib.h>
int count=0;
/*define a block. Note that you could put more data field in the block like what is commented */
typedef struct block
{
int data;
//float percentage;
struct block *next;
}
node;
node *head=NULL;
node* createblock()
{
int val;
node *temp;
temp=(node *... |
C | #include <stdio.h>
int main(void) {
char logfile[] = "error_log";
FILE *fp = freopen(logfile, "w", stdout);
close(2); // close stderr
dup(1); // dup stdout, so stderr now points to stdout
fprintf(stdout, "Hello there stdout\n");
fflush(stdout);
fprintf(stderr, "Hello there stderr\n");
return 0;
}
|
C | #include<mympi.h>
void treeMPI_Bcast(int *N) {
int Nactive = 1;
int rank, size;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
while(Nactive < size) {
//ranks < Nactive send the value
if(rank < Nactive && rank + Nactive < size) {
//MPI_Send to rank + Nactive
... |
C | /***************************************************************
Copyright © wkangk <wangkangchn@163.com>
文件名 : tree_walk.c
作者 : wkangk <wangkangchn@163.com>
版本 : v1.0
描述 : 树的遍历
时间 : 2020-09-04 09:31
***************************************************************/
#include <stdio.h>
#include "../tools/... |
C |
/* Offset of member MEMBER in a struct of type TYPE. */
#if defined(__GNUC__) && __GNUC__ > 3
#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
#else
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE*)0)->MEMBER)
#endif
|
C | /*
Clinica medica
*/
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <string.h>
#define HORA 7 // incicio da contagem da horas
#define TAM_HORA 8 // quantidade de horas disponifel no dia
// Registro
typedef struct Especialidade{
char nome[25];
int codigo;
} Especialidade;
typedef struct Usuari... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line_utils.c :+: :+: :+: ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* color.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
int main(int argc, char* argv[]) {
int numBytes = atoi(argv[1]);
int numPerSequence = 1;
if(argc > 2) {
numPerSequence = atoi(argv[2]);
}
int firstAsciiLetter = 97; //ASCII value of letter 'a'
int lastAsc... |
C | /**
* @file dbg_cntrl.h
* @brief Declarations for debug and output functions over DMA serial console.
* @date 09/09/2014
* @author Harry Rostovtsev
* @email rost0031@gmail.com
* Copyright (C) 2014 Harry Rostovtsev. All rights reserved.
*
* @addtogroup groupDbgCntrl
* @{
* <b> Introduction </b>
*
* The... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <pthread.h>
int main()
{
pthread_t tidp;
extern void agent_tiny_entry(void);
if ((pthread_create(&tidp, NULL, agent_tiny_entry, NULL)) == -1)
{
printf("create error!\n");
return 1;
}
while(1);
printf("end\n... |
C | /* I2OP.c */
#include "Utilities.h"
#define MYDEBUG 0
/*--------------------------------------------------------------------*/
/*
---------------------------------------------------------
initializer.
create and return an array of n I2OP structures.
the structures are linked in one of three ways.
f... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_split.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<conio.h>
int main()
{
float j;
int num;
for(j = 20.0, num=1; j >= 10.0; j-=0.5, num++){
printf("%d\n", num);
}
getch();
return 0;
}
|
C | /*
Example 04
Simple sample that shows a mMessage Box
*/
#include <ulib/ulib.h>
//Our map data is in the file Map.c
#include "map.h"
//Our tileset PNG data
#include "mountains_png.h"
//Make it global so we can access it from our Render function
UL_MAP *mapMountains;
//This function will do our ren... |
C | /*
This file is provided under the LGPL license ver 2.1.
Written by K.Tanaka & Katsumi
http://www.ze.em-net.ne.jp/~kenken/index.html
http://hp.vector.co.jp/authors/VA016157/
*/
#include <xc.h>
#include "api.h"
#include "compiler.h"
static FSFILE* g_fhandle;
static char* g_fbuff;
static int g_... |
C | #include <iostream>
using namespace std;
void main()
{
int num1, num2, i, num, digit, sum;
cin >> num1;
cin >> num2;
for(i = num1; i <= num2; i++)
{
sum = 0;
num = i;
for(; num > 0; num /= 10)
{
digit = num % 10;
sum = sum + digit * digit * di... |
C | #pragma warning(disable:4996)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct student
{
char name[10];
char stnum[11];
char ch;
};
int main()
{
struct student st[5];
struct student* p1, * p2;
char find_name[10];
char tmp;
for (p1 = st; p1 < st + 5; ++p1)
{
scanf("%s", p1->name);
scanf(... |
C | // 20xx#x
// Description:
// find the first char which appear only once
// // Time complexity O(n * n)
// Code:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main()
{
int tb[128] = {0};
char str[100];
// ASCII 编码中,有 128 个字符,只需要开一个 128 的数组,每个字符出现一次,记录在对应 ASCII 编码数组元素中
gets(str);
... |
C | /* Copyright (c) 1998 by Inria Lorraine. All Rights Reserved */
/***
NAME
lpack
PURPOSE
NOTES
HISTORY
Serge Steer / Eric Fleury - Mar 13, 1998: Created.
$Log: lpack.c,v $
Revision 1.1 1998/03/27 13:44:22 fleury
Premier ajout de lpack.
version OK
***/
#include <... |
C | /*!
* \file extern.c
* \brief
* \author sunshine
* contact mxdhlj@163.com
* \version 0.00
* \date 11-12-08 10:58:25
*/
#include <stdio.h>
extern int global;
/*extern int new_printf(char* argv);*/
/*int new_printf(char* argv);*/
int main(int argc, char* argv[])
{
if(global)
printf("We can use the ... |
C | int rob(int *nums, int numsSize)
{
// base cases
switch (numsSize)
{
case 0:
return 0;
case 1:
return nums[0];
default:
break;
};
//set second index to first index if first index is greater
if (nums[0] > nums[1])
{
nums[1] = nums[0];
}
//... |
C | int getHeight(struct TreeNode* root) {
if(root == NULL)
return 0;
int left = getHeight(root->left);
int right = getHeight(root->right);
return (left > right ? left : right) + 1;
}
void traversal(struct TreeNode* root, int** order, int** columnSizes, int level) {
if(root == NULL)
re... |
C | #include <stdio.h>
int main() {
const int Year = 2010;
const int My_Old = 20;
const int Bro_Old = 18;
printf("ش %d Դϴ.\n", Year);
printf(" ̴ %d Դϴ.\n", My_Old);
printf(" %d ¾ %d° ذ Ǿϴ.\n", Year - My_Old, My_Old);
printf(" ̴ %d Դϴ.\n", Bro_Old);
printf(" %d ¾ %d° ذ Ǿϴ.\n\n", Year - Bro_Old, Bro_Old);
... |
C | // gcc -o rop64 rop64.c -fno-stack-protector
#include <stdio.h>
#include <unistd.h>
void gadget() {
asm("pop %rdi");
asm("pop %rsi");
asm("pop %rdx");
asm("ret");
}
int main()
{
char buf[256];
write(1, "Data: ", 6);
read(0, buf, 1024);
return 0;
} |
C | #include <stdio.h>
int main()
{
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++)
{
float a,b,c,d;
scanf("%f %f %f",&a,&b,&c);
d=(a*2+b*3+c*5)/10;
printf("%.1f\n",d);
}
}
|
C | #include <stdio.h>
int cont_insertion = 0;
int cont_selection = 0;
void insercao (int *vetor, int n){
int k, j, aux;
for (k = 1; k <= n - 1; k++){
// printf("\n[%d] ", k);
aux = vetor[k];
j = k - 1;
while (j >= 0 && aux < vetor[j]) {
//printf("%d, ", j);
vetor[j+1] = veto... |
C | #include <stdio.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <sys/mman.h>
#include <semaphore.h>
#include "shmipc.h"
int nms_shm_get(char* shm_file, void** shm, int mem_len)
{
int fd;
fd = shm_open(shm_file, O_RDWR | O_CREAT, 0666);
if (fd < 0) ... |
C | #include "stdio.h"
int power(int x, int n)
{
int a = x;
int b = x*x;
int c = n;
if (n ==2)
return b;
else if (n==1)
return a;
else if (n==0)
return 1;
else if (n>1&& n%2==0)
return b*power(x,n-2);
else
{
c = n-1;
return a*power(x,c/2)*power(x,c/2);
}
}
int main()
{
printf... |
C | #include "mystring.c"
int main(){
char *str1 = "HelsoleH";
char *str2 = "so";
char *doubleStr = "1;2;3.5;-8c;4a4";
double *doubleArr;
int size = 0, i = 0;
printf("1. \"%s\" <-- \"%s\" in %d position \n", str1, str2, substr(str1, str2));
printf("2. %d\n",subseq(str1, str2));
printf("3. %d\n",ispal(str1));
p... |
C | #ifndef AVRS_CORE_PRIMITIVE_TYPES_H
#define AVRS_CORE_PRIMITIVE_TYPES_H
/** An 8-bit signed integer type */
typedef signed char int8;
/** A 16-bit signed integer type */
typedef signed short int16;
/** A 32-bit signed integer type */
typedef signed int int32;
/** A 64-bit integer type */
typedef signed long long in... |
C | #include <arpa/inet.h>
#include <net/if.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <getopt.h>
#include "gw.h"
typedef struct ConfigInput_s {
char discovery_addr[MAX_ADDR_STRLEN];
char query_addr[MAX_ADDR_STRLEN];
char tunnel_addr[MAX_ADDR_STRLEN];
char int... |
C | #include <stdio.h>
int main(void)
{
char s[5];
printf("Enter your name: ");
scanf("%s", s);
for (int i = 0; i < 5; i++)
{
printf("%c", s[i]);
}
printf("%c", s[6]);
printf("%c", s[7]);
printf("%c", s[8]);
printf("%i", s[9]);
printf("%i", s[10]);
printf("%i",... |
C | // /**
// * Flvia de Jesus correia 25 / 02 / 2020 - Computao Grfica - Prtica 4
// * Desenhar Octgono Regular usando a funo GL_POLYGON de Lado L = 75
// */
//
// #include <GL/glut.h>
// #include <stdio.h>
//
// void Inicializa();
// void Desenha();
//
// int main(int argc, char *argv[])
// {
// glutInit(&argc,... |
C | #include <stdio.h>
#include <math.h>
static const int INIT_N = 100;
static const double LEFT = 0;
static const double RIGHT = 10;
double f(double x){
return 2*sin(x/3);
}
void thomasAlgorithm(double *y, double *h, int N, double *c){
double alfa[N], beta[N], hamma[N], delta[N], A[N], B[N];
alfa[1] = hamma... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int* convert2bin(const int* num, int* binaryNum){ // convert a decimal number to a 16 bit binary using the divide by 2 method
int intermediateNum = *num;
int currPos = 15;
while(intermediateNum != 0){
if(intermediateNum%2 == 1){
binaryNum[c... |
C | #include <yajl/yajl_parse.h>
#include <string.h>
#include <stdlib.h>
#include "cetcd.h"
typedef struct yajl_parser_context_t {
void *userdata;
cetcd_array keystack;
cetcd_array nodestack;
} yajl_parser_context;
#define EQ(s, d) ((strncmp((s), (d), sizeof((d)) - 1) == 0) && (sdslen(s) == (sizeof((d))-1))... |
C | // getenv.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
seed@ubuntu:~$ export MYSHELL=/bin/sh
seed@ubuntu:~$ gcc -o getenv getenv.c
seed@ubuntu:~$ ./getenv MYSHELL ./vuln
MYSHELL will be at 0xbffffe8a*/
int main(int argc, char const *argv[])
{
char *ptr;
if(argc < 3)
{
printf("Us... |
C | /* today is 389e */
/* the C cave */
/* magPi - 03 */
#include <stdio.h>
int main()
{
int i = 100, j = 9, k;
i = i/10;
k = i - j;
printf("Well done this program compiles.\n");
printf("%d - %d = %d\n",i,j,k);
return 0;
}
|
C | //
// Created by 王晓雨 on 17/1/20.
//
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include "graph.h"
#define MAXSTRING 1000
#define MAXPAGE 30
int main(int argc, char *argv[]) {
char delim[2] = " ";
char *token;
char line[MAXSTRING] ;
FILE *f;
... |
C | //C program for strupr()//
#include<stdio.h>
#include<string.h>
int main()
{
char str[10];
printf("enter the string\n");
gets(str);
printf("the strupr()is:%s",strupr(str));
return 0;
}
|
C | // shows how pointers work
// Oliver Kenny
#include <stdio.h>
// POINTER RULES
// [*] accesses the literate pointer varible for example "int number" in this case
// [pointer with no '*'] asseses the pointer address, the address of "int number" in this case
// Pointers allow for direct alterations to be made directly t... |
C | #include <stdio.h>
int main(){
int grupos,i,maior=0,n;
while(scanf("%d", &grupos)!=EOF){
maior=0;
for(i=0;i<grupos;i++){
scanf("%d", &n);
if(maior<n){
maior=n;
}
}
if(maior<10){
printf("1\n");
}
if(maior>=10&&maior<20){
printf("2\n");
}
if(maior>=20){
printf("3\n");
}
}
return 0;
} |
C | #ifndef _FILE_H
#define _FILE_H
char get_value[30];
typedef struct item_t
{
char *key;
char *value;
} ITEM;
/*
*ȥַҶ˿ո
*/
char *strtrimr(char *pstr);
/*
*ȥַ˿ո
*/
char *strtriml(char *pstr);
/*
*ȥַ˿ո
*/
char *strtrim(char *pstr);
/*
*ļһжkeyvalue,itemָ
*line--ļһ
*/
int get... |
C | #include <stdio.h>
#include <string.h>
int f_calls = 0;
int fibo[50];
int fib(int n)
{
f_calls += 1;
if (fibo[n] != 0) {
return fibo[n];
}
if (n == 1 || n == 2) {
return fibo[n];
}
fibo[n] = fib(n - 1) + fib(n - 2);
return fibo[n];
}
int main()
{
in... |
C | #include "vector_capacity.h"
#include <assert.h>
#include <stdio.h>
size_t multiplier = 2;
int main(void) {
assert(1 == calc_new_capacity(0, 1));
assert(6 == calc_new_capacity(3, 4));
assert(7 <= calc_new_capacity(2, 7));
struct Vector v = empty_vector();
assert(resize_vector(&v, 20));
for (size_t i = ... |
C | /*
Nombre: Alejandro Molina Criado
Fecha: 01 / 04 / 2020
para compilar: gcc -O2 -fopenmp -o nombre nombre.c
*/
#include <stdio.h>
#include <stdlib.h>
#include <omp.h>
int main(int argc , char **argv){
int i,n = 20 ,
a[n],
suma = 0;
if(argc < 2) {
fprintf(stderr , "\nERRO... |
C |
void partition(int * arr, int low, int high) {
int p = (low + high) / 2;
int pivot = arr[p];
int h = high;
int l = low;
// move all values less than the pivot to the first
// part of the arr, values higher than the pivot to
// the second.
// can assume that the pivot is in the co... |
C | #include <math.h> // required for sqrt(), fabs();
#include <stdio.h> // required for exit
#include <stdlib.h> // required for malloc(), free();
#include <float.h> // required for DBL_EPSILON
#include <string.h> // required for memcpy()
#include <time.h>
#define FMAX(a,b) ((a) > (b) ? (a) : (b))
void freema... |
C | #include <stdio.h>
int main()
{
int iM, iN, iC, iD, matA[10][10], matB[10][10], matAnswer[10][10];
printf("Enter the number of rows and columns of matrix\n");
scanf("%d%d", &iM, &iN);
printf("Enter the elements of matA matrix\n");
for (iC = 0; iC < iM; iC++)
for (iD = 0; iD < iN; iD++)
... |
C | #include <stdio.h>
int main(void)
{
int i,low,high,k;
printf("\n enter the start range:");
scanf("%d",&low);
printf("\n enter the end range");
scanf("%d",&high);
printf("\n the prime numbers between %d and %d are:",low,high);
for(i=low;i<=high;i++)
{
for(k=2;k<=i;k++)
{
if(i%k==0)
break;
}
if(i==k)
printf("\n%d",k... |
C | /*
test int type change to char type
,used for gpt slot change
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
int n;
int a;
int b;
char buff[20];
char tmp[32];
char *server_ip;
char sum[8] = "1.2.3";
n = ~(1 << 2) &0xff;
printf("n is %x\n",n);
server_ip = "56";
sprintf(tmp,... |
C | //*****************************************************************************
//* Jaakko - Projekt WORM *
//*****************************************************************************
#include "allan.h"
#include "time.h"
//#include "stdio.h"
//********************... |
C | #include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main()
{
FILE * fileIn;
FILE * fileOut;
int i, j, amt, num, min, max;
char currentHeading;
char buff[50]={}, inName[50]={}, outName[50]={};
srand(time(0));
for(i = 1; i <= 20; i++)
{
sprintf(inName, "%d.in", i);
sprintf(outName, "%d.sol", i);
f... |
C | #include <prodcons.h>
#include <future.h>
int n; //Definition for global variable 'n'
sid32 produced,consumed,futuresem,prodsem,conssem;
/*Now global variable n will be on Heap so it is accessible all the processes i.e. consume and produce*/
shellcmd xsh_prodcons(int nargs, char *args[])
{ int len=0,j,... |
C | #include<stdio.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<netinet/in.h>
#include<netdb.h>
#define SERV_TCP_PORT 5035
int main(int argc,char*argv[])
{
int sockfd;
struct sockaddr_in serv_addr;
//struct hostent *server;
char buffer[4096];
///define socket///
sockfd=socket(AF_INET,SOCK_STREAM,0);
///socke... |
C | #include <stdlib.h>
#include <stdio.h>
#include "3-calc.h"
/**
* main - Here our function will calculates two integers together
* @argc: This is our argument count
* @argv: This is our argument for strings
*
* Return: 0
*/
int main(int argc, char *argv[])
{
if (argc != 4)
{
printf("Error\n");
exit(98);
}... |
C | #include <stdio.h>
#include <stdlib.h>
/*From Now we are going to make program more interactive
and we let computer decide whether execute output or not.
in this module we are going to use if statement.
in "if" statement if condition given in parenthesis is satisfies , output will execute
*/
int m... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
#include <pwd.h>
#include <grp.h>
#include "debug_stat.h"
#define NUMOFLSFLAGS sizeof(ls_flags)/sizeof(char*)
/*
void clr_hidden(){
//Bold blue
printf("\... |
C | #define F_CPU 8000000
#include<avr/io.h>
#include<util/delay.h>
#define USART_BAUDRATE 1200 // Baud Rate value
#define BAUD_PRESCALE ((F_CPU / (USART_BAUDRATE * 16)) - 1)
void USART_write_string(unsigned char *str);
void usart_init(void);
void usart_putch(unsigned char send);
unsigned int usart_getch(... |
C | #include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/i2c-dev.h>
#include <unistd.h>
void Write_4_7seg_I2C(unsigned int value){
unsigned int vetor[4];
float x;
float aux;
// 1023 ----- 3
// value ---- x
// x = (3*value)/1023;
x = (3*val... |
C | /*
*timing.c
*Michael Blackburn
*determines cache line size using iteration
*/
#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>
#define SIZE 64 * 1024
double timing(int jump){
int test_array[SIZE];
struct timeval t1, t2;
int i, value = 0;
double avg = 0.0, sec1, sec2, usec1, usec2, total... |
C | /* Reference * 1. http://csapp.cs.cmu.edu/2e/ics2/code/conc/echoservers.c
* (code related to use select function)
*/
#include "csapp.h"
#include "network.h"
#include <semaphore.h>
#include <stdbool.h>
#include <sys/time.h>
#include "protocol.h"
#include <sys/epoll.h>
#include <unistd.h>
#define MAX_EVENT_NUM 10000... |
C | /*
Author:- KARSHIL SHETH
Objective:-Implementation of for Loop.
Date:- 11-02-2018
*/
void main()
{
int i,sum=0;
clrscr();
for(i=1;i<=50;i++)
{
printf("\nI : %d",i);
sum=sum+i;
}
printf("\n Sum = %d",sum);
getch();
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.