language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include "../inc/libmx.h"
void *mx_memccpy(void *restrict dst, const void *restrict src, int c, size_t n) {
unsigned char *p = dst;
const unsigned char *p2 = src;
unsigned char ch = c;
size_t i = 0;
while (i < n) {
p[i] = p2[i];
if (p[i] == ch) {
return p + i + 1;
... |
C | /**
* @file cipher.c
* @brief Implements the Kmyth cipher utility library for TPM 2.0.
*/
#include "cipher/cipher.h"
#include <string.h>
#include <openssl/rand.h>
#include <openssl/err.h>
#include "defines.h"
#include "cipher/aes_gcm.h"
#include "cipher/aes_keywrap_3394nopad.h"
#include "cipher/aes_keywrap_5649... |
C | // PID.cpp : Defines the entry point for the console application.
//
#include"pid.h"
//PIDȫֱṹ弰ָ
PID PidPar[4]; //{1,1,1,0.3,0.1,0,0,0,5.0,2.0}
PP pid = PidPar;
///PIDʼ
void PID_Initial()
{
int i;
for(i=0;i<4;i++)
{
(pid+i)->T = 1; //ĬϲΪ1s
(pid+i)->Kp = 1; //ĬϱΪ 1
(pid+i)->Ki = 0... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_atoi_base.c :+: :+: :+: ... |
C | #include <stdio.h>
int main() {
const float CAL = 2.54;
float calValue;
printf("Podaj wartosc w calach\n");
scanf("%f", &calValue);
float cmValue = calValue * CAL;
printf("%f cali = %f cm\n", calValue, cmValue);
return 0;
} |
C | #include<stdio.h>
#include<stdlib.h>
void printSol(int colour[], int V)
{
int i;
for(i=0;i<V;i++)
printf("Colour %d for vertex %d.\n", colour[i],i+1);
}
int isSafe(int v, int **graph, int colour[], int c, int V)
{
//v is vertex which will be marked with colour c, V*V graph, colour array
int i;
for(i=0;... |
C | /*
程序 12】判断 1010 到 200 之间的素数。
题目:判断 101-200 之间有多少个素数,并输出所有素数。
*/
#include <stdio.h>
#include <math.h>
int leap(int n) {
int temp = sqrt(n + 1);
for (int i = 2; i <= temp; i++) {
if (n % i == 0)
return 0;
}
return 1;
}
int main(void) {
for (int i = 100; i <= 200; i++)
if (leap(i))
printf("%d\t", i);
... |
C | #include<stdio.h>
int getArray(int);
int displayArray(int,int);
int main()
{
int arr[1000],limit;
printf("\nEnter array size : ");
scanf("%d",&limit);
arr=getArray(limit);
printf("\n\n\n ");
displayArray("%d",arr[],limit);
}
int getArray(int jk[])
{
int i,array[1000];
printf("\nEnte... |
C | // Athur: Mohamad Elchami Date: November 6th, 2015 Discription:
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
int main(void)
{
int number, rn, n, spaces;
printf("Enter a number between 2 and 9: ");
scanf("%d", &number);
time_t t;
srand((unsigned) time(&t));
for (; number > 0... |
C | #include <stdio.h>
#include <string.h>
#include "base.h"
char stack[26];
int stackIdx;
char str[27];
void push(char);
char pop();
char peek();
int main(void) {
int strIdx = 0;
char alpha = 'a';
printf("Input : ");
scanf_s("%s", str, 27);
printFirst();
while (1) {
if (strIdx == strlen(str)) {
return 0;
}... |
C | #include<stdio.h>
int main()
{
int n,t,y;
int jiecheng(int x);
printf("请输入正整数n:\n");
scanf("%d",&n);
t=1;
y=0;
while(t<=n)
{y=y+jiecheng(t);
t++;}
printf("结果为:%d\n",y);
return 0;
}
int jiecheng(int x)
{ int s,b;
s=1;
if(x!=0)
{for(b=1;b<=x;b++)
s=s*b;}
return(s);
}
|
C | /**
* @file opd_sample_files.h
* Management of sample files
*
* @remark Copyright 2002 OProfile authors
* @remark Read the file COPYING
*
* @author John Levon
* @author Philippe Elie
*/
#ifndef OPD_SAMPLE_FILES_H
#define OPD_SAMPLE_FILES_H
#include "op_list.h"
#include "odb.h"
struct opd_image;
/** one sam... |
C | #include<stdio.h>
int main()
{
int hours,minutes,seconds;
printf("\n enter seconds:");
scanf("%d",&seconds);
hours = (seconds/60*60);
printf("%d",hours);
minutes = (seconds/60);
printf("%d",minutes);
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <mqueue.h>
#include <sys/stat.h>
#include <limits.h>
#include "utils.h"
char *get_customer_queue_name(void){
char *str = calloc(MAX_QNAME_LENGTH, sizeof(char));
strcpy(str, "/");
char tmp[MAX_QNAME_LENGTH];
sprintf(tmp, "%d", getpid()... |
C | #include <stdio.h>
#include <stdlib.h>
/**
* array_range - Create an arrary from min to max numbers.
* @min: Minimum number.
* @max: Maximum number.
*
* Return: The array.
*/
int *array_range(int min, int max)
{
int *tmp;
int size = (max - min) + 1, i;
if (min > max)
{
return (NULL);
}
tmp = malloc(siz... |
C | /****************************************************************************
* *
* Filename: c1s1.c *
* *
* P... |
C | /**
* @brief It defines the die test
*
* @file inventory_test.c
* @author Guillermo Hoyo
* @version 1.0
* @date 31-03-2017
* @copyright GNU Public License
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "inventory.h"
#include "inventory_test.h"
#include "test.h"
#define MAX_TESTS 20... |
C | #include <stdio.h>
typedef struct BST
{
int data;
struct BST * lchild, * rchild;
} BinaryTreeNode;
BinaryTreeNode* Convert(BinaryTreeNode* pRootOfTree)
{
BinaryTreeNode * pLastNodeInList = NULL;
ConvertNode(pRootOfTree, &pLastNodeInList);
// pLastNodeInList points to the tail of double-linked list,
... |
C | /*
prog4.c
Richard Coffey
ECE 223
Program #4
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include "functions.h"
#define HSZ 8191
//prototypes
stats_table *parse_file(char *filename, hash_table *hash, int book_num, stats_table *stats);
void print_stats(hash_table *ha... |
C | #include <stdio.h>
int main()
{
char a[10];int i,l=0;
scanf("%s",&a);
for(i=0;a[i]!='\0';i++)
{
l++;
}
printf("%d",l);
}
|
C | #include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv)
{
int mat1[10][10];
int mat2[10][10];
int arows = 0;
int acols = 0;
int brows = 0;
int bcols = 0;
int xx = 0; int yy = 0;
int space = 0;
char line[1024];
char *line_res;
char **args;
args = malloc(1024 *sizeof(char*));
line_res =... |
C | /*
* The information in this file is
* Copyright(c) 2012, Gabriele Colosimo, Andrea Nascetti <gabriele.colosimo, andrea.nascetti>@uniroma1.it
* and is subject to the terms and conditions of the
* GNU Lesser General Public License Version 2.1
* The license text is available from
* http://www.gnu.org/licenses/lgpl.html
*... |
C | #include<stdio.h>
int main()
{
int x,y,z;
printf("enter the three numbers");
scanf("%d%d%d",&x,&y,&z);
if(x>y && x>z)
printf("the largest numbers is %d",x);
else if(y>x && y>z)
printf("the largest numbers is %d",y);
else
printf("the largest numbers is %d",z);
return 0;
}
|
C | //#pragma once
////#include <d3dx9math.h>
//#include "Vector3.h"
////#include "math.h"
//
//class Quaternion;
//
//static float m4Ident[4][4] =
//{
// { 1.0f, 0.0f, 0.0f, 0.0f },
// { 0.0f, 1.0f, 0.0f, 0.0f },
// { 0.0f, 0.0f, 1.0f, 0.0f },
// { 0.0f, 0.0f, 0.0f, 1.0f }
//};
//
//class Matrix4
//{
//public:
// float ma... |
C | #include <stdio.h>
void print(int line_no) {
for(int j = 0; j < line_no; j++)
printf("$");
printf("\n");
}
int main(void)
{
const int line = 5;
for(int i = 0; i < line; i++)
{
print(i + 1);
}
return 0;
}
|
C | #include <myutils.h>
#include <protocollo.h>
#include <mypthread.h>
#include <mysocket.h>
#include <mypoll.h>
#include <parser_writer.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/wait.h>
/** var. globali */
static int pipefd_dir[2]; /* pipe di comunicazione fra ... |
C | //
// Created by russell on 12.09.16.
//
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <pthread.h>
#include "generator.h"
#include "queue.h"
void *GenerateMessage(void *thrStr) {
int length;
char message[MAXSTRINGSIZE];
threadStr *sharedStr = (threadStr *) thrStr;
... |
C | #include <stdio.h>
/* DONE*/
/* RESEMBLES BUBBLE SORT*/
int main()
{
long long int test, count;
int l, i, j, x, temp;
int ar[50];
scanf("%lld", &test);
while(test--){
scanf("%d", &l);
x = 0;
while(l--){
scanf("%d", &ar[x++]);
}
count = 0;
for(i = 1; i < x; i++){
for... |
C |
#include <stdio.h>
int main(void)
{
int ch;
int cnt = 0;
printf("\nstatic unsigned char module[] = {\n");
while ((ch = getc(stdin)) != EOF) {
if (cnt == 0)
printf("\t\"");
printf("\\x%2.2X", ch);
cnt++;
if (cnt == 16) {
printf("\"\n");
cnt = 0;
}
}
printf("%s};\n", (cnt ? "\"\n" : ""));
... |
C | #include "tile.h"
#include <string.h>
#include <stdbool.h>
bool containNeighbors(const tile_t *tiles, int tile_count, int firstNeighbor, int secondNeighbor);
int tiles_is_able_to_chow(tile_t tiles[], int tile_count, tile_t tile)
{
if (containNeighbors(tiles, tile_count, tile + 1, tile + 2) || containNeighbors(til... |
C | //---------------------------------------------------------------------------------------
// Smile Programming Language Interpreter
// Copyright 2004-2019 Sean Werkema
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You ma... |
C | #include <ctype.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "C.h"
Node *new_node(NodeKind kind, Node *lhs, Node *rhs) {
Node *node = calloc(1, sizeof(Node));
node->kind = kind;
node->lhs = lhs;
node->rhs = rhs;
return node;
}
Node *new_node_... |
C | // Remove all comments from a C program.
//
// "quoted strings" and character constants should also be
// Handled properly...
//
#include <stdio.h>
#define MAX_SIZE 300
int read_line(char input[], int size);
void parse_line(char input[]);
void write_line(char input[], char output[]);
int is_comment(char buffer[]);
i... |
C | /**
* a simple stream cipher based on RC4
*
* Copyright (C) AlexandrinKS
* https://akscf.me/
**/
#include "cipher.h"
void cipher_init(cipher_ctx_t *ctx, const char* key, size_t key_len) {
int i = 0,j = 0, t=0 ;
uint8_t *sbox_b = (void *) bf_s_box;
/* rc4 */
for(i = 0; i < 256; i++) {
ctx-... |
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>
double cf(int);
int main() {
double e = 2 + 1.0 / cf(1);
printf("%f\n", e);
return 0;
}
double cf(int depth) { /*ここにコードを書く*/
if (depth > 10) {
return 1;
}
if ((depth % 3) == 2) {
return 2 * (depth / 3 + 1) + 1.0 / cf(depth+1);
} else {
return 1.... |
C | /* gen_ref.c : Write a program to implement reflection
along a general line : y=mx+c.*/
#include<stdio.h>
#include<graphics.h>
#include<math.h>
int c,bgcolor;
int a,b,num,den;
int n;
int xm1,ym1,xm2,ym2,xm3,ym3;
void draw_xy();
void bresenham(int x1,int y1,int x2,int y2,int x[],int y[]);
void l... |
C | #include"Heap.h"
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void swap(HPDataType *a, HPDataType *b)
{
HPDataType tmp;
tmp = *a;
*a = *b;
*b = tmp;
}
void DownAdjust(Heap *hp, int n)
{
int cur = n;
while (cur * 2 + 1 < hp->_size)//һѵĽڵûڵ㣬ôҶӣֱ
{
if (hp->_data[cur] < hp->_data[cur * 2 + 1])//УұСҪִн... |
C | #ifndef READDIR_H
#define READDIR_H
/*
* Structures and types used to implement opendir/readdir/closedir
* on Windows 95/NT.
*/
#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
/* struct dirent - same as Unix */
struct dirent {
long d_ino; /* inode (always 1 in WIN32) */
off_... |
C | #include "binary_trees.h"
/**
* binary_tree_depth - check the depth of a tree
* @tree: checking
* Return: depth
*/
size_t binary_tree_depth(const binary_tree_t *tree)
{
size_t size;
if (!tree)
return (0);
else if (tree->parent)
{
size = binary_tree_depth(tree->parent);
return (size + 1);
}
else
... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAX_LEN 10
typedef struct treeNode
{
char club[MAX_LEN];
int point;
struct treeNode *left, *right;
} treeNode;
treeNode *search(char club[], treeNode *root)
{
if (root == NULL)
return NULL;
else if (strcmp(root->club, club)... |
C | #include <stdio.h>
#include <string.h>
#include "sfpr_queue.h"
#include "sfpr_string.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
*\file sfpr_queue.c
*\brief SFPRqueue ģ
*\author bijing
*\version 0.1.0
*\date 2012-02-06
*/
struct sfpr_queue_node_s{
unsigned long flag;
void *data; /**<... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
char str[12];
int used[999] = {};
int check[5] = {};
int oks[] = {123, 999, 114, 514, 99};
int main() {
for (size_t k = 0; k < 1000000; k++) {
srand(k);
for (int i = 0; i < 1000; i++) used[i] = 0;
for (int i = 0; i < 5; i++) check[i] = 0;
for (i... |
C | /* ---------------------------------------------------------------------------
** sqlite3-bind: SQLite C API - Parameter binding helper for SQLite.
** ---------------------------------------------------------------------------
** Copyright (c) 2016 by Payton Bissell, payton.bissell@gmail.com
** --------------------... |
C | //
#include "probe.h"
#include "ppoint.h"
#include <stdio.h>
//
//void probe_for_ppoint(uberprobe_t *probe, ppoint_t *ppoint) {
// probe->probe = ppoint;
// probe->start = (size_t (*)(void *)) ppoint_start;
// probe->stop = (size_t (*)(void *, size_t)) ppoint_stop;
//}
typedef struct {
ppoint_t *point;
siz... |
C | #include <stdio.h>
#include <stdlib.h>
#include "Funciones Matematicas.h"
#include "Funcion pedir numero.h"
int main(){
int opcion;
char seguir='s';
float numeroA;
float numeroB;
float suma;
float resta;
float division;
float producto;
int factorialA;
int factorialB;
int flagDivision=0;
int flagNumeroA=0;
int flagNum... |
C | #include "../includes/fractol.h"
void draw_pixel(int x, int y, t_windows *window, int color)
{
int pixel;
int hex;
hex = color;
if(window && x >= 0 && y >= 0 && x < LONGUEUR && y < LARGEUR)
{
pixel = (x * 4) + (4 * LONGUEUR * y);
window->img_str[pixel] = (hex / 64) + 10;
window->img_str[pixel + 1] = (hex /... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
int main()
{
char ch1 = 'g';
char ch2 = 's';
char *ptr;
printf("Char 1 is %c\n", ch1);
printf("Char 2 is %c\n", ch2);
printf("Address of Char 1 is %p\n", &ch1);
printf("Address of Char 2 is %p\n", &ch2);
p... |
C | #include "vuaes.h"
//#include "vumacro.h"
#include "reg.h"
#include "auth_aes.h"
//#define AES_MODE_START 0x04 // start data encrypt/decrypt
#define AES_MODE_KEYEXPAND 0x10 // start key expanding
#define AES_MODE_KEY_INS 0x02 // key inserted
#define AES_MODE_DATA_INS 0x00 // data inserted
#define AES_SIZE_... |
C | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define max 5
void disp(int ps[][max+2],int size){
for(int i=0;i<pow(2,size);i++){
printf("\n");
for(int j=0;j<=ps[i][0]+1;j++)
printf("%d\t",ps[i][j]);
}
}
void genpowset(int *set,int size,int ps[][max+2]){
int powsetsize=pow(2,size);
for(int i=0;i<pow... |
C | #include<stdio.h>
#include<malloc.h>
#include<stdlib.h>
typedef struct node
{
int data;
struct node* next;
}NODE;
typedef struct list
{
NODE* head;
NODE* last;
}LIST;
//Function prototyping
int init(LIST* L);
NODE* create_node(int value);
int is_empty(LIST L);
int append(LIST* L,int value);
void display(LIST L)... |
C | #include "Button.h"
#include "DIO.h"
void Button_Initialize(unsigned char portName, unsigned char pinNumber)
{
// Set the direction of the given pin in the given port (direction 0 = input)
DIO_vsetPINDir(portName, pinNumber, 0);
}
unsigned char Button_Read(unsigned char portName, unsigned char pinNumber)
{
unsigne... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define EPLISON 1.0e-20
#define N_ALPH 256 /* num. of alphabets (EOF is not counted.) */
#define N_SYM (N_ALPH+1) /* num. of all symbol codes including "End-Of-File" code */
/* 8bit 256 alphabets + 1 EOF */
#define N_MAX_... |
C | #include <stdio.h>
int main()
{
int cm = 0;
scanf("%d", &cm);
int foot = cm / 30.48;
int inch = (cm / 30.48 - foot) * 12;
printf("%d %d\n", foot, inch);
return 0;
}
|
C | #include "common.h"
#include "linkedlist.h"
#include "thread_pool.h"
List db = {
.name = "db",
.head = NULL,
.tail = NULL,
.count = 0,
.lock = PTHREAD_RWLOCK_INITIALIZER
};
// Thread pool
pthread_t thread_pool[SERVER_BACKLOG];
// Server
int server_init(short port, int backlog);
int ser... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include "gpio.h"
#include "button.h"
#define NUM_OF_BUTTONS_LIMIT 9 // This is a hack - get this from GPIO?
typedef struct _m_tsData
{
bool bPressed;
uint8_t u8Handle;
void (*pvCallback)(void);
} m_tsData;
static m_tsData m_... |
C | #include "hashtable.h"
#include <stdlib.h>
#include <assert.h>
/*
A very simple hash function
*/
int ht_hash(hashtable ht, int id) {
return id % ht->num_buckets;
}
hashtable ht_create(int size_hint)
{
int num_buckets = size_hint;
hashtable ht = (hashtable) malloc(sizeof(ht_table_instance));
assert(ht);
... |
C | #include<stdio.h>
int N1,res;
char S;
int main()
{//inico
do{
printf("Programa que te dice si el numero es par o impar\n\n ");
printf("Ingrese su numero:");
scanf("%d",&N1);
res=N1 % 2;
if(res==0)
{
printf("Felicidades es un numero par\n\n");
}
else
{
printf("Felicidades es un numero impar\n\n")... |
C | // Done by - Akhil Raymond George
/*
BANKING SYSTEM PROGRAM WITH PERSISTENCE
BINARY FILE - data.dat used to store user informations
[Program uses structure, functions,file handling]
ADMIN password 123
*/
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<... |
C | /* Copyrighted Pixar 1989 */
/* From the RenderMan Companion p. 25 */
/* NOTE: The main() function has been removed and moved to colormain.c */
/* Listing 2.3 Control over viewer and color */
#include <ri.h>
#include <stdio.h>
#define L -.5 /* For x: left side */
#define R .5 /* For x: right side ... |
C | /*
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#pragma once
#include <sdkconfig.h>
#inclu... |
C | /*
* CSI030-2018-01 - Programao de Computadores I
* Nome: Renan Saldanha Linhares
* Matricula: 18.1.5908
* Curso: Engenharia de Computao
* Exercico: Atividade prtica 1, exercicio 03
*/
/* Bibilotecas*/
#include <stdio.h>
#include <locale.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include... |
C | #include<stdio.h>
#include<math.h>
int main()
{
int num,i;
i=1;
printf("Enter any Number:");
scanf("%d", &num);
printf("Multiplication table of %d= ", num);
while(i <= 10)
{
printf(" %d x %d = %d", num, i, num * i);
i++;
}
return 0;
} |
C | #include <sys/time.h>
int main(){
struct timeval tv;
struct timezone tz;
gettimeofday(&tv, &tz);
printf("%d, %d\n",tv.tv_sec, tv.tv_usec);
}
|
C | /*
Author Name :-Shashank Pandora
Organisation :-Emertxe Information Technologies (p) Ltd.
Date :-8 Mar 2020
Description :-Write a program to generate fibbonacci numbers.
Input :-A positive integer say 'N'.
*/
#include<stdio.h>
int main()
{
... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
int main(){
int s = socket(AF_INET, SOCK_STREAM, 0);
if(s == -1){
perror("socket failed");
exit(2);
}
struct sockaddr_in addr = {
.sin_addr.s_addr = INADDR_AN... |
C | #include<stdio.h>
#include<stdlib.h>
struct Node {
int data;
struct Node * next;
};
void printNode(struct Node *a){
while( a != NULL)
{
printf("Elements in Nodes are %d \n", a->data);
a = a->next;
}
}
struct Node * GetnewNode(int data){
struct Nod... |
C | /* pf.c */
/* Add by Wuxf 20181202 First version */
#include "pf.h"
#include "array.h"
#include <semaphore.h>
#define MAX_CV_NUM 20
#define MAX_MUTE_NUM 40
#define MAX_SEMA_NUM 20
typedef struct condition_info{
UINT32 state;
pthread_cond_t c;
pthread_mutex_t *m;
}CV_INFO;
typedef struct mute_info{
... |
C | struct point {
int x, y;
};
struct rectangle {
struct point upper_left, lower_right;
};
struct point center(struct rectangle);
int main(void) {
return 0;
}
struct point center(const struct rectangle r) {
struct point p;
p.x = r.upper_left.x + ((r.lower_right.x - r.upper_left.x) / 2);
p.y = ... |
C | #include "filelogger.h"
static void _write(File_Logger *this_logger, const char *msg);
File_Logger *CreateFileLogger(int level)
{
File_Logger *logger;
logger = (File_Logger *)malloc(sizeof(File_Logger));
if (logger == NULL)
{
return NULL;
}
memset(logger, 0, sizeof(File_Logger));
d... |
C | #include<stdio.h>
int main(void) {
int num, i, a, b,sum[1000];
scanf("%d", &num);
for (i = 0; i <num; i++) {
do {
scanf("%d %d", &a, &b);
} while (a < 0 || a>10 || b < 0 || b>10);
sum[i] = a + b;
}
for (i = 0; i < num; i++) {
printf("Case #%d: %d\n", i + 1, sum[i]);
}
return 0;
} |
C | /*
* Copyright (c) 1992, 1993 by the University of Southern California
*
* For copying and distribution information, please see the file
* <usc-license.h>.
*
* Written by bcn 1991 as part of rdgram.c in Prospero distribution
* Modified by bcn 1/93 modularized and incorporated into new ardp library
*... |
C | #include "holberton.h"
/**
* print_square - prints areas.
* @size: specification for the area size.
* Return: print a line.
*/
void print_square(int size)
{
int i;
int s;
if (size > 0) /* \ is 92, space is 32 */
{
for (i = 1; i <= size; i++)
{
for (s = 1; s <= size; s++)
_putchar(35);
_putchar('\n');
}
}
else
{
_... |
C | #include <stdlib.h>
#include <string.h>
#include <Windows.h>
#ifdef UNICODE
// Convert a null-terminated Wide Character string to a dynamically allocated UTF8 string
LPSTR UTF8_Encode_Dyn( LPCWSTR inStr )
{
LPSTR outStr;
int outSize;
outSize = WideCharToMultiByte(CP_UTF8, 0, inStr, -1, NULL, 0, NULL, NULL);
... |
C | #include "main.h"
/********************************/
int main()
{
while(1)
{
/* input data */
input_handler(input_data);
}
return 0;
}/********************************/
/* read input string */
void input_handler(char *str)
{
fflush( stdout );
scanf(" %s", str);
if... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ray_tracer_utils.c :+: :+: :+: ... |
C | /*
Example for Temp_Hum_9 Click
Date : Nov 2018.
Author : Aleksandar Paunovic
Test configuration PIC :
MCU : P18F87K22
Dev. Board : EasyPIC PRO v7
PIC Compiler ver : v7.2.0.0
---
Description :
The application is composed of three sections :
- System Initia... |
C | #include "apue.h"
#include <ctype.h>
int
main(void)
{
int c;
char str[5] = {'\0', '\0', '\0', '\0', '\0'};
str[4] = '\0';
int i = 0, j;
char tmp;
while ((c = getchar()) != EOF) {
if (islower(c))
c = toupper(c);
if (i >= 4){
tmp = str[0];
for (j = 0; j < 4; j++){
str[j] = str[j + 1];
}
i... |
C | /* $Id: alloc-1.c $ */
/** @file
* Allocate lots of memory, portable ANSI C code.
*/
/*
* Copyright (C) 2007-2017 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify i... |
C | /*
* Lib_Sensor.c
*
* Created on: Mar 11, 2015
* Author: cedric
*/
/*******************************************
* I N C L U D E *
********************************************/
//#include <stdlib.h>
//#include <string.h>
//
//#include "Lib_Sensor_DHT22.h"
//#include "bbb_mmio.h"
///****************... |
C | /*
* ascii.cpp
*
* Created on: 2011/05/03
* Author: mizu
*/
#include "kernel/ctype.h"
#include "kernel/libstr.h"
#include "kernel/basic.h"
int decto10(char* _str)
{
int cnt = 0;
int val = 0;
int magnifi = 1;
// 文字列のケタをカウントする
while(1)
{
if(_str[cnt] == 0x00) // NULLでカウンタ終了
break;
if(!((_str[cn... |
C | #include<stdio.h>
#define LEN 20
struct names{
char first[LEN];
char last[LEN];
};
struct guys{
struct names handles;
char jobs[LEN];
char favfood[LEN];
float income;
};
int main(void){
struct guys fellow[2]={
{{"aa","bb"},
"student",
"chips",
1000.00
},
{{"cc","dd"},
"teacher",
"patatos",... |
C | //zoulang7.c
inherit ROOM;
void create()
{
set("short", "");
set("long", @LONG
һȣȶŽķ羰ÿɫӼ
Ҳߵľ룬ɫߣۻɫĵש棬Ѿߡū
ȥæԼ飬һ㵡˻Ⱦܵ
ˣеӵϢңŮӵϢҡ
LONG
);
set("no_fight",1);
set("exits", ([
"west" : __DIR__"zoulang6",
"east" : __DIR__"huilang",
"north" : __DIR__"xxshi1",
"south" : __DIR__"xxshi2",
]));
setup();
}
int valid... |
C | #ifndef LFR_LEXER_H
#define LFR_LEXER_H
#include <stdbool.h>
/* #include <Data_Structures/darray.h> */
#include <ast/identifier.h>
#include <lexer/tokens.h>
struct inpfile;
struct lexer {
struct {darray(struct token);} tokens;
struct {darray(int);} indices;
unsigned int tok_index;
struct inpfile *... |
C | /*
int _flushbuf(c, stream)
char c;
FILE *stream;
If the standard I/O stream referenced by <stream>
is unbuffered, the character <c> is written
to the stream. Otherwise, the buffer associated
with the stream is flushed to the stream, the
... |
C | /*
** EPITECH PROJECT, 2018
** zappy
** File description:
** Connect_nbr command related
*/
#include <stdbool.h>
#include "game.h"
#include "entity.h"
bool respond_connect_nbr(game_t *game, player_t *player, char *argument)
{
list_t *tmp = player->entity.team->eggs->head;
int eggs = 0;
(void)game;
if (argument)... |
C | #include<stdio.h>
#include<stdlib.h>
int main()
{
FILE *fp;
char a[10];
printf("Enter Data:\n");
fp=fopen("BMSCE.txt","w");
fgets(a,6,stdin);
fclose(fp);
printf("\n Output\n");
fp = fopen("BMSCE.txt","r");
if(fp == NULL)
{
printf("Error");
exit(... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
//makro pre jednoduchsiu kontrolu navratovej hodnoty volania funkcie a vypis popisu chyby
#define CHECK( command ) if( ! (command) ) { fprintf(stderr, "Error: '%s' at %s line %d: %... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int utn_getString( char *msg,
char *msgError,
int minimo,
int maximo,
int reintentos,
char *resultado);
int utn_isValidNumber(char *str);
int utn_getNumber( ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#define beat(x) "\x01\x02\x00"[(x)]
#define unbeat(x) "\x02\x00\x01"[(x)]
#define max(x,y) ((x) > (y) ? (x) : (y))
#define min(x,y) ((x) < (y) ? (x) : (y))
#define throws 100000
#define algos_n 3
#define vals_n 10
#define choose(x,y,z,... |
C | #include <stdio.h>
void sum_array(int *A, int *B, int *C, int size)
{
for (int i = 0; i < size; i++)
*(C + i) = *(A + i) + *(B + i);
}
int main()
{
int n;
int ary[1000];
scanf("%d", &n);
for (int i = 0; i < n; i++)
{
scanf("%d", &ary[i]);
}
sum_array(ary, ary + 1, ary + 1, n - 1);
for (int i = 0; i < n; ... |
C | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<pthread.h>
#include <sys/time.h>
static inline double get_time()
{
struct timeval t;
gettimeofday(&t, NULL);
return t.tv_sec + t.tv_usec*1e-6;
}
#define B_SIZE 4096
#define N_REP 1000
#define REPETITIONS 50
int rep = N_REP;... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "fixedXor.h"
int score(char *s);
int main(){
char b[68];
printf("Enter a hex string: ");
fgets(b, 68, stdin);
char output[68]; int max=0;
for(int i=48; i<127; i++){
printf("%s \n", other_hexor(i, b));
if(score(other_hexor(i, b))>max){
max... |
C | #include "setsid.h"
int main()
{
if(fork() != 0)
printf("exit success\n");
if(setsid() == -1)
printf("setsid\n");
printf("PID=%ld, PGID = %ld, SID = %ld\n", (long)getpid(),(long)getpgrp(),(long)getsid(0));
if(open("/dev/tty", O_RDWR) == -1)
printf("open /dev/tty\n");
}
|
C | /** \file
* \ingroup hqbits
*
* $HopeName: HQNc-standard!export:hqbitvector.h(EBDSDK_P.1) $
*
* Copyright (C) 2008-2014 Global Graphics Software Ltd. All rights reserved.
* This source code contains the confidential and trade secret information of
* Global Graphics Software Ltd. It may not be used, copied or dis... |
C | /* Ofront+ 0.9 -xtspkae */
#include "SYSTEM.h"
#include "Platform.h"
static CHAR Console_line[128];
static INTEGER Console_pos;
export void Console_Bool (BOOLEAN b);
export void Console_Char (CHAR ch);
export void Console_Flush (void);
export void Console_Hex (INTEGER i);
export void Console_Int (INTEGER i, INTEGER... |
C | #define _GNU_SOURCE
#include <stdio.h> // perror
#include <stdlib.h> // exit, EXIT_*
#include <syscall.h> // SYS_pivot_root
#include <unistd.h> // syscall, chdir, execv
int
main(int argc, char *argv[])
{
argc = argc;
if (syscall(SYS_pivot_root, "rootfs-target", "rootfs-target/.oldroot"))
{
perror("pivot roo... |
C | //Includes
#include<sys/socket.h>
#include<netdb.h>
#include<ifaddrs.h>
#include<stdio.h>
#include<stdlib.h>
int main() {
//declare pointer addresses
struct ifaddrs *addresses;
//getifaddrs allocates the memory for addresses, and gives a linked list of addresses to addresses
//Also checks if it works
if (getifad... |
C | /*
* COMP20007 Design of Algorithms
* Semester 1 2016
*
* David Murges
* 657384
*
* This module provides all the topological sorting functionality.
*
*/
#ifndef TOPOSORT_H
#define TOPOSORT_H
#include "graph.h"
/* Returns a list of topologically sorted vertices using the DFS method */
extern List dfs_sort(Grap... |
C | #include <stdio.h>
//#include<Fraction.h>
struct Fraction
{
int numerator;
int denominator;
};
void enter(struct Fraction*far);
void simplify(struct Fraction*);
void display(const struct Fraction*);
int main(void)
{
struct Fraction f; //abc
//int num;
printf("Fraction Simplifier\n");
printf("================... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.