language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
int main(){
char a = 'a', b = 'b', c, *p, *q, *r;
const int f = -10;
int * s = &f; // value pointer value can't be changed
// int * const s = &f address that pointer points to cant changed
// const int *const a value and address can't be changed
// s = &a;
//f = 11;
*s = -1000;
printf(... |
C | #include <stdio.h>
#define IN 1
#define OUT 0
void drawBar (len) {
for (int i = 0; i < len; i++) {
putchar('#');
}
putchar('\n');
}
int main(void)
{
int c, whitespace;
int state = OUT;
int len = 0;
while ((c = getchar()) != EOF) {
whitespace = (c == '\t' || c == '\n' || c == ' ');
if (whi... |
C | #include <stdint.h>
#include "reg.h"
/**
*
* LED init
*
*/
void led_init(unsigned int led)
{
SET_BIT(RCC_BASE + RCC_AHB1ENR_OFFSET, GPIO_EN_BIT(GPIO_PORTD));
//MODER led pin = 01 => General purpose output mode
CLEAR_BIT(GPIO_BASE(GPIO_PORTD) + GPIOx_MODER_OFFSET, MODERy_1_BIT(led));
SET_BIT(GP... |
C | #include<stdio.h>
int main(){
int T = 0;
int n = 0;
int i = 1;
char *D[30];
scanf("%d", &T);
for(i=1;i<=T;i++){
scanf("%d", &n);
if( n%2 == 0)
D[i-1] = "even";
else
D[i-1] = "odd";
}
for(i=1;i<=T;i++)
printf("%s\n", D[i-1]);
}
|
C | #include "holberton.h"
/**
* reset_to_98 - a function that takes a *ip as parameter an reset it with 98.
* @n: Parameters.
*
* Return: Void.
*/
void reset_to_98(int *n)
{
*n = 98;
}
|
C | /* Garcia, Matthew
Lab 2 poem
*/
#include <stdio.h>
int main()
{
char input;
while( input = getchar() )
{
if(input == EOF)
{
break;
}
else if(input == 32)
{
printf("\n");
}
else if(input >=33 && input <= 64)
{
printf("");
}
else if(input >= 9 && input <= 11)
{
printf("");
}... |
C | /*
FILE : breathingLED.c
PROJECT : Stm32f3 Discovery Board/Linux
PROGRAMMER : Rohit Bhardwaj
DESCRIPTION : The code is for STM32F303 board, it configure, and write to the Timers in PWM mode. Moreover,Commands present,
and work to implement a 'Breathing' LED that auto... |
C | /* 实现 int sqrt(int x) 函数。
计算并返回 x 的平方根,其中 x 是非负整数。
由于返回的类型是整数,结果只保留整数的部分,小数部分将被舍去。 */
#include <stdio.h>
int mySqrt(int x);
int main(void)
{
printf("%d\n", mySqrt(1213123323));
return 0;
}
int mySqrt(int x)
{
int result;
unsigned int t;
for (t = 1; t * t < x; t++)
continue;
if (t * t == x)
result = t;
els... |
C | /*=============================================================================
* Copyright (c) 2019, Miguel del Valle <m.e.delvallecamino@ieee.org>
* All rights reserved.
* License: bsd-3-clause (see LICENSE.txt)
* Date: 2019/08/23
* Version: rev0
*================================================================... |
C | //
// list.c
// threads
//
// Created by Adam on 5/9/18.
// Copyright © 2018 Adam. All rights reserved.
//
#include "list.h"
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#ifdef PTHREADS
#include <pthread.h>
#endif
struct node_t {
unsigned int key;
void * value;
node_handle next;
node_handle ... |
C | #include "binary_trees.h"
/**
* depth - measure the depth of a binary tree
* @node: root of the binary tree
*
* Return: integer depth of the tree
*/
int depth(const binary_tree_t *node)
{
int d = 0;
while (node != NULL)
{
d++;
node = node->left;
}
return (d);
}
/**
* is_perfect - check whether binary ... |
C | #include "libft2.h"
int ft_isalnum(int n)
{
return (ft_isalpha(n) || ft_isdigit(n));
}
|
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
void math_add( char *const data_string)
{
if(!data_string)
return;
char* data1 = NULL;
char* data2 = NULL;
char* start = data_string;
while(*start != '\0' )
{
if(*start == '=' && data1==NULL)
{
data1 = start+1;
start++;
continue;
}
if(... |
C | #include<stdio.h>
#include<stdlib.h>
struct node
{
int data;
struct node *next;
};
struct node *head;
struct node *temp;
void add (int x)
{
struct node *newnode;
newnode = (struct node *) malloc (sizeof (struct node));
newnode->next = NULL;
newnode->data = x;
if (head == NULL)
{
head = te... |
C | #define _CRT_SECURE_NO_WARNINGS
#include <assert.h>
#include <math.h>
#include <stddef.h>
#include <stdio.h>
#include "equation.h"
#include "helpfunction.h"
#define CONST 0.001
int linear_equation(double k, double b, double* x1) {
if (is_equal(fabs(k), 0) == 0) {
*x1 = -b / k;
return ... |
C | #include <math.h>
#include <pthread.h>
#include <signal.h>
#include <string.h>
#include <unistd.h>
#include "./utils.h"
struct image image;
void load_image(char *filename);
void save_image(char *filename);
void negate(int threads_no, void *(*start_routine)(void *));
void *start_routine_numbers(void *context);
void *... |
C | #include "usart3.h"
/*
* ʼIO 3
* bound:
*/
void usart3_init( u32 bound )
{
NVIC_InitTypeDef NVIC_InitStructure;
GPIO_InitTypeDef GPIO_InitStructure;
USART_InitTypeDef USART_InitStructure;
RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOB, ENABLE ); /* ʹGPIOBʱ */
RCC_APB1PeriphClock... |
C | #include <assert.h>
#include <per_support.h>
static void put(asn_per_outp_t *po, size_t length) {
fprintf(stderr, "put(%zd)\n", length);
do {
int need_eom = 123;
ssize_t may_write = uper_put_length(po, length, &need_eom);
fprintf(stderr, " put %zu\n", may_write);
assert(may_wri... |
C | #include <stdio.h>
int main(int argc, char *argv[])
{
int i = 0;
// go through each string in argv
// why am I skipping argv[0]?
for(i = 1; i < argc; i++) {
printf("arg %d: %s\n", i, argv[i]);
}
// let's make our own array of strings
char *states[] = {
"California... |
C | #include "ac_allocator.h"
#include <stdio.h>
void uppercase(char *s) {
while (*s) {
if (*s >= 'a' && *s <= 'z')
*s = *s - 'a' + 'A';
s++;
}
}
int main(int argc, char *argv[]) {
char **a = ac_split(NULL, ',', "alpha,beta,gamma");
char **b = ac_strdupa(a);
for (size_t i = 0; a[i] != NULL; i++) ... |
C | #include <stdio.h>
#define MARK 4
#define NUM 13
int zero(int*);
int main(){
int card[MARK][NUM];
char mark;
int num;
int roop;
int i;
int j;
zero(&card[0][0]);
scanf("%d", &roop);
for(i = 0;i < roop;i++){
scanf("%c", &mark);
if(mark == '\n'){
while(1){
scanf("%c", &mark);
if(ma... |
C | // 题目:输入二叉搜索树,将该二叉搜索树转换成一个排序的双向链表。要求不能创建任何新的节点,只能调整树中节点指针的指向。
struct BinaryTreeNode
{
int m_nValue;
BinaryTreeNode* m_pLeft;
BinaryTreeNode* m_pRight;
};
//按照中序遍历的顺序,当我们遍历转换到根结点(值为10的结点)时,它的左子树已经转换成一个排序的链表了,并且处在链表中的最后一个结点是当前值最大的结点。我们把值为8的结点和跟结点链接起来,此时链表中最后一个结点就是10了。接着我们去遍历转换右子树,并把根结点和右子树中最小的结点链接起来。... |
C | #include "led.h"
#include "delay.h"
#include "key.h"
#include "sys.h"
#include "beep.h"
/*主机启动后,再插入4G模块,以正确加载驱动;
单片机判断心跳信号,发现主机死机后,重启主机,再上电4G模块
*/
int main(void)
{
vu8 key=0;
u16 t =0;
u8 pre = 0;
delay_init(); //延时函数初始化
LED_Init(); //初始化与LED连接的硬件接口
BEEP_Init(); //初始化蜂鸣器端口
KEY_Init(); ... |
C | #include <stdio.h>
char *vc_strnstr(const char *big, const char *little, size_t len) {
const char *littleCounter = little;
int littleNum = 0;
while(little[littleNum] != '\0'){
littleNum++;
}
for(size_t i = 0; i < len; i++)
{
int num = 0;
if(big[i] == little[num])
{
int correct... |
C | /* This program estimates the value of log 2.5 using third order Newton Interpolation
polynomial from the given values of logx ( which here is fx[] values ) for 4 values
(points) of x i.e. x = 1,2,3,4 */
#include <stdio.h>
#include <conio.h>
float newdiv(int u, int l);
float multiple(int, float);
float x[4] = ... |
C | /******************************************************************************
All content 2017 Digipen Institute of Technology Singapore, all rights reserved
filename BuffsDebuffs.c
author Wong Zhihao
DP email zhihao.wong@digipen.edu
course RTIS
Brief Description:
Contains the functions of every powerup ... |
C | #ifndef _MATH_H_
#define _MATH_H_
#include "math_vector.h"
#include "math_matrix.h"
#define PI 3.141592654f
#define TWOPI 6.283185307f
#define IVVPI 0.318309886f
#define INV2PI 0.159154943f
#define PIDIV2 1.570796327f
#define PIDIV4 0.785398163f
inline float toRadians(float x) {
return x * PI / 180.0f;
}
inline... |
C | /**
* \file semaphores.h
* \author Christian Kruse, <cjk@wwwtech.de>
* \brief Wrappers around the sem* functions
*
* This module provides some wrapper functions for the semaphore
* functions provided by POSIX. These functions make the handling
* of semaphores much easier
*/
/* {{{ Initial headers */
/*
* $Las... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "hiredis/hiredis.h"
int main( int argc, char *argv[] ) {
redisReply *reply;
long int i;
char buffer[256];
char* keyString;
char* host;
char* password;
int port;
if (argc < 2) {
printf("Usage... |
C | //
// doubly_circular_linkedlist.c
// LinkedList
//
// Created by Seoksoon Jang on 2016. 11. 10..
// Copyright © 2016년 Seoksoon Jang. All rights reserved.
//
#include "doubly_circular_linkedlist.h"
void dcll_deleteNode(DCLLNode* node) {
if (node != NULL) {
free(node);
} else {
perror(... |
C | #include <netdb.h>
#include <netinet/in.h>
#include <stdio.h>
#include <strings.h>
#include <stdlib.h>
#include <unistd.h>
#include <getopt.h>
#include <arpa/inet.h>
#include <ctype.h>
#include <string.h>
#include <sys/socket.h>
#include <pthread.h>
#include <sys/stat.h>
#include <sys/sendfile.h>
#include <fcntl.h>
#in... |
C | // slot.c - code to handle/schedule slot controllers
// part of the robot.o robot process
// InMotion2 robot system software
// Copyright 2003-2013 Interactive Motion Technologies, Inc.
// Watertown, MA, USA
// http://www.interactive-motion.com
// All rights reserved
#include "rtl_inc.h"
#include "ruser.h"
#include ... |
C | //Bible
//How to pray?
//Book of John
//Learn C
//Calculus
//Teach yourself PHP
//
// One storage. Use pointer to just point to this storage.
#include <stdio.h>
int
main(void)
{
char *books[] = { "Bible", "Learn C", "How to pray?", "Calculus", "Book of John", "Teach yourself PHP" };
char **ChristianBooks... |
C | #include <stdio.h>
#include <math.h>
double delta(double a, double b, double c){
return (b*b) - 4*a*c;
}
int bhaskara(double a, double b, double c){
double x1, x2;
double d = delta(a, b, c);
if(d > 0){
x1 = (-b + sqrt(d))/(2*a);
x2=(-b - sqrt(d))/(2*a);
printf("%.2lf %.2lf\n", x1, x2);
}
... |
C | #include <stdio.h>
#include <string.h>
#define STUNUMBER 20
char stu_data_file[] = "E:\\GitHub\\C_Learn_Demo\\student.dat";
/* ---学生结构体--- */
typedef struct{
char name[20];
char stuno[20];
double height;
double weight;
double chinese;
double math;
double english;
} student;
/* ---学生成绩数据--- */
student StuDat[... |
C | #include<stdio.h>
int main()
{
double c;
scanf("%lf",&c);
printf("%.2f\n",1.8*c+32);
return 0;
}
|
C | /*
* Copyright (c) 2020 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or... |
C | #define uint unsigned int
struct node
{
struct node * rev;
struct node * fwd;
//only allow for int data
//TODO: use generics?
int value;
};
typedef struct node Node;
/* node operations */
void initNode (Node * p)
{
p->fwd = NULL;
p->value = 0xDEADBEEF;
p->rev = NULL;
}
void initNodeWithValue (Node *... |
C | #include<iostream>
using namespace std;
//Function to reverse the given array
void reverseArray(int a[],int n){
int l=0;
int r=n-1;
while(l<r){
int temp=a[l];
a[l]=a[r];
a[r]=temp;
l++;
r--;
}
}
//Function to print the elements of array
void printArray(int a[],i... |
C | #include "types.h"
#include "user.h"
#include "x86.h"
#define PGSIZE 4096
int
thread_create(void (*start_routine)(void*), void* arg)
{
void *stack = malloc(2 * PGSIZE);
if ((uint)stack % PGSIZE != 0) stack += PGSIZE - (uint)stack % PGSIZE;
return clone(start_routine, arg, stack);
}
int
thread_join(int pid)
{
... |
C | #include "header.h"
void edge(char* address)
{
FILE* inputFile = NULL;
inputFile = fopen(address, "rb");
fread(&bmpFile, sizeof(BITMAPFILEHEADER), 1, inputFile);
fread(&bmpInfo, sizeof(BITMAPINFOHEADER), 1, inputFile);
int width = bmpInfo.biWidth;
int height = bmpInfo.biHeight;
int size =... |
C | #include "bit-array.h"
#include "hamming-code.h"
#include "hamming_impl.h"
size_t hamming_decode(bits_t *dst, bits_t *src) {
size_t uncorrectable = 0;
bit a, b, c, d, x, y, z, p;
while (bitarray_size(src) >= 8) {
a = bitarray_next_front(src);
b = bitarray_next_front(src);
c = bitarray_next_front(src);
d = b... |
C | #include <stdarg.h>
#include <stdio.h>
#include "variadic_functions.h"
/**
* print_strings - prints strings followed by new line
* @separator: string between strings
* @n: number of strings passed to the function
*/
void print_strings(const char *separator, const unsigned int n, ...)
{
va_list vlist;
unsigned i... |
C | #include "header.h"
//================================================
// Name: countLessThan6Occurances
// Input: int
// Output: int
// Author: Ganesh Narayan Jaiwal
// Date: 4 Aug 2020
// Description: Count occurances of digits less that 6
//================================================
int countLessThan6Occuran... |
C | #include<stdio.h>
#include<math.h>
struct point
{
float x;
float y;
}p2,p1;
double distance(struct point p3,struct point p4)
{
return sqrt(pow((p3.x-p4.x),2)+pow((p3.y-p4.y),2));
}
int main()
{
double i;
printf("enter the x co-ordinate and y co-ordinate");
scanf("%f%f",&p1.x,&p1.y);
printf("enter the x c... |
C | /* Copyright (c) 2005 Russ Cox, MIT; see COPYRIGHT */
#include "taskimpl.h"
#include <fcntl.h>
#include <stdio.h>
Task *taskrunning;
Context taskschedcontext;
static void taskstart(uint y, uint x)
{
Task *t;
ulong z;
z = x<<16; /* hide undefined 32-bit shift from 32-bit compilers */
z <<= 16;
z |= y;
t = (Ta... |
C | #include <stdio.h>
int fib(int n) {
//printf("%s\n", __FUNCTION__);
if(n < 1) return 0;
if( 1 == n || 2 == n) return 1;
return fib(n - 1) + fib(n - 2);
}
int fib_loop1(int n) {
int f1, f2;
f1 = f2 = 1;
for (int i = 3; i <= n ; ++i) {
f2 = f2 + f1;
f1 = f2 - f1; // Get old value of f2.
//printf(... |
C | /*******************************************************************************
// main.c
*******************************************************************************/
/*******************************************************************************
// Includes
******************************************************... |
C | //
// fileProcessingFuntion.c
// newC
//
// Created by yeawonKim on 2021/09/07.
// Copyright © 2021 yeawonKim. All rights reserved.
//
#include <stdio.h>
int file_copy(char *oldname, char *newname);
void main() {
char source[80], destination[80];
printf("\n Enter source file : ");
gets(source);
pri... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line.c :+: :+: :+: ... |
C | #include <stdio.h>
#include "cfile.h"
int sum(int a,int b)
{
int c=a+b;
printf(" helllpppkfvjo\n");
printf("%d %d",a,b);
printf("sum = %d",c);
return 0;
}
|
C | /*
* File: newmain3.c
* Author: RENAN CARDOSO
*
* Created on 10 de Junho de 2019, 23:02
*/
#define _XTAL_FREQ 4000000
#include <xc.h>
void decrease_10m(void);
void init_count(void);
void alarm_activate(void);
void delay_1min(void);
void decrement_disp(void);
int msb = 6; // Bit mais significativo do contador [6... |
C | #include "my_dll.h"
#include <stdio.h>
#include <stdlib.h>
// Creates a DLL
// Returns a pointer to a newly created DLL.
// The DLL should be initialized with data on the heap.
// (Think about what the means in terms of memory allocation)
// The DLLs fields should also be initialized to default values.
dll_t* create_d... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
void quick_sort(int tab[],int deb,int fin)
{
const int pivot = tab[deb];
int pos=deb;
int i;
if (deb>=fin)
return;
for (i=deb; i<fin ; i++)
{
if (tab[i]<pivot)
{
tab[pos]=tab[i];
pos++;
tab[i]=tab[pos];
tab[pos]=pivot;
}
}
tri_tab_... |
C | //Escribir un programa que consulte y muestre en pantalla el estado del cerrojo sobre un fichero usando lockf(3). El programa mostrará el estado del cerrojo (bloqueado o desbloqueado). Además:
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int lockf(int f... |
C | /*
** EPITECH PROJECT, 2018
** n4s
** File description:
** ia.c
*/
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include "get_info.h"
#include "commands.h"
void init_info(info_t *info)
{
info->n_left = 0;
info->left = 0;
info->n_right = 0;
info->right = 0;
info->middle = 0;
}
int check_ret(int ret... |
C | #include "monty.h"
/**
* execute - executes function
* @opcode: The opcode
* @line_number: The line number the opcode is found
*/
void execute(char *opcode, unsigned int line_number)
{
unsigned int i;
instruction_t opcodes[] = {
{"pall", pall},
{"pint", pint},
{"nop", nop},
{"pop", pop},
{"swap", swap}... |
C | /*
* Copyright(C) 2007 Neuros Technology International LLC.
* <www.neurostechnology.com>
*
*
* 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, version 2 of the License.
... |
C | #include "stdio.h"
#include "string.h"
#include "stdlib.h"
int main (int argc, char** argv) {
char c = 0;
char dBug = 0;
char enc = 0;
char* key;
char* inFileName;
char* outFileName;
size_t size;
int counter = 0;
FILE* in = stdin;
FILE* out = stdout;
for (int i = 1; i... |
C | #include <stdio.h>
#include <stdlib.h>
#define STR_LEN 80
// 函数原型
int count_spaces(const char *);
int main(void)
{
char str[STR_LEN + 1] =
"fdsa drf tewq gsdafsd";
printf("%d\n", count_spaces(str));
return 0;
}
// 函数定义
// const常量,只读参数
int count_spaces(const char *s)
{
int count = 0;
/... |
C | #include<stdio.h>
#include<stdlib.h>
#define Max_String 100
#define Max_Lines 10
//Searches the string for a specified value and returns the position of where it was found
int Find(char *s, char *value){
if(! *value)
return -1;
int index = 0;
while(*s && *s != *value)
s++, index++;
while(*s &&... |
C | # include <stdio.h>
# include <stdlib.h>
# include <stdarg.h>
# include <errno.h>
# include <string.h>
# include <math.h>
enum{
LINESZ = 256,
INIT = 2,
GROW = 2,
NSAMP = 5000
};
typedef struct mat {
int nrows;
int ncols;
int nelem;
int max;
double *elem;
} matrix;
char *argv0;
char *filename;
int lineno;
d... |
C | #include <stdio.h>
#include <string.h>
#include <librdkafka/rdkafka.h>
int main(int argc, char **argv) {
rd_kafka_conf_t *conf;
char buf[512];
size_t sz = sizeof(buf);
rd_kafka_conf_res_t res;
static const char *expected_features = "ssl,sasl_gssapi,lz4,zstd";
char errstr... |
C | /*
** my_showa_wordtab.c for my_show_wordtab in /home/antonin.rapini/CPool_Day08/task03
**
** Made by Antonin Rapini
** Login <antonin.rapini@epitech.net>
**
** Started on Wed Oct 12 21:18:48 2016 Antonin Rapini
** Last update Wed Feb 15 01:41:18 2017 Antonin Rapini
*/
#include "utils.h"
void my_show_wordtab(cha... |
C | #include "lib.h"
#include <errno.h>
#include <stdint.h>
#include "sys9.h"
char end[];
static char *bloc = { end };
extern int _BRK_(void*);
char *
brk(char *p)
{
unsigned long n;
n = (uintptr_t)p;
n += 3;
n &= ~3;
if(_BRK_((void*)n) < 0){
errno = ENOMEM;
return (char *)-1;
}
bloc = (char *)n;
return 0;
}... |
C | #include<stdio.h>
//Question 2-3: Write the function htoi(s), which converts a string of
//hexadecimal digits (including an optional 0x or 0X) into its equivalent
//integer value. The allowable digits are 0 through9, a through f, and A
//through F.
//
//
int htoi(char s[]);
int main(void){
char s[10] = "ABCD";
in... |
C | /*
** EPITECH PROJECT, 2017
** my_printf
** File description:
** printf
*/
#include <stdlib.h>
#include <stdarg.h>
#include "my.h"
#include "display_f.h"
int contains(char const *str, char c)
{
int count = 0;
for (int i = 0; str[i]; i++) {
if (str[i] == c)
count++;
}
return (count);
}
char *flags_manager(c... |
C | #include<stdio.h>
#include<stdlib.h>
struct node
{
char data;
struct node* left;
struct node* right;
};
int search(char arr[], int strt, int end, char value);
struct node* newNode(char data);
struct node* buildTree(char in[], char pre[], int inStrt, int inEnd)
{
static int preIndex = 0;
if(inStrt > i... |
C | /*
** EPITECH PROJECT, 2020
** NWP_myteams_2019
** File description:
** parse_command
*/
#include "server.h"
void parse_command_f5(lklist_char_t *nq, lklist_char_t *str,
lklist_str_t *array, lklist_char_t *topush)
{
bool check = false;
for (size_t i = 0; i != nq->size(nq); i += 1) {
if (nq->at(nq, i)... |
C | #include "holberton.h"
#include <stdio.h>
#include <stdlib.h>
/**
* *create_array - function to create an array of char pre initialised
* @size: size of the array
* @c: character to initialise the array with
* Return: pointer to new array
*/
char *create_array(unsigned int size, char c)
{
unsigned int i = 0;
c... |
C | #ifndef __EVENT_CTL_H__
#define __EVENT_CTL_H__
#include <time.h>
#include <stdint.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/epoll.h>
#ifndef _TIME_H
#define _TIME_H
struct timespec
{
__time_t tv_sec; /* Seconds. */
long int tv_nsec; /* Nanoseconds. */
};
str... |
C | #include <stdio.h>
/*
* Função que recebe n, que é a quantidade de repetições
* e retorna a forma recursiva com a quantidade de repetições em n
*/
int fibbo (int n) {
if(n <= 2){
return 1;
} else {
return fibbo(n - 1) + fibbo(n - 2);
}
}
void main (void) {
int a = fibbo(8);
printf("%d\... |
C | #include <stdlib.h>
#include <string.h>
#include "tree.h"
#include <stdio.h>
int btree_depth(BTree *tree)
{
int lD;
int rD;
lD = 0;
rD = 0;
if(tree)
{
lD = btree_depth(tree->right);
rD= btree_depth(tree->left);
if(lD>rD)
return lD+1;
else
return rD+1;
}
else
return... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <string.h>
#include "IntSet.h"
#include "nfa.h"
NFA newNFA(int numstates){
//allocate NFA
NFA nfa = (NFA)malloc(sizeof(struct nfa));
//initialize NFA
nfa->CURR_STATES = NULL;
nfa->NUM_STATES = numstate... |
C | #include <stdio.h>
#include <stdlib.h>
#include "master.h"
void validate_arguments(int argc, char **argv) {
if (argc != 1 && argc != 2) {
fprintf(stderr, "Usage: %s [port]\n", argv[0]);
exit(EXIT_FAILURE);
}
if (argc == 2 && !is_port_number_valid(argv[1])) {
fprintf(stderr, "Invali... |
C | #include "console.h"
#include "os/kernel.h"
#include "string.h"
#include "vargs.h"
// vsprintf 定义在vsprintf.c中
extern int vsprintf(char * buf, const char * fmt, va_list args);
void printk(const char *format, ...)
{
// 避免频繁创建临时变量,内核的栈很宝贵
static char buff[1024];
va_list args;
int i;
va_start(args, format);
i = vs... |
C | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
char *load_memory_init(size_t init_elems)
{
char *load_ptr;
if ( (load_ptr = (char *) malloc(init_elems * sizeof(char) ) ) ) {
return load_ptr;
free(load_ptr);
} else {
return NULL;
exit(1);
}
}
int program_weight_transform(size_t init_program_... |
C | #include <stdio.h>
#include <stdlib.h>
void mergeSort(int *, int);
void mergePass(int *, int *, int, int);
void merge(int *, int *, int, int, int);
void input_data(int *, int);
void output_data(int *, int);
int main()
{
int *a = NULL;
int i, n;
printf("Input the length of array:\n");
scanf("%d", &n);
a = (int *... |
C | #include <stddef.h>
#include <stdio.h>
#include <string.h>
#include "lua.h"
#include "lauxlib.h"
#ifndef CPRINT_STREAM
# define CPRINT_STREAM stdout
#endif
#ifndef LUA_QL
# define LUA_QL(s) "'" s "'"
#endif
#define w( s, n ) (fwrite( (s), sizeof( char ), (n), CPRINT_STREAM ))
#define tab() (putc( '\t', CPRINT_... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ld.c :+: :+: :+: ... |
C | #include "Auth.h"
CLIENT *cl;
int main(int argc, char *argv[])
{
int *result;
int selection;
char choice;
if (argc < 2)
{
printf("USAGE: client <SERVER IP>");
return 1;
}
cl = clnt_create(argv[1], PRINTER, PRINTER_V1, "tcp");
if (cl == NULL) {
printf("error: could not connect to... |
C | #include <stdio.h>
int main (int argc, char*argv[]) {
// primeira variavel
char a;
a = 'X';
// variavel que armazena um ENDERECO de char
// (char*)
char* p;
// armazeno o endereco da primeira variavel
p = &a;
printf("Endereco inicial: %p\n", p);
printf("Conteudo no endereco: %c\n", *p);
int x = 1;
... |
C | #include "matrix_test.h"
#include <stdbool.h>
#include <stdio.h>
#include <assert.h>
int main() {
clock_t start, end;
matrix_t first_input_matrix, second_input_matrix, output_matrix;
/** CAUTION: mult function calls "create and fill" function for out matrix,
* so do not send a fullly created and filled matrix ... |
C | #include <smartcard_utils_interface/serialize_util.h>
/********************************************************************/
/* Implementation using JSON and Base64/HEX */
/********************************************************************/
#include <smartcard_common/global_vars.h>
#include <... |
C | #include <stdio.h>
void ifAndElse(int n) {
if (n < 10) {
printf("Oh no!");
}
if (n > 10) {
printf("Hey!");
} else {
printf("Hey!");
}
}
void ifAndElse2(int n) {
if (n < 10) {
printf("Oh no!");
}
if (n > 10) {
printf("Hey!");
} else {
printf("Hey!");
}
}
int main() {
ifAn... |
C |
#include <stdio.h>
#include <unistd.h>
#include "threadPool.h"
#include "osqueue.h"
void stupid_task(void *a) {
printf("\n\t1 + 1 = 3\n");
}
void test_thread_pool_sanity(int numThreads) {
ThreadPool *tp = tpCreate(numThreads);
int i;
for (i = 0; i < numThreads; ++i) {
tpInsertTask(tp, stup... |
C | #include<stdio.h>
int main()
{
float fahr,celsius; //declaration
int lower, upper,step;
lower = 0; /*lower limit */
upper = 300; /* upper limit */
step = 20; /* step size */
fahr = lower;
while(fahr <= upper){
celsius = (5.0/9.0) * (fahr-32.0);
printf("%3.0f\t%6.1f\n",fahr,celsius);
fah... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* tester_read.c :+: :+: :+: ... |
C | /* $Id: tekpot.c,v 1.3 2010/01/31 08:30:19 demon Exp $ */
/*
* Copyright (c) 2009 Dimitri Sokolyuk <demon@dim13.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appea... |
C |
int main(void)
{
int num[1000]; // ????
int n; // ??2?n??
memset(num, 0, sizeof(num));
num[0] = 1;
cin >> n;
for(int i = 1; i <= n; i++)
{
for(int j = 0; j < 1000; j++)
{
num[j] *= 2; // ????2
}
for(int j = 0; j < 1000; j++) // ??
{
if(num[j] >= 10)
{
num[j] -= 10;
... |
C | #include<stdio.h>
#include<conio.h>
void buscar(char mat[4][20], char npesquisa[20]);
main(){
char mat[4][20], npesquisa[20];
int linha=0;
for(linha=0; linha<=3; linha++){
printf("Digite o nome[%d] =",linha);
gets(mat[linha]);
}
printf("Digite um nome para pesquisar: ");
gets(npesquisa);... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdarg.h>
#include <string.h>
#include "coreServ.h"
#include "../linkedlist.h"
#include "../utils.h"
#include "../parser.h"
#include "../commands.h"
char* gameManager(int* idGame, int ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct Student{
char name[50];
int score[5];
double average, total;
};
/*
int main()
{
int i;
FILE *fp;
struct Student *p;
int n;
printf("student num : ");
scanf("%d",&n);
p = (struct student*)malloc(n * sizeof(struc... |
C | /*#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <string.h>
#include <arpa/inet.h>
*/
#include "../include/my.h"
int my_strlen(char const *str)
{
int n = 0;
while (*(str + n))
++n;
return (n);
}
void my_putchar(c... |
C | #include<stdio.h>
#include<sys/types.h>
#include<sys/wait.h>
#include<unistd.h>
#include<fcntl.h>
#include<time.h>
#include<ctype.h>
#include<getopt.h>
#include<stdlib.h>
#include<sys/mman.h>
#include"vector.h"
#define MAX_SIZE 65100
int get_error(int argc, char* argv[]){
if(argc<4){
printf("The usage: \
... |
C | /*
filename - main.c
version - 1.0
description - ⺻ Լ
--------------------------------------------------------------------------------
first created - 2020.02.10
writer - Hugo MG Sung.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Լ
int main(void)
{
int arr1[3] = { 1,2,3 };
dou... |
C | #include <ajp.h>
#include <sock.h>
#include <notify.h>
#include <stdint.h>
#include <string.h>
struct AJP13_T
{
int sent;
int recv;
uint8_t ping[5];
uint8_t pong[5];
};
size_t AJP13SIZE = sizeof(struct AJP13_T);
AJP13
new_ajp13()
{
AJP13 this;
this = calloc(AJP13SIZE, 1);
re... |
C | /* i++ ڼ */
/* ++i ȼ */
/* i-- ڼ */
/* --i ȼ */
/* ǰȼӼ iǰ */
#include <stdio.h>
void main()
{
int i = 8;
printf("%d\n", ++i); /* i=9*/
printf("%d\n", --i); /* i=9Ļϼ1 8*/
printf("%d\n", i++); /* i=8Ļȴӡ Ϊ9*/
printf("%d\n", i--); /* i=9Ļȴӡ Ϊ8*/
printf("%d\n", -i--); /* i=8ĻϴӡΪ-8 8ڼ1Ϊ7 ... |
C | /* ================= printOneQueue =================
This function prints the data in one queue,
ten entries to a line.
Pre Queue has been filled
Post Data deleted and printed. Queue is empty
*/
void printOneQueue (QUEUE* pQueue)
{
// Local Definitions
int lineCount;
int* dataPtr;
// Statements
li... |
C | #include "kernel/types.h"
#include "kernel/stat.h"
#include "kernel/fcntl.h"
#include "user/user.h"
#define PGSIZE 4096
int main(void){
fprintf(1,"sbrk - allocating memory in PGSIZE\n");
uint64 a,b,c;
a = (uint64)sbrk(PGSIZE);
b = (uint64)sbrk(PGSIZE);
c = (uint64)sbrk(PGSIZE);
*(int*)a ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.