language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
#include <stdlib.h>//exit();
#include <pthread.h>
void thread_1(void)
{
int i=0;
for(i=0;i<=6;i++)
{
printf("This is a pthread_1.\n");
if(i==2)
//用pthread_exit()来调用线程的返回值,用来退出线程,但是退出线程所占用的资源不会随着线程的终止而得到释放
pthread_exit(0);
sleep(1);
}
}... |
C | #include <stdio.h>
int main()
{
int a = 10;
int *b = &a;
int **c = &b;
//address of a
printf("%d\n", &a);
printf("%d\n", b);
printf("%d\n", *c);
//value of a
printf("%d\n", a);
printf("%d\n", *b);
printf("%d\n", **c);
//address of b
printf("%d\n", &b);
printf("%d\... |
C | /*
* buttons.c
*
* Reads two push buttons as inputs
* to turn on and of two LEDs as outputs.
*
* Created on: 27/07/2016
* Author: doc2
*/
#include <avr/io.h>
#include <util/delay.h>
/*
* delay_ms(delay_in_ms)
*
* Delay the specified number of milliseconds.
*
* _delay_ms uses a floating point dataty... |
C | #include "str.h"
#include "blockify.h"
Sexp* bDo(Sexp *);
Sexp* bIf(Sexp*);
Sexp* bContainer(Sexp*, size_t);
Sexp* bDef(Sexp* s);
void blockify(Sexp* p) {
for (size_t i = 0; i < p->len; ++i) {
if (isDef(p->list[i])) {
p->list[i] = bDef(p->list[i]);
}
}
}
/**
* Turns (def FuncN (params ...) Type St... |
C | // TODO: right now, the parser ignores all garbage after the ends of lines
#include "parse.h"
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <stdarg.h>
#include <stdlib.h>
// error messaging macros
#define ERR "assembler: ERROR: line %u: "
#define WERR(msg, ...) sprintf(err, ERR msg, line, __VA_ARG... |
C | #include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main()
{
int n;
scanf("%d", &n);
int i, j, pom = n;
int i2 = 2*n - 1;
int j2 = 2*n - 1;
for (i=0;i<i2;i++){
for (j=0;j<j2;j++){
printf("%d ", pom);
if (i >= n){
... |
C |
#ifndef _DT_QUEUE_H_INCLUDED_
#define _DT_QUEUE_H_INCLUDED_
#include <stddef.h>
typedef struct dt_queue_s dt_queue_t, dt_list, dt_queue;
struct dt_queue_s {
dt_queue_t *prev;
dt_queue_t *next;
};
#define dt_queue_init(q) \
(q)->prev = q; ... |
C | #include<stdio.h>
#include<math.h>
main()
{int num,unit,csum=0,x;
printf("Enter the number to check for armstrong number:\n");
scanf("%d",&num);
x=num;
while(num!=0)
{
unit=num%10;
csum=csum+pow(unit,3);
num=num/10;
}
if(x==csum)
printf("The number is an armstrong number");
else
printf... |
C | #include "sys.h"
#include "delay.h"
/**
*ڵʵ(IOģ)
* ʣ9600 1-8-N
* TXD : PC13
* RXD : PB14
* ʹⲿж϶RXD½ؽдʹöʱ49600ʽжʱݽա
* Demo: 11ݣȻѽյݷͳȥ
*/
#define OI_TXD PCout(13)
#define OI_RXD PBin(14)
#define BuadRate_9600 100
u8 len = 0; //ռ
u8 USART_buf[11]; //ջ
enum{
COM_START_BIT,
COM_D0_BIT,
COM_D1_BIT,
COM_D2_BIT,... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* div_op.c :+: :+: :+: ... |
C | // implementation of the temperature conversion behavior from the reactive
// programming survey ...
// we have a behavior temp that continuously presents the current temperature
// in degrees Celcius
#include <stdlib.h>
#include "unit/test.h"
#include "reactive-c/api.h"
// to observe a value/variable...
double te... |
C | #include "conversion.h"
/* 256 array of Decimal values of the base64 characters
Organized by ASCII value */
int r64Lookup[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 0... |
C | /* tpsimul1.c LIR simulator test 1 */
int g1, g2;
int ga1[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
int ga2[3], g3, g4;
int printf( char*, ... );
void initiate( int *param1, int *param2 )
{
ga2[0] = 11;
ga2[1] = 12;
ga2[3] = 13;
*param1 = *param2 ;
}
int main()
{
int i, j1, j2, aa[10], bb[5], j3, j4;
... |
C | /* file litnet1.c */
#if !defined(COMPILE_ENVIRONMENT)
#include <phone/stdcenvf.h> /* std compile environment for functions */
#endif
void literalize_network(NETWORK *net, NODE *node, int *perr)
/*******************************************************************/
/* ... |
C | //
// main.c
// 9_1
//
// Created by MAC on 15/6/14.
// Copyright (c) 2015年 MAC. All rights reserved.
//
#include <stdio.h>
struct {
int year;
int month;
int day;
}date;
int main(int argc, const char * argv[]) {
int days=0,i;
int month[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
... |
C | //
// Created by 单颖博 on 2019/2/20.
// 每个系统标准不一样,所以函数定义,差别较大所以这章叫unix标准与实现
//
#include "apue.h"
#include <errno.h>
#include <limits.h>
#ifdef PATH_MAX
static int pathmax = PATH_MAX;
#else
static int pathmax = 0;
#endif
#define SUSV3 200112L
static long posix_version = 0;
/* If PATH_MAX is indeterminate, no guarantee... |
C | /*
* Programmer: Kanishk Yadav
* Project: 2K Pre-Test
* File Desc: The program outputs the minimum time required before a message sent
* from the capitol (city #1) throughout the empire, i.e. the time it is received
* in the last city to get the message.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.... |
C | #include"camera.h"
void init_camera(Camera *cam,SDL_Rect posperso,int width,int height)
{
cam->camera.x=posperso.x-(width*.5);
cam->camera.y=posperso.y-(height*.5);
cam->camera.w=width;
cam->camera.h=height;
}
void poscamera(Camera *cam,SDL_Rect posperso,int width,int height)
{
(cam->camera.x)=(posperso.... |
C | /* gcc -Wall -o tree blatt3-rahmen.c --std=c99 */
#include <malloc.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
struct node {
struct node *left;
struct node *right;
int val;
};
struct node *new_node(int val)
{
struct node * new = (struct node*) malloc(sizeof(struct no... |
C | #include<stdio.h>
#include<math.h>
int main()
{
int n,b,a,count=0,c,sum=0,num,d;
printf("Enter a Number ");
scanf("%d",&n);
a=n;
d=n;
while(a!=0)
{
b=a%10;
count++;
a=a/10;
}
printf("The number %d has %d digits\n",n,count);
while(d!=0)
{
c=d%10;
num=pow(c,count);
sum+=num;
... |
C |
#include<stdio.h>
#include<math.h>
#include<malloc.h>
int factorial(int num, double fact)
{
if(num == 0)
{
printf("0");
return 0;
}
if(num == 1) return fact;
fact = fact * num;
factorial(--num, fact);
}
int main(int argc, char *argv[])
{
int num, i;
num = atoi(argv[1]);
double fact = 1;
fact = factori... |
C | #include <stdio.h>
int linear_search(int arr[], int n, int i, int key)
{
if (i == n)
{
return -1;
}
if (arr[i] == key)
{
return i;
}
return linear_search(arr, n, i + 1, key);
}
int main()
{
int arr[] = {1, 2, 3, 4, 5, 6};
int n = sizeof(arr) / sizeof(arr[0]);
... |
C | #include "distance.h"
/* Find the minimum of 3 int
*
* Params:
* int a: first int
* int b: second int
* int c: third int
*
* Returns: the minimum.
*/
static int minimum (int a,int b, int c){
int minimum = a;
if (a > b){
minimum = b;
}
if (minimum > c){
min... |
C | #include<stdio.h>
int main()
{float tempFH, tempCS;
printf("Enter temperature in farheinheat") ;
scanf("%f",&tempFH);
tempCS = (tempFH-32)*5/9;
printf ("Temperature in centigrades is %f ",tempCS);
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
unsigned power (unsigned x, unsigned y);
//void run_check (unsigned x, unsigned y, unsigned expected_ans);
void test (unsigned x, unsigned y, unsigned expected_ans) {
unsigned temp = power(x, y);
if (temp != expected_ans) {
exit (EXIT_FAILURE);
}
}
int main (voi... |
C | #include <stdio.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <arpa/inet.h>
int main() {
struct sockaddr_in serv_addr;
int listen_fd = 0;
if ((listen_fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
exit(1);
}
bzero(&serv_addr... |
C | #ifndef JHD_TLS_CAMELLIA_H
#define JHD_TLS_CAMELLIA_H
#include <tls/jhd_tls_config.h>
#include <stddef.h>
#include <stdint.h>
#include <tls/jhd_tls_cipher.h>
#define JHD_TLS_ERR_CAMELLIA_INVALID_KEY_LENGTH -0x0024 /**< Invalid key length. */
#define JHD_TLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH -0x00... |
C | #include<stdio.h>
#include<stdbool.h>
bool Vowels(char str[])
{
if(str==NULL)
{
return 0;
}
while(*str != '\0')
{
if((*str=='a') || (*str=='A') || (*str=='e') || (*str=='E') || (*str=='i') || (*str=='I') || (*str=='o') || (*str=='O') || (*str=='u') || (*str=='U') )
{
break;
}
str++;... |
C | #include "p11-12.h"
int main(void) /* 服務程式 */
{
struct exchange *shm;
int producer_ok,consumer_ok,i;
int shmid;
char readbuf[BUFSIZ];
/* 建立訊號量consumer和producer */
consumer_ok = open_semaphore_set(key1, 1);
producer_ok= open_semaphore_set(key2, 1);
init_a_semaphore(consumer_... |
C | #include <stdio.h>
#include <pthread.h>
pthread_t h1, h2;
void *hilo1 ();
void *hilo2 ();
int main() {
pthread_create (&h1, NULL, hilo1, NULL);
pthread_create (&h2, NULL, hilo2, NULL);
pthread_join (h1, NULL);
pthread_join (h2, NULL);
return 0;
}
void *hilo1(){
printf ("HILO1: Mi TID es %d\n... |
C | #define _POSIX_C_SOURCE 200809L
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include "libtep.h"
static FILE *OpenFile(char*, const char*, unsigned short);
static int AddLine(FILE*, size_t, book*, size... |
C | /*
Student Name:Sunita Gosai
Subject:Programming Fundamental
Lab Sheet No:20
Program:WAP to find cube of any number using function with no argument
Date:18,Jan2017
*/
#include<stdio.h>
void cube();
int main(){
cube();
return(0);
}
void cube(){
int n,result;
printf("Enter any number:\n");
scanf("%d",&n);
result=n*n*n;... |
C | #include <msp430.h>
#include <stdint.h>
#include "libs/i2c.h"
#include "libs/timer.h"
#include "libs/lcd.h"
uint8_t lcdAddr = 0x3F;
#define BT BIT3
#define EN BIT2
#define RW BIT1
void lcdWriteNibble(uint8_t nibble, uint8_t rs)
{ // BT EN RW RS
i2cSendByte(lcdAddr, nibble <... |
C | #include <linux/module.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/ioport.h>
// Used To Access KERNEL Macros And Functions
static int Major, result;
struct file_operations fops;
unsigned long start = 0xd260, length = 0x4;
// Parameter to assign value of any variable during loading of module
int me... |
C | #include "menger.h"
/**
* menger - draws a 2D Menger Sponge
* @level: is the level of the Menger Sponge to draw
*/
void menger(int level)
{
int i, j, size;
if (level == 0)
{
printf("#\n");
return;
}
size = pow(3, level);
for (i = 0; i < size; i++)
{
for (j = 0; j < size; j++)
{
if (sponge(i, j) =... |
C | #include <gba_console.h>
#include <gba_video.h>
#include <gba_interrupt.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/dir.h>
#include "gbfs_stdio.h"
#define TEST(expr) if (!(expr)) printf("TEST failed! (%s:%d)\n", __FILE__, __LINE__)
void test_fopen()
{
FILE *fp;
fp = fopen("test.txt... |
C | #include <stdio.h>
int main()
{
int width;
int breadth;
scanf("%d %d", &width, &breadth);
if (width == 1 && breadth == 1)
printf ("#\n");
else
{
for(int i = 0; i<breadth; i++)
{
for(int j = 0; j<width;j++)
if( j == 0 || j == width - 1 || i =... |
C | #include "functions.h"
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <assert.h>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
char* humidity() {
int leido,i,fd;
char* token;
char* chunk = (char*) malloc (128*sizeof(char));
char* buff... |
C | #include <stdlib.h>
#include <string.h>
#include "map.h"
// https://en.wikipedia.org/wiki/Hash_table
void map_init(map* map, int capacity, int growth_trigger, float growth_rate) {
int size = sizeof(map_entry[capacity]);
map_entry* list = malloc(size);
memset(list, 0, size);
map->list = list;
map->... |
C |
int runLength(int N, int*arr, void*val_s, void*len_s){
int i;
int rN;
int *val = (int*) val_s;
int *len = (int*) len_s;
if(N==0)
return 0;
rN = 1;
val[0] = arr[0];
len[0] = 1;
for(i=(1);i<(N);i++){
if(val[rN-1] == arr[i]){
len[rN-1]++;
}
else{
val[rN] = arr[i];
len[r... |
C | /*
* Lisp Parsing Module
*/
#ifndef PARSE_H_
#define PARSE_H_
#include "tree.h"
#include "hashtable.h"
/*
* Constants
*/
#define MAX_LINE_LENGTH 1024
/*
* Functions
*/
/**
* Parse a Lisp expression of the form: (str<Child_1><Child2>...<Child_n>)
* where <Child_x> are sub-expressions,
* and return a parse... |
C | #include <stdio.h>
int a[5];
int top=-1;
void push(int x)
{
if(top==4)
{
printf("Overflow codition");
}
else
{
a[++top]=x;
}
}
void pop()
{ if(top==-1)
printf("Pop can't be done due to underflow condition");
else
top--;
}
void printstack()
{
int i;
for(i=0;i<5;i++)
printf("%d\n",a[i]);
}
int mai... |
C | #include "../test.h"
void type_c()
{
if (MANDATORY == 1)
{
title("Type c Mandatory: ");
/*1*/
{
PRINT("This %c string is %c been %c tested %c with %c", 0, 'a', 'b', 'c', 'd', 'e');
}
/*2*/
{
PRINT("This %c", 0, 0);
}
/*3*/
{
PRINT("This %c string is %c been %c tested %c with %c", 0, 'a',... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define S 25
void insertionSort (int * arr , int size)
{
/*
* Função de ordenação Insertion Sort
* @param endereço do array
* @param tamanho do array
*/
int temp;
int iCount, jCount;
for (iCount = 1 ; iCount < size ; iCount++)
{
temp = arr[iCount]... |
C | #include<stdio.h>
int main(){
int i=1,num,exponent;
long power=1;
printf("\nenter the number :");
scanf("%d",&num);
printf("\nexponent of num:");
scanf("%d",&exponent);
while(i<=exponent){
power=power*num;
i++;
}
printf("The %d power of %d is: %ld",num,exponent,power);
return 0;
}
|
C | //Derek D Kim
//Jan. 21, 2016
//CS 241
//HW0
#include <stdio.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
//Chapter 4
//Memory allocation using malloc, heap and time
//if you want to use data after the lifetime of the function it was created in
//then you could use a static data out side o... |
C | /*
David Morosini de Assumpção
*/
#include "linkedlist.h"
/*Funções para inicialização das estruturas de dados*/
lst_node * new_node_(cell * data, lst_node * prox_node){
lst_node * n = (lst_node *)malloc(sizeof(lst_node));
assert(n != NULL);
if(n != NULL){
n -> data = data;
n -> prox =... |
C | /* Authors:
* Trevor Perrin
*
* See the LICENSE file for legal information regarding use of this file.
*/
#ifndef __TACK_STORE_FUNCS_H__
#define __TACK_STORE_FUNCS_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include "TackRetval.h"
#include "TackFingerprints.h"
/* Structure used to communic... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_convert.c :+: :+: :+: ... |
C | /**
* 3460:677 Final Project: Paralelizing OCR using PCA
* Christopher Stoll, 2014
*/
#ifndef OCRLIB_C
#define OCRLIB_C
#include <stdlib.h>
#include <math.h>
#include "ocrKit.c"
#include "imageDocument.c"
#include "resizeImage.c"
#define STANDARD_IMAGE_SIDE 16
#define DEBUG_SAVE_STANDARDIZED_CHARACTERS 0
#define ... |
C | #include<stdio.h>
#include"Create.c"
#define ARRAYLWN 12
/*
ðĻ˼ǣ
ͷɨ¼УɨĹ˳ȽԪصĴС
ִlength-1ɣÿ˶n-iΡͻύݣύ
һûзô˵鱾Ѿõ
Ծֹ
*/
void BubbleSort(int a[],int n){
int i ,j ,change = 1;
int x= 0;
for(i = 1;(i<=n-1) && (change==1);i++){
change = 0;
for(j = 1;j<=n-i;j++)
if(a[j]>a[j+1]){
x = a[j];
... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <3ds.h>
#include "fs.h"
#include "file.h"
FS_Archive fsArchive, ctrArchive;
//extern FS_Archive fsArchive;
u32 crc32(u8 *buf, u32 len)
{
uint32_t crc=0;
static uint32_t table[256];
uint32_t rem;
uint8_t octet;
int i, j;
u8 *p, *q;
/* This ch... |
C | /* open.c */
#include <fcntl.h> /* defines options flags */
#include <sys/types.h> /* defines types used by sys/stat.h */
#include <sys/stat.h> /* defines S_IREAD & S_IWRITE */
static char message[] = "Hello, world";
int main()
{
int fd;
cha... |
C | #include "pbdata.h"
/* ----------------------------------------------------------------------*/
__IO uint32_t AsynchPrediv = 0, SynchPrediv = 0;
#define RTC_CLOCK_SOURCE_LSI //ʹLSIʱ
#define RTC_FLAG_BKP 0xA55A //־
/************************************************
RTC_Confi... |
C | /**
* @file libpower.c
*
* @author Lorenz Gerber
* @date 31.10.2016
* @brief dynamic library for calculating power from resistance or current.
*
*/
#include "libpower.h"
/**
*
* @brief function to calculate power from voltage and resistance
*
* The function calculates power in watt according to the formu... |
C | #include "types.h"
#include "debug.h"
#include "pmm.h"
#include "vmm.h"
#include "boot.h"
// 内核初始化函数
void kmain();
// 开启分页机制之后的 Multiboot 数据指针
multiboot_t *glb_mboot_ptr;
// 开启分页机制之后的内核栈
char kern_stack[STACK_SIZE];
// 内核使用的临时页表和页目录
// 该地址必须是页对齐的地址,内存 0-640KB 肯定是空闲的
__attribute__((section(".init.data"))) pgd_t *pgd_... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
#include <string.h>
#include <dirent.h>
#define handle_error(msg) \
do { perror(msg); exit(EXIT_FAILURE); } while(0)
int main(int argc, char *argv[]) {
int p[2];
pid_t child;
/* p[0] --> read end of the pipe
* p[1] --> write e... |
C | #include "holberton.h"
/**
* print_last_digit - prints the last digit of a number.
* @i: input integer
*
* Return: the value of the last digit;
*/
int print_last_digit(int i)
{
if (i < 0)
{
i = i % 10;
i = -i;
}
else
i = i % 10;
_putchar(i + '0');
return (i);
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* check_map.c :+: :+: :+: ... |
C | #include<stdio.h>
void display(int arr[], int size){
int i;
for(i = 0; i <= size; i++){
printf("%d ",arr[i]);
}
printf("\n");
}
int main(){
int array[] = {5,3,1,9,8,2,4,7};
int size = sizeof(array)/sizeof(array[0]);
display(array,size);
int i, j, temp;
for(i=0; i<size-1;i... |
C | #ifndef __MENU_H__
#define __MENU_H__
#include "screen.h"
typedef enum menu_states_e {
STATE_INTRO,
STATE_READY,
STATE_OUTRO,
} menu_states_e;
typedef struct menu_t {
screen_t screen;
} menu_t;
menu_t menu_init();
void menu_update();
void menu_fini();
#endif
#ifdef __MENU_H_IMPLEMENTATION__
#undef... |
C | #include<stdio.h>
void main(){
int x;
printf("输出男女\n");
scanf("%d",&x);
if(x==0){
printf("女\n");
}
else if(x==1){
printf("男\n");
}
else {
printf("输入有误,请重新输出\n");
}
}
|
C | #include "hash_table.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
static int hash_func(char *string, int max) {
int len = strlen(string);
unsigned long long hash = 0;
for (int i = 0; i < len; i++) {
hash = (((hash << 5) + hash) + string[i]) % max;
}
return hash % max;
}
... |
C | #include <stdio.h>
int main()
{
float M, MM;
printf("Digite um valor em metros para ser convertido para milimetros: \n");
scanf("%f", &M);
MM = M * 1000;
printf("%.2f milimetros \n", MM);
return 0;
}
|
C | /*
* ListOfPrimes.c
*/
#include <stdio.h>
#include "mathutils.h"
#define MAXSIZE 2000
#define SEARCHLIMIT 17389
int ArrayOfPrimes[MAXSIZE];
int main(int argc, char **argv)
{
int index = 0;
for (int i = 2; i <= SEARCHLIMIT; i++)
{
if (primechecker(i) == 1)
{
ArrayOfPrimes[index] = i;
index+... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_check_content_and_create_s_array.c :+: :+: :+: ... |
C | #define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
int prime(int num){
for (int i = 2; i < num; i++){
if (num%i == 0){
printf("");
break;
}
else{
printf("");
}
}
return 0;
}
int main(){
int Num;
printf("һ:");
scanf("%d\n", &Num);
prime( Num);
system("pause");
return 0;
} |
C | #define CHAR_SIZE sizeof(char)
#define INT_SIZE sizeof(int)
#define null '\0'
#include <stdlib.h>
#include "expr_assert.h"
#include "arrayUtil.h"
#include <string.h>
#include <stdio.h>
#include <stddef.h>
typedef char* String;
ArrayUtil util, resultUtil, expectedUtil;
int sample[] = {1,2,3,4,5};
//-------------------... |
C | #include<stdio.h>
#include<conio.h>
void greatest(double,double,double);
void greatest(double a,double b,double c)
{
if(a>b&&a>c)
{
printf("\n A=%lf is greatest",a);
}
else if(b>c&&b>a)
{
printf("\n B=%lf is greatest",b);
}
else if(c>a&&c>b)
{
printf("\n C=%lf is greatest",c);
}
else... |
C |
void ingresar_cola(ptrNodo *ptrS, ptrNodo *ptrF )
{
ptrNodo ptrActual;
ptrNodo ptrNuevo;
ptrNodo ptrFinal;
int dato;
ptrNuevo = (ptrNodo)malloc(sizeof(NODO));//se crea espacio para el nodo
ptrActual = *ptrS;
ptrFinal = *ptrF;
if(ptrNuevo != NULL)//si se pudo crear el espacio entra
{
/*ACA... |
C | #include <stdio.h>
/*
int main(){
int rest[10] = {0, };
int cnt = 0;
int num;
for(int i = 0; i<10; i++){
scanf("%d",&num);
rest[i] = num % 42;
}
for(int i = 0; i<42; i++){
for(int j = 0; j<10; j++){
if(rest[j] == i){
cnt++;
break;
}
}
}
printf("%d\n", cnt);
}
*/
/*
int main(){
int rest[4... |
C | /**
* @file test2.cpp
* @Author Kolesnikov Alexandr(mr.alexandr.kolesnikov@gmail.com)
* @date October, 2017
* @brief test file for Test_PixelPlex project
**/
/* Required header files of standard libraries. ---------------------*/
#include <iostream>
#include <string>
/**
* @brief some function
* @param ... |
C | /*
// Author: Chris Hyman, chris@wugs.me
// Date: 3 Oct 2020
// A solution to Programming Exercises and Projects from
// Chapter 5 of C Programming: A Modern Approach by K. N. King
//
// 9. Write a program that prompts the user to enter two dates and then
// indicates which date comes earlier on the calendar:
// ... |
C | #ifndef CORC_CORE_STR_H
#define CORC_CORE_STR_H
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
typedef struct CorcString_ CorcString;
struct CorcString_
{
char *string;
char *end;
size_t len;
size_t size;
};
extern size_t corcstr_concat_raw(char *dst, const char *src, size_t siz);
extern... |
C | #include <stdio.h>
#define PRINCIPAL 100
#define SINGLE_INSTEREST 0.1
#define COMPOUND_INSTEREST 0.05
double Daphne_investment(int year)
{
return (1 + SINGLE_INSTEREST * year) * PRINCIPAL;
}
double my_pow(double x, int y)
{
double a = 1;
for(int i = 0; i < y; i++)
a *= x;
return a;
}
double Deirgre_investment(in... |
C | #include <stdio.h>
#include <stdlib.h>
//o codigo pede por 2 horarios diferentes e calcula a diferenca entre eles (caso o horario final seja menor que o inicial, subentende-se que se trata do dia seguinte)
struct cronometro {
int hora;
int min;
int seg;
};
typedef struct cronometro relogio;
void printInterv... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include "stack.h"
#include "integer.h"
void
Fatal(char *fmt, ...)
{
va_list ap;
fprintf(stderr,"An error occured: ");
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
exit(-1);
}
static void showStack(stack *s)
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strtrim.c :+: :+: :+: ... |
C | int main(void){
char m[5][7] = {"abcdef", "ghijkl", "mnopqr", "stuvwx", "yz"};
char (*p)[7] = m;
printf("%c ", **m);
printf("%c ", *(*m+2));
printf("%c ", *(*(m+1)+1));
printf("%c ", *(m[1] + 2));
printf("%c ", (*(m+2))[3]);
printf("%c ", (*(p+3))[2]);
p++;
printf("%d... |
C | #include <stdio.h>
int grow_up(int n) {
int prev_n = 10, flag = 1;
while(n > 0) {
if (prev_n > (n % 10)) {
prev_n = n % 10;
} else {
flag = 0;
break;
};
n /= 10;
}
return flag;
}
int main() {
int val = 0;
scanf("%i", &val);
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <time.h>
#include "listFunctions.h"
#include "searchFunctions.h"
bool binarySearch(LIST *data, int key, int *location)
// Ask for number to search using binary search algorithm
{
bool res=0;
nodePtr mid, low, high;
// initialize nod... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void menu()
{
printf("************************************\n");
printf("*********** 1. Ϸ ************\n");
printf("*********** 0. ˳Ϸ ************\n");
printf("************************************\n");
}
void game... |
C | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <time.h>
#include <sys/time.h>
void main(int argc,char *argv[])
{
int tomalloc; // for ben
int malloced = 0;
void *p;
tomalloc = atoi(argv[1]);
printf("mallocing at least %d MB\n",tomalloc);
tomalloc *= 1000000;
while... |
C | #include<stdio.h>
int main(){
int n,tmp;
int list[1000]={0,};
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d",&list[i]);
}
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
if(list[i]>list[j]){
tmp=list[i];
list[i]=list[j];
... |
C | #include "gtools.h"
/* This is a pruning function for use with geng. It causes
geng output to be restricted to chordal graphs. To use it
you need to compile it together with geng.c like this (assuming
your compiler is gcc). The file nautyW1.a is made by the nauty
distribution. It needs access to the *.h files of nau... |
C | /*
* ===================================================================================== *
* Filename: cgragh.c
*
* Description:
*
* Version: 1.0
* Created: 2017年11月24日 13时40分08秒
* Revision: none
* Compiler: gcc
*
* Author: Cz (mn), 13613283216@msn.cn
* ... |
C |
#include "alloc_btree_internal_header.h"
void alloc_btree_swap_data(
struct s_node *node_a,
struct s_node *node_b)
{
void *content;
void *size;
uint8_t node_type;
content = node_a->ptr_a;
node_a->ptr_a = node_b->ptr_a;
node_b->ptr_a = content;
size = node_a->m.ptr_b;
node_a->m.ptr_b = node_b->m.ptr_b;
... |
C | #include <stdio.h>
#include <stdlib.h>
void hanoi (int n, char dest_c, char origem_c, char aux_c);
int main (void){
return 0;}
void hanoi (int n, char dest_c, char origem_c, char aux_c){
if(n>0){
hanoi(n, origem_c, aux_c, dest_c);
printf("%c (origem) -> %c (destino)\n", origem_c, dest_c);
hanoi(n, aux_... |
C | #include <stdio.h>
#include <stdlib.h>
int ostatnia_cyfra(int n)
{
n;
if(n==39)
{
return 9;
}
}
int main()
{
int n = 39;
printf("Ostatnia cyfra argumentu to: ");
printf("%d", ostatnia_cyfra(n));
return 0;
}
|
C | /*
鲢ǽڹ鲢ϵһЧ㷨㷨Dz÷ηһdz͵Ӧ
кϲõȫУʹÿ
ʹжμϲһΪ·鲢
*/
/*
鲢ϲУ
ֽ:ݰλãķֳУһֻһ
ϲڵнкϲ
ҪO(n)ĸռ
*/
//кϲbegin end end+1 end2
//begin mid end
void merge(int* arr, int begin, int mid, int end, int* tmp)
{
//
//䣺[begin,mid][mid+1,end]
int begin1 = begin;
int end1 = mid;
int begin2 = mid + 1;
int end2 = end;
//ռʼλ
int idx = beg... |
C | #include "fillit.h"
void print_result(t_res *res)
{
int i;
i = 0;
while (i < res->size)
{
write(1, res->tab + (i * res->size), res->size);
ft_putchar('\n');
i++;
}
}
void delete_tetris(t_res *res, t_tetro tetris)
{
int i;
i = 0;
while (i < (res->size * res->size))
{
if (res->tab[i] == tetris.shape[... |
C | #include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
int A[n];
int i;
for(i=0;i<n;i++)
scanf("%d",&A[i]);
int maxSum = -1;
for(i=0;i<n;i++)
{
if(A[i]<=0)
continue;
int bestSum = -1;
for(int j=i;j<n;j++)
{
int currSum = 0;
for(int k=i;k<=j;k++)
currSum += A... |
C | /* ************************************************************************** */
/* LE - / */
/* / */
/* ft_resol.c .:: .:/ . .:: ... |
C | /*
* Userspace program that communicates with the led_vga device driver
* primarily through ioctls
*
* Ayush Jain : aj2672
* Shivam Choudhary : sc3973
* Columbia University
*/
#include <stdio.h>
#include "vga_led.h"
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include ... |
C | #include <unistd.h>
#include <sys/types.h>
#define MAP_ANONYMOUS 0x20
#define MAP_PRIVATE 0x02
#define MAP_SHARED 0x01
#define PROT_READ 0x1
#define PROT_WRITE 0x2
#define PROT_EXEC 0x4
#define PROT_NONE 0x0
typedef struct {
void *addr;
int blockSize;
struct meta_block * next;
} meta_block;
meta_block *ROOT =... |
C | /***********************************************
Author: Vibishan Wigneswaran
Date: 7/15/2020
Answer to question:
If a large number is used it will still dsiplay. In the recursive example there wasnt enough memory to store each number because all 500000 numbers needed to be stored in a n instant.
Using a loop, this is ... |
C | #include<stdio.h>
#include<string.h>
main(){
char palabra[100];
int n,aux,largo;
scanf("%d",&n);
while(n--){
scanf("%s",palabra);
largo=strlen(palabra);
for(int i=0;i<largo;i++){
aux=palabra[i];
if(aux<91){
aux+=32;
printf("%c",aux);
}
else{
aux-=32;
printf("%c",aux);
}
}
pr... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
//Max Min functions
#define MIN(a, b) a<b?a:b
#define MAX(a, b) a>b?a:b
//fixed size and dimensions
#define trainsize 6670
#define testsize 3333
#define dimensions 193
//classifier function
void Bayes(int trainingset[][dimensions], int testingset[][dimensions], ... |
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 <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <sys/wait.h>
#include <sys/types.h>
#define MAX_LEN 512
void myPrint(char *msg)
{
write(STDOUT_FILENO, msg, strlen(msg));
}
void errorPrint(){
/*
If a command does not exist or a command is over the length limit
*/
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.