language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_itoa_base_u.c :+: :+: :+: ... |
C | #ifndef EXERCISE_I_LINE_BUFFER_H
#define EXERCISE_I_LINE_BUFFER_H
#include <stddef.h>
#include <memory.h>
#include "Attributes.h"
#include "Macros.h"
typedef struct Line_Buffer {
char *contents;
size_t bytes;
} Line_Buffer;
static __INLINE__
Line_Buffer Line_Buffer_Create(void) {
return (Line_Buffer) {
... |
C | #include <stdio.h>
#include <sys/wait.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <png.h>
#include <errno.h>
#include <stdarg.h>
#include "main.h"
//Entrada: Estructura bitmap_t que contiene los pixeles, ancho y alto de la imagen/ posicion en columnas/ posicion en filas.
//Funcionamiento: E... |
C | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
int matriz[20][20];
int apx=15,apy=6,ptox=6,ptoy=11;
void llenar() {
int x,y;
for(y=0;y<20;y++)
for(x=0;x<20;x++)
matriz[x][y]=0;
}
void mostrar() {
int x,y;
for(y=0;y<20;y++){
for(x=0;x<20;x++)
printf("%d ", matriz[x][y]);
printf("\n");
}
}
in... |
C | /*
* ublox.c
* modified from TT7's ublox code: https://github.com/TomasTT7/TT7F-Float-Tracker/blob/99133b762c971b24040d007fff3f1a348941d788/Software/ARM_UBLOX.c
* Author: Tomy2
* Author: Medad Newman 23/12/19
*
*/
#include <stdlib.h>
#include "ublox.h"
#include <stdio.h>
#include "stm32l0xx_hal.h"
#include "ma... |
C | #include <stdio.h>
// void error1()
// {
// int a = 1;
// int *p = &a;
// int **pp = &a;
// printf("%d\n", a );
// printf("*p = %d\n", *p);
// printf("**pp = %d\n", **pp);//waring: initialization from incompatible pointer type 运行时程序报错
// }
// void error2()
// {
// int a = 1;
// int *p = &a;
// int **pp = &&a... |
C | #include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//not done
struct listnode{
struct listnode *next;
int data;
};
struct listnode *create_node(int data){
struct listnode *new = malloc(sizeof(struct listnode));
new->next = NULL;
new->data = data;
return new;
}
void print_in... |
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 | /************************************************
* creator: vingc zhang
* time: 2017.03.22
*************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
ref: http://www.geeksforgeeks.org/check-if-a-given-array-can-represent-preorder-traversal-of-binary-search-tree/
C... |
C |
#define _CRT_SECURE_NO_WARNINGS 1
#define _CRT_NONSTDC_NO_DEPRECATE 1
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "ctype.h"
#define N 100
typedef struct
{
int top; //统计栈中有多少个元素,data[top]是栈顶
int data[N]; //数组用于存放数据
} stack;
stack mystack = {-1, {0}};
//-1代表栈中... |
C | /********************************************************
ƽ ̨KL46Сϵͳ
ԭ桿
ĽBUPTSmartCar 2011
¡2014102
dev.env.IAR6.50
Target KL46
Crystal 50.000Mhz
*********************************************************/
#ifndef __GPIO_H__
#define __GPIO_H__
#include "common.h"
#define GPIO_SET(PORTx,n,x) GPIO_SET_##... |
C | #include <stdio.h>
#include <stdlib.h>
int main() {
float x, y, x2, y2, temp;
float my_x[100], my_y[100];
int line=0, i;
FILE *coor = fopen("Result.txt", "r");
//creer 2 tableaux x, y
for (i=0 ; i<100 ; i++) {
while (fscanf(coor, "%f %f", &my_x[i], &my_y[i])==1) {}
}
fclose(coor);
/*
//affic... |
C | #include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); } while (0)
/* This program prints out a bunch of information about the system
* it's running on... |
C | #include "Stack.h"
#include "cc.h"
#include "ImageMap.h"
int cc(char* sourcefile, char* destinefile){
int label =2;
int aux=0;
int *m, *origem;
int nlin,ncol,x[4]={-1,0,0,1},y[4]={0,-1,1,0};
Stack* pilha;
Image *image;
image = readImageBinaryFormat(sourcefile);
nlin = ... |
C | #include <stdio.h>
#include <malloc.h>
#include <fcntl.h>
#include <signal.h>
#include <netinet/in.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <unistd.h>
#include <getopt.h>
#include <errno.h>
static char *chroot_path = NULL;
static int do_fo... |
C | #include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>
int main(void)
{
int p_id;
int status;
int return_code = 0;
if((p_id = fork()) == 0) {
printf("start process A\n");
sleep(2);
printf("end process A\n");
}
else {
if(p_id != -1) {
wait(&status);
printf("end root pro... |
C | #include <stdio.h>
struct XXX
{
int x;
float y;
char z;
};
int main()
{
struct XXX *ptr=(struct XXX *)0;
ptr++;
printf("Size of structure is: %d",*ptr);
return 0;
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_file_properties.c :+: :+: :+: ... |
C | // Please visit this link for question https://www.interviewbit.com/problems/search-for-a-range/
int* searchRange(const int* A, int n1, int B, int *len1)
{
int *arr=(int *)malloc(sizeof(int)*2);
int l=binary(A,n1,B,0);
int r=binary(A,n1,B,1);
arr[0]=l;
arr[1]=r;
*len1=2;
return arr;
}
int bi... |
C | #include<stdio.h>
#include<string.h>
void main()
{
char s[30];
int i;
printf("Enter string :");
gets(s);
for(i=0;i< strlen(s);i++)
{
if(s[i]>='a' && s[i]<='z')
{
s[i]= toupper(s[i]);
}
else
{
s[i]=tolower(s[i]);
}
}
printf("\nConverted string is ");
puts(s);
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* putline.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<stdlib.h>
void towerOfHanoi(int n,char fromTower,char toTower,char auxTower){
if(n==1){
printf("\nMove disc 1 from tower %c to tower %c\n",fromTower,toTower);
return;
}
towerOfHanoi(n-1,fromTower,auxTower,toTower);
printf("\nMove disc %d from tower %c t... |
C | /*********************************************************
Name: Sahil Nimeshkumar Lapsiwala
ID: 132-584-160
Section: M
*********************************************************/
#include<stdio.h>
#define MAXDAYS 10
int main()
{
int ndays = 0, i,num = 0, flag = 0;
double avg = 0, temp=0;
int high[MAXDAYS... |
C | #include <stdio.h> /* input, output */
#include <stdlib.h> /* malloc, calloc */
#include "inout.h" /* funções, ED */
/* 1 modulo - contém o tratamento de entradas e saidas */
FILE* abrearquivo(char *nome, char *funcao){
FILE *fp;
fp = fopen(nome, funcao);
if(fp == NULL){
printf("erro ao abrir arq... |
C | #ifndef HASH_H
#define HASH_H
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#define HASH_SIZE 256
typedef struct hash_table hash_table;
typedef struct hash_node hash_node;
typedef long long int lli;
struct hash_node {
hash_node* next;
void* key;
lli frequency;
int new... |
C | //
// Created by przemek on 11/29/18.
//
#include <printf.h>
#include "../include/message.h"
mes_car gen_car(int seed)
{
mes_car new_car;
if((seed % 7 == 0) || (seed % 5 == 0) || (seed % 12 == 0))
//if((seed % 7 == 0) || (seed % 5 == 0) || (seed % 6 == 0) || seed % 3 == 0 || seed % 4 == 0 || seed % 8 == 0... |
C | #include <time.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
#include <assert.h>
#include "ai.h"
#include "utils.h"
#include "hashtable.h"
#include "stack.h"
void copy_state(state_t* dst, state_t* src){
//Copy field
memcpy( dst->field, src->field, SIZE*SIZE*sizeof(int8_t) );
dst->curs... |
C | #include<stdio.h>
#include<stdlib.h>
void main()
{
int day,month,year;
int nextday,nextmonth,nextyear;
printf("\n Enter the date format DD MM YYYY:");
scanf("%d%d%d",&day,&month,&year);
if(((day>=1)&&(day<=31))&&((month>=1)&&(month<=12))&&((year>=1812)&&(year<=
2012)))
{
nextmonth=month;
nextyear=year;
if((month==1)||(... |
C | /**
* COMP30023 Project 2
* Author: Jonathan Jauhari 1038331
*
* Ungraded Phase 1: read raw binary packets from STDIN, parse them into a
* data structure and print appropriate logs to a file
*/
#include <arpa/inet.h>
#include <assert.h>
#include <getopt.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio... |
C | #include "json.h"
int writeJson(json_object* json)
{
FILE* file = NULL;
file = fopen("training.json", "w");
if (file == NULL)
{
return 0;
}
//fseek(file, 0, SEEK_END);
fprintf(file, "%s\n", json_object_to_json_string(json));
fclose(file);
return 1;
}
void dbErase()
{
FILE* file = NULL;
file = fopen("... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main ()
{
//int DeltaCalculate = "RootsDeltaCalculate.exe";
int a,b,c;
float x1, x2;
printf("Please Enter A: ");
scanf("%d", &a);
printf("Please Enter B: ");
scanf("%d", &b);
printf("Please Enter C: ");
scanf("%d", &c);
... |
C | #include <stdio.h>
int main()
{
int marks[5];
for (int i = 0; i < 5; i++)
{
printf("enter the value of marks for student %d: ", i + 1);
scanf("%d", &marks[i]);
}
for (int i = 0; i < 5; i++)
{
printf("enter the value of marks for student %d: %d \n ", i + ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_flag_tab.c :+: :+: :+: ... |
C | #include <detpic32.h>
#define DisableUart1RxInterrupt() IEC0bits.U1RXIE = 0
#define EnableUart1RxInterrupt() IEC0bits.U1RXIE = 1
#define DisableUart1TxInterrupt() IEC0bits.U1TXIE = 0
#define EnableUart1TxInterrupt() IEC0bits.U1TXIE = 1
#define BUF_SIZE 8
#define INDEX_MASK (BUF_SIZE - 1)
#define TRUE 1
#define FALSE ... |
C | #include <EEPROM.h>
/**
* Модуль чтения-записи данных в/из EEPROM согласно их "типам":
* умеет читать/писать данные автонастройки датчиков линии, а также
* данные по группе настроек калькулятора линии
*
* @author fvn-20171009
*
* !!! Внимательно: подключать после файлов sensor.h, calculator.h и др..
*/
/**... |
C | #include<string.h>
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
#define SIZE 100
void main()
{
int size = SIZE;
char** word = (char**)malloc(SIZE*sizeof(char*));
char** translation = (char**)malloc(SIZE*sizeof(char*));
int i = 0, flag = 1,j;
while(1)
{
if(i == size)
{
size*=2;
word = (char*... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char const *argv[]) {
if (argc < 3) {
printf("ERROR: Too few arguments!\n");
return 1;
}
FILE* fp = fopen(argv[1], "r");
if (!fp) {
printf("ERROR: Input file not found!\n");
return 2;
}
... |
C | #include <stdio.h>
#include <stdlib.h>
struct NodoArbol{
int dato;
struct NodoArbol* ptrNodoIzq;
struct NodoArbol* ptrNodoDer;
};
struct NodoArbol* crearNuevoNodo(int dato){
struct NodoArbol* nuevoNodo = (struct NodoArbol*) malloc(sizeof(struct NodoArbol));
nuevoNodo->ptrNodoIzq = NULL;
nuevoNodo->ptrNodoDer =... |
C | //Write a parallel program for Points Classification. Justify the inference.
#include<stdio.h>
#include<stdlib.h>
#include<omp.h>
#include<math.h>
#define CLUSTER_SIZE 4
int cluster[CLUSTER_SIZE][2] = {{75, 25}, {25, 25}, {25, 75}, {75, 75}};
long long cluster_count[CLUSTER_SIZE];
unsigned long points_sizes[6]={10000... |
C | /******************************
* Filename: LinkedListLab.c
* Author: Blakely North
* Date Last Edited: 1-22-2019
* Brief Description: A demonstration of a few things you can do with malloc and pointers
gcc -Wall -Wextra -O -ansi -pedantic -o LinkedListLab LinkedListLab.c
******************************/
... |
C | #include <stdio.h>
/* Observation: Integer Format Specifiers */
int main() {
// RJ = Right Justified, LJ = Left Justified, B = BLOCKS
// %[A].[B]d -->> meaning A is the *CONSIDERING SIDE and B is the *FILLING SIDE
// see the notebook to understand better
// If it is a decimal, no matter +ve or -ve decimal, it willbe R... |
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct Label_s {
char name[16];
int age;
} Label;
typedef struct NameStats_s {
int cntTotal;
int cntLong;
} NameStats;
typedef struct AgeStats_s {
int cntTotal;
int cntAdults;
int cntKids;
} AgeStats;
///////... |
C | #include <stdio.h>
#include <string.h>
#include<math.h>
int main(void) {
int t,i,len,flag;
char a[12345],save;
scanf("%d",&t);
while (t-- > 0) {
scanf("%s",a);
len = strlen(a);
flag=0;
for(i=0;i<len/2;i++) {
if(a[i] == a[len-i-1]) {
if (a[i] == '.') {
... |
C | #include<stdio.h>
#include<string.h>
#include<pthread.h>
#include<stdlib.h>
#include<unistd.h>
pthread_t tid1;
pthread_t tid2;
int status, skorA=0, skorB=0, sisaA=16, sisaB=16;
char nama1[100]; char nama2[100];
int boardA[20];
int boardB[20];
int turn=1;
int bagian=1;
void *playerA(void *arg){
int lubang;
while(1){... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* print_ptr.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main()
{
char x;
char y[100];
char z[100];
scanf("%c %s %[^\n]%*c", &x, &y, &z);
printf("%c\n%s\n%s",x,y,z);
return 0;
}
|
C | /* SCMS Include File SCCS Header
* "@(#)SCCSID: libstdtime.h 82.1"
* "@(#)SCCSID: Version Created: 08/27/98 12:26:19"
*/
#ifndef _LIBSTDTIME_H_
#define _LIBSTDTIME_H_
#include <sys/time.h> /* for struct timeval */
#include <time.h> /* for time_t and struct tm */
#include <limits.h> /* for LONG_MIN and LONG_... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char str[1000] = "GET /562f25980001b1b106000338.jpg HTTP/1.1";
char content[1000] = "Content-Length:40";
char *content_lenght = content;
char *murl;
murl = strpbrk(str," \t");
*murl++ = '\0';
if(strncasecmp(content_lengh... |
C | #include<stdio.h>
#include<omp.h>
#include<string.h>
#define threads_num 4
#define var_num 4
struct variable
{
char* name;
double values[3];
};
//Struct for storing first two max looping variable values
struct ip_var
{
char* name;
double value;
};
int main(int argc,char* argv[])
{
int i,j,threads... |
C | /*
** EPITECH PROJECT, 2018
** ia_turn.c
** File description:
** ia turn
*/
#include "../include/proto.h"
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
int process_ia_turn(unsigned char **board, unsigned int nb_m, unsigned int ln)
{
matches_t matches_removed = {0, 0};
matches_removed = compute_algorithm... |
C | /* Kion Smith
* kls160430
* CS 3377.0W3
*/
#include <stdio.h>
//using defines to set the limits of the bounds
#define UPPER 400
#define LOWER 100
int main(void)
{
//Initilize a
int i;
//Print F and space for C
printf("F\t C\n");
//Loop from 100 to 400
for(int i=LOWER;i<=UPPER;i++)
{
//Print out the cu... |
C | /**
* Adapted from Hacking, the Art of Exploitation by Jon Erickson
* See more elaborate version in exploitable.c
*/
#include <stdio.h>
#include <string.h>
int main(int argc, char * argv[]) {
char text[1024];
strcpy(text, argv[1]);
printf(text);
printf("\n");
} |
C | #include <stdexcept>
const int YEAR_MIN = 1970;
const int YEAR_NOM = 2000;
const int YEAR_MAX = 2018;
enum MONTH {
JAN = 1, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC
};
const int MONTH_MIN = JAN;
const int MONTH_MAX = DEC;
const int DAY_MIN = 1;
const int DAY_NOM = 15;
const int DAY_MAX[MONTH_MAX + ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* builtin_export.c :+: :+: :+: ... |
C | #include <err.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
char *fileName;
int i, size = 10;
FILE *fp;
if (argc == 1)
errx(EXIT_FAILURE, "no output file name given");
fileName = argv[1];
if (argc > 2)
size = atoi(argv[2]);
... |
C | #include "text_display_driver.h"
#include <common.h>
#define D(x) ((display_t*)x)
void display_init(display_p d, word_t *address, byte_t width, byte_t height) {
D(d)->address = address;
D(d)->width = width;
D(d)->height = height;
D(d)->attribute = TXT_DEFAULT;
D(d)->x = D(d)->y = 0;
D(d)->tab_width = TXT_... |
C | #include<stdio.h>
#include<stdlib.h>
#include<conio.h>
int main()
{
int n1,n2,s,r,m,d;
printf("nIntroduzca el primer numero positivo o negativo:\n");
scanf("%d",&n1);
printf("Introduzca el segundo numero positivo o negativo:\n");
scanf("%d",&n2);
s=n1+n2;
r=n1-n2;
m=n1*n2;
d=n1/n2;
printf(... |
C | #include "font.h"
TTF_Font *loadFont(char *name, int size)
{
/* Use SDL_TTF to load the font at the specified size */
TTF_Font *font = TTF_OpenFont(name, size);
if (font == NULL) {
printf("Failed to open Font %s: %s\n", name, TTF_GetError());
exit(1);
}
return font;
}
void close_font(TTF_Font *font)
{
/... |
C | /*
* Write a program to accept a number and print all factors excluding the number
Input: 24
Output: all factors: 1, 2, 3, 4, 6, 8, 12
*/
#include "6.h"
int main()
{
int fact, num;
printf("Enter a number: ");
scanf("%d", &num);
/* factors which perfectly divides the number are the factors*/
fact = 1;
while(nu... |
C | #include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "framebuffer.h"
#include "bitmap.h"
#include "input.h"
int main(){
InitFramebuffer();
// Image spaceshipImage = LoadBitmapAsImage("spaceship.bmp");
Image parachuteImage = LoadBitmapAsImage("parachute.bmp");
parachuteImage.pivot.y = 0;
Image back... |
C | #include <stdio.h>
#include <stdlib.h>
struct employee
{
char name[10];
int num;
char sex[5];
int age;
char adress[30];
int salary;
char health[20];
char edu[10];
}Emp[10];
void main()
{
int i;
FILE *fp;
if ((fp=fopen("employee.dat","r"))==NULL)
{
printf("无法打开文件\n");
exit(1);
}
else
{
for (i=0; i... |
C | #include<stdio.h>
#include<string.h>
#include<pthread.h>
#include<stdlib.h>
#include<unistd.h>
#include<semaphore.h>
sem_t cEmpty; //semaphore für producer
sem_t cFull; //semaphore für consumer
int counter = 0; // Produktanzahl
int lagerGrosse = 10; //lagergröße
int itemBuffer[10]; //Array für Lager
//... |
C | #include <stdio.h>
int main()
{
//To store the number
long int num;
int sum=0; // To store sum
printf("Enter a number: ");
scanf("%ld",&num);
//While number is not zero
while(num!=0){
sum+=num%10;
num=num/10;
}
//displaying sum
printf("The sum of the digits is: %d",sum);
return 0;
} |
C | //////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
// @file App_access.c //
// @brief Acces Control main //
// @author Grupo 4 //
//////////////////////////////////////////////////////////////////
//////////... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include "ia.h"
#include "utils.h"
#include "mapa.h"
#include "grafo.h"
#include "fronteira.h"
void prepara_fronteiras(tmapa *m) {
zera_status(m);
zera_counted(m);
flood_set_status(m, 0, 0, m->mapa[0]->cor, STAT... |
C | /*
* SPI Test code.
* License. Do whatever you want with the code. Just remember my name :)
* Author : Zubair Lutfullah Kakakhel. But most of this comes from scattered forum posts..
* Email : EL12ZLK@LEEDS.AC.UK
*/
#include "alt_types.h"
#include "sys/alt_stdio.h"
#include "io.h"
#include "system.h"
#include "sys/... |
C | #include "robotarm.h"
// ---------- UART Interrupt --------------------------
#pragma vector=USCIAB0RX_VECTOR
__interrupt void USCI0RX_ISR(void)
{
volatile char inChar;
inChar = UCA0RXBUF; // Read in UART serial port
testInput(inChar); // Test the input
}//UART_ISR()
// ------- Timer A1.0 IS... |
C | // External test case from SAMATE's Juliet Test Suite for C/C++
// (http://samate.nist.gov/SRD/testsuite.php)
// Associated with CWE-134: Uncontrolled format string. http://cwe.mitre.org/data/definitions/134.html
// Examples amended to have all function declarations inlined.
#define NULL 0
typedef unsigned long size_t... |
C | #include "cstd.h"
#include <sys/wait.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
static void proc_null_redirect(proc_t* args)
{
int rfd, wfd;
const char* f = "/dev/null";
rfd = open(f, O_RDONLY, 0);
if (rfd < 0)
pdie("open() on '%s'... |
C | #include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <omp.h>
int main(int argc, char **argv) {
/* create an array of size 1 million */
int *A;
A = (int *) malloc(1000000 * sizeof(int));
assert(A != NULL);
int j;
for (j=0; j<1000000; j++) {
A[j] = (j % 8);
}
... |
C | #include <stdio.h>
int main() {
char c;
int floor = 0;
int pos = 0;
while ((c = getchar()) != EOF) {
pos++;
switch (c) {
case '(':
floor++;
break;
case ')':
floor--;
break;
}
if (floor == -1) {
printf("%d\n", pos);
break;
}
}
return 0;
}
|
C | #ifndef NODE_H
#define NODE_H
typedef struct Node node;
int lookup(node*, int target);
node* new_node(int data);
node* insert(node* n, int data);
void print_nodes_with_order(node* n, int order);
void print_nodes_preorder(node* n);
int count_nodes(node* n);
void assign_data(node* n, int data);
int get_data(node* n);
v... |
C | #include<stdio.h>
int min(int a[],int x,int y)
{
if(a[x]<a[y])
return x;
return y;
}
int max(int a[],int x,int y)
{
if(a[x]>a[y])
return x;
return y;
}
int main()
{
int n,k,p,i,j,temp,istart=0,jstart=0,num,state=0,mi,a[1000000]={0},st[1000000]={0},b[1000000],ma,del=0,count=0;
scanf("%d",&n);
long long int su... |
C | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: main.c
* Author: ANURADHA
*
* Created on December 5, 2019, 11:43 AM
*/
#include <stdio.h>
int main()
{
float a... |
C | #include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
int main(void){
pid_t p1=fork();
wait();
if(p1==-1){
exit(-1);
}
if(p1==0){
printf("I'm..\n");
}else{
printf("I'll never join you!\n");
pid_t p2=fork();
wait();
if(... |
C |
/* adjacency tool for assoicated objects */
/* Copyright 2007 United States Government as represented by the
* Administrator of the National Aeronautics and Space
* Administration. No copyright is claimed in the United States under
* Title 17, U.S. Code. All Other Rights Reserved.
*
* The knife platform is lice... |
C | #include <stdio.h>
struct date {
int month;
int day;
int year;
} my_day;
struct date* get_date(struct date *d);
int main()
{
struct date *p = &my_day;
(*p).month = 12;
// 指针所指的结构变量中的成员
p->month = 12;
printf("p.month = %d\n", p->month);
struct date d1;
struct date *d2 = get_da... |
C | /*
This file is written by Lepidum Co., Ltd.
Copyright (c) 2005-2006 by Lepidum Co., Ltd.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define TEST_MAGIC 0xABADCAFEUL
#define TEST_CASE(func) extern void test_case_##func(void);
#define TEST_CASE_S(func, s) extern void test_case_##func(voi... |
C | #include <assert.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <string.h>
#include <stdio.h>
#include <fcntl.h>
#include <arpa/inet.h>
#include <dirent.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include <math.h>
/* ... |
C | /*
** list.c for PSU_2015_zappy in /home/boivent/B4/1.UnixProg/PSU_2015_zappy/srcServer
**
** Made by David BOIVENT
** Login <boivent@epitech.net>
**
** Started on Thu Jun 09 13:53:25 2016 David BOIVENT
** Last update Sun Jun 26 17:41:14 2016 Matthew LEJEUNE
*/
#include "server.h"
t_server *init_server(int port)
{... |
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int k = 2;
int **Hyoun;
int Height, Width;
int chec(int H, int W){
if (H < 0 || H >= Height || W < 0 || W >= Width)
return 0;
if (Hyoun[H][W] == 1){
Hyoun[H][W] = k;
chec(H - 1, W - 1);
chec(H - 1, W);
chec(H - 1, W + 1);
chec(H, W - 1);
chec(H, W +... |
C | #include <errno.h>
#include <stdio.h>
/*
* Functions that set the value of errno can be checked with this function.
* errno is a global variable defined in errno.h
*
* returns 1 if an error was set, 0 if one was not set
*/
int errno_check() {
switch (errno) {
case EACCES: fprintf(stderr, "EACCES\n");
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* dig_maze.c :+: :+: :+: ... |
C | //5809650335
//Bannawich Chaliewkriengkrai
#include <stdio.h>
int main(){
int num;
printf("input: ");
scanf("%d",&num);
switch(num){
case 1:printf("One"); break;
case 2:printf("Two"); break;
case 3:printf("Three"); break;
case 4:printf("Four"); break;
case 5:printf("Five"); break;
}
ret... |
C | #include "apue.h"
int
main(int argc, char *argv[]) {
int int1, int2;
char line[MAXLINE];
while (NULL != fgets(line, MAXLINE, stdin)) {
if (2 == sscanf(line, "%d%d", &int1, &int2)) {
if (EOF == printf("%d\n", int1 + int2)) {
err_sys("printf error");
}... |
C | /*#include <stm32f407xx.h>
int i=0,j=0;
void gpioinit();
void usartinit();
int main()
{
gpioinit();
usartinit();
while(1)
{
for(i =0;i<=100;i++)
{
while((USART1 -> SR & (1<<7)) == 0)
{}
USART1 -> DR = i;
for(j = 0;j<=10000;j++);
while((USART1 -> SR & (1<<6))== 0)
... |
C | #include <stdio.h>
#include <stdlib.h>
#include "LinkedList.h"
#include "Controller.h"
#include "Employee.h"
#include "utn.h"
#include "parser.h"
#define arch "C:/Users/agus_/Downloads/TP3/eclipse_tp3/tp3_windows/data.csv"
/****************************************************
Menu:
1. Cargar los datos de los ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
unsigned int mask1 = 0x80, result1 = 0x00,
mask2 = 0xe0, result2 = 0xc0,
mask3 = 0xf0, result3 = 0xe0,
mask4 = 0xf8, result4 = 0xf0,
maskByte = 0xc0, resultByte = 0x80;
int valid1(unsigned int c) {
if((c & m... |
C | #include<stdio.h>
#include<stdlib.h>
struct array
{
int *A;
int size;
int length;
};
void Display(struct array arr);
void Rarrange(struct array *arr);
void swap(int *p,int*q);
void Display(struct array arr)
{
int i;
printf("The elements in the array are: \n");
for(i=0;i<arr.length;i++)
{
... |
C | #include "csapp.h"
#define TERMINAL 0
int main(int argc, char **argv)
{
char buf[MAXLINE]; //INPUTS FROM TERMINAL
char serverbuf[MAXLINE]; //MESG FROM SERVER
char chat[MAXLINE]; //CHAT
char move[3]; //MOVE
int turn = 0; //VARIABLE FOR YOUR TURN
int port; //PORT FOR CONNECTION
char *serverip; //SERVER IP... |
C | #include <stdio.h>
#include <stdlib.h>
#include "validar.h"
#include "cliente.h"
#include "alquiler.h"
#include "estadisticas.h"
#define TAM_CLIENTES 100
#define TAM_ALQUILERES 1000
int main()
{
ECliente arrayClientes[TAM_CLIENTES];
cli_initCliente (arrayClientes,TAM_CLIENTES);
EAlquiler a... |
C | /****************************************Copyright (c)****************************************************
**--------------File Info---------------------------------------------------------------------------------
** File name: time_clock.c
** Latest modified Date: 2019-03-21
** Latest Version: ... |
C | #include <EEPROM.h>
void saveSettings() {
EEPROM.put(0, settings);
EEPROM.put(sizeof(settings), SETTINGS_VERSION);
EEPROM.commit();
Serial.println("Saved settings to EEPROM " + String(SETTINGS_VERSION));
}
void loadSettings() {
EEPROM.begin(sizeof(settings) + 5);
char v[5];
EEPROM.get(sizeof(se... |
C | #include "malloc.h"
#include "malloc_internal.h"
#include <errno.h>
/*
* Calls `realloc` with size `nmemb * size`.
* If the multiplication overflows, `realloc` isn't called and `NULL` is
* returned.
*/
__attribute__((malloc))
void *reallocarray(void *ptr, const size_t nmemb, const size_t size)
{
size_t n;
if(n... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "alloc.c"
#include "afree.c"
char *p, *q[10];
main(int argc, char *argv[])
{
char buf[1000];
FILE *fp;
int i, j, k;
if (argc > 1)
fp = fopen(argv[1], "r");
else
fp = stdin;
while (fgets(buf, sizeof(buf), fp) != NULL) {
for (i = 0; i < 5... |
C | /*
* cTools.c
*
* Created on: 2019年10月22日
* Author: summer
*/
#include "itracker88Platform.h"
#include "cTools.h"
#include "commands.h"
#include "itrackerCharArray.h"
//分成2bytes。 "87a.a66"-->87,0; " 87.6a6"-->87,6; " 287.6 9"-->31,6; 因为287超过了256
int8 versionBytes(uint8* version, uint8* buffer, uint8 b... |
C | //C'de sabit ifadesi gereken yerlerden bazılarında C++'da sabit ifadesi gerekmiyor
#include <stdio.h>
int x = 10;
//int y = x; //C'de gecersiz C++'da gecerli
struct Nec {
int m1 : 3;
//int m2 : x; //hem C'de hem C++'da geçersiz
};
int main()
{
int i1 = 10, i2 = 20, i3 = 30;
int a[] = { i1, i2, i3 }; //C'de gec... |
C | #include<stdio.h>
#include<conio.h>
int main()
{
int a, b, c;
printf("Enter a value in a : ");
scanf("%d",&a);
printf("Enter a value in b : ");
scanf("%d",&b);
c=a;
a=b;
b=c;
printf("The value of a is %d and the value in b is %d",a,b);
getch();
return 0;
} |
C | /*
** claraxuxu, 2019
** my_str
** File description:
** dest copy src
*/
#include "lib_str.h"
char *my_strcpy(char *dest, char const *src)
{
int count = 0;
char const *cpy = src;
for (cpy = src; *cpy != '\0'; cpy++)
count ++;
for (int j = 0; j <= count; j++)
dest[j] = src[j];
ret... |
C | int sum_even(int *p, int num){
int i,sum = 0;
for(i = 0; i < num; i++){
if(*p % 2 == 0){
sum = sum + *p;
}
p++; //o pointer move-se para a próxima posição do inteiro
}
return sum;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.