language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /*************************************************************************
> File Name: hw_5_34.c
> Author: RunRui_Li
> Mail: 770486267@qq.com
> Created Time: Tue 29 May 2018 07:42:48 PM CST
************************************************************************/
/**
* 5.34❺试编写递归算法,逆转广义表中的数据元素。
*
* 例... |
C | #include <stdlib.h>
#include <string.h>
#include <dirent.h>
#include <stdio.h>
#include "csapp.h"
#define MAXBUF 8192
#define MAXLINE 8192
char *sreplace(char *orig, char *rep, char *replacetxt);
char *sinsert(char *orig, char *rep, char *replacetxt);
int main(int argc, char const *argv[])
{
struct dirent *... |
C | #include<stdio.h>
main() {
int i=1;
int dOne;
int dMax;
int dNumb;
scanf("%d",&dOne);
dMax=dOne;
while (i<10){
scanf("%d",&dNumb);
if(dNumb>dMax) {dMax=dNumb;};
i++;}
printf("Max value is %d", dMax);
return 0;
}
|
C | #include <stdio.h>
#include "sightglass.h"
__attribute__((export_name("add")))
__attribute__((noinline))
int add(int a, int b)
{
return a + b;
}
int main()
{
bench_start();
int c = add(40, 2);
bench_end();
printf("%d\n", c);
}
|
C |
void imp_mano(int array_cartas[], int cantidad_mano,int arriba_abajo,int carta_sel)
{
/*Permite imprimir cantidad determinada de cartas en horizontal
* para evitar construir una mano fija hace un barrido de impresion
* secuencial por un bucle y el uso de la funcion "fragmento_carta" */
short c;
short c1;
... |
C | //
// stdlib.h
//
// written by sjrct
//
#ifndef _STDLIB_H_
#define _STDLIB_H_
#include <stddef.h>
typedef struct {
int quot;
int rem;
} div_t;
typedef struct {
long quot;
long rem;
} ldiv_t;
void srand(unsigned int seed);
int rand();
void * malloc(unsigned size);
void free(void * ptr);
int abs(int);
long la... |
C | #include <stdio.h>
#define SEC_PER_MIN 60
int main(){
int min, sec , sec_left;
printf("==========CONVERTING SECONDS TO MINUTES AND SECONDS===========\n\n");
printf("Enter the number of seconds you wish to convert:\n");
scanf("%d" , &sec);
min = sec / SEC_PER_MIN;
sec_left = sec % SEC_PER_MIN;
... |
C | /* DriverLib Includes */
#include "driverlib.h"
/* Standard Includes */
#include <stdint.h>
#include <stdbool.h>
#include "Motor.h"
#include "ST7735.h"
uint16_t i = 0, j = 0, steps = 128, delay = 2;
/**********************************************************************
* Steps the motor 11.25 deg, 32 ... |
C | #include <stdio.h>
#include <stdlib.h>
#define NOT_EXIST - 1
#define VISITED 0
#define FRESH 1
#define TREE 2
#define BACK 3
typedef int VertexIndex;
typedef int EdgeIndex;
typedef int ID;
typedef struct Sack
{
VertexIndex v;
struct Sack *next;
}Sack;
typedef struct Edge
{
int weight;
VertexIndex endPoints[2];... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int x;
printf("=======================================\n FACTOR NUMBER FINDER\n=======================================\n");
printf("Please insert integer: ");
scanf("%d", &x);
while (x <= 0) {
printf("You insert number below than 0... |
C | #include <stdio.h>
#include <stdlib.h>
#include "list.h"
//===============================================
//将item拷贝进节点,此函数可根据Item的不同进行修改
//===============================================
static void CopyItem(Item item, struct node* pnode)
{
pnode->item = item;
}
//================================================... |
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: abdullah
*
* Created on December 28, 2017, 11:23 PM
*/
#include <stdio.h>
#include <stdlib.h> //f... |
C | //
// Created by Howe Chen on 11/06/2018.
//
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[]) {
int numbers[4] = {0};
char name[4] = {'Z', 'e', 'd', '\0'};
printf("numbers: %d %d %d %d\n", numbers[0], numbers[1], numbers[2], numbers[3]);
for (int i = 0; i < sizeof(name) / sizeof(char)... |
C | //
// recursive_pado.c
// W01-Practical-New
//
// Created by apple on 2018/2/11.
// Copyright © 2018年 Elsa Wei. All rights reserved.
//
#include <stdio.h>
int padocalc(int n) {
if (n == 0 || n == 1 || n == 2) {
return 1;
}
else return padocalc(n-2) + padocalc(n - 3);
}
|
C | #include<stdio.h>
void lmn(int p)
{
if(p==4) return;
lmn(p+1);
printf("%d\n",p);
}
int main()
{
lmn(1);
return 0;
}
|
C | #include <malloc.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
typedef int boolean;
#define true 1
#define false 0
typedef
void (*Func)();
typedef
struct _St_A {
Func *vt;
} _class_A;
_class_A *new_A(void);
void _A_first( _class_A *this,int _pn ) {
}
Func VTClass_A[] = {
( void... |
C | /*
* Title : Menghitung luas dan keliling segitiga
* Name : Rahmat Sabilludin Nurmughni
* NIM : A11.2016.09515
* Class : A11.4105
* Compile : Code::Blocks 16.01 Ubuntu (Linux)
*/
#include <stdio.h>
#include <ctype.h>
void menghitung();
void luas();
void keliling();
void keluar();
void main(){
... |
C | /*
ZZZZZZZZZZZZZZZZZZZZ 8888888888888 00000000000
ZZZZZZZZZZZZZZZZZZZZ 88888888888888888 0000000000000
ZZZZZ 888 888 0000 0000
ZZZZZ 88888888888888888 0000 0000
ZZZZZ 8888888888888 0000 0000 ... |
C | #include <stdio.h>
#include "myQue.h"
bool qempty(qnode head){
if(head==NULL) return true;
return false;
}
void qpop(qnode &head){
qnode tmp = head;
head=head->nxt;
free(tmp);
}
void qpush_back(qnode head,pthread_t n){
if(head==NULL){
head.data=n;
head->nxt=NULL;
qnode_n=1;
return;
}
qnode newqnode;
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_ncurses_players.c :+: :+: :+: ... |
C | #include "lsm6ds33.h"
#define ACCEL_DATARATE ACCEL_DR_104_Hz
#define ACCEL_RANGE ACCEL_4G
#define ACCEL_AA AA_50_Hz
#define GYRO_DATARATE GYRO_DR_104_Hz
#define GYRO_RANGE FS_245_DPS
#define X_SIGN 0
#define Y_SIGN 0
#define Z_SIGN 0
#define ORIENTATION 0
/*
* @brief: reads the 2 data registers and puts t... |
C | #include "kc_linearscroll.h"
/* http://stackoverflow.com/questions/977233/
* warning-incompatible-implicit-declaration-of-built-in-function-xyz*/
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
float timeb_di... |
C | #include"SeqHead.h"
int Insert(SeqList* list,int n,mytype x)//插入元素到第n个,错误返回-1,成功返回1
{
int i;
if(n > list->len)
{
printf("erro");
return -1;
}
else if(list->len == MAXLEN)
{
printf("erro");
return -1;
}
else if(n < 0)
{
printf("erro");
return -1;
}
else
{
for(i = list->le... |
C | #include<stdio.h>
struct POINT{
int x,y;
};
char left(struct POINT *ivst,struct POINT *p1,struct POINT *p2){
if(p1->x==p2->x&&p1->x<ivst->x) return 1;
return 0;
}
char cross_threshold(struct POINT *ivst,struct POINT *p1,struct POINT *p2){
if(p1->y>=ivst->y&&p2->y<ivst->y) return 1;
if(p2->y>=ivst->y&&p1->y<ivst->y... |
C | #include <stdio.h>
int main() {
double journey, fee = 0;
int time;
scanf("%lf %d", &journey, &time);
if(journey <= 3) fee = 10.0;
else if(journey <= 10) fee = 10.0 + (journey - 3.0) * 2.0;
else fee = 24.0 + (journey - 10.0) * 3.0;
if(time >= 5) fee += time / 5 * 2;
printf("%.0lf", fee);
return 0;
}
|
C | #include <unp.h>
int main(int argc, char ** argv)
{
if (argc < 2)
err_quit("wrong parametes");
in_addr_t addr;
addr = inet_addr(argv[1]);
printf("%x\n", addr);
struct in_addr addr_stru;
addr_stru.s_addr = addr;
printf("convert back: %s\n", inet_ntoa(addr_stru));
return 0;
}
|
C | #include <stdio.h>
int main()
{
int x;int factorial=1;
printf("please enter any number\n");
scanf("%d" , &x);
for (int i=1;i<=x;i++)
{ factorial = factorial*i;}
printf("factorial =%d\n",factorial);
return 0;
}
|
C | /******************************************************************************
Heat Equation Richardson's Method - Algorithm 12.2C
*******************************************************************************
To approximate the solution of the Parabolic partial-differential equation
u(x,t)/t - u(x,t)/x = ... |
C | #include <msp430.h>
#define S1 P2IN&BIT1
#define S2 P1IN&BIT1
/**
* main.c
*/
int main(void)
{
//WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer
//interfacing LED 1 and LED 2 as outputs
P1DIR |= BIT0; //P1.0 Output direction
P4DIR |= BIT7; //P4.7 Output direction
P1OUT &= ~BIT0; //led 1 is OFF
... |
C | #include<stdio.h>
int main()
{
// 13, 21, 52 - n kolejnych liczb
int n;
printf("Podaj liczbę n: ");
scanf("%d", &n);
int i=1;
int suma=0;
/*
for (i=1; i<=n; i++)
if (i%100 == 13 || i%100 == 21 || i%100 == 52)
{
suma = suma + i;
}
else
n++;
while (i<=n)
{
if (i%10... |
C | #include<stdio.h>
#include"libstack.h"
/* xの値を表示する関数 */
void print_x(int x) {
printf("the valule of x: %d\n", x);
}
int main() {
struct cell * init=NULL;
int x;
/* stackの状態を表示 */
printstack(init);
/* stackに2をpushして,更新後のstackへのポインタを受け取る */
printf("push(init, 2)\n");
init = push(init, ... |
C | #include <stdio.h>
#include <string.h>
#define SEC_PER_HOUR 3600.
/*************************************************************************/
/* */
/* File: calc_stress.c */
/* ... |
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>
#pragma warning (disable:4996)
int second(int num1);
int second(num1) {
int h, m, s;
printf(" Է: ");
scanf("%d", &num1);
h = num1 / 3600;
m = (num1%3600) / 60;
s = num1 % 60;
printf("%d %d %d", h, m, s);
}
void main() {
int num1=0;
second(num1);
} |
C | #include <stdio.h>
int main(void){
int n,m,l,p,q,r,ans=0;
scanf("%d%d%d%d%d%d",&n,&m,&l,&p,&q,&r);
if ( (n/p)*(m/q)*(l/r)>ans){
ans=(n/p)*(m/q)*(l/r);
}
if ( (n/p)*(m/r)*(l/q)>ans){
ans=(n/p)*(m/r)*(l/q);
}
if ( (n/q)*(m/p)*(l/r)>ans){
ans=(n/q)*(m/p)*(l/r)... |
C | #include "space.h"
#include "thread.h"
#include <string.h>
#include <math.h>
typedef struct ZGridCell {
unsigned count;
unsigned first_agent_i;
} ZGridCell;
static inline int4 _position_to_cell_indices(float4 pos, float4 orig, float4 sizes, int dims) {
int4 indices;
switch (dims) {
case 1: {
... |
C | #pragma once
#include <cx/cx.h>
#include "futex.h"
#include "aspin.h"
// Event: Similar to auto-reset events on Windows.
// Basically a semaphore that has a maximum value of 1, but includes some extra
// features such as releasing an arbitrary number of threads on demand.
// Also can be locked in a signaled state th... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "utn.h"
#include "pantalla.h"
#define OCUPADO 0
#define LIBRE 1
#define TIPO_LED 0
#define TIPO_LCD 1
static int proximoId();
static int generarId(void){
static int id=-1;
id++;
return id;
}
int pantalla_inicializar(Pantalla* arrayPantall... |
C | #include "caves.h"
#include "terrain.h"
static int caveNoiseHeight;
static int getPosCaves(int x, int y) {return x*caveNoiseHeight + y;}
static void fillRandom(char* noise, int width, int height, PerlinNoise2D perlin2D);
//static int surroundings(char* noise, int posX, int posY);
//static void automatonStep(char* noi... |
C | #include <babybird.h>
void babybird_eat(int babyID, int num_of_worms_to_eat, int* total_birds,
struct mutex_t *room_lock, struct mutex_t *someone_eating, struct cond_v_t *plate_empty, struct cond_v_t *plate_full,
int *dish, struct cond_v_t *my_turn)
{
int i = 0;
char message[200];
while (i < num_of_worms_to_... |
C | #ifndef ARRAYEMPLOYEES_H_INCLUDED
#define ARRAYEMPLOYEES_H_INCLUDED
#define TRUE 0
#define FALSE -1
typedef struct
{
int id;
char name[51];
char lastName[51];
int sector;
float salary;
int isEmpty;
} eEmployee;
int addEmployee(eEmployee* lista, int len, int id, char name[],cha... |
C | #include "Game.h"
#include "Ball.h"
#include <math.h>
#include <time.h>
void start_position_of_ball(struct Ball *b)
{
b->speed=0.6f;
b->dx=cos(90 * 22/7)*b->speed;
b->dy=sin(90 * 22/7)*b->speed;
b->x=SCREEN_W/2-10; /*dla obrazka*/
b->y=SCREEN_H-72; /*dla obrazka*/
}
void set_new_direction(struct... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <pthread.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include "omp.h"
#include <time.h>
void main(int argc, char*argv... |
C | #include <stdio.h>
#define N 5
int captura();
int ordenacion();
int imprime();
int masalto();
int impresion();
int main ()
{
int clave[N];
char nombre[N][100];
int est[2][N];
captura (clave, nombre, est);
ordenacion(nombre);
imprime(clave,nombres,est)
masalto(est)
impresion(est)
ret... |
C | #include <stdio.h>
int main() {
int num1, num2;
printf("Enter the first number: ");
scanf("%d", &num1);
printf("Enter the second number: ");
scanf("%d", &num2);
if (num1 > 100 && num2 > 100)
printf("Both Are Greater Than 100.\n");
else if (num1 > 100 && num2 < 100)
printf("O... |
C | #include <stdio.h>
// add first n natural numbers using recursion
int total(int num);
int main()
{ int num;
puts(" enter the limit ");
scanf("%d" ,&num);
printf("the sum of first n natural numbers = %d \n" ,total(num));
return 0;
}
int total(int num)
{
if(num == 1)
return 1;
else
return (total(num -1) + num);
... |
C | #include<stdio.h>
#include<string.h>
main()
{
int i,ctr=0;
char c;
char s[30];
printf("enter word: \n");
gets(s);
printf("enter character to be searched: \n");
scanf("%c",&c);
for(i=0;s[i]!='\0';i++)
{
if(s[i]==c)
{
ctr++;
}
}
printf("answer: %d \n",ctr);
}
|
C | #include "TLPI_include.h"
int main(int argc, char* argv[])
{
struct sigaction sigstruc;
memset(&sigstruc, 0, sizeof(sigstruc));
sigemptyset(&sigstruc.sa_mask);
sigstruc.sa_handler = SIG_IGN;
if(sigaction(SIGCHLD,&sigstruc, NULL) == -1) {
errorExit("error in sigaction");
}
// sigset_t sigset, befor;
... |
C | #include "holberton.h"
/**
*print_alphabet -print alpha
*@void: no argument
**/
void print_alphabet(void)
{
char ch;
ch = 'a';
while (ch <= 'z')
{
_putchar(ch);
ch++;
}
_putchar('\n');
}
|
C | #include <stdio.h>
#include <stdlib.h>
int main() {
while (1) {
int c = getchar();
// windows ctrl+z
// linux ctrl+d
if (c == EOF) {
break;
}
if (c >= 'a' && c <= 'z') {
putchar(c - ('a' - 'A'));
}
else if (c >= 'A' && c <= 'Z') {
putchar(c + ('a' - 'A'));
}
else if (c >= '0' && c <= '... |
C | #ifndef _SYS_INTERRUPT_H_
#define _SYS_INTERRUPT_H_
#include <sys/cdefs.h>
#include <sys/queue.h>
#include <sys/spinlock.h>
#include <sys/priority.h>
typedef struct ctx ctx_t;
typedef struct device device_t;
/*! \brief Disables hardware interrupts.
*
* Calls to \fn intr_disable can nest, you must use the same numb... |
C | #ifndef __CONVOLUTION5x5Fp16ToFp16_H__
#define __CONVOLUTION5x5Fp16ToFp16_H__
#include <mv_types.h>
#include <mvcv_macro.h>
//!@{
/// This kernel performs a convolution on the fp16 input image using the given 5x5 matrix
/// @param[in] in - Input lines, 16-bits floating point
/// @param[in] out - Output... |
C | /* Streamlined hash table implementation, with emphasis on lookup performance.
* Key and value sizes are fixed. Lookup is thread-safe, but update is not. */
#ifndef _HTABLE_H_
#define _HTABLE_H_
#include <stdint.h>
#include <rte_config.h>
#include <rte_hash_crc.h>
#include "simd.h"
/* tunable macros */
#define IN... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
struct Customer_details
{
char name[30];
char gender;
char _grp[4];
char city[10];
char address[100];
int id;
long long contact_no;
char _bank[30];
}Customer;
void insert()
{ system("clear");
printf("===Welcome To Customer Registration Page===\n");
FILE *fp1; ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* skip.c :+: :+: :+: ... |
C | /* Копирайте съдържанието на файл1 във файл2 */
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char* argv[])
{
if (argc != 3){
write(2,"Incorrect arguments count\n",30);
exit(-1);
}
int file_d1;
int file_d2;
char c;
if ( ( file_d1 = open(argv[1], O_RDONLY) ) == -1 ) {
write... |
C | #include <stdio.h>
#include <stdlib.h>
//定义存放最小值的stack的每一个结点
struct MStack_
{
int value;
struct MStack_* next;
int end;
};
typedef struct MStack_ * MStack;
//初始化存有最小值得stack
MStack MstackInit();
//压栈
MStack MPush(MStack stack, int value);
//出栈
MStack MPop(MStack stack, int* mData); |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
float pi,total,k,p;
pi = 3.1416;
printf(" informe o raio de um circulo aqui:");
scanf("%f",&k);
p =2*pi*k;
total=pi*(k*k);
printf("a area do circulo e : %f \n E seu perimetro e: %f", total,p );
return 0;
}
|
C | #include <stdio.h>
void change(int* arr, int len)
{
printf("%d\n",sizeof(arr));
for(int i=0; i<len; i++) {
arr[i]++;
}
}
int main(int argc, char *argv[])
{
int a[5]={0, 1, 2, 3, 4};
printf("a=%d\n",sizeof(a));
//printf("%d\n",sizeof(a[0]));
int len=sizeof(a)/sizeof(a[0]);
cha... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int is_substring( char* a, char* b);
int main()
{
// Create a program which asks for two strings and stores them
// Create a function which takes two strings as parameters and
// returns 1 if the shorter string is a substring of the longer one and... |
C | #include<stdio.h>
int main(){
long int a,b,i,j,k,n;
double x,y,z,p,q,r,s;
scanf("%d",&n);
for(i=0;i<n;i++){
j=0;
scanf("%ld%ld%lf%lf",&a,&b,&x,&y);
p=a;
q=b;
for(;;){
if(p>q)
break;
p=p+((p*x)/100);
q=q+((q*y)/100);
j++;
if(j>100){
printf("Mais de 1 ceculo.\n");
break;}
}
if(j<=100){
printf("%d anos.\n",j);}
}... |
C | #include "main.h"
struct Node* CreateNode ()
{
struct Node* newNode = (struct Node*)malloc(sizeof(struct Node));
if (!newNode) {
printf("Memory didn't allocated, cannot continue\n");
return NULL;
}
newNode->data = 0;
newNode->prevEntry = NULL;
newNode->nextEntry = NULL;
return newNode;
}
struct ... |
C | #include <stdio.h>
#include <stdio_ext.h>
#include <string.h>
#include <stdlib.h>
typedef struct{
int cod;
char nome[20];
float preco;
}Produto;
typedef struct _nodo{
Produto info;
struct _nodo *prox;
struct _nodo *ant;
}Nodo;
typedef struct lista{
int nItens;
Nodo *pri;
Nodo *ult;
}Lista;
Lista *push(List... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define SLEN 50
struct nameect
{
char *fname;
char *lname;
int letters;
} maria;
void getinfo(struct nameect *pst)
{
char temp[SLEN];
printf("Please enter your first name.\n");
gets(temp);
/* allocate memory to hold name */
ps... |
C | struct foobar {
char foo;
char bar;
};
char a;
int b;
void c;
void main() {
char ab;
int bc;
void cd;
func_call();
b = func_call();
while (a) {
while_a();
}
if (a) {
if (b) {
do_b();
}
else {
else_b();
}
}
... |
C | /***************** C3.2. c file ********************/
#include <stdio.h>
int main() {
int pid = fork(); // fork a child
if (pid){ // PARENT
printf("PARENT %d CHILD =%d\n", getpid(), pid);
// sleep( 1); // sleep 1 second = = > let child run next
printf(" PARENT %d EXIT\n", getpid());
}
else{ // child... |
C | #include <stdio.h>
int main()
{
int a=100 ;
a-=10 ; //equivalent to a=a-10 ;
printf("Updated value of a %d",a);
}
|
C | #include "ESP8266.h"
#include "string.h"
void ESP8266_Init(void)
{
POINT_COLOR=RED;
while(atk_8266_send_cmd("AT","OK",20)){ LCD_ShowString(19,57,200,16,16,"wifi is no online"); }
delay_ms(20);
u2_printf("ATE0\r\n"); //رջ
delay_ms(20);
while(atk_8266_send_cmd("AT+CIPMUX=1","OK",50)){ LCD_ShowString(19,57,... |
C | #ifndef ERROR_H_
#define ERROR_H_
#include <stdio.h>
#include <stdarg.h>
#define MAX_ERR_LEN 128
typedef enum {
TODO_OK,
TODO_ENOMEM,
TODO_ENOID,
TODO_ENOTXT,
TODO_EALRDYEXISTS,
TODO_EINVALIDCMD,
TODO_ESTYLE,
TODO_ESTYLENOFILE,
TODO_ESTYLENOACTV,
TODO_ESTYLEPARSE,
TODO_ESTYLECRNUM,
TODO_ESTYLEBGNUM,
TOD... |
C | // LEVEL 2
#include "func2.c"
extern int WR;
#define BLKSIZE 1024
truncate(struct MINODE *mip){
int dev = mip->dev;
int blocks = mip->ip.i_blocks/2;
int *i_blocks = (int *)mip->ip.i_block;
int i, j, k, l, m;
char buf[BLKSIZE];
char ibuf[BLKSIZE];
char iibuf[BLKSIZE];
if(debug)
printf("starting loop with %... |
C | /* Copyright (C) 1991,92,97,2000,02 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C 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.... |
C | int* plusOne(int* digits, int digitsSize, int* returnSize) {
int tmp = 1, idx = digitsSize - 1 ;
while(tmp && idx >= 0)
{
digits[idx] += tmp;
if(digits[idx] >= 10)
{
tmp = 1;
digits[idx] -= 10;
}
else
{
tmp = 0;
}
... |
C | #include <stdio.h>
#include <io.h>
#include <sys/types.h>
#include <sys/stat.h>
int main( int argc, char *argv[])
{
const char *name = "\\..";
struct stat st;
int rc;
printf("Testing stat() for [\\..]...\n");
rc = stat( name, &st );
printf("%s: [%s], rc = %d(%d).\n",
rc == 0 ? "FAI... |
C | #include <stdio.h>
#include <stdlib.h>
typedef int ElementType;
typedef struct Node *PtrToNode;
struct Node {
ElementType Data;
PtrToNode Next;
};
typedef PtrToNode List;
List Read(); /* 细节在此不表 */
void Print( List L ); /* 细节在此不表 */
List Reverse( List L );
int main()
{
List L1, L2;
L1 = Read();
... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <assert.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
typedef struct QueueNode
{
int data;
struct QueueNode* next;
}QN;
typedef struct Queue
{
QN* front;
QN* back;
}Q;
typedef struct {
Q q1;
Q q2... |
C | #include <stdio.h>
int main()
{
int array[10]= {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
// p指向数组的的地址(数组中第一个元素的地址)
int *p = array;
int i;
for(i = 0; i < 10; i++)
{
printf("%d ",*(p + i));
}
printf("\n");
return 0;
}
|
C | #include <stdio.h>
int get_num(int numbers[]){
int c;
int i = 0;
int sum = 0;
while ( (c = getchar()) != EOF){
if ( c >= '0' && c <= '9'){
sum = sum * 10 + c - '0';
}
else if ( c == '\n'){
numbers[i++] = sum;
sum = 0;
}
}
retu... |
C | #include "watchuser.h"
// thread that will monitor our user linked list
void *watchuser_thread(void *param){
while(1){
// we may make changes to the user list so be sure to lock
pthread_mutex_lock(&lock);
watchuserElement *temp = watchuserHead;
while (temp != NULL){
setutxent(); /* start at beg... |
C | #include<stdio.h>
void main()
{
int i;
for(i=6;i<9;i++)
{
if(i%2==0&&i!=6)
{
printf("%d ",i);
}
}
|
C | #include <stdlib.h>
#include <stdio.h>
int main()
{
int n, i = 0;
int *arr = (int *)calloc(1000, sizeof(int));
while(scanf("%d",&n))
{
arr[i++] = n;
if(getchar() == '\n')
break;
}
int num = i;
i = 1;
int j = 0;
while(i < num)
{
if(arr[i-1] == ... |
C | #include "helpers.h"
#include <math.h>
#include <string.h>
// Convert image to grayscale
void grayscale(int height, int width, RGBTRIPLE image[height][width])
{
float turnGray;
for (int i = 0; i < width; i++)
{
for (int j = 0; j < height; j++)
{
turnGray = round((image[j][i].rgb... |
C | #include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <conio.h>
#include "invader.h"
struct INVASOR inv [6];
struct INVASOR inv2 [6];
void cria_invader () //cria primeira fila de invaders
{
int i,n=0;
for(i=0; i<6; i++)
{
inv[i].x_invasor = 5+n;
inv[i].y_invaso... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
void main(int argc, char **argv)
{
char **param=(char**)malloc(sizeof(char*)*8);
//char *trunk=(char*)malloc(sizeof(char)*8*25);
int i=0, idx=0, next_idx=0;
char *cmds=(char*)malloc(sizeof(char)*200);
char *cmd=(char*)malloc(sizeof(char)*... |
C | #include <stdio.h>
#include <winsock2.h> //need winsock for int and u_char in pcap.h
#define HAVE_REMOTE
#include <pcap.h> //Winpcap
#include "device_display.h"
#include "utils.h"
#pragma comment(lib, "wpcap.lib") //For winpcap
#pragma comment(lib, "ws2_32.lib") //For winsock
//#define IPTOSBUFFERS 12
... |
C | //This is a calculator program
#include<stdio.h>
void main()
{
int a,b,c;
//Add calculator functions here
}
int add(int p,int q)
{
}
int subtract(int p,int q)
{
return p-q;
}
|
C | #include "Planificador.h"
#include <string.h>
void crear(T_Planificador *planif)
{
*planif = NULL;
}
void insertar_tarea(T_Planificador *planif, int pri, char * id)
{
T_Planificador aux = malloc(sizeof(struct TNodo));
aux->id = id;
aux->pri = pri;
aux->sig = NULL;
T_Planificador ptr = *planif, ... |
C | #include "lineprocess.h"
#include "symbollist.h"
#include "symbol.h"
int instructions_memory = 0;
int data_memory = 0;
char ** entry_list = NULL;
extern int get_instructions_counter(int size);
extern int get_data_counter(int size);
extern bool is_command(char * command);
extern int calculate_command_space(char *... |
C | #ifndef Signal_H
#define Signal_H
#define IO_PIN 4
#define CLK_PIN 4
/*
* @brief set pin to high
* @param pinNo is the pin to set high
*/
void setPinHigh(int pinNo);
/*
* @brief set pin to low
* @param pinNo is the pin to set low
*/
void setPinLow(int pinNo);
/*
*read the pin state
pinNO is the pin read from
ret... |
C | #include <stdio.h>
#define INT_STACK_MAX 1024
struct int_stack {
int data[INT_STACK_MAX];
int size;
};
typedef struct int_stack int_stack;
void int_stackInit(int_stack *s){
s->size=0;
}
int int_stackTop(int_stack *s){
if(s->size==0){
fprintf(stderr, "Error: int_stack empty\n");
return -1;
}
return s->d... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main()
{
int pid;
if ((pid = fork()) < 0)
{
printf("Error with forking process\n");
exit(1);
}
else if (pid == 0)
{
printf("Child process calling\n");
char *args[] = {"ls", "-l", NULL};
int status = execvp("/bin/ls", args);... |
C | #include<stdio.h>
#include<string.h>
int main()
{
char str[]="REverseMe",t;
int i,j,n;
printf("\nEnter the string :");
i = 0;
j = strlen(str) - 1;
n=strlen(str);
while (i < j)
{
t = str[i];
str[i] = str[j];
str[j] = t;
i++;
j--;
}
for(i=0;i<n;i++)
{
if(... |
C | #include <stdio.h>
void printchar(char c[128], int n)
{
int i;
for(i=0;i<n;i++)
{
printf("%s", c);
}
printf("\n");
}
int main()
{
printchar("*", 10);
}
|
C | #include <stdio.h>
int total, sum, n;
int ss( int set[], int prev ) //prev is the previous number index which was added to the set
{
int i;
int flag;
for(i=prev+1 ;i<n; i++)
{
total+=set[i];
printf("\nNumber: %d Total: %d",set[i],total);
if(total>sum) //Backtrack
{
total-=set[i];
printf("... |
C | #ifndef G_CONSOLE_H
#define G_CONSOLE_H
#include <Ethernet2.h>
// Telnet listens on port 23
EthernetServer telnet(23);
// Client needs to have global scope so it can be called
// from functions outside of loop, but we don't know
// what client is yet, so creating an empty object
EthernetClient telnetClient = 0;
... |
C | #include "drum_utils.h"
#include <stdint.h>
// Code based off ThatOneTeam's code from last year
void hitDrum(int hit){
R_T(); // toggle Red LED
// two stick instruments
#ifdef DOUBLE_STICK
static uint8_t hitLeft = 0x0;
if (hitLeft)
{
LEFT_PORT |= LEFT_H;
LEFT_PORT &= ... |
C | #include <stdio.h>
#include <conio.h>
#include<stdlib.h>
typedef struct Node CSL;
struct Node
{
int data;
CSL *next;
}*head1 = NULL;
CSL *head2=NULL;
CSL *head3=NULL;
void insertion_in_end(int data,CSL **head){
CSL * new_node=(CSL*)malloc(sizeof(CSL));
new_node->data=data;
new_n... |
C | #include <stdio.h>
int isPrimo(int primo);
int main(int argc, char **argv)
{
int numero;
printf("Inserisci il numero:\n");
scanf("%d", &numero);
if(isPrimo(numero)){
printf("E\' un numero primo.\n");
} else {
printf("Non e\' un numero primo.\n");
}
ret... |
C | #include "../includes/push_swap.h"
void first_node(t_frame *frame, t_struct *tmpA, long int num)
{
frame->stack_a = (t_struct *)malloc(sizeof (t_struct));
tmpA = frame->stack_a;
tmpA->num = num;
tmpA->next = NULL;
tmpA->previous = NULL;
}
void add_to_stack(t_frame *frame, char stack_name, long int num)
{
t_stru... |
C |
/*
* Big thanks for helping me out to: BitPuffin http://bitpuffin.com
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define car(p) ((p).pair->atom[0])
#define cdr(p) ((p).pair->atom[1])
#define nilc(p) ((p).type == AtomType_Nil)
char* slurp(const char* path)
{
FILE* file;
char... |
C | #include "cachelab.h"
#include "getopt.h"
#include "stdlib.h"
#include "stdio.h"
#include "string.h"
#include "assert.h"
#include "unistd.h"
// Wei Chen, weichen1@andrew.cmu.edu
/******************************************************
* Types
******************************************************/
typedef struct ca... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.