language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /**
* @file pps-client-cat.c
* @date 02 Mai 2018
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h> // for memset()
#include "system.h"
#include "client.h"
#include "network.h"
#include "node.h"
#include "config.h"
int main(int argc, char* argv[])
{
client_t client;
if(client_init((client_ini... |
C | #include <stdio.h>
int main(){
int x[5] = {1,1};
for(int i = 0; i < 13; i++){
for(int j = 0; j < 2; j++){
printf("Register %d:%d\n",(i * 2 + j) ,x[j]);
}
x[0] = x[0] + x[1];
x[1] = x[1] + x[0];
}
}
|
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "params.h"
#include "blake2.h"
#include "aes.h"
#include "math.h"
#include <gmp.h>
#include <time.h>
// ======== RSA Stuff
typedef struct {
mpz_t n; /* Modulus */
mpz_t e; /* Public Exponent */
} public_key;
typedef struct {
... |
C | #include "usart.h"
#include <avr/io.h>
void USART_Init( unsigned int ubrr)
{
/* Set baud rate */
UBRRH = (unsigned char)(ubrr>>8);
UBRRL = (unsigned char)ubrr;
/* flush transmitt register, Double speed */
UCSRA = (1<<UDRE)|(1 << U2X);
/* enable receiver interrupt and transmitter, pins forced */
UCSR... |
C | // twofloats.h - My twofloats data type, useful for passing stereo data
// around.
// --------------------------------------------------------------------------
// Copyright (c) 2005 Niall Moody
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated d... |
C | #include<stdio.h>
#define toint(X) (X - '0')
// ˷
// https://blog.csdn.net/u010983881/article/details/77503519
// http://www.cnblogs.com/king-ding/p/bigIntegerMul.html
int getlen(char in[]) {
int count=0;
while(in[count] != '\0')
count++;
return count;
}
void muti(char *mult, char *fact) {
// pri... |
C | #include <stdint.h>
#include <stdbool.h>
#include <math.h>
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/fpu.h"
#include "driverlib/sysctl.h"
#include "driverlib/rom.h"
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#define SERIES_LENGTH 1000
float gSeriesData[S... |
C | /*32. Se ingresa una lista de pares ordenados (numero de socio, edad).
El último es ('*', 0). La computadora debe indicar cuántas personas
tienen más de 18 años y menos de 65, el numero de socio del mayor y
del menor.*/
#include <stdio.h>
int main (){
int age, youngage, oldage, cont=0;
int num, youngnum,... |
C | #pragma once
#include "cocos2d.h"
// This functions shift the origin from the bottom left to the center of the screen
static void shiftOrigin(cocos2d::Node* node)
{
const cocos2d::Node* parent = node->getParent();
// only adjust position if there is a parent, and the parent is no the root scene
if (parent && dyna... |
C | #include<fcntl.h>
#include<sys/stat.h>
#define BUFSIZE 1024
int main()
{
int fd;
while(1)
{
if((fd=open("/etc/passwd",O_RDONLY))==-1)
{
perror("open");
exit(1);
}
printf("file des:%d\n",fd);
}
exit(0);
}
|
C | #include<complex.h>
#include<math.h>
#include<stdlib.h>
#include<stdio.h>
#include<assert.h>
complex plainmonte(int dim, double f(double* x), double* a, double *b, int N);
int main(){
double f(double* x){
return 1./(1.-cos(x[0])*cos(x[1])*cos(x[2]))/M_PI/M_PI/M_PI;
}
//Boundaries
double a[]={0,0,0};
double b[... |
C | /*
* Author: Jhonatan Casale (jhc)
*
* Contact : jhonatan@jhonatancasale.com
* : casale.jhon@gmail.com
* : https://github.com/jhonatancasale
* : https://twitter.com/jhonatancasale
* : http://jhonatancasale.github.io/
*
* Create date Tue 31 Jan 18:30:10 BRST 2017
*
*/
#include... |
C | #include "b_lock.h"
#include "time.h"
void lock(volatile int*lock_m) {
long wait_time = 10;
struct timespec ts = {
0, wait_time
};
// Try test and set
while(test_and_set(lock_m)) {
// Wait until lock_m is 0
while (*lock_m) {
nanosleep(&ts, &ts);
wa... |
C | #include <bios/format.h>
#include <bios/log.h>
#include <bios/intervalFind.h>
#include <mrf/mrf.h>
/**
* \file mrfMappingBias.c Module to calculate mapping bias for a given annotation set.
* Aggregates mapped reads that overlap with transcripts (specified in file.annotation) and \n
* outputs th... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* philo_bonus_routines.c :+: :+: :+: ... |
C | #ifndef TESTS_H
#define TESTS_H
#include "sha2.h"
void print_ui512(ui512 num)
{
unsigned char *cnum = (unsigned char *) #
for(int i=0; i<(512/8); i++)
{
int byte = cnum[i];
printf("%02X", byte);
}
printf("\n");
}
void test1()
{
ui512 input;
ui512 output = SHA2::hash(in... |
C | #include<stdio.h>
void main()
{
int num,pos2,i=7;
printf("Enter any number:\n");
scanf("%d",&num);
pos2=(num>>2)&0x01;
printf("%d\n",pos2);
while(i>=0)
{
if((num>>i)&0x01)
{
if(i==2)
{
printf("%d",pos2);
}
else
{
printf("0");
}
}
else
{
if(i==2)
{... |
C | /* * * * * * * * * * * * * * * * * * * * * * * * * *
* Author : Mahmoud Gamal Mohamed Ibrahem *
* date : 20 Feb 2020 *
* version: 1.0 *
* * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef _STD_TYPES_H_
#define _STD_TYPES_H_
/**********... |
C | //
// main.c
// Factors
//
// Created by Parth Verma on 31/01/17.
// Copyright © 2017 Parth Verma. All rights reserved.
//
#include <stdio.h>
int main() {
int x,i;
printf("Enter an integer: ");
scanf("%d",&x);
printf("Factors of %d are:\n",x);
for(i = 1;i <= x;i++)
{
if(x % i == 0)... |
C | #include "sequlist.h"
/**
* 将顺序表L1的数据进行分类,奇数存到L2中,偶数存到L3中
*/
void sprit(sequence_list *L1, sequence_list *L2, sequence_list *L3) {
initseqlist(L2);
initseqlist(L3);
int t;
for (int i = 0; i < L1->size; i++) {
t = L1->a[i];
if (t % 2 == 1) {
L2->a[L2->size++] = t;
}... |
C | #include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int white='W'; //white W
int black='B'; // black B
int white_cnt=2; // ǿ ٵϵ
int black_cnt=2; // ǿ ٵϵ
int gameboard[6][6];
int printBoard(int gameboard[6][6]){ // ... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define N 100
int count = 0;
struct dict_list{
/*(ア)*/
struct dict_list *next;
char *name;
};
struct dict_list *bucket[N];
int h(char *str){
return *str%N;
}
int h2(char *str){
return (str[0] + str[1]) % N;
}
int h3(char *str){
unsigned int i, v;
... |
C | #include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/ipc.h>
#include <semaphore.h>
int main()
{
sem_t *sem;
sem = sem_open("/aaa",0);
int looptime = 0;
while(1)
{
sem_w... |
C | int subtract(int x , int y){
int result;
result = x-y;
return result;
} |
C | /*
* 题目:给定一个二叉树,返回它的中序遍历。
*
* 示例:
* 输入: [1,null,2,3]
* 1
* \
* 2
* /
* 3
*
* 输出: [1,3,2]
*
* 进阶: 递归算法很简单,你可以通过迭代算法完成吗?
*
*/
/*
* 思路:二叉树的中序遍历可以采用递归和非递归两种算法。本题中的难点在于题目要求
* 返回中序遍历的数组,以及树中的元素个数,需要每次在添加元素时动态的调整内存空间的大小;
* 非递归算法需要借助于栈来实现;
*/
/**
* Definition for a binary tree node.
* struct Tre... |
C | /*
* Wodox reimplemented again.
* This code copyright (c) Luis Javier Sanz 2009-2013
*/
#include "play_private.h"
/*----------------------------------------------------------------------------
* Grab an object from the unused list and initialize it.
*------------------------------------------------------------... |
C | #define MAX_N_SERVER 1000
void single_server_queue(float arrival_time_ls[], float service_time_ls[], float wait_time_ls[], int n_customer);
void const_multi_server_queue(float arrival_time_ls[], float service_time_ls[], float wait_time_ls[],
int n_server, int n_customer);
void changing_m... |
C | // i/o example
#include <iostream>
using namespace std;
int main ()
{
int j = 0;
int i;
while(true){
cin >> i;
j++;
cout << j;
}
return 0;
}
|
C | /*********************************************************************
* Test Program
* ---------------------------------------------------------
* Filetype: (SOURCE)
*
* Copyright -- see file named COPYRIGHTNOTICE
*
********************************************************************/
/*! \file
* \ingroup ... |
C | #include <stdio.h>
int main(void)
{
int n,b;
printf("һ\n");
scanf("%d", &n);
for (int i = 2; i < n; i++)
{
b = n % i;
if (b == 0)
{
printf("һ");
goto quit; //һ1Լѭʾ
}
}
printf("һ");
quit:return 0;
} |
C | #include <stdio.h>
struct Shape {
int type;
};
struct Point {
struct Shape shape;
int x, y;
};
struct Line {
struct Point start;
struct Point end;
};
int main_inherit()
{
struct Line line;
struct Point *point_start = (struct Point *) &line;
line.start.x = 10;
line.start.y = 11;
... |
C | #pragma once
#include <time.h>
#include <windows.h>
const __int64 DELTA_EPOCH_IN_MICROSECS = 11644473600000000;
/* IN UNIX the use of the timezone struct is obsolete;
I don't know why you use it. See http://linux.about.com/od/commands/l/blcmdl2_gettime.htm
But if you want to use this structure to know about GMT(UTC... |
C | /**
* @brief
* Function that waits for a specific event.
* @author
* Felix Brüning
*/
#ifndef THREAD_WAIT_FOR_EVENT_H
#define THREAD_WAIT_FOR_EVENT_H
#include <pthread.h>
/**
* Function that waits until the function @see f returns the value val.
*
* @param cond
* Condition to wait for.
* @param mutex... |
C | #include "solution.h"
// Crea una soluzione vuota per un problema di dimensione n
void create_solution (int n, solution_t *px)
{
point_pos p;
px->f = 0;
px->card_x = 0;
px->card_N = n;
px->in_x = bool_alloc(n+1);
// Liste dei punti nella soluzione x e nel complemento N \setminus x
px->... |
C | #include <linux/module.h>
#include <linux/init.h>
#include <linux/fs.h>
/* Meta Information */
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Johannes 4 GNU/Linux");
MODULE_DESCRIPTION("Registers a device nr. and implement some callback functions");
/**
* @brief This function is called, when the device file is opened
*/
st... |
C | #include<stdio.h>
#include<string.h>
void main(){
char a[]="bb是大傻子";
char b[]="BB是小机灵鬼";
if(strcmp(a,b)==0){
printf("说得对");
}
else{
printf("b说的不对");
}
}
|
C | #include <time.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdint.h>
#include "/opt/acml5.3.0/gfortran64/include/acml.h"
extern void xdrotg_(double *a, double *b, double *c, double *s);
void f_drotg(double *a, double *b, double *c, double *s)
{
xdrotg_(a, b, c, s);
}
d... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* philo_one.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
void main()
{
int i, sumo, ans;
sumo = 0;
ans = 0;
for(i = 1; i<=200; i++)
{
sumo += i;
if(i == 10)
{
ans += sumo;
}
else if(i == 100)
{
ans += sumo;
}
e... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define LCHILD(x) 2 * x + 1
#define RCHILD(x) 2 * x + 2
#define PARENT(x) (x - 1) / 2
typedef struct node {
int id;
int data;
int b_time;
} node ;
typedef struct maxHeap {
int size ;
node *elem ;
} maxHeap ;
node process[10];
int pos_h=0;
... |
C | /*
pretty heuristic in deletion. need to consider corner cases especailly in deletion.
insert is for recursive insertion. need to update the left/right pointer,
so address of left/right pointer should be delivered.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
/* max ran... |
C | // 1. Product of numbers
// Create a program that calculates the product of the first 10 numbers (1…10), which is 10 factorial.
// You may use the given pseudo code. Put an extra line in the loop to print the value of the loop variable
// and that of the product as well in order to see how the product develops.
// Le... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "include/global_config.h"
#include "include/threadtab.h"
/* for testing */
#include "include/threadtab_structs.h"
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
int main(void){
threadtab *tb = threadtab_init();
threadtab_i... |
C | static int mem[4096] = {0};
static int mpos = 0;
static int disk[8191] = {0};
static int dpos = 0;
int get_mem()
{
static int init = 4095;
if (init) return init--;
else return (mpos) ? mem[mpos--] : 0;
}
void put_mem(int x)
{
mem[++mpos] = x;
}
int get_disk()
{
static int init = 4095;
if (ini... |
C | #include <stdio.h>//Importas librerias.
#include <stdlib.h>
int main(int argc, char** args){
int **p; //Puntero representa una matriz
int **q; //Puntero representa una matriz
int **r; //Puntero representa matriz producto
int af, ac, bf, bc, i, j, k; //Variables para definir las matrices y utilizar las en los ci... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* encode_tokens_2.c :+: :+: :+: ... |
C | #include "holberton.h"
/**
* _strstr - function finds the first occurrence
* of the substring needle in the string haystack.
* @haystack: Source string.
* @needle: String to look for.
* Return: Remaining string from point character occurs.
*/
char *_strstr(char *haystack, char *needle)
{
unsigned int i, ii;
if (ne... |
C | #include <stdio.h>
#define MOUTHS 12
int main(void)
{
int days[MOUTHS] = { 31, 28, [4] = 31, 30, 31, [1] = 29};
int i;
for (i = 0; i < MOUTHS; i++)
{
printf("%2d %d\n", i+1, days[i]);
}
return 0;
} |
C | //
// Created by Noa Biton on 3/27/2017.
//
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include "unit_test_util.h"
#include "../SPKDTree.h"
static SPKDArray *createArr() {
//int d = 3, n = 8
int d = 3, n = 3;
SPPoint **arr = (SPPoint **) malloc(sizeof(SPPoint *) * n);... |
C | /*
* 1.cpp
*
* Created on: 2012-10-8
* Author: Lixurong
*/
int runnian( int a );
int main()
{
int n, k;//????
cin >> n;//????
k = n*(n-1)/2;//????
double a[n][3];//????
double b[k][3];//????
for( int i=0; i<n; i++ )//????
{
cin >> a[i][0] >> a[i][1] >> a[i][2];
}
int p=0;
... |
C | #if 0
static DC_notifier_t g_notif;
void thread_func (DC_thread_t *th, void*data)
//void func (void *data)
{
int i= 10;
//DC_notifier_wait (&g_notif, 0);
while (i) {
printf ("Thread %u\n", pthread_self ());
usleep (1000000);
i--;
}
}
void task_func (DC_task_t *task... |
C |
//o(n^3)
maxsofar = 0;
for (i = 0; i < n; i++)
for (j = i; j < n; j++) {
sum = 0;
for (k = i; k <= j; k++)
sum += A[k];
if (sum > maxsofar)
maxsofar = sum;
} |
C | // NAME: Alex Chen
// EMAIL: achen2289@gmail.com
// ID: 005299047
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <netinet/in.h>
#include <getopt.h>
#include <errno.h>
#include <string.h>
#include <poll.h>
#incl... |
C | /**
* @file
* Ein-/Ausgabe-Modul.
* Das Modul kapselt die Ein- und Ausgabe-Funktionalitaet (insbesondere die GLUT-
* Callbacks) des Programms.
*
* @author Christopher Blöcker
* @author Julius Beckmann
*/
/* ---- System Header einbinden ---- */
#include <stdlib.h>
#include <stdio.h>
#include <GL/glut.h>
/* ---... |
C | #include "../inc/curses.h"
#include "../inc/my_show_board.h"
#include "string.h"
#include "stdlib.h"
#include "unistd.h"
void init_win_params(WIN *p_win)
{
p_win->height = 5;
p_win->width = 5;
p_win->prev = ' ';
p_win->starty = (LINES - p_win->height)/2;
p_win->startx = (COLS - p_win->width)/2;
p_win->pos... |
C | #include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "bitstream.h"
#include "huffman.h"
#include "jpeg_reader.h"
struct jpeg_desc *read_jpeg(const char *filename){
/* On initialise la structure jpeg_desc */
struct jpeg_desc *jdesc = malloc(sizeof(struc... |
C | class Solution {
public:
int totalHammingDistance(vector<int>& nums) {
int num = nums.size();
if(num == 0) return 0;
vector<int> cnt(32,0);
for(int i = 0;i<num;i++){
int tmp = nums[i];
int j = 0;
while(tmp){
cnt[j++]+=(tmp%2);
... |
C | // 01_errors.c corregido
#include <stdio.h>
#include <conio.h>
int main()
{
clrscr();
gotoxy(10, 10);
printf("Estoy en la fila 10 columna 10");
return 0;
} |
C | #include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#define BUFF_SIZE 10
int main(int argc, char const *argv[]) {
const char *filename = argv[1];
char buff[BUFF_SIZE];
ssize_t rresult;
ssize_t wresult;
int fd = open(filename, O_RDONLY);
if ... |
C | // ch13_01.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct st_person{
char name[20];// 이름
char address[80];// 주소
int age;// 나이
};
struct st_person* add_person();
void list_person(struct st_person* list[], int size);
int main()
{
struct st_person* plist[10];
for(int i=0; i<3; i++){
printf("#... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct s_btree
{
struct s_btree *left;
struct s_btree *right;
void *item;
} t_btree;
t_btree *btree_create_node(void *item);
t_btree *btree_create_node(void *item)
{
t_btree *node;
if(!(node = (t_btree*)mal... |
C | /**
* C program to enter marks of five subjects and find percentage and grades
*/
#include <stdio.h>
int main()
{
int phy,chem,maths,bio,comp;
float per;
/*
Input marks of five subjects from the user
*/
printf("Enter five subjects marks");
scanf("%d%d%d%d%d",&phy,... |
C | /**
******************************************************************************
* @file contact_detection.c
* @author Inmotion NaviPanel team
* @date 2016/09/19
* @brief 碰撞传感器驱动
* @attention Copyright (C) 2016 Inmotion Corporation
*****************************************************************************... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <unistd.h>
#include </usr/include/errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <netinet/in.h>
#pragma warning(disable : 4996)
extern int errno;
#define MAXLINE 1024
int echo_process(int echo... |
C | #include <stdint.h>
#include <stdbool.h>
#pragma once
// Our stack datatype - holds individual characters in an array
#define MAX_STACK_LENGTH 1000
struct stack{
uint8_t content[MAX_STACK_LENGTH];
int16_t length;
};
// Helper function to print an error and exit the program
void print_error(const char * msg)... |
C | #include <stdio.h>
int main(void){
long double x[100] = {0,};
long double e = 0.001;
int i = 1;
x[0] = 1.0;
x[1] = 1.7;
while(x[i] - x[i-1] > 0 && x[i] - x[i-1] > e || x[i] - x[i-1] < 0 && x[i] - x[i-1] < -e){
long double fxi = x[i] * x[i] * x[i] + x[i] * x[i] - 3 * x[i] - 3;
l... |
C | #include<stdio.h>
int main(){
int ret;
ret = soma(2, 3);
print(¨O resultado é: %d¨, ret);
return 0;
}
|
C | int ft_tolower(int c)
{
if (ft_isupper(c))
return (c + 32);
return (c);
} |
C | /**
* Logging facility for debug/info messages.
* _EGL_FATAL messages are printed to stderr
* The EGL_LOG_LEVEL var controls the output of other warning/info/debug msgs.
*/
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "egllog.h"
#include "eglmutex.h"
#define MAXSTRING ... |
C | /*
* Various functions using read and stdio for handling reads and buffers
* Written by: James Ross
*/
#include "input.h"
/*
* Uses the read() system call to read from the given file descriptor.
* Result of the read is placed in the provided buffer.
* nbyte is the size of the buffer.
*
* Reads nbyte-1 and pl... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include "header.h"
void Swap(int *a, int *b)
{
int temp = *a;
*a = *b;
*b = temp;
}
void SelectionSort(int *array, size_t n)
{
size_t i, j, min_index;
int temp;
for(i = 0; i < n-1; i++)
{
min_index = i;
for(j = i+1; j < n; j++... |
C | /***************************************************************************
* binoffset.c
* (C) 2002 Randy Dunlap <rdunlap@xenotime.net>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation;... |
C | #include<stdio.h>
#include<stdlib.h>
//ҪһṹһԱ
union MyUnion{
int num;
double db;
};
void main() {
//printf("%d", sizeof(union MyUnion)); //ȡ
union MyUnion my1;
my1.db = 1111111111123.988776; //һ
printf("%8d %f\n", my1.num, my1.db); //һı仯Ӱһ
my1.num = -10;
printf("%8d %f\n", my1.num,my1.db);
system("... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
main()
{
char a ;
a = 'a' ;
printf("%c\n",a) ;
}
|
C | #ifndef __TREE23_H__
#define __TREE23_H__
#include<stdlib.h>
#include<stdio.h>
typedef struct Key Key,*keyp; //关键词链
typedef struct Node Node,*nodep; //节点
typedef struct Tree Tree,*treep; //23树
typedef enum{
FALSE = 0,
TRUE = 1,
}Boolean;
struct Key{
int key;
struct K... |
C | /** example_pwm app:
*
* This app shows how to generate two PWM signals with the Wixel on pins P1_3
* and P1_4 using Timer 3.
*
* To understand how this app works, you will need to read Section 12 of the
* CC2511 datasheet, which documents Timer 3 and Timer 4.
*
* We do not currently have a general-purpose PWM ... |
C | /*
* Test that a basic collector works. Here we will do a basic reduction, keeping
* the last value received
*
*/
#include "../tests.h"
#include <area51/log.h>
#include <area51/list.h>
#include <area51/stream.h>
#define TEST_VALUE 42
static int result = INT_MIN;
static void forEach(StreamData *d) {
result =... |
C | /****************************************************************************/
/* ecvt v2.54 */
/* Copyright (c) 1995-2004 Texas Instruments Incorporated */
/****************************************************************************/
#inc... |
C | /********************************************************************************
*
* FILE NAME : divisibility_check.c
*
* DESCRIPTION: It takes as an input an array and a parameter N and checks
* whether N is divisible by the values in the array or not.
*
* DATE NAME REFERENCE REASON
*
* 8-MAR-08 ... |
C | /*
stack using linklist implementation
*/
#include <stdio.h>
#include <stdlib.h>
typedef struct node{
int data;
struct node *next;
}stack;
void push(stack **top, int val){
stack *tem;
tem=(stack *)malloc(sizeof(stack));
if(!tem){
printf("\n~~~ MEMORY ERROR ~~~\n");
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* launch.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <pthread.h>
#include "queuestruct.h"
void queue_initialize(prod_cons_queue *q)
{
//printf("queue inializer\n");
// initialize the queue
for (int i=0; i<20; i++)
{
q->element[i] = 0;
}
// initialize head and tail
q->head = NULL;
q->tail = NULL;
// initi... |
C |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
int main(void)
{
unsigned int *addr;
unsigned long size;
int count = 0;
int credNum = 0;
int uid;
unsigned mmapStart = 0x57575000;
uid = getuid()... |
C | #include "lists.h"
/**
*sum_dlistint - Sum all int into linked list
*@head: Head of the linked list.
*Return: Integer of sum.
*/
int sum_dlistint(dlistint_t *head)
{
int i = 0;
dlistint_t *tmp;
if (head == NULL)
return (0);
tmp = head;
while (tmp != NULL)
{
i = i + tmp->n;
tmp = tmp->next;
}
return ... |
C | #include"array.h"
#include<stdio.h>
#include<stdlib.h>
const int BLOCK_SIZE = 20;
//typedef struct {
// int *array;
// int size;
//}Array;
//һԶСı
Array array_create(int init_size)
{
Array a;
a.size = init_size;
a.array = (int*)malloc(sizeof(int)*init_size);
return a;
}
//ͷڴ
void array_free(Arr... |
C | #include<stdio.h>
#include<math.h>
//The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
//Find the sum of all the primes below two million.
int is_prime(long n);
int main (){
long long sum = 0;
for( long i= 2; i < 2000000; i++){
if ( is_prime(i) == i ) {
sum... |
C | /*
* Multilevel queue manipulation functions
*/
#ifndef __MULTILEVEL_QUEUE_H__
#define __MULTILEVEL_QUEUE_H__
/*
* multilevel_queue_t is a pointer to an internally maintained data structure.
* Clients of this package do not need to know how the queues are
* represented. They see and manipulate only multilevel_que... |
C | // Xadrez de Ambrolândia
#include <stdio.h>
int d2(int n, int i, int j, int cont, int matriz[][n]){
if(i >= 0 && j < n){
if(matriz[i][j] == 0){
++cont;
d2(n, --i, ++j, cont, matriz);
}
else return cont;
}
... |
C | #include <stdio.h>
int main(void)
{
int n,k,a[10],i,b;
scanf("%d %d",&n,&k);
printf("The given two numbers n and k are:%d and %d\n",n,k);
scanf("%d",&b);
for(i=0;i<=b;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<=b;i++)
{
if(a[i]==k)
{
printf("K exists");
}
}
return 0;
}
|
C | #include<stdio.h>
int main(){
int i, numero = 0;
printf("Informe um numero: ");
scanf("%d", &numero);
int sequencia[numero];
for(i = 0; i < numero; i++){
if(i < 2){
sequencia[i] = 1;
} else {
sequencia[i] = sequencia[i-2] + sequencia[i-1];
}
}
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#define VAR_SIZE 4
typedef struct Var
{
union data
{
double d;
int src_index;
char c;
}data;
enum {Int,Double,Char}type_name;
}Var;
// VM
struct Frame
{
Var *local_field;
Var return_v... |
C | #include "settings_state.h"
CONFIG_FILE ms_game_settings = {9, 9, 10, 3};
void play_settings_state()
{
int c, selected_item = -1, n_choices = 5;
// menu options
char *choices[] = {
"Rows number",
"Cols number",
"Mines number",
"Cell size",
"Go back",
};
// full size window
WINDOW *settings_win = n... |
C | #include <stdio.h>
main()
{
int numero;
int contad;
numero=0;
contad=0;
printf("Cuantos asteriscos quiere?: ");
scanf("%d", &numero);
for(contad=1; contad <= numero ; contad++)
{
printf("*");
}
contad=1;
while(contad <= numero)
{
printf("*");
contad++;
}
contad=1;
do
{
printf("*");
co... |
C | #include <stdio.h>
#include <stdlib.h>
#include <locale.h>
int Solicitar(int i);
int Somatorio(int valores[6]);
int Solicitar(int i) {
int solicitarvalor;
printf("Digite o %d valor: ", i);
scanf("%d", &solicitarvalor);
return solicitarvalor;
}
int Somatorio(int valores[6]) {
int j,resultsomatorio=0;
for ... |
C | #include <ctype.h>
#include <dirent.h>
#include <fcntl.h>
#include <limits.h>
#include <math.h>
#include <pwd.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <dirent.h>
/* Preprocessor Directives */
#ifndef DEB... |
C | # include<stdio.h>
void main()
{
int num,num1,sum=0,a;
printf("enter the num");
scanf("%d",&num);
lable:
num1=num;
a=num%10;
sum=sum*10+a;
num=num/10;
if(num>0)
goto lable;
if(sum==num1)
printf("%d",sum);
else
printf("%d is not",sum);
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct stu
{
int number;
char name[10];
struct stu *next;
};
typedef struct stu STU;
STU *add_node(STU *head)
{
STU *ptr = head;
STU *p = NULL;
p = malloc(sizeof(STU));
if (NULL == p)
{
perror("add");
exit(0);
... |
C | /**
* @file normal_forms.h
* @brief Contains declarations of NormalForms' functions.
*/
#ifndef NORMAL_FORMS_HPP
#define NORMAL_FORMS_HPP
/**
* @struct NormalForms
* @brief Contains information about normal forms (for any rule), each of them
* contains ending for normal form, ending's length and grammar ... |
C | #include<stdio.h>
void main()
{
printf("输入两个正整数:\n"); //输入两个正整数
int m, n, r, a, b;
scanf("%d%d", &m, &n);
if (m < n) //对输入的数字进行排序
{
a = n;
n = m;
m = a;
}
b=m*n;
while (n!=0) //辗转相除法求最大公约数
{
r = m%n;
m=n;
n=r;
}
printf("两个数的最大公约数为:%d\n",m); //输出结果
print... |
C | /*
Edgar Cruz
2/26/15
CS 111
Lab 6-2
This program will ask for a month and tell the season.
*/
#include <iostream>
using namespace std;
int main()
{
int month;
cout << "\nPlease enter a month (1 for January, 12 for December): ";
cin >> month;
switch (month)
{
case 12:
case 1:
case 2: cout << "wi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.