language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /*
* Copyright (C) 2016 Thomas Costigliola
*/
#include <stdlib.h>
#include <stdbool.h>
#include "threadpool.h"
struct threadpool * threadpool_new(int thread_count, int queue_size) {
if(thread_count < 1 || queue_size < 1 || queue_size < thread_count) {
/* Do not allow empty pools and queues smaller than the n... |
C | #include<string.h>
#include<stdio.h>
int main()
{
char ch[100];
int l,i,n=0;
while(gets(ch)){
l=strlen(ch);
for(i=0;i<l;i++){
if(ch[i]=='"'){
if(n%2==0)
printf("``");
else
printf("''");
n++;
}
else
... |
C | /*
** EPITECH PROJECT, 2020
** my_strincl
** File description:
** my_strincl
*/
#include <stdbool.h>
#include <string.h>
bool my_strincl(char const *str, char const *part)
{
size_t i = 0;
int len = strlen(str);
if (len < strlen(part))
return false;
for (; str[i] && str[i] != part[0]; i++);
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
int main()
{
int shm_fd;
char *start="ds";
char isPalin[20];
char *ptr;
int SIZE=1024;
shm_fd = shm_open(start,O_RDWR,0666);
ptr = mmap(0,SIZE,PROT_READ,MAP_SHARE... |
C | /*
* Tri_Tri_Intersection.h
* newshell_prj
*
* Created by Norbert Stoop on 11.05.09.
* Copyright 2009 __MyCompanyName__. All rights reserved.
*
*/
#include "Tri_Tri_Intersection.h"
/* Triangle/triangle intersection test routine,
* by Tomas Moller, 1997.
* See article "A Fast Triangle-Triangle Intersecti... |
C | #include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <string.h>
/*
* simple program implementing cat
*/
int main(int argc, char **argv)
{
pid_t my_id;
char buffer[4096];
my_id = getpid();
fprintf(stderr,"pid: %d -- I am my-cat and I have started\n",my_id);
... |
C | #include <stdio.h>
int A(int Id, int find[]){
for(int i=0; find[i] != 0; i++){
if(Id == find[i]){
return i;
}
}
return -1;
}
double payment(int itemID[], double price[], int orderItemID[],int orderQuantity[], int onSaleItemID[]){
double total = 0.0;
for(int i=0; orderItemID[i] != 0; i++){
int check =... |
C | //program to check armstrong number of n digits
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int number,originalnumber,remainder,result=0,n=0;
printf("enter an integer: ");
scanf("%d",&number);
originalnumber=number;
while(originalnumber!=0)
{
originalnumber/=10;
... |
C | #include "rog.h"
#include "mainMenu.h"
void generateFirstLevel(gameSet* game)
{
game->levels[game->currentLevel] = createLevel(1);
game->currentLevel++;
}
void generateNextLevel(gameSet* game)
{
game->levels[game->currentLevel] = createLevel(game->currentLevel+1);
copyPlayerStats(game->levels[game->currentLevel-1... |
C | #include<stdio.h>
main(){
double resp, receive, value[7];
int i;
scanf("%lf",&resp);
receive = resp;
for(i = 0;i<7;i++){
value[i] = 0;
}
while(receive>99){value[6] = value[6] + 1;receive = receive - 100;}
while(receive>49){value[5] = value[5] + 1;receive = receive - 50;}
while(receive>19){value[4] = valu... |
C | #include<stdio.h>
void main()
{
char a[100],b[100];
int i,c=0,d=0,k;
scanf("%s",a);
scanf("%s",b);
for(i=0;a[i]!='\0';i++)
{
c++;
}
for(i=0;b[i]!='\0';i++)
{
d++;
}
if(c>=d)
{
k=d;
}
else if(c<d)
{
k=c;
}
for(i=0;a[i]!='\0';i++)
{
if(i<k)
{
printf("%c",a[i]);
}
}
for(i=0;b[i]!='\0';i++)
{
if(i<k)
{
printf("%c",b[i]);
}... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
int a,b,c;
printf("a, b, c uzunluklarini giriniz : "); scanf("%d %d %d", &a, &b, &c);
printf("\n-------------------------------------\n\n");
if(b+c>a)
if(a>abs(b-c))
{
if(a+c>b)
if(b>abs(a-c))
{
... |
C | #include <stdio.h>
int main()
{
for (int i = 1111; i <= 9999; i++)
{
if ((i / 1000) % 10 == (i / 100) % 10 && (i / 10) % 10 == i % 10) // This is to check for AA BB wala condition.
{
for (int j = 1; j <= i; j++) // iss loop se har j ka value ke liye j*j krke check krte hai ki kya wo i ke equal hai agar hai toh... |
C | #include<string.h>
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<pthread.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<netinet/in.h>
pthread_t t1,t2;
char recvBuff[1024]; //read buffer
char s[1024]; //write buffer
int inet_pton(int,const char *,void *);
void* serv_read(void *args)
{
... |
C | #include <sys/types.h>
#include <sys/stat.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/sysmacros.h>
#include <string.h>
int main(int argc, char *argv[]){
struct stat sb;
if (argc != 2) {
fprintf(stderr, "Usage: %s <pathname>\n", argv[0]);
... |
C | #define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h> // malloc()
int main()
{
int a = 0;
// ǥ
unsigned int int_size1 = sizeof a;
unsigned int int_size2 = sizeof(int);
unsigned int int_size3 = sizeof(a);
size_t int_size4 = sizeof(a);
size_t float_size = sizeof(float);
prin... |
C | #include<sys/types.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<unistd.h>
#include<error.h>
#include<sys/wait.h>
int main(int argc, char **argv)
{
int fds[2];
pid_t pid;
if(pipe(fds) == -1)
perror("pipe");
pid=fork();
if(pid == 0)
{
if(dup2(fds[1], STDOUT_FILENO) == -1)
perror("... |
C | #ifndef BST_H_
#define BST_H_
typedef struct text
{
int key_l;
int key_r;
//80 is standard column for programming +1 for end line
char *line_l;
char *line_r;
struct text *left;
struct text *middle;
struct text *right;
//For inserting into 3 nodes
int key_m;
struct text *parent;
} te... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* readers.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <string.h>
int main()
{
void *pvData = NULL;
int *iData = NULL;
float *fData = NULL;
char *cData = NULL;
printf("size of void pointer = %d\n", sizeof(pvData));
printf("size of int pointer = %d\n", sizeof(iData));
printf("size of float pointer = %d\n", sizeof(fDa... |
C | #include "contiki.h"
#include "sys/timer.h"
#include "dev/leds.h"
#include "pt.h"
//TODO PORQUE ESTE SI FUNCIONA SIN EL PROCESS_PAUSE ?
/*---------------------------------------------------------------------------*/
PROCESS(test_etimer_process, "Test ET");
AUTOSTART_PROCESSES(&test_etimer_process);
static struct le... |
C | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include "liste.h"
#include "genList.h"
int isPrime(int val){
int limite = 2, i;
/* for(i=0; primeTab[i]<=lim; i++){ if((val % primeTab[i]) == 0) {return 0;} }*/
while((limite * limite) < val){
if((val % limite) == 0){return 0;}
else {++limite;}
}
return ... |
C | #include <libC.h>
#include <lib.h>
#include <stdarg.h>
#define ULONG_MAX ((unsigned long)(~0L)) /* 0xFFFFFFFF */
#define LONG_MAX ((long)(ULONG_MAX >> 1)) /* 0x7FFFFFFF */
#define LONG_MIN ((long)(~LONG_MAX)) /* 0x80000000 */
//http://www.firmcodes.com/write-printf-function-c/
int printf(char *form... |
C | #include<stdio.h>
#define PI 3.14
int main(void)
{
int p_speed;
int h_speed;
int radius = 5;
double round;
double time;
printf("Type the number\n");
printf("horse\n");
scanf("%d",&h_speed);
printf("panda\n");
scanf("%d",&p_speed);
round = radius * 2 * PI;
time = round/(h_speed - p_speed);
printf("시간... |
C | #include <stdio.h>
#ifndef TREE_H
#define TREE_H
/* structures */
struct Node
{
void *data;
struct Node *lt;
struct Node *gte;
};
struct Performance
{
unsigned int reads;
unsigned int writes;
unsigned int mallocs;
unsigned int frees;
};
/* function prototypes */
struct P... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_cmdpath.c :+: :+: :+: ... |
C | #include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <stdlib.h>
size_t ft_write(int fildes, const void *buf, size_t nbyte);
size_t ft_strlen(const char *s);
char *ft_strcpy(char * dst, const char * src);
int ft_strcmp(const char *s1, const char *s2);
ssize_t ft_read(int fildes, void ... |
C | #include <SDL2/SDL.h>
#include <time.h>
#define RUNS 1000
int main (int argc, char** argv)
{
SDL_Window* window = NULL;
window = SDL_CreateWindow
(
"sdl2box", SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
640,
480,
SDL_WINDOW_SHOWN
);
SDL_Renderer* rend... |
C | #ifndef FACTBASE_H
#define FACTBASE_H
typedef struct Fact {
unsigned int id;
char desc[256];
} Fact;
typedef struct FactBaseElem {
Fact fact;
struct FactBaseElem *next;
struct FactBaseElem *prev;
} FactBaseElem;
/* The FactBase datatype contains a pointer to both the first and the last fact in th... |
C | #include<stdio.h>
#include<string.h>
void main()
{
char s1[20],s2[20];
int a,i=0;
printf("enter two string");
scanf("%s",s1);
scanf("%s",s2);
a=strlen(s1);
a=a-1;
while(s2[i]!='\0')
{
s1[a+1]=s2[i];
i++;
b++;
}
printf("%s",s1);
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* minishell.c :+: :+: :+: ... |
C | #include<stdio.h>
struct details
{
int name;
int address;
float date_of_birth;
char blood_group;
};
int main()
{
struct details d[2];
int i;
for ( i = 0; i < 2; i++)
{
printf("enter the details %d name ",i+1);
scanf("%d",&d[i].name);
printf("enter the details %d... |
C | #ifndef __STACK_H__
#define __STACK_H__
typedef int stackElementT;
typedef struct stack {
int top;
int size;
stackElementT *contents;
}stackT;
int initStack(stackT *stack, int size); /* 初始化栈,大小为size*/
void destoryStack(stackT *stack); /* 销毁栈 */
int stackIsEmpty(stackT... |
C | #include<stdio.h>
struct node{
int x;
struct node *next;
};
int main()
{
struct node head,link;
head.x=10;
head.next=&link;
link.x=20;
link.next=NULL;
printf("head.x : %d\n",head.x);
printf("head.next->x: %d",head.next->x);
return 0;
}
|
C | #include<stdio.h>
#include<stdbool.h>
#include<stdlib.h>
struct node
{
int data;
struct node* prev;
struct node* next;
}*head = NULL, *toe;
typedef struct node NODE;
int main(int argc, char const *argv[])
{
/* code */
return 0;
}
void create(int n)// Creates or Extends list by 'n'
{
if (h... |
C | #pragma once
// bn.h
struct bn_s;
typedef struct bn_s bn;
/*enum bn_codes {
BN_OK, BN_NULL_OBJECT, BN_NO_MEMORY, BN_DIVIDE_BY_ZERO
}; */
bn *bn_new(); // BN
bn *bn_init(bn const *orig); // BN
// BN
int bn_init_string(bn *t, const char *init_string);
// BN
// radix
int bn_init_... |
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
//Լ:call bu reference
//mainԼ a 氡.
void change(int* p) {
*p = 20;
}
//mainԼ μ ٲٱ
void twochange(int* pa, int* pb) {
int temp = *pa;
*pa = *pb;
*pb = temp;
}
//հ豸ϱ
void sumCal(int* pa, int* psum) {
*psum += *pa;
}
int main() {
//Լ ͳѱ
/*int a=10;
change(&a);... |
C | #ifndef BRIDGE_H
#define BRIDGE_H
#include <stdint.h>
#define reg_t uint64_t
#define print(string) print_string(string, uart_write_char)
#define println(string) print(string "\n\r")
#define print64(val) print_hex(val, uart_write_char, 8)
#define print64_raw(val) print_hex_raw(val, uart_write_char, 8)
#define TRUE (... |
C | #include <stdio.h>
void calculate_the_maximum(int n, int k) {
int max[3] = {0,0,0};
for(int i=1; i<=n; i++){
for(int j=i+1; j<=n; j++){
int temp[3] = {i&j,i|j,i^j};
if(temp[0]>max[0] && temp[0]<k){
max[0] = temp[0];
}
if(temp[1... |
C | #include "function_declaration.h"
#include <malloc.h>
#include <stdlib.h>
#include <stdio.h>
static VertexID visit_seq[MAX_VERTEX_NUM];
static VertexID seq;
void init_gragh(gragh *G) //初始化图
{
G->arcnum = G->vertexnum = 0;
}
#ifdef kinderfisher
INFO new_info_kf()
{
int i = 0;
char c;
INFO info;
prin... |
C | #include "../include/macro.h"
#include "../include/menu.h"
#include <stdio.h>
#include <termios.h>
static struct termios old, current;
/* Initialize new terminal i/o settings */
void initTermios(int echo)
{
tcgetattr(0, &old); /* grab old terminal i/o settings */
current = old; /* make new settings same as old s... |
C | // ***
// *** You MUST modify this file
// ***
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "tree.h"
// DO NOT MODIFY FROM HERE --->>>
void deleteTreeNode(TreeNode * tr)
{
if (tr == NULL)
{
return;
}
deleteTreeNode (tr -> left);
deleteTreeNode (tr -> right);
free (tr);
}
... |
C | /*
** player_position.c for zappy in /home/Dante/rendu/System_Unix/PSU_2016_zappy/Zappy_server/src
**
** Made by Dante Grossi
** Login <Dante@epitech.net>
**
** Started on Tue Jun 27 16:58:29 2017 Dante Grossi
** Last update Sat Jul 1 17:22:30 2017 Dante Grossi
*/
#include "viewer.h"
static bool send_position(t_z... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#define BUFF_SIZE 8096
void help();
void copy_mmap(char* fd_from, char* fd_to);
void copy_read_write(char* fd_from, char* fd_to);
... |
C | #include "Lib/Std_Types.h"
#include "MCAL/TMR_interface.h"
#include "MCAL/GIE_interface.h"
#include "RTOS_interface.h"
#include "RTOS_private.h"
#include "RTOS_config.h"
TaskControlBlock_t TaskBlocksArr[RTOS_TASK_NUM] = {{NULL}};
void RTOS_VidStart()
{
TMR_VidInit();
TMR_VidSetDutyCycle(0, 50); /* Set OCR0 =... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(){
struct chatting_list{
char chatting_room[100]; // 채팅방 이름
int unread; // 안읽은 메시지
int is_it_multi_room; // 채팅방 옵션
int key[20]; // 암호화/복호화 키
}list[100];
FILE *chatting_fp;
//struct chatting_list list[100];
chatting_fp = fopen("./ch... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fork.c :+: :+: :+: ... |
C | /*
* cgi2scgi: A CGI to SCGI translator
*
*/
/* configuration settings */
#ifndef HOST
#define HOST "127.0.0.1"
#endif
#ifndef PORT
#define PORT 4000
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <... |
C | #include <stdio.h>
int index_array[9] = {0,};
int order_array[9] = {0,};
void number_array(int N,int M,int count){
if(M ==count){
for (int i = 0; i < M; ++i) {
if(order_array[i])
printf("%d ",order_array[i]);
}
printf("\n");
}
else{
for (int i = 1; ... |
C | /*-------------------------------------------------
//Date: 10.12.2020
//Autor: Vlaimir Draga
//S. Prata. Chapter 14
//Programming exercise 10
//-------------------------------------------------
/*
Text programmming exersice.
10. Write a program that implements a menu by using an array of pointers to functions. For
in... |
C | #include <stdio.h>
int main(int argc,char *argv[])
{
int integerOne, integerTwo, integerThree;
printf("Input the first integer: ");
scanf("%d",&integerOne);
printf("Input the second integer: ");
scanf("%d",&integerTwo);
printf("Input the third integer: ");
scanf("%d",&integerThree);
if(integerOne > integerTwo ... |
C | /*
* DA4B_T1.c
*
* Created: 4/18/2019 1:30:14 PM
* Author : victor
*/
#define F_CPU 16000000UL
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
void adc_initializer(void); // void function we will use for ADC
void slow_the_freak_up(void); // does this to begin slowing ... |
C | #include<stdio.h>
#include<string.h>
#include<pthread.h>
#include<stdlib.h>
#include<unistd.h>
pthread_t tid1;
pthread_t tid2;
int status;
FILE *fp;
FILE *fq;
int hitung(char* String, char *str){
int count=0;
char* Temp = String;
while(Temp != NULL){
Temp=strstr(Temp,str);
if(Temp){
Temp++;
count++;
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line.c :+: :+: :+: ... |
C | #include<stdio.h>
int main()
{
int T;
scanf_s("%d", &T);
int a, b, j, t;
for (int i = 0; i < T; i++)
{
scanf_s("%d %d", &a, &b);
if (a < b)
{
t = a;
a = b;
b = t;
}
j = 1;
while (1)
{
if ((b * j)%a==0)
{
printf("%d\n", b*j);
break;
}
j++;
}
}
return 0;
} |
C |
/*
Name: number.c
Purpose: Perform add operations on a natural given number
*/
#include <stdio.h>
#include "number.h"
/*
Name: sum_of_first_with_for
Purpose: Compute the sum of the first N natural numbers using for
... |
C | #include <stdio.h>
#include <windows.h>
#include <assert.h>
void ReverseString(char *str)
{
assert(str);
char *start = str;
char *end = str + strlen(str) - 1;
while (start < end){
char temp = *start;
*start = *end;
*end = temp;
start++, end--;
}
}
int main()
{
char str[] = "abcd1234";
printf("Befor: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include "paises.h"
#include <string.h>
#include <time.h>
ePais* nuevo_Pais()
{
return (ePais*) malloc(sizeof(ePais));
}
//---------------------------------------------------------------------------------------------------
ePais* paisesParametros(char* idStr, ch... |
C | /* Do not remove the headers from this file! see /USAGE for more info. */
#define XP_FACTOR 250
void save_me();
private
int level = 1;
private
int experience = 0;
private
int xp_modifier;
private
nosave int guild_xp_buff;
void set_level(int x)
{
level = x;
}
int query_level()
{
return level;
}
void raise_le... |
C | // sets.h -- operators on sets of up to 32 elements
// by: Douglas W. Jones
// users of this must first include <stdint.h>
// the set data type
typedef uint32_t set32_t;
// set32_t TO_SET32( int i )
#define TO_SET32(i) (((set32_t)1)<<(i))
// constructs a new set from one integer
// bool IN_SET32( int i, set32_t s... |
C | /**
* @file
* @brief Application to manage phone contacts
* @author Alejandro Brugarolas
* @since 2019-05
*/
#include <stdio.h>
#include "model/structs.h"
#include "functions/Contact.h"
/**
* Shows all the options and calls the appropriate function depending of the chosen option
*/
void showMenu(contact *cont... |
C | //musl-libc
#include "stdio.h"
#include "stdlib.h"
#include "signal.h"
#include "sys/stat.h"
#include "errno.h"
#include "syscall.h"
#include "time.h"
#include "unistd.h"
#include "string.h"
//$(pwd)/include
#include "vars.h"
#include "pthread.h"
#define THREAD_NUM 8
//#define TOTAL_MEM 0x3ffd0000
#define TOTAL_MEM 0... |
C |
#include <stdio.h>
int a[8] = { 0, 1, 2, 3, 0, 1, 2, 3 };
char b[5];
char c[3];
char d;
int main()
{
char x[5], y[3], z[7];
printf("sizeof(char) %lu, sizeof(int) %lu, sizeof(long) %lu\n"
"sizeof(a) %lu, sizeof(c) %lu\n"
"address of a[0] %p\naddress of b[0] %p\n"
"address of c[0] %p\naddress of d %p\n"
... |
C | #include <stdio.h>
#include <string.h>
#define BUFSIZE 100
int buf[BUFSIZE];
int bufp = 0;
int value = EOF;
int getch(void)
{
return (bufp > 0) ? buf[--bufp] : getchar();
}
void ungetch(int c)
{
if (bufp >= BUFSIZE)
printf("ungetch: too many characters\n");
else
buf[bufp++] = c;
}
void... |
C | #include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <stdlib.h>
#define MAX_LENGTH 256
struct Operands {
int x, y;
};
//Exercise 1.
int main(void){
int fd[2];
pid_t pid;
if (pipe(fd) == -1){ //Opens pipe.
perror("Pipe error");
exit(1);
}
if ((pid = fork()) == -1){
perror("F... |
C | #include "pic.h"
void pic_acknowledge(uint8_t _interrupt)
{
// If handled by slave, acknowledge this
if (_interrupt >= PIC_SLAVE_START_INTERRUPT && _interrupt <= PIC_SLAVE_END_INTERRUPT)
out_byte(PIC_SLAVE_COMMAND_PORT, PIC_ACKNOWLEDGE);
out_byte(PIC_MASTER_COMMAND_PORT, PIC_ACKNOWLEDGE);
}
void ... |
C | // htab_move.c
// Riesenie IJC-DU2, priklad b), 20. 4. 2021
// Autor: Tomas Valent
// Prekladac: gcc 9.3
// Move konstruktor hash tabulky
#include "htab.h"
#include "htab_struct.h"
htab_t *htab_move(size_t number, htab_t *t2)
{
htab_t *table = htab_init(number); //nova tabulka so zadanou velkostou
if(table... |
C | /*
* myio.c
* Trey Oehmler
* CS315 Assignment 2 Fall 2018
*/
#include "myio.h"
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <string.h>
struct tfile *myopen(const char *path, int flags)
{
/* initalizes new tfile
* returns ptr to tfile, or... |
C | /*
Vamos a entender el funcionamiento de la sentencia SWITCH con su DEFAULT. Es como comparar IF con su ELSE.
Este es el esquema que sigue switch:
switch (variable){
caso var1 : sentencias1;break;
caso var2 : sentencias2;break;
caso var3 : sentencias3;break;
default: sentencias;
}
*/
#include <stdio.h> //Exis... |
C | /* ================================================================ */
/* Generate random instance of set covering problem */
/* Programmed by Shunji Umetani <umetani@ist.osaka-u.ac.jp> */
/* Date: 2014/04/15 */
/* =================================... |
C | #include "pid.h"
#include "hg_math.hpp"
#include "hg_defines.h"
#include <math.h>
void PID_Init(PID_Controller *PID,float P,float I,float D)
{
PID->dt = 0.0f;
PID->error_int = 0.0f;
PID->error_now = 0.0f;
PID->error_pre = 0.0f;
PID->error_last = 0.0f;
PID->feedback = 0.0f;
PID->int_limit = ... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "esp_system.h"
#include "spiffs/spiffs_vfs.h"
#include "esp_log.h"
static const char *TAG = "reader_storage";
static const char* filename_stored = "stored.dat";
static const char* filen... |
C | #include "hw1.h"
#include <stdlib.h>
int morse(unsigned short mode){
char buffer, *newline="\n", *space=" ", *tab="\t";
int isDecrypt = 0x2000 & mode;
int morseCount = 0;
//Setup table
setupMorseTable(key);
if(isDecrypt){
}else{
buffer = getchar();
while(buffer != EOF){... |
C | /* Kernel headers, needed for e.g. KERN_ALERT. */
#include <linux/kernel.h>
/* Type definitions, needed for e.g. ssize_t. */
#include <linux/types.h>
/* Module headers, needed for various Kernel module-specific functions and globals. */
#include <linux/module.h>
/* Device headers, needed for managing a device. */
#incl... |
C | /*
* apartment.c
*
* Created on: 27 2016
* Author: Liron
*/
/*
*
* this should be everything
* whatever I've tested and found to work has " //works" written above it, the splitting function could be improved
* I've also implemented two helpful functions, their declaration can be seen her... |
C | #include <stdio.h>
#include <stdlib.h>
int G[25][25], visited_places[10], limit, cost = 0;
int tsp(int p)
{
int count, nearest_place = 999;
int minimum = 999, temp;
for(count = 0; count < limit; count++)
{
if((G[p][count] != 0) && (visited_places[count] == 0))
{
if(G[p][count] < minimum)
{
minimum = G[count]... |
C |
#include "lib/kernel/list.h"
#include "threads/thread.h"
#include <debug.h>
#include <stdio.h>
#include "userprog/pagedir.h"
#include "threads/palloc.h"
#include "threads/malloc.h"
#include "threads/vaddr.h"
#include "vm/swap.h"
#include "vm/frame.h"
static struct list_elem *clock_ptr;
void vm_frame_init() {
list_... |
C | /*
** EPITECH PROJECT, 2019
** do_ops
** File description:
** do_op point and line
*/
#include "../../include/my.h"
int div_mod_zero(char *nbr2)
{
if (my_abs(nbr2)[0] == '0') {
my_putstr("error");
exit(84);
}
return (0);
}
char *do_op_line(char *nbr1, char op, char *nbr2)
{
int len = ... |
C | #include <stdlib.h>
#include <string.h>
#include "benchmark.h"
/* The implementation */
#include "sglib.h"
#include "rhash.h"
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
/* define the initial size of the hash table (0 is illegal) */
#define HASHSIZE 100000
/* define the object of the hash table */
#defin... |
C | /*
** EPITECH PROJECT, 2020
** algo
** File description:
** push_swap
*/
#include "my.h"
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
int is_list_sorted_min_to_max(list_t *list)
{
int len_list = length_list(list);
int n = 0;
for (int i = 0, j = 1; j < len_list; i++, j++) {
if (get_at... |
C | #include <errno.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
// compute the entropy of a given p array of node attribute
static double entropy(double *p, uint64_t n)
{
double sum = 0;
for (uint64_t i=0; i<n; i++) {
sum +=... |
C |
int main()
{
int a,b,c,d;
scanf("%d %d %d",&a,&b,&c);
if((a%100!=0&&a/4==0)||a%400==0)
{
switch(b)
{
case 1:printf("%d",c); break;
case 2:printf("%d",d=31+c);break;
case 3:printf("%d",d=60+c);break;
case 4:printf("%d",d=91+c);break;
case 5:printf("%d",d=121+c);break;
cas... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* patterns_2.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <string.h>
#define MAX_N 8
static int map[MAX_N][MAX_N] = {}, ans[MAX_N] = {}, tmpans[MAX_N] = {}, used[MAX_N] = {1, 0};
static int n;
static int max = 0;
static void findroad(int now, int count)
{
if (now == 0 && used[0] == 2)
{
if (count > max)
{
max = count;
memmove(ans, tmpan... |
C | /*
* @Author: your name
* @Date: 2020-02-19 11:13:32
* @LastEditTime: 2020-02-19 13:31:32
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: /c-lang/unit-8/14.c
*/
#include <stdio.h>
void sort(char *num, int n)
{
char temp;
for (int i = 0; i < n / 2; i++)
{
... |
C | 2.
a)color is an array of 6 elements where each stores the address of char type data
b)address of 2nd element.i.e., "blue"
c)address of "r" in red
d)address of "b" in blue
e)color[5] gives address of 5th element.i.e., "yellow", *(colour + 5) represents the address of 0th element of 5th array.i.e., "y" in yellow.
|
C | #include <stdio.h>
#include <stdlib.h>
struct node {
int key;
struct node* next;
};
struct node* new(int n) {
struct node* p;
p=(struct node*) calloc (1,sizeof(*p));
p->key=n;
p->next=NULL;
return p;
}
int searchkey(struct node* l, int n) {
struct node* p=l;
while (p!=NULL) {
if (p->key==n)
return 1;... |
C | //##################################################################################################
//
// Pthread mutex handling.
//
//##################################################################################################
#include <pthread.h>
#include <stdio.h>
#include "wlibc_panic.h"
#include "wrm_mtx.... |
C | #include <stdio.h>
#include <stdlib.h>
int isTriangle(int lado1, int lado2, int lado3){
if(lado1 + lado2 > lado3 && lado1 + lado3 > lado2 && lado2 + lado3 > lado1){
if(lado1 == lado2 && lado2 == lado3){
//equilatero
return 3;
}else if(lado1 == lado2 && lado2 != lado3){
... |
C | #include<stdio.h>
void sumsqrcube()
{
int i=0,sum=0,cube=0,sqr=0;
for(i =0 ;i<=10;i++)
{
sum += i;
sqr += i*i;
cube += i*i*i;
}
printf("sum : %d\n",sum);
printf("sqr : %d\n",sqr);
printf("cube : %d\n",cube);
}
int main()
{
sumsqrcube();
return 0;
}
|
C | /*
**my_strcat:concatenate t to the end of s; pointer version
*/
#include<stdio.h>
#include<string.h>
#define MAXNUM 200
void my_strcat(char *s, char *t);
main(){
char s[MAXNUM],t[MAXNUM];
strcpy(s, "hello, ");
strcpy(t, "weekend!");
my_strcat(s, t);
printf("result : %s\n", s);
}
void my_strcat(char *s, ch... |
C | #include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
void *funcion(void *argumento);
int numero_hilos = 0;
int main(int argc, char const *argv[])
{
int num_hilos, maxima_cuenta;
/*printf("Indique el numero de hilos y el conteo max de cada uno:\n");
scanf("%d",&num_hilos);
scanf("%d",&maxima_cuenta);*/
pthr... |
C | #include <stdio.h>
int comp(void* a, void* b)
{
return *(int*)a - *(int*)b;
}
void *max (void* m, size_t size, size_t n, int (*comp)(void*, void*))
{
char* input = m;
int* res = input;
for(int i = 0; i < n; ++i)
{
int check = 0;
for(int j = 0; (j < size) && !check; ++j)
... |
C | #include <stdio.h>
#include <string.h>
int main()
{
char str1[2001] = "This is simple string.";
char str2[] = "is";
char str3[] = "a";
int str_num = 2;
int location[2] = {2, 5};
int r;
char tmp[2001];
strcpy(tmp, str1);
printf("%s\n", str1);
int wordsize = strlen(str2);
... |
C | #include "http.h"
#include <strings.h>
static void parse_uri(char *root, char *uri, int length, char *filename);
static const char *get_file_type(const char *type);
static void serve_static(int fd, char *filename, int filesize, fv_http_out_t *out);
static void do_error(int fd, char *cause, char *errnum, char *shortmsg... |
C | #include <cs50.h>
#include <stdio.h>
int main(void)
{
int bottle = 12;
int num_bottles;
printf("minutes: \n");
int minutes = get_int();
if (minutes > 0)
{
num_bottles = bottle * minutes;
printf("bottles: %d\n", num_bottles);
}
else
{
num_bottles = bottle * minutes;
printf("retry: ");
}
} |
C | /* Author: Tyler Punch
* File: partB.c
* Purpose: this file contains my something cool
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "gpio.h"
#include "partA.h"
// Blink LEDs at ascending rate
void ascending(char *arr[])
{
int delay = 3000000;
for(int i = 0; i < 8; i ++) {
usleep(delay... |
C | static int isDelimiter(char p, char delim){
return p == delim;
}
static int split(char *dst[], char *src, char delim){
int count = 0;
for(;;) {
while (isDelimiter(*src, delim)){
src++;
}
if (*src == '\0') break;
dst[count++] = src;
while (*src && !isDelimiter(*src, delim)) {
src... |
C | #include<signal.h>
#include<stdio.h>
void main()
{
int ret,pid;
printf("Enter pid of the process to kill:");
scanf("%d",&pid);
ret=kill(pid,9);
if(ret>=0)
printf("process killed \n");
else
printf("kill error \n");
}
|
C | #include "ant.h"
#include <stdarg.h>
#include <conio.h>
#include <alloc.h>
extern char log_file_name[80];
extern FILE *log_file;
extern char sys_file_name[80];
extern FILE *sys_file;
extern char his_file_name[80];
extern FILE *his_file;
extern int **map;
extern int MAP_ROWS,MAP_COLS;
extern int test_run;
/*////////////... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.