language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
int reverse(int x)
{
int res=0;
while(x!=0)
{
int tmp=x%10;
x=x/10;
res=res*10+tmp;
}
return res;
}
int main()
{
int x=123;
printf("x=%d,\t x_inv=%d\n",x,reverse(x));
x=-123;
printf("x=%d,\t ... |
C | /* -*- Mode: C; tab-width: 8; c-basic-offset: 2; indent-tabs-mode: nil; -*- */
#include "util.h"
static void breakpoint(void) {
int break_here = 1;
(void)break_here;
}
int main(void){
sleep(1);
breakpoint();
atomic_puts("EXIT-SUCCESS");
return 0;
}
|
C | /* SPDX-License-Identifier: GPL-2.0 */
#include <stdio.h>
#include <stdlib.h>
#include "graph.h"
struct vertex {
enum color { white, gray, black } color;
int data;
int hops;
};
static int same(const void *d1, const void *d2)
{
const struct vertex *v1 = d1, *v2 = d2;
return v1->data == v2->data;
}
int ma... |
C |
#include<stdio.h>
int qiu(int n){
if(n<4){
return 1;
}else{
return qiu(n-1)+qiu(n-3);
}
}
int main(void){
int n;
scanf("%d",&n);
int nums = qiu(n);
printf("%d\n",nums);
return 0;
}
|
C | #include <stdio.h>
#include <string.h>
int main()
{
char string[500]; scanf("%[^\n]", string);
printf("%d\n", (int) strlen(string));
return(0);
}
|
C | //void fun(int *a,int n){
// int i;
// for(i=0;i<n;i++)
// printf("%d\n",a[i]);
//}
//int main(){
// int a[5]={1,2,3,4,5};
// fun(a,5);
//}
//void fun(int a[],int n){
// int i;
// for(i=0;i<7;i++)
// printf("%d\n",a[i]);
//}
//int main(){
// int a[5]={1,2,3,4,5};
// fun(a,5);... |
C | //BUBBLE SORT
#include <stdio.h>
int main()
{
int i,j,n;
printf("enter the size of the array\n");
scanf("%d",&n);
char a[n],temp;
printf("enter the characters into the array\n");
for(i=0;i<=n-1;i++)
scanf(" %c",&a[i]);
for(i=0;i<=n-2;i++)
for(j=0;j<=n-i-1;j++)
{
if(a[j]>a[j+1])
... |
C | #include <stdlib.h>
#include <stdio.h>
#include "card.h"
#include "cardlist.h"
#include "memwatch.h"
/*
* purpose : create a new circularly linked list
* input : None
* returns : An intitalized circularly linked list
*/
List list_create(){
return NULL;
}
/*
* purpose : create a new node with a link, a privat... |
C | // The following code was written by Aman Patel
// January 28, 2020
// CSCI-C 291
#include<stdio.h>
int main(void) {
// Initialization of all statistical variables
int totalAll = 0;
int totalInternational = 0;
int totalDomestic = 0;
int totalWeekly = 0;
int totalHourly = 0;
int totalCommission = ... |
C | #include "avr.h"
#include "lcd.h"
#define DDR DDRB
#define PORT PORTB
#define RS_PIN 0
#define RW_PIN 1
#define EN_PIN 2
/*sets the direction of the avr to output (11111111) */
static inline void
set_data(unsigned char x)
{
PORTD = x;
DDRD = 0xff;
}
/*sets DDRD as a input then return the inpu... |
C | #include <msp430.h>
#include <stdint.h>
#include "led_control.h"
// Transmit codes to send long pulse (1) and short pulse (0).
#define HIGH_CODE (0xF0) // b11110000
#define LOW_CODE (0xC0) // b11000000
// Board size
#define NUM_LEDS 128
#define COLUMNS 8
#define ROWS 16
// LED colors
#define OFF ... |
C | #include <stdio.h>
void fun(a,b)
{ printf("a=%d,b=%d\n",a,b);
}
main()
{ int m=5;
fun(m+3, m++);
}
|
C |
// UCLA CS 111 Lab 1 command reading
#include <string.h>
#include "command.h"
#include "command-internals.h"
#include <stdio.h>
#include <stdlib.h>
#include <error.h>
#define PRECEDENCE_SEMI_NEWLINE 1
#define PRECEDENCE_AND_OR 2
#define PRECEDENCE_PIPE 3
#define INITIAL_SIZE 1024
typedef struct commandNode *command_n... |
C | #include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <pthread.h>
void print_prime_factors(uint64_t n)
{
uint64_t i = 0;
uint64_t nPrime = n;
printf("%ju: ", n);
for( i = 2 ; i <= nPrime ; i ++)
{
if(nPrime%i == 0)
{
nPrime = nPrime/i;
printf("%ju ", i);
i = 1;
}
el... |
C | //
// point2d.h
// ComputacionGrafica
//
// Created by Alejandro Larraondo on 10/9/19.
// Copyright © 2019 Alejandro Larraondo. All rights reserved.
//
#ifndef point2d_h
#define point2d_h
struct Point2d
{
float x,y;
Point2d(float x, float y){
this->x = x;
this->y = y;
}
Point2d& o... |
C | #include<stdio.h>
int main()
{
char a[1000];
int b[10] = {0,0,0,0,0,0,0,0,0,0};
int i = 0, j = 0, k =0;
scanf("%s", a);
while(a[i]){
i++;
}
for(j = 0; j < i; j++){
for(k = 0; k < 10; k++){
if(a[j] - '0' == k){
b[k]++;
}
}
}
for(i = 0; i < 10; i++){
if(b[i] != 0){
pr... |
C | #include <errno.h>
#include <stdio.h>
#include <dirent.h>
#include <sys/stat.h>
#include <string.h>
#include <stdbool.h>
typedef struct{
ino_t inode;
char names[128];
nlink_t links;
}File;
unsigned int cnt = 0;
bool found = 0;
File A[128];
struct stat es;
struct dirent *de;
int main(){
DIR *dir=opend... |
C | /* Problem : Find number of paths going from top left to bottom right only moving right and down */
/* From combinatorics the formula is m + n choose m */
/* for m = n = 20 40 choose 20 */
/* 40! / 20! * 20! */
/* => 40*39*...*21 / 20 * 19 * .. */
/* => 2^10 * 39 * 37 * ... * 21 / 10! */
/* You can further simplify it ... |
C | #include <stdio.h>
int main(void)
{
int N;
int a;
int b;
scanf("%d", &N);
for(int i=0; i<N; i++)
{
scanf("%d %d",&a,&b);
printf("%d\n",a+b);
}
return (0);
} |
C | #define _GNU_SOURCE
#ifdef __APPLE__
#define _XOPEN_SOURCE
#endif
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#ifdef _WIN32
#include <stdio.h>
#include <fcntl.h>
int pipe(int pipefd[2])
{
return _pipe(pipefd, BUFSIZ, O_BINARY);
}
#endif
#include "pipe_sem.h"
// Initializes a... |
C | #include <stdio.h>
//////////////// ַ /////////////////////////////////
///////////////////////////////////////////////////////////////
void ABC(int *p, int N) {
int i, temp, *q;
temp = *p;
for (q = p; q< p+N; q++) {
if (*p < *(q + 1)) { // ڸ ִ밪
temp = *(q+1);
*(q+1) = *p;
*p = temp;
}
}
}
... |
C | #include <stdio.h>
#include <string.h>
int main(int argc, char **args)
{
if (argc == 3){
if (strlen(args[1]) != strlen(args[2])) printf("Error!!!");
else {
int len = strlen(args[1]);
char c;
while ((c = getchar()) != EOF){
int i;
for (i = 0; i < len; ++i){
if (args[1][i] == c){
c = arg... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define STACK 10 /* size of stack */
int
main(int argc, char **argv)
{
int stack[STACK] = {0};
int *sp = &stack[0];
int a, b;
for (++argv; *argv != NULL; ++argv) {
switch (*(*argv)) { /* first byte of argv[1] */
case '0': case '1': case '2': case '3'... |
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | #include <stdio.h>
#include "gmp.h"
#include <time.h>
#include "point.h"
/* convert affine point to projective point */
void afftopro(PROJECTIVE_POINT R, const AFFINE_POINT P)
{
mpz_set(R->X, P->x);
mpz_set(R->Y, P->y);
mpz_set_ui(R->Z, 1);
}
/* convert projective point to affine point */
void protoa... |
C | #include<stdio.h>
int a,b,c;
int val(int k,int base)
{
int i,v=0,h=1,b=1;
for(i=0;i<7;i++)
{
v+=(k/h%10)*b;
h*=10;
b*=base;
}
return v;
}
int findmaxd(int m)
{
int maxd=0,i,d;
int h=1;
for(i=0;i<7;i++)
{
d=m/h%10;
h*=10;
if(d>maxd) maxd=d;
}
ret... |
C | #include <stdio.h>
#include <stdlib.h>
int Check(int d[], int n);
int Check1(int d[], int n);
int main(int argc, char const *argv[])
{
int d[8] = {1, -2, 3, -4, 5, -6, 7, -8};
printf("%d %d\n", Check(d, 8), Check1(d, 8));
return 0;
}
int Check(int d[], int n)
{
int flag = 1;
for(int i = 0; i < n - 1 && flag... |
C | /*
* These tests implement examples provided in the following documents:
* Focusses on AES-128 because DESFire AES only uses 128-bit keys
*
* NIST Special Publication 800-38B
* Recommendation for Block Cipher Modes of Operation: The CMAC Mode for Authentication
* May 2005
*/
#include <string.h>
#include "../mifa... |
C | //
// LCBXXZDChapterSevenAlgorithmDesignFour.c
// DataStructurePractice
//
// Created by ly on 2018/7/7.
// Copyright © 2018年 LY. All rights reserved.
//
#include "LCBXXZDChapterSevenAlgorithmDesignFour.h"
void deleteBomaryTreeSubtreeParivate(BinaryTree *tree) ;
void deleteBinaryTreeSubtreeAnotherPrivate(BinaryTr... |
C | #include <stdio.h>
#include <stdlib.h>
#include <mpi.h>
#include <math.h>
#include <time.h>
/* Andres McNeill
cpsc 4770
Fall 2019
Assignment 1
*/
int main(int argc, char *argv[]) {
int i, count; // Points inside the unit quarter circle
double x, y; // Coordinates of points
int samples; // Samples number of poi... |
C | #include "ports.h"
void halt()
{
asm volatile ( "hlt" );
}
uint8_t inb(uint16_t port)
{
uint8_t ret;
asm volatile ( "inb %1, %0"
: "=a"(ret)
: "Nd"(port) );
return ret;
}
void outb(uint16_t port, uint8_t val)
{
asm volatile ( "outb %0, %1" : : "a"(val), "Nd"(... |
C | #include <lib/circular_buffer.h>
#include <lib/lib.h>
/*
* circular_buffer_init
* Initialize the circular buffer and use the given backing memory.
*
* @param buf The circular buffer to initialize
* @param data_buf A contiguous block of memory that we will use circularly.
* @param max_len Maximum length... |
C | #ifndef AWE_ALG_H
#define AWE_ALG_H
// =====================================================================
// Serviceroutinen
// (c) - 2013 A. Weidauer alex.weidauer@huckfinn.de
// All rights reserved to A. Weidauer
// =====================================================================
// Maschinen Null DOUBLE
#... |
C | #include <stdio.h>
int main(void)
{
char nome[50];
int x;
printf("Digite seu nome: ");
scanf("%49s", nome);
for (x=0; x<49; x++)
{
if (nome[x]==0)
{
break;
}
printf("%c", nome[x]);
}
printf("\... |
C | /*
* Universidade Federal do Rio de Janeiro
* Escola Politecnica
* Departamento de Eletronica e de Computacao
* EEL270 - Computacao II - Turma 2019/2
* Prof. Marcelo Luiz Drumond Lanza
*
* Autor: <nome completo>
* Descricao: <descricao sucinta sobre o programa>
*
* $Author$
* $Date$
* $Log$
*/
#include "e... |
C | /*
16 8 ǥ 꿡 ̿Ǵ ̴.
*/
#include <stdio.h>
int main(void)
{
int num1=0xA7, num2=0x43;
int num3=032, num4=024;
printf("0xA7 10 : %d\n", num1);
printf("0x43 10 : %d\n", num2);
printf("032 10 : %d\n", num3);
printf("024 10 : %d\n", num4);
printf("%d-%d=%d\n", num1, num2,... |
C | #include "headers.h"
int main(int argc, char ** argv){
if(argc < 2){
printf("Not enough args\n");
exit(0);
}
if( !strcmp(argv[1], "-c" ) )
create_all();
else if( !strcmp(argv[1], "-v") )
view_story();
else if( !strcmp(argv[1], "-r") )
remove_all();
else
printf("Invalid arg: %s... |
C | // -------------------------------------------------------------------------
// github.com/souza10v
// souza10vv@gmail.com
// -------------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main() {
int conta[10000],i,totalnegativos,... |
C |
#include <iostream>
using namespace std;
bool f[1009] = {};
int main(int argc,char *argv[])
{
int i = 0;
int j = 0;
f[1] = true;
for(i = 2; i <= 1000; ++i){
if(f[i]){
continue;
}
j = i + i;
while(j <= 1000){
f[j] = true;
... |
C | #include <stdio.h>
#define DIM1 2
#define DIM2 3
size_t StringLength_suboptimal(char *string)
{
size_t index = 0;
for (; string[index] != '\0'; ++index)
;
return index;
}
size_t StringLength(char *string)
{
char *current = string;
for (; *current != '\0'; ++current)
;
return current - string;
}
void mai... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ArrayEmployees.h"
#include "MiLibreria.h"
int main()
{
char seguir = 's';
char confirmacion;
char opcion;
int flag = 0;
int hayEmpleados = 0;
Employee lista[TAM];
int id = 1000;
initEmployees( lista, TAM);
while(seguir... |
C | #define _XOPEN_SOURCE 600
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <signal.h>
#include <errno.h>
#include "server_handler.h"
#define M... |
C | /*
** read_dir.c for tetris in /home/wyzlic_a
**
** Made by Dimitri Wyzlic
** Login <wyzlic_a@epitech.net>
**
** Started on Wed Jul 27 15:47:20 2016 Dimitri Wyzlic
** Last update Sun Aug 21 03:52:45 2016 wyzlic_a
*/
#include <dirent.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include "my.h"
t_ll ... |
C | //
// Created by Brett Garberman
//
// Written for Teensy 2.0 (ATMEGA32U4)
//
#include <avr/interrupt.h>
#include <avr/io.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "uart.h"
#include "Uroflow_AVR.h"
uint16_t reading = 0;
int newSample = 0;
int currentVal = 0;
int lastV... |
C | // These functions are already defined as macros
// in the MoSync API and in order not get compile
// errors, we only use these declarations in the binding
// definitions used by tolua, not in the actual C-code.
// This file is never included in any C-code.
/**
* Create an object the represents a size (width and heig... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct student {
int Matrikelnr;
char *VName;
char *NName;
};
void student_print(struct student *p){
printf("\tMatrikelnr: %d\n",p->Matrikelnr);
printf("\tVorname: %s\n",p->VName);
printf("\tNachname: %s\n",p->NName);
}
int main(){
struct student ... |
C | //#define COMMENT 0
#define ZERO 48
#define NINE 57
#define REVZERO -128
#define REVNINE -119
#define VALUE 80
#include<stdio.h>
#define RLELENGTH 50
void append(char* des,char* src);
void numberToString(int num,char* str);
int string_length(char* str);
#include<stdlib.h>
#include"stringManipulation.c"
void isNumber(ch... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "definition.h"
#include "loadProfile.h"
/**
* Change the cwd of the shell
* @param shell Shell state
* @param path Path to change to
* @return Success status
*/
int cd(Shell *shell, const char *path) {
if(path ==... |
C | #include "string.h"
int slen(char* str)
{
int count = 0;
while (str[count] != '\0') {
count++;
}
return count;
}
int s_tok(char* str, char delim, char* ptr[])
{
char* suf = str;
ptr[0] = str;
int i, j = 1;
while ((i = schr(suf, delim)) >= 0) {
suf[i] = '\0';
s... |
C | #include "refcount.h"
#include <stdio.h>
#define mu_assert(message, test) do { if (!(test)) return message; } while (0)
#define mu_run_test(test) do { const char *message = test(); tests_run++; \
if (message) return message; } while (0)
int tests_run;
static const char *test_initial_re... |
C | /*--------------------------------------------------
* 实现屏幕操作的函数
* 文本模式下VGA保留内存0xb8000-0xb8fa0
* 0xfa0 = 25 * 80 * 2 对应80 × 25 文本模式
每个字符占两个字节,低字节为字符,高字节为显示的颜色
*--------------------------------------------------
*/
#include "types.h"
#include "console.h"
//显示缓冲区起始地址为0xb8000
static uint16_t *video_mem = (uin... |
C | #include<stdio.h>
#include<fcntl.h>
#include<unistd.h>
#include<string.h>
#include<arpa/inet.h>
#include<sys/socket.h>
int main(){
struct sockaddr_in direccionServidor;
direccionServidor.sin_family= AF_INET;
direccionServidor.sin_addr.s_addr=INADDR_ANY
direccionServidor.sin_port=htons(9000)
i... |
C | #include <stdio.h>
typedef unsigned char * byte_pointer;
void main(void){
int x= 97; //binary
byte_pointer tmp = (byte_pointer) &x;
printf("%d\n", (int) *tmp); // 97
printf("%c\n", *tmp); // a
printf("%.2x\n",tmp[0]); // 61
printf("%.2x\n",tmp[1]); // 00
printf("%.2x\n",tmp[2]); ... |
C | #include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "distmon.h"
#include "distlock.h"
#include "debug.h"
int main(int argc, char **argv)
{
pthread_t distmon_thread;
int interactive = distmon_start(argc, argv, &distmon_thread);
if (interactive < 0) {
fprintf(stde... |
C | /*@
behavior a_less:
assumes a<b;
ensures \result == a;
behavior b_less:
assumes a>=b;
ensures \result == b;
*/
int min(int a, int b){
if(a<b)
return a;
else
return b;
} |
C | #include <stdio.h>
#define M 14
void main()
{
char a[M];
int i;
for(i=0;i<M;i++)
{
scanf("%c",&a[i]);
}
for(i=0;i<M;i++)
{
if(a[i]==',')
printf("\n");
else if ((a[i]>='a'&&a[i]<='z')||(a[i]>='A'&&a[i]<='Z'))
printf("%c",a[i]);
else
printf("룡");
}
printf("... |
C | /*
** add_list.c for dante in /home/angevil124/prog/CPE/dante
**
** Made by Benoit Hoffman
** Login <benoit.hoffman@epitech.eu>
**
** Started on Tue Apr 25 10:22:25 2017 Benoit Hoffman
** Last update Wed May 3 12:23:30 2017 Benoit Hoffman
*/
#include <stdlib.h>
#include "generator.h"
void free_stack(t_stack **... |
C | #include <sys/time.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/resource.h>
#include <unistd.h>
void main(int argv, char *argc[]){
struct timeval start, end;
struct rusage usage;
getrusage(RUSAGE_SELF, &usage);
start = usage.ru_utime;
//printf("Time in User Mode: %s\nTime in Kernel Mode: %s\n", usage.r... |
C | /*
* File: opt.c
* Author: Ron F. <>
* Last Modified: August 19, 2018
* Topic: ASSEMBLER
* ----------------------------------------------------------------
*/
#include "myas.h"
/* CHECK OPT LINE AND RETURN HOW MUCH IC THERE */
int checkOPT(theDATA d)
{
int sum_ic;
theDATA * d_ptr = &d;... |
C | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[]){
int s;
while((s = getopt(argc,argv,"ma:")) != -1){
int sum = 0;
int mul = 1;
for(int i = 2; i < argc; i++){
sum += atoi(argv[i]);
}
for(int i ... |
C | #include <stdio.h>
#include <stdlib.h>
#include "LinkedListLib.h"
#include "LinkedListLib_int.h"
#include "LinkedListLib_Log.h"
/******************************************************************************
* Function LinkedListLib_Init --
* This function should be invoked to initialize the LinkedLis... |
C | #include "barrier.h"
void ResetBarrier(barrier_t* b, int max_count) {
b->barrier_counter = 0;
b->barrier_max = max_count;
pthread_cond_init(&(b->barrier_active), NULL);
}
void IncrementBarrier(barrier_t* b) {
pthread_mutex_lock(&(b->barrier_mutex));
b->barrier_counter += 1;
pthread_mutex_unlock(&(b->barrier_m... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line.c :+: :+: :+: ... |
C | #include <stdio.h>
extern int fak (int v);
extern int tester(int i);
int realfak(int v){
int sum = 1;
while(v != 0){
sum *= v;
v--;
}
return sum;
}
int main (void)
{
int i = 10;
printf("Fak(%d) = %d(%d)\n",i,fak(i),realfak(i));
printf("Testprogram(%d) = %d\n",i,tester(i));
}
|
C | #ifndef __errors_h
#define __errors_h
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
* Define a macro that can be used for diagnostic output from examples.
* When compiled -DDEBUG, it results in calling printf with the specified
* argument list. When DEBUG is n... |
C | # include <stdio.h>
# define LENGTH 10
# define WIDTH 5
# define NEWLINE '\n'
void test02()
{
const int LENGTH1 = 10;
const int WIDTH1 = 5;
const char NEWLINE1 = '\n';
int area;
area = LENGTH1 * WIDTH1;
printf("value of area:%d\n",area);
printf("看看newline的值是什么:%c\n",NEWLINE1);
retur... |
C | #include <linux/kernel.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/signal.h>
#include <asm/io.h>
#include <linux/timekeeping.h>
#include <linux/gpio.h>
#define BUTTON_1 25 // switch
#define LED_1 24 // LED1
#define IRQ_NAME "button_1" // define IRQ_NAME, we can type cat /... |
C | #include<stdio.h>
#include<conio.h>
#include<stdlib.h>
float calc(float raio)
{
return (4/3 * raio * raio * raio);
}
main()
{ float raio=0;
printf ("Informe o raio\n");
scanf ("%f",&raio);
printf ("O valor %.2f ",calc(raio));
getch();
}
|
C | #include <ncurses.h>
#include <string.h>
#include <unistd.h> /* only for sleep() */
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(){
clock_t start, end;
float time_dif;
printf("starting the program\n");
start = clock();
while(1){
//check time
... |
C | /*-------------------------------------------------------------------------------
* Project: KoreBot Library
* $Author: pbureau $
* $Date: 2004/11/12 14:35:23 $
* $Revision: 1.3 $
*
*
* $Header: /home/cvs/libkorebot/src/kb_wav.c,v 1.3 2004/11/12 14:35:23 pbureau Exp $
*/
/*----------------------------------... |
C | /*! \file userlist.c
\brief The utility file.
*/
/*! \fn main()
\brief The main executing function.
*/
#include<stdio.h>
//#include "userlist.c"
int main()
{
char string[10];char nl[2];char x;
x='y';
struct node *first;
first=NULL;
while(x!='n')
{
printf("Enter user name : ");
gets(string);
first =... |
C | #include <reg51.h>
sbit WAVE =P0^1;
void timer0() interrupt 1 {
WAVE=~WAVE; //toggle pin
}
void serial0() interrupt 4 {
if (TI==1) {
TI=0; //clear interrupt
}
else {
P0=SBUF; //put value on pins
RI=0; //clear interrupt
}
}
void main() {
unsigned char x;
P1=0xFF; //make P1 an input
TMOD=0x22;
TH1=0xF6;... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <fcntl.h>
int main() {
struct stat fileStat;
int file = open("ex1.txt", O_RDWR);
stat("ex1.txt", &fileStat);
off_t size = fileStat.st_size;
char * mes... |
C | #include <stdio.h>
#include <string.h>
#include <math.h>
#define Length 100010
#define Len 200020
#define OK 1
#define ERROR 0
typedef int Status;
typedef char QElemType;
typedef struct BinaryS{
char bs[13];
int front;
int rear;
int maxsize;
}BinaryS;
Status EnQueue(BinaryS *Q, QElemType e){
if((Q->rear + 1) % ... |
C |
#include "gender_id.h"
const char* gender_id_to_str(int genderId)
{
const char* ret;
switch (genderId)
{
case GENDER_ID_Male: ret = "Male"; break;
case GENDER_ID_Female: ret = "Female"; break;
default:
case GENDER_ID_Neuter: ret = "Neuter"; break;
}
return ret;
}
|
C | #include <stdio.h>
#include <stdlib.h>
int main(){
FILE *fptr;
char str[81];
if((fptr = fopen("Testestr.txt", "r")) == NULL){
puts("Não foi possível abri o arquivo.");
return 0;
}
while(fgets(str, 80, fptr) != NULL)
printf("%s", str);
fclose(fptr);
return 0;
} |
C | #include<stdio.h>
void fun();
void main()
{
int a=5;
printf("the value of a=%d",a);
fun();
}
void fun()
{
int a =10;
printf("value of a within fun is fx:%d",a);
} |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct Node {
int key;
struct Node *left;
struct Node *right;
struct Node *parent;
} Node;
Node *BST_Min(Node *node) {
Node *cur = node;
while (cur->left) {
cur = cur->left;
}
return cur;
}
Node *BST_Max(Node *node) {
Node *cur = node;
while (c... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <math.h>
int prime(int x)
{
if(x<=1)
return 0;
for(int i=2; i*i<=x; i++)
{
if(x%i==0)
return 0;
}
return 1;
}
int main()
{
int fd0[2],fd1[2];
if(pi... |
C | #ifndef linkedList_H
#define linkedList_H
typedef struct _Item {
struct _Item* nextItem;
char* data;
} Item;
typedef struct LinkedList {
Item* originItem;
} LinkedList;
LinkedList* createList(Item* originItem);
void freeList(LinkedList* list);
void printList(LinkedList* list);
Item* createIte... |
C | #define SDL_MAIN_HANDLED
#include <SDL2/SDL.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int rnd(int max) {
return rand() % max;
}
void draw_rect(SDL_Surface *surf, int x, int y, int w, int h, int color) {
SDL_Rect rect = {x, y, w, h};
SDL_FillRect(surf, &rect, color);
}
v... |
C | #include "controller.h"
//Function that creates an empty controller
controller* CtrlCreate() {
controller* C = (controller*)malloc(sizeof(controller));
C->repo = RepoCreate();
C->undoStack = StackCreate(&VecCreate);
C->redoStack = StackCreate(&VecCreate);
C->undoStackOps = StackCreate(&OperationDestroy);
C->redo... |
C | /*
дһ
ÿڵҶӽڵ
*/
#include<stdio.h>
#include<stdlib.h>
#define M 100
int i=0;
typedef char Datatype;
typedef struct Node
{
Datatype data;
struct Node *Lchild;
struct Node *Rchild;
}Bitree;
Bitree *Create()
{
Bitree *root;
char ch;
scanf("%c",&ch);
if(ch=='*')
root=NULL;
else
{
root=(Bitree *)mallo... |
C | // Sean Szumlanski
// COP 3502, Spring 2019
// =======================
// DupeyDupe: UnitTest02.c
// =======================
// This test case helps ensure that your hoursSpent() function is implemented
// correctly.
//
// For instructions on compiling your program with this source code, please see
// the assignment P... |
C | #include<stdio.h>
int main()
{
int seive[1000*1000];
long long i,j,s,temp,count,mp;
s = 0;
mp = 2;
for(i=2;i<1000*1000;i++)
seive[i] = 0;
for(i=2;i<1000;i++)
if(seive[i] == 0)
for(j=i*i;j<1000*1000;j=j+i)
seive[j] = 1;
for(i=2;i<1000*1000;i++)
if (seive[i] == 0) {
temp = i;
count = 1;
for(j... |
C | #include <stdio.h>
#include <stdlib.h>
int simple(int * a, int size){
int counter = 0;
for(int i = 0; i < size; i+=1){
counter += a[i];
};
return counter;
}
int doubl(int * c, int size){
int counter = 0;
for(int i = 0; i < size - 1; i += 2){
counter += c[i];
counter += c[i + 1];
}
return c... |
C | #include <stdio.h>
#include <stdlib.h>
void trace(int a[], int N){
for (int i =0 ; i<N; i++){
if (i>0){
printf(" ");
}
printf("%d", a[i]);
}
printf("\n");
}
void insertion(int a[], int N){
int i, j, tmp;
for (int i=0; i<N;i++){
tmp=a[i];
j=i-1;
... |
C | #include <cs50.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
string get_name(){
string name;
do {
name = get_string();
}while(name == NULL);
return name;
}
void make_initials(string name){
char initial[2];
for(int i = 0; i < strlen(name); i++){
if(isalph... |
C | #include <stdio.h>
/*
问题描述:
返回输入正整数第一个是1的比特位的位置(若输入0或负数返回-1)
样例输入:
12
0
样例输出:
2
-1
*/
int indexFind(long long int num)
{
if(num <= 0)
return -1;
int index = 0;
while(((num >> index) & 1) == 0)
{
++index;
}
return index;
... |
C | /*
@Anugunj Naman
@1801022
To run this file create object file using lpthread
then $>./server
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <mirror.h>
#include <sys/msg.h>
#include <signal.h>
#include <pthread.h>
#define _GNU_SOURCE
int send_message( int... |
C | #include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<sys/time.h>
#include<signal.h>
#include<sys/types.h>
void fa(int signo){
printf("random\n");
}
int main(){
//设置对信号SIGALRM进行自定义处理
if(SIG_ERR==signal(SIGALRM,fa))
perror("signal"),exit(-1);
struct itimerval timer;
//设置间隔时间
ti... |
C | #include <stdio.h>
int triangulo(int x, int y, int z) {
return (x < y+z && y < x+z && z < x+y );
}
int tipoTriangulo(int x, int y, int z) {
if(!triangulo(x, y, z)) {
return 0;
}
if(x == y && y == z) {
return 3;
}
else if(x == y || x == z || y == z) {
return 2;
... |
C | #include<stdio.h>
//implement by piyal_IT_15021
void main()
{
int nop,nof,page[20],i,count=0;
printf("\nEnter the No. of Pages: ");
scanf("%d",&nop);
//Store the no of pages
printf("\n Enter the Reference String:\n");
for(i=0; i<nop; i++)
{
scanf("%d",&page[i]); //Array for Stori... |
C | #include<stdio.h>
#include<math.h>
int main(){
int x;
scanf("%d",&x);
double sum=1;
double t=1;
double cons=0.00001;
int i=1;
while(t>cons){
t=power(x,i)/fact(i);
sum+=t;
i++;
}
printf("sum =%lf\n",sum);
printf("exp(%d)=%lf",x,exp(x));
return 0;
}
|
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>>
struct email {
char title[100];
char receiver[50];
char sender[50];
char content[1000];
char date[100];
int priority;
};
int main(void)
{
struct email e;
//strcpy(e.title, "Ⱥ ");
printf("title:\n");
scanf_s("%s", e.title,sizeof(e.title));
//strcpy(e... |
C | #include <stdio.h>
#include <unistd.h>
double t = 0.1;
int y = 7;
double g = 6.9;
int main(void)
{
int k = 0;
printf("Hello, world!\n");
y = y + 3;
g = g + t;
sleep(5);
/* changed from master */
return k;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#define MAX_WORD_SIZE 100
#define MAX_MEANING_SIZE 200
typedef struct {
char word[MAX_WORD_SIZE];
char meaning[MAX_MEANING_SIZE];
} element;
typedef struct TreeNode {
element key;
TreeNode *left, *right;
} TreeNode;
int compare(elem... |
C | /* set_initial: stores initial values on all points of the */
/* computational grid */
/* (very simple and dumb routine) */
/* input: int grid[3] # of points in all directions */
/* double *domain Pointer to the mem... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line.c :+: :+: :+: ... |
C | #include "Polinomios.h"
NoLOG* criaListaLOG(){ /* Cria lista do LOG */
return NULL;
}
/* Insere no inicio da lista LOG as operações e resultados do usuário */
NoLOG* InsereInicioLOG (NoLOG* l, char* info)
{
NoLOG* novo = (NoLOG*) malloc(sizeof(NoLOG));
if(novo == NULL){ printf("Erro."); exit(1);}
nov... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.