language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <assert.h>
#include <unistd.h>
#include <stdio.h>
#include "disastrOS.h"
#include "disastrOS_syscalls.h"
#include "disastrOS_semaphore.h"
#include "disastrOS_semdescriptor.h"
void internal_semOpen(){
// do stuff :)
int semnum = running->syscall_args[0];
if(semnum < 0){
// semnum non valido... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* format_unsigned.c :+: :+: :+: ... |
C | //Basic Pong
#include <xc.h>
#include <stdio.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <stdlib.h>
#include <unistd.h>
#ifdef _SIMULATE_
#include "simAVRHeader.h"
#endif
//Task Struct
typedef struct task {
int state;
unsigned long period;
unsigned long elapsedTime;
int (*TickFct)(... |
C | #include <stdio.h>
#include <unistd.h>
#include <netinet/in.h>
#include "poll.h"
#include "debug.h"
#include "socket.h"
#include "writen.h"
#define BUFFSIZE 1024
#define UNUSED_PARAMS(x) (void)x
void read_cb(poll_event_t * poll_event, poll_event_element_t * node,
struct epoll_event ev)
{
UNUSED_PARAMS(poll_eve... |
C | #include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <ctype.h>
#include <string.h>
int main() {
int dice1;
int dice2;
int try = 0;
printf("press any button to roll 2 dice.\n");
srand(time(NULL));
while (1) {
getch();
dice1 = (rand() % 6) + 1;
dice2 = (rand() % 6) + 1;
... |
C | /*
** EPITECH PROJECT, 2018
** Test_criterion
** File description:
** Test de my_getfloat
*/
#include <criterion/criterion.h>
#include <lib.h>
#include "lib.h"
Test(test_my_getfloat, Test_entry_NULL, .timeout = 0.5, .exit_code = 0)
{
cr_assert_eq(my_getfloat(NULL), 0);
}
Test(test_my_getfloat, Test_entry_1, .timeou... |
C | #include <math.h>
#include <stdio.h>
int main() {
float A=1;
float s=2;
float Prec;
while (s>1) {
A=A/2;
s=1+A;
/* printf("s = %12.17f A = %12.17f\n",s,A); */
}
Prec = 2*A;
/* printf("Precisao = %2.20f\n",Prec); */
printf("Precisao = %f\n",Prec);
}
|
C | #include "types.h"
#include "user.h"
#include "x86.h"
#define PGSIZE 4096
void
thread_wrapper(void *arg)
{
struct thread_obj *obj = (struct thread_obj*)arg;
(obj->func)(obj->arg);
free(obj);
exit();
}
int
thread_create(void (*start_routine)(void*), void* arg)
{
void *stack = malloc(PGSIZE * 2);
if (!st... |
C | #ifndef __ZA__
#define __ZA__
/*
Providing aliases for the data type to be used in the program
*/
typedef int INT;
typedef unsigned int UINT;
typedef char CHAR;
/*
Defining macros for the format specifiers to be used in the program
*/
#define INT_FS "%d"
#define UINT_FS "%u"
#define CHAR_FS "%c"
#define STR_F... |
C | /*
** my_put_nbr.c for emacs in /home/Johanne-Franck/CPE_2016_matchstick
**
** Made by Johanne-Franck NGBOKOLI
** Login <Johanne-Franck@epitech.net>
**
** Started on Thu Feb 16 18:30:20 2017 Johanne-Franck NGBOKOLI
** Last update Sun Feb 26 16:16:53 2017 Johanne-Franck NGBOKOLI
*/
#include "lib.h"
int my_put_nbr... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "dsi_packing.h" /* For this, see http://www.dsi-lifeboat.com/viewtopic.php?f=13&t=17 */
#include "pcm_proc.h" /* For this, see http://www.dsi-lifeboat.com/viewtopic.php?f=13&t=130 */
#define PCM_MAX 176400
#define EVOLVER_ID 0x20 /* All Evolvers */
#... |
C | #include <stdio.h>
int main(int argc, char const *argv[]) {
int a = 30000, b = 10000;
long c;
char str[] = "=========================";
c = (long) a + b;
//c = a + b;
printf("c = %ld\n",c );
printf("sizeof \n" );
printf("%s\n", str );
printf("char : %d\n", sizeof(char));
printf("short... |
C | #include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <math.h>
#include <omp.h>
#define N 255
const double epsilon = 0.000456;
double *matrixMulVect(const double *matrix, const double *vector) {
double *res = (double *) calloc(N, sizeof(double));
#pragma omp parallel for
for (int i = 0; i < N; ... |
C | #include <stdio.h>
#include <stdlib.h>
#include "DLinkNode.h"
DLinkNode* CreateDNode(DLinkType value) {
DLinkNode* ptr = (DLinkNode*)malloc(sizeof(DLinkNode));
ptr->data = value;
ptr->next = ptr;
ptr->prev = ptr;
return ptr;
}
void Destroy(DLinkNode* ptr) {
free(ptr);
}
void DLinkListInit(DLinkNode** head) {
... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int i,product=1,sum=0;
for (i=1; i<=5; i++)
{
product=product*i;
sum=sum+i;
}
printf("product %d\n",product);
printf("sum %d\n",sum);
return 0;
}
|
C | #include <stdio.h>
int main(void)
{
int a;
printf("Please set case (1,2,3)\n");
scanf("%d",&a);
switch (a)
{
case 1:
printf("Case was set to 1\n");
break;
case 2:
printf("Case was set to 2\n");
break;
case 3:
printf("Case was set to 3\n");
break;
default... |
C | /* Author: Joseph DiCarlantonio
* Partner(s) Name: Brandon Tran
* Lab Section:
* Assignment: Lab # Exercise #
* Exercise Description: [optional - include for your own benefit]
*
* I acknowledge all content contained herein, excluding template or example
* code, is my own original work.
*/
#include "../header/... |
C | #include <stdio.h>
#include <stdlib.h>
int main() {
float valor,taxa,tempo,prest;
printf("insira o valor, taxa e tempo:\n");
scanf("%f%f%f",&valor,&taxa,&tempo);
prest = valor +(valor*(taxa/100)*tempo);
printf("valor da prestacao: %f",prest);
return 0;
} |
C | #include <stdio.h>
// Exercise 7.6 from King
// By Max Parisi
// finished 1/13/2019
int main(void)
{
printf("sizeof(int) == %zu\nsizeof(short) == %zu\nsizeof(long) == %zu\n",
sizeof(int), sizeof(short), sizeof(long));
printf("sizeof(float) == %zu\nsizeof(double) == %zu\nsizeof(long double) == %zu\n",
sizeof(fl... |
C | /*
** EPITECH PROJECT, 2020
** CleanSFMl
** File description:
** Header file for the create functions
*/
#ifndef INC_H_
#define INC_H_
#include "header.h"
/**
* \brief Create functions:
* \brief It return a complete sfRenderWindow *.
* Parameters:
* @param width is the width of the sfRenderWindow *.
* @par... |
C | #include <stdint.h>
#include "stm32f0xx.h"
#include "ili9341.h"
#define DC (2)
#define RST (3)
#define CS (4)
#define SCK (5)
#define MOSI (7)
#define CLR_RS (GPIOA->ODR &= ~(1 << DC))
#define SET_RS (GPIOA->ODR |= 1 << DC)
#define CLR_CS (GPIOA->ODR &= ~(1 << CS), SPI1->CR1 &= ~(SPI_CR1_SSI))
#define SET_CS (GPIOA->... |
C | #include <stdio.h>
void printArray(int a[], int size) { //based on stack working it will work so writing acc to recursion function
for (int i =0; i<size;i++) {
printf("%d ", a[i]);
}
printf("\n");
}
void merge(int a[], int left, int mid, int right) {
int l,r,m ; // current index for the le... |
C | #include <Python.h>
static PyObject*
say_hello(PyObject* self, PyObject* args)
{
const char* name;
if (!PyArg_ParseTuple(args, "s", &name))
return NULL;
printf("Hello %s!\n", name);
Py_RETURN_NONE;
}
static PyMethodDef HelloMethods[] =
{
{"say_hello", say_hello, METH_VARARGS, "Greet so... |
C | // convert int to string- GfG
#include <stdio.h>
int main()
{int a=10;
char *x;
x=(char)a;
printf("%s",x);
return 0;
} |
C | #include "lStack.h"
int main(int argc ,char **argv){
Stack *stack = (Stack *)malloc(sizeof(Stack));
initStack(stack);
push(stack , 3);
push(stack , 4);
push(stack , 5);
push(stack , 6);
push(stack , 7);
printf("The length:%d\n",getLength(stack));
disp(stack);
pop(stack);
printf("The length:%d\n" ,getLength... |
C | #include <stdio.h>
#include <stdlib.h>
#include "../include/linked_list.h"
void insertItem( ListNodePtr *headPtr, int value )
{
/* Create list walker */
ListNodePtr previousPtr = NULL;
ListNodePtr currentPtr = *headPtr;
/* Create the new node */
ListNodePtr newNode = malloc(sizeof(ListNode));
/* Should ... |
C | #include "Nano100Series.h" // Device header
#include "step_motor.h"
int step_motor_max = 0, step_motor_count = 0;
void step_motor_init(int max){
GPIO_SetMode(PE, BIT7 | BIT8 | BIT9 | BIT10, GPIO_PMD_OUTPUT);
step_motor_max = max;
}
void step_motor(int n){
short q = 0;
PE7 = PE8 = PE9 = PE10 = 0;
sw... |
C | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* All rights reserved. *
* *
* T... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <sys/types.h>
#include <signal.h>
#include <time.h>
#include <errno.h>
void myfunc(int signo)
{
//打开文件
int fd = open("time.txt",O_RDWR | O_CREAT |O_APPEND, 0755);
ti... |
C | /*
* Copyright (c) 2016 Intel Corporation.
* Intel Corporation All Rights Reserved.
*
* Portions of the source code contained or described herein and all documents related
* to portions of the source code ("Material") are owned by Intel Corporation or its
* suppliers or licensors. Title to the Material rema... |
C | #include<stdio.h>
int main()
{
int i,m,n;
double jg;
scanf("%d%d",&m,&n);
if(m==0||n==0){
printf("0");
}
else if(m<=n){
printf("1");
}
else{
jg=m-n+1;
for(i=2;i<=n;i++){
jg*=((double)m-n+i)/i;
}
printf("%d",(int)jg);
}
return 0;
} |
C | /*
* atenderNodoYFS.c
*
* Created on: 10/6/2015
* Author: utnso
*/
#include "variablesGlobales.h"
void *atenderNFS(void*arg){
char *mensaje;
char *direccion;
char *bufferSet;
char* paquetito;
char* bloqueGet;
int offset,tamanioDelPaquetito;
int socket= (int)arg;
int entero; // handshake para sabe... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
void main()
{
FILE *in_file,*sym_tab,*op_tab;
int op1,start_ad,loc_ctr,o,len,found=0;
char la[20],m1[20],op[20],otp[20];
in_file=fopen("input.txt","r");
sym_tab=fopen("symtab.txt","w");
fscanf(in_file,"%s %s %d",l... |
C | /* ex7-12-3.c -- ȡֱ0ձż0
ܸƽƽ*/
#include <stdio.h>
int main(void)
{
int num, odd_sum, even_sum;
int odd_count, even_count;
float odd_average, even_average;
odd_sum = even_sum = 0;
odd_count = even_count = 0;
printf("0");
scanf("%d", &num);
while(num != 0)
{
if(num % 2 == 0... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <errno.h>
#include <signal.h>
#include <limits.h>
void lock(int fd) {
}
void unlock(int fd) {
}
#define SEQ_FILE "./file"
int main(int argc... |
C | #include "apue.h"
#include <errno.h>
#include <limits.h>
#ifdef PATH_MAX
static long pathmax = PATH_MAX;
#else
static long pathmax=0;
#endif
static long posix_version =0;
static long xsi_version =0;
#define PATH_MAX_GUESS 1024
char *path_alloc(size_t *sizep);
int main(int argc,char *argv[])
{
char *ptr;
size_t siz... |
C | // Sergey Kirgizov's implementation of
// Maximilien Danisch's algorithm that finds
// maximal subgraph with maximal average degree (MAD)
// UWAGA! in this file density means MAD.
// We suppose that your graph is so big
// that it doesn't fit into the memory.
// So we are going to do some hardwork with your hard drive... |
C | #include<stdio.h>
int main()
{
int i,t,n,m,a,b;
scanf("%d",&t);
for(i=0;i<t;i++)
{
scanf("%d%d",&n,&m);
a=m/4;
b=m%4;
b=b/2;
printf("%d %d",a,b);
}
}
|
C | /*
Find the lowest common ancestor in an unordered binary tree given two values in the tree.
Lowest common ancestor : the lowest common ancestor (LCA) of two nodes v and w in a tree or directed acyclic graph (DAG) is the lowest (i.e. deepest) node that has both v and w as descendants.
Example :
_______3__... |
C | //Reverse of a linklist till stack has the address
void Reverse(){
if(head == NULL)
return ;
stack<struct Node*> S;
Node* temp = head ;
while(temp!=NULL)
{
S.push(temp);
temp = temp->next;
}
temp = S.top();
head = temp;
S.pop();
while(!s.empty()){
temp->next = S.top();
S.pop();
temp = tmep->next;
}
temp ->next = NU... |
C | //Fibonacci Series using Recursion - Option 1
/*
The Fibonacci numbers are the numbers in the following integer sequence.
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ……..
In mathematical terms, the sequence Fn of Fibonacci numbers is defined
by the recurrence relation.
Fn = Fn-1 + Fn-2
with seed values
F... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "se_fichier.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
int client(int argc,char **argv)
{
int i,gains=-1,fd=open("tube.fifo",O_WRONLY);
if(errno && fd==-1)
{
printf(" \n\nthere ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#define BUF_SIZE 1024
#define OPSZ 4
#define WORD_STATIS 3
/* 통계 구조체 자료형 정의 */
typedef struct statis {
char alphabet;
float prob;
float succ;
float total;
int check;
} s... |
C | #include<stdio.h>
typedef struct node{
int data;
struct node *left,*right;
}node;
void insertBt(node **p,int v){
int ch;
printf("Inserting value %d\n",v);
if(*p==NULL){
node *newnode;
newnode=(node*) malloc(sizeof(node));
newnode->data=v;
newnode->left=NULL;
newnode->right=NULL;
*p=newnode;
}
else
{
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct Stack {
int* key;
int top;
int max_stack_size;
}Stack;
Stack* CreateStack(int max) {
Stack* S = NULL;
S = (Stack*)malloc(sizeof(max));
S->key = (int*)malloc(sizeof(int)*max);
S->max_stack_size = max;
S->top = -1;
return S;
}
... |
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
int main(int argc, char* argv[]) {
int n;
sscanf(argv[1], "%d", &n);
for (int i = 0; i < n; i++) {
for (int j = 0; j < 2 * n - 1; j++) {
if (i >= abs(n - 1 - j))
printf("%c", '*');
else
printf("%c", ' ');
}
printf... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
typedef struct Node{
pid_t pid_process;
char pname[100];
int num;
struct Node *next;
}node;
extern node *head;
extern pid_t pid;
extern int counter;
in... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* reverse_rotate_op.c :+: :+: :+: ... |
C | #include "../binary_trees.h"
/**
* main - Entry point
*
* Return: 0 on success, error code on failure
*/
int main(void)
{
binary_tree_t *root;
root = binary_tree_node(NULL, 98);
root->left = binary_tree_node(root, 64);
root->left->left = binary_tree_node(root->left, 32);
binary_tree_print(root);
printf("Rot... |
C | /*
** set_param.c for zappy in /home/chazot_a/rendu/PSU_2014_zappy/sources/GFX
**
** Made by Jordan Chazottes
** Login <chazot_a@epitech.net>
**
** Started on Sun Jul 5 19:25:22 2015 Jordan Chazottes
** Last update Mon Jul 6 17:39:23 2015 Jordan Chazottes
*/
#include "gfx.h"
int set_player_param(t_player *new... |
C | //文本文件
#include<stdio.h>
#include<string.h>
int main(){
char str[] = "1,2,3,4,5"; //字符串字面值初始化数组
FILE *p_file = fopen("a.txt","wb");
if (p_file) {
fwrite(str,sizeof(char),strlen(str)/*数出字符个数*/,p_file);
fclose(p_file);
p_file = NULL;
}
return 0;
}
|
C | #include <stdio.h>
typedef enum State
{
OUT,IN
}State;
int main()
{
State state=OUT;
int c;
while((c=getchar())!=EOF)
{
switch(state)
{
case OUT:
switch(c)
{
case ' ':case '\n':case '\t':
break;... |
C | /*
** my_printf_utils.c for utils in /home/onillo_l/rendu/PSU/PSU_2015_my_printf/src
**
** Made by Lucas Onillon
** Login <onillo_l@epitech.net>
**
** Started on Fri Nov 6 01:57:42 2015 Lucas Onillon
** Last update Mon Nov 16 23:14:34 2015 Lucas Onillon
*/
#include "my.h"
#include "my_printf.h"
/*
** Check if a f... |
C | #include<stdio.h>
#include<stdlib.h>
typedef struct ponto{
int x, y;
}ponto;
void imprime_ponto(ponto point){
printf("x = %d, y = %d", point.x, point.y);
}
int main(int argc, char const *argv[])
{
ponto p1;
p1.x = 0;
p1.y = 1;
imprime_ponto(p1);
return 0... |
C | /*
* Card Counting Helping Programs
* By: Taylor Brazelton
* Updated: 2/8/2015
*/
#include <stdio.h>
#include <stdlib.h>
int main(){
bool keepGoing = true;
int count = 0;
while(keepGoing){
char in[3];
//Put text on screen...then ask for input.
puts("Input h = high; l = low... |
C | #include <std.h>
inherit ROOM;
void create() {
::create();
set_terrain(CITY);
set_travel(PAVED_ROAD);
set_property("light",1);
set_property("indoors",1);
set_property("no teleport",1);
set_short("%^BLUE%^City street%^RESET%^");
set_long(
"%^BLUE%^The city street is made of cobblestones wi... |
C | #include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
void hander(int sig){
printf("recv sig = %d\n");
exit(EXIT_SUCCESS);
}
int main(void)
{
int sock;
if((sock = ... |
C | #include <stdio.h>
#include "queue.h"
#define MAX_SIZE 10
int front = 0, rear = 0;
int queue[MAX_SIZE];
void enqueue(int data) {
if (rear == MAX_SIZE)
printf("The queue is full!\n");
else
queue[rear++] = data;
}
int dequeue() {
if (front == rear) {
printf("The queue is empty!\n")... |
C | #include<stdio.h>
int main()
{
int array[10] = { 0,1,2,3,4,5,6,7,8,9 };
int i = 0;
for (i = 9; i >= 0; i--)
{
printf("%d ", array[i]);
}
printf("\n");
return 0;
}
//쳲
#include<stdio.h>
int main()
{
int i;
int f[20] = { 1,1 };//ǰԪظֵΪ1
for (i = 2; i < 20; i++)
f[i] = f[i - 1] + f[i - 2];
for (i = 0; i < ... |
C | #include <stdio.h>
#include <errno.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <time.h>
#include <arpa/inet.h>
#include <dirent.h>
#include <sys/types.h>
int getDirectory(char *cwd, int sock)
{
//use stat.h to check if t... |
C | /* 2
编写一个程序,提示用户输入名和姓,并执行一下操作:
a.打印名和姓,包括双引号;
b.在宽度为20的字段右端打印名和姓,包括双引号;
c.在宽度为20的字段左端打印名和姓,包括双引号;
d.在比姓名宽度宽3的字段中打印名和姓。
*/
#include <stdio.h>
#include <string.h>
#define NAMESIZE 12
int main(int argc, char const *argv[])
{
char firstname[NAMESIZE];
char lastname[NAMESIZE];
printf("First name: ");
... |
C | #include "stdio.h"
struct Employee1 {
int roll_number;
} emp1;
struct Employee2 {
int roll_number :32;
} emp2;
void bit_fields_main() {
printf("size of emp1.roll_number:%d\n", sizeof(emp1));
printf("size of emp2.roll_number:%d", sizeof(emp2));
}
|
C | #include "bbs_mysql.h"
#include "common.h"
#include "logging.h"
#include <arpa/inet.h>
#include <errno.h>
#include <mysql.h>
#include <netinet/in.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <unistd.h>
// Maximum number of server connections
#defin... |
C | #include<sys/socket.h>
int get_line(int cfd,char* buf,int size){
int i=0;
char c='\0';
int n=0;
while((i<size-1)&&(c!='\n')){
n=recv(cfd,&c,1,0);
if(n>0){
if(c=='\r'){
/*拷贝读一次*/
n=recv(cfd,&c,1,MSG_PEEK);
if((n>0)&&(c=='\n')){
recv(cfd,&c,1,0);
}else{
c='\n';
}
}
buf[i]=... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
//-----------------------------------------------------------------------------
int main(void) {
printf("The real user of this process has ID %d\n",getuid());
printf("The effective user of this process has ID %d\n",geteuid());
... |
C | #include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>
// Traits
struct Monster {
char *name;
float size;
};
// Constructor
void Monster_Constructor(struct Monster* this, char *n, float s) {
this->name = n;
this->size = s;
}
// Inheritance
struct Zombie {
struct Monster monster;
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* printer.c :+: :+: :+: ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* errors.c :+: :+: :+: ... |
C | #pragma once
#include <inttypes.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Begin C API */
struct fastlock;
void fastlock_init(struct fastlock *lock);
void fastlock_lock(struct fastlock *lock);
int fastlock_trylock(struct fastlock *lock, int fWeak);
void fastlock_unlock(struct fastlock *lock);
void fastlock_free(str... |
C | int getRandNum() {
FILE *fp;
if ((fp = fopen("/dev/urandom", "r")) == NULL) {
fprintf(stderr, "Error!, Could not open /dev/urandom to read.\n");
return -1;
}
int result = fgetc(fp);
return result;
}
char *getRandString(size_t len) {
const char charset[] = "abcdefghijklmnopqrstu... |
C | #include <stdio.h>
#include "ImageCompression.h"
//#define IMAGESIZE 256
//#define DEBUG
struct node{
int i;
int j;
struct node *nextPtr;
};
typedef struct node NODE;
typedef NODE *NODEPTR;
struct LISnode{
int i;
int j;
char type;
struct LISnode *nextPtr;
};
typedef struct LISnode LISNODE;
... |
C | #include <string.h>
#include <stdlib.h>
#include "constants.h"
#include "types.h"
#include "storage.h"
struct Channel *channels_cache[CHANNELS_CACHE_SIZE] = {0};
int tail_index = 0;
void cache_add(struct Channel *channel) {
if (channels_cache[tail_index]) {
delete_channel(channels_cache[tail_index]);
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* builtins.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<math.h>
int main()
{
int a,b,c,x;
double pow(double x,double y);
for(x=100;x<1000;x++)
{
a=x/100%10;
b=x/10%10;
c=x/1%10;
if(x==pow(a,3)+pow(b,3)+pow(c,3))
{
printf("%d\n",x);
}
}
return 0;
}
|
C | /** cju_str.c
* Clanjor Utilities Library: String
**
* This code is under GPLv3, NO WARRANTY!!!
* Copyleft (C) eXerigumo Clanjor, 2010-2011.
**
* Coded by eXerigumo Clanjor.
*/
#include <stdlib.h>
#include "cju_str.h"
cju_str_t *cju_str_new(void)
{
return calloc(sizeof(cju_str_t), 1);
/*
cju_str_t *str;
i... |
C | #include "my.h"
/* Nicholas Massa
* I pledge my honor that I have abided by the Stevens Honor System.
* LibMy v1.1 tests: Tests for adding multiple string functionality to LibMy.
* Test main returns 0 and displays "All Tests complete" if all tests pass.
* If a test fails, my_panic will exit.
*
*/
/* NOTE: str... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){
//文件操作
//参数一:_Filename 文件的来源
//参数二:_Mode 模式r(读) w(写) rb(作为二进制文件的读) wb(作为二进制文件的写)
//返回值:FILE 结构体
// fopen();
printf("读取文件\n");
char *fileName = "D:\\ee.txt";//文件的路径
FILE * file = fopen(fileName,"r");
if(!file){
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <Windows.h>
// Լ ʿ Լ̴.
int IF_X(int c, int d); // ˻ Լ
int IF_Y(int e, int f); // ˻ Լ
int Make_Board(); // Լ
int Check(); //ߺ ϱ ˻ Լ
int Check_For_Else(); //ߺ 迭 ʱȭ Ű Լ
// Լ ÷̸ ϱ ʿ Լ̴.
int Playing(); //ڿ ÷̿ ִ Լ
int How_To(); //ϴ ڼ Ұ... |
C | #include <stdio.h>
void AssignGameMap(char gameMap[30][50]);
void FindPlayer(int playerLoc[2], char gameMap[30][50]);
void MovePlayer(int playerLoc[2], char gameMap[30][50]);
int ExitReached(char gameMap[30][50]);
//NOTE: Cannot enter a variable array size for func input so 50col 30 row limit
int main(void) {
st... |
C | /**
* @file VectorCompatibility.h
* @brief Provides methods and typedefs for the use of vectors in the code
*
* @license This file is distributed under the BSD Open Source License.
* See LICENSE.TXT for details.
**/
#ifndef VECTORCOMPATIBILITY_H
#define VECTORCOMPATIBILITY_H
#include <immintrin.h>
#ifnde... |
C | #include<stdio.h>
#include<stdlib.h>
unsigned char cautarebinara(short int vector[], short int nr_elemente, short int nr_cautat)
{
int li, lf, k;
li = 1; lf = nr_elemente;
while (li <= lf)
{
k = (li + lf) / 2;
if (nr_cautat == vector[k]) return 1;
else if (nr_cautat < vector[k]) lf = k - 1;
else li = k + ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstdelone.c :+: :+: :+: ... |
C | #include <stdio.h>
#define BUF_SIZE 256
// Read one line from a file, output it on the screen.
// ファイルから一行読み込み、画面に出力する
int Func(FILE* fp)
{
char s[BUF_SIZE];
if(fgets(s,BUF_SIZE,fp))
{
fputs(s,stdout);
return 1;
}
return 0;
}
int main()
{
FILE *fpA, *fpB;
fpA = fopen("a.txt","r");
fpB = fopen("b.txt","r"... |
C | /*
TASK: Intro04
LANG: C
AUTHOR: ~pnw
SCHOOL: RYW
*/
#include<stdio.h>
int main() {
double a,b,c,d;
scanf("%lf %lf %lf %lf", &a, &b, &c, &d);
printf("%.2lf\n", a/(c-b)*d);
return 0;
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* tree.c :+: :+: :+: ... |
C | #include<stdio.h>
intmain()
{
int n,a,product=1;
scanf("%d",&n);
while(n!=0)
{
a=n%10;
product=prodcut*a;
n=n/10;
}
printf("%d",product);
return 0;
}
|
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include "sArrList.h"
#include "utils.h"
sArrList_st *create_sArrList(int list_size, int data_size)
{
sArrList_st *plist;
if((list_size <= 0) || (data_size <= 0)){
return NULL;
}
plist = malloc(sizeof(sArrList_st) + list_size * dat... |
C | #include <stdio.h>
int main(void)
{
int a, b, c;
scanf("%d", &a);
scanf("%d", &b);
scanf("%d", &c);
if (a%111 == 0)
{
printf("0.%d...\n", a/111);
}
else if (a < 10)
{
printf("0.00%d...\n",a);
}
else if (a < 100)
{
printf("0.0%d...\n",a);
... |
C | #include "type.h"
#include "const.h"
#include "string.h"
#include "keyboard.h"
#include "keymap.h"
#include "proto.h"
#include "protect.h"
#include "process.h"
#include "global.h"
//私有键盘缓冲区
PRIVATE KB_INPUT kb_in;
/*该键盘中断处理逻辑负责从键盘端口中读取数据,并写入缓冲区中*/
PUBLIC void keyboard_handler(int irq){
//键盘控制器(接口)8042只有将数据缓冲器的数据清... |
C |
#include <stdio.h>
// һҪס, Ҫʵδݵʲô, ֻβξͿ
// βʱ, ôںββӰ쵽ʵ
// β, ôںβλӰ쵽ʵ
void change1(char ch){
ch = 'T';
}
void change2(char ch[]){
ch[0] = 'T';
}
void change3(char ch[][3]){
ch[0][0] = 'T';
}
int main()
{
/*
* ǰѧϰΪʱ, ֪ĵַ
* chs[0]chs[1]Ƕάеһά
* chs[0]chs[1]Ҳĵַ chs[0]... |
C | //
// Created by Steffan Ianigro on 3/06/2016.
//
#include "mapParams.h"
const double GAINMIN = 0;
const double GAINMAX = 3;
const double BIASMIN = -4;
const double BIASMAX = 4;
const double WEIGHTMIN = -10;
const double WEIGHTMAX = 10;
const double TCMIN = 1;
const double TCMAX = 3;
const double SINECOEFFICIENT... |
C | //Controls the movement of the agent with a selector switch
#include <stdio.h>
#include <math.h>
#include "selector.h"
#include "motors.h"
void movement_1();
void movement_2();
int left_v, right_v;
int main()
{
motor_init();
while(1)
{
//Select mode of operation
switch(get_selector())
{
cas... |
C | #include <fits.h>
extern char* fitsnum(double x);
ftype fits;
int main(int argc,char**argv) {
int i=1,j,ver=0;
char *str;
if (argc>=2 && !strcasecmp(argv[1],"-full")) {
ver=1;
i++;
}
for (;i<argc;i++) {
fclose(readfitsh(argv[i],&fits,0));
if (!ver) {
if (fits.img.Z<2) printf("... |
C | #include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>
int main()
{
int status;
int pid1 = fork();
if(pid1 == 0)
{
printf("\n2 my=%d pid=%d ppid=%d",pid1, getpid(), getppid());
return 0;
}
else
{
printf("This goes to buffer");
fflush(stdout); //flush or else child process will have same buffer as p... |
C | #include "header.h"
extern pthread_mutex_t mtx;
extern pthread_cond_t cond_empty;
extern pthread_cond_t cond_full;
extern Queue* workQueue;
extern pthread_t *cons;
extern int thread_pool_size;
extern int flag;
Queue* createQueue()
{
Queue* _queue = (Queue *)malloc( sizeof( Queue ) );
_queue->head = _queue->la... |
C | #include "llist_iter.h"
void list_foreach(const llist* lst, void (*iter_fun) (int)) {
while (lst != NULL) {
iter_fun(lst->el);
lst = lst->rest;
}
}
void list_foreach_ctx(const llist* lst, void* context, void (*iter_fun) (int, void*)) {
while (lst != NULL) {
iter_fun(lst->el, context);
lst = lst-... |
C | #include <stdio.h>
/*
条件分支语句:
1.
if (condition) {
statement;
}
2.
if (condition) {
满足语句;
} else {
否则;
}
3.
if (condition1) {
} else if (condition2) {
} else if (condition3) {
} else {
}
4.
switch (常量值/常量表达式) {
case value1:
statement1;
break; // 结束分支
case value2:
....... |
C | //
// Created by dcat on 10/11/17.
//
#include <env.h>
#include <str.h>
#include <umem.h>
#include <print.h>
#include <syscall.h>
#include "uexec.h"
extern uchar_t *memcpy(void *dest, void *src, int count);
int find_in_path(const char *file, char *pathbuff) {
const char *path = getenv("PATH");
if (path == NU... |
C | /* send.c - send */
#include <conf.h>
#include <kernel.h>
#include <proc.h>
#include <stdio.h>
#include "lab0.h"
extern int summarizeProcess;
/*------------------------------------------------------------------------
* send -- send a message to another process
*---------------------------------------------------... |
C | #include <stdio.h>
#include <assert.h>
int missingNumber0(int* nums, int numsSize) {
long long sum = 0;
int i;
for (i = 0; i < numsSize; i++) {
sum += nums[i];
}
long long prod = (numsSize + 1) * numsSize / 2;
return prod - sum;
}
int missingNumber(int* nums, int numsSize) {
int ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.