language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* delete_struct.c :+: :+: :+: ... |
C | //
// main.c
// 01数据类型
//
// Created by FCNA01 on 2018/12/18.
// Copyright © 2018年 FCNA01. All rights reserved.
//
#include <stdio.h>
int main(int argc, const char * argv[]) {
/**
基本类型
1.整型
2.浮点型
unsigned:无符号,即没有负数部分
char 1 字节
short ... |
C | #include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[])
{
int a[50],b[50],c[100],l1,l2,l3,i,j,k;
// input in first array start
printf("please enter the length of the first array:-");
sca... |
C | #include <stdio.h>
int arr[500001], temp[500001];
void mergesort(int s, int e);
void merge(int s1, int e1, int s2, int e2);
int main() {
int n, ans;
scanf("%d %d", &n, &ans);
getchar();
for(int i=0; i<n; i++) {
scanf("%d", &arr[i]);
getchar();
}
mergesort(0, n-1);
printf("%d\n", arr[ans-1]);
return 0;
}
... |
C | #ifndef GLSL_ALGO_RW_TYPES_H
#define GLSL_ALGO_RW_TYPES_H
#ifdef __cplusplus
extern "C"{
#endif
typedef enum
{
GARWTint1,
GARWTint2,
GARWTint4,
GARWTuint1,
GARWTuint2,
GARWTuint4,
GARWTfloat1,
GARWTfloat2,
GARWTfloat4,
GARWTundefined
} GLSL_ALGO_READ_WRITE_TYPE;
... |
C | /*
* leetcode
* 9. Palindrome Number AC
* zhao xiaodong
*/
bool isPalindrome(int x) {
int a = x;
int num =0;
while(a>0){
num = num*10 + a%10;
a = a/10;
}
return num==x?true:false;
}
/*
* Note:
* c版:
* 三目运算符竟然比if else还要快好多
*/ |
C | #include <stdio.h>
#define MAX 20
int binary(int array[], int low, int high, int key);
int main() {
int i, n = MAX - 1, key, index, low, high;
int array[MAX];
printf("\nEnter Size of Array : ");
scanf("%d", &n);
printf("\nEnter Elements of Array in sorted order : ");
for (i = 0; i < n; i++) ... |
C | //QUESTAO 1
//dado um intervalo definido por a e b, desenvolver uma funcao que determine quantas potencias de 2 existem nesse intervalo e qual a ultima potencia
#include<stdio.h>
int funcao(int a, int b,int *pos);
void main()
{
int a, b,pos,resp;
printf("Digite um numero para iniciar o intervalo : \n");... |
C | #include <stdio.h> /* getchar, printf */
#include <stdlib.h> /* NULL, malloc, free */
#include <string.h> /* strcpy */
#include <ctype.h> /* isspace, isdigit, isapotEqha, isalnum */
#include <assert.h> /* assert */
#include "scanner.h"
#include "evalExp.h"
#include "recognizeExp.h"
/* to do:
* - variables... |
C | /*
shows the ternary operations on function call & input variable
*/
#include <stdio.h>
int f1(int n);
int f2(void);
int main (void)
{
int t;
printf("enter a number : \n");
scanf("%d", &t);
t? f1(t)+f2() : printf("Zero has been entered\n");
return 0;
}
int f1(int n)
{
printf("%d:",n);
r... |
C | /*
Elaborar un programa que obtenga la suma de dos vectores de 100 elementos enteros utilizando 5 hilos
*/
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
int array1[100];
int array2[100];
int arrayR[100];
void *sumaArreglos (void *indice);
void llenaVectores();
void main() {
pthread_t hilos[5];
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "Employee.h"
#include "utn2.h"
/** \brief Reserva espacio de memoria para la estructura Empleado.
* \return Employee* retorna la direccion de memoria reservada.
*/
Employee* empleado_new(void)
{
return (Employee*) malloc(sizeof(Employee));
}
/** \... |
C | #include "image.h"
#include "log.h"
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define TWOPI 6.2831853
image make_ones_image(int w, int h, int c) {
image im = make_image(w, h, c);
for (int i = 0; i < im.w * im.h * im.c; i++) {
im.data[i] = 1;
}
return i... |
C |
// #define DOS
#ifdef DOS
#define M_PI 3.14159265358979323846
#include "SDL.h"
#define DEBUGTOFILE
#else
#include <SDL.h>
// #include <sched.h>
#endif
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#include <SDL.h>
#define regPixel(surface,x,y) ( (*(Uint32 *)(((Uint8 *)((surface)->pixels... |
C | #include<stdio.h>
#include<math.h>
int main()
{
int i=1;
double d,n;
while(scanf("%lf",&d)==1)
{
if(d==0) break;
n=ceil((3+sqrt(9+8*d))/2);
printf("Case %d: %.0lf\n",i++,n);
}
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include "Date.h"
struct Date* CreateDate(int day,int month, int year){
struct Date* p_Date = NULL;
p_Date = (struct Date*)malloc(sizeof(struct Date));
if(p_Date == NULL){
printf("Memory Allocation Failed");
return NULL;
... |
C | //
// Created by yekai on 2021/7/23.
//
#include "CorelessMotor.h"
#include "gpio.h"
#include "tim.h"
const uint16_t SPEED_MAX = 2100;
const uint16_t SPEED_MIN = 600;
void LMotor_SetSpeed(int16_t speed) {
if (speed > SPEED_MAX){
speed = SPEED_MAX;
}
if (speed < SPEED_MIN){
speed = SPEED_M... |
C | #include <RASLib/inc/common.h>
#include <RASLib/inc/gpio.h>
#include <RASLib/inc/time.h>
#include <RASLib/inc/motor.h>
#include <RASLib/inc/adc.h>
static tMotor *leftMotor;
static tMotor *rightMotor;
static tADC *light[3];
tBoolean blink_on = true;
void blink(void)
{
SetPin(PIN_F3, blink_on);
blink_on... |
C | #include <stdio.h>
#include <stdlib.h>
int my_putchar(char c)
{
return (write(1, &c, 1));
}
int my_putstr(char *str)
{
int i;
i = 0;
while (str[i])
{
my_putchar(str[i]);
i++;
}
return (i);
}
int my_strlen(char *str)
{
int i;
i = 0;
while (str[i])
i++;
return (i);
}
int m... |
C | /* ----- Example of pointer arithmetic. ----- */
#include <stdio.h>
#include <stdio.h>
#include <string.h>
int main(void) {
char multiple[] = "a string";
char *p = multiple;
/*
Loops through the whole string showing two methods of printing the actual character and
two methods of showing the memory... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unitcl/unitcl.h>
TEST(Analise, ListarTecnicos) {
printf("Sera? \n");
int i = 1;
ASSERT(i == 3)
}
TEST(Analise, ListarTecnico) {
printf("Outra funcao? \n");
int i = 1;
ASSERT(i == 3)
}
TEST(CadastroUsoAgua, ListarIntervencoes) {
printf("Canal \n");
int i = 8;
... |
C | #include <or1k-support.h>
#include <spr-defs.h>
#include <stdio.h>
char* i2c_base = (char*) 0xa0000000; //(start + write byte)
char* i2c_write = (char*) 0xa0000001; //(write byte)
char* i2c_write_stop = (char*) 0xa0000002; //(write byte + stop)
char* i2c_read = (char*) 0xa0000003; //read byte
char* i2c_read_stop ... |
C | // Revision:
// 2/4/2011 - added slice_seek and row_seek variables to reduce the number of operations
// in the tripple loop.
// Removed the custom hpsort function in this file.
// Modified medianFilter so that the hpsort function in hpsort.c is used,
// which indexes from 0 rather than 1.
// Added the nv variable.
//... |
C | int s(int m);
int p(int m,int i,int a[100]);
void e(int i,int c[100],int d[100],int m,int n);
int main()
{
int i,m,n,a[100],b[100],c[100],d[100];
scanf("%d%d",&m,&n);
for(i=0;i<m;i++) a[i]=s(i);
for(i=0;i<n;i++) b[i]=s(i);
for(i=0;i<m;i++) c[i]=p(m,i,a);
for(i=0;i<n;i++) d[i]=p(n,i,b);
for(i=0;i<m+n;i... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "closest.h"
struct duration {
int minutes;
schedule* flight;
};
schedule flights[] = {
{"8:00am", "10:16am"},
{"9:43am", "11:52am"},
{"11:19am", "1:31pm"},
{"12:47pm", "3:00pm"}
};
int sincemidnight(char* time) {
int hou... |
C | #include <stdio.h>
//超级块结构
struct filesys {
unsigned int s_size; //总大小
unsigned int s_itsize; //inode表大小
unsigned int s_freeinodesize; //空闲i节点的数量
uns... |
C | #include <stdio.h>
int main(void)
{
int u, v;
float r;
printf("Enter your two numbers\n");
scanf("%i %i", &u, &v);
if (v == 0)
printf("Divide by zero\n");
else
{
r = (float) u / v;
printf("%.3f\n", r);
}
return 0;
} |
C | #include <stdio.h>
#include <math.h>
int main(){
float raio,altura,volume,area,base,lado;
printf("digite a altura do cilindro: ");
scanf("%f",&altura);
printf("digite o raio do cilindro: ");
scanf("%f",&raio);
base = 2 * M_PI * pow(raio,2);
lado = 2 * M_PI * raio * altura;
area = b... |
C | //
// list.h
// dishiqizhang
//
// Created by mingyue on 15/12/3.
// Copyright © 2015年 G. All rights reserved.
//
#ifndef list_h
#define list_h
#include <stdio.h>
#include <stdbool.h>
#define TSIZE 45
struct film{
char title[TSIZE];
int rating;
};
//一般类型定义
typedef struct film Item;
typedef struct node{... |
C | #include"header.h"
int exec_shell_cmd(char *cmd_string,char *buf,int buf_len)
{
int res;
int pipefd[2];
pid_t cpid;
FILE *fp;
res = pipe(pipefd);
if (res == -1) {
exit(EXIT_FAILURE);
}
cpid = fork();
if (cpid == -1) {
... |
C | // C program to find the maximum number of handshakesM
#include<stdio.h>
int main()
{
//fill the code
int num;
scanf("%d",&num);
int total = num * (num-1) / 2; // Combination nC2
printf("%d",total);
return 0;
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<stdlib.h>
//Program to show a basic structure and how to acces its members.
struct Point{
int x,y;
char ch;
int* pointer;
};
int main(){
struct Point p1 = {1,0,'a'};
//the pointer points to nil.
printf("%d %d %c %p",p1.x,p1.y,p1.ch, p1.pointer);
} |
C | /*
** print_tab.c for imprime tableau in /u/epitech_2012/jaspar_y/public/42sh
**
** Made by sylvain tissier
** Login <tissie_s@epitech.net>
**
** Started on Tue May 27 15:10:26 2008 sylvain tissier
** Last update Thu Jun 12 19:23:02 2008 sylvain tissier
*/
#include "sh.h"
void print_tab(char **str)
{
int i;
... |
C | #include "lists.h"
/**
* add_nodeint_end - add a new node to a list in the end
(* a blank line
*@head: the head of list
*@n: the integer to put in the new node
* Description: add a new node to a list in the end)?
(* section header: the header of this function is lists.h)*
* Return: the head of the list.
*/
listint_t *... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/wait.h>
int main(){
/* int sneaky_pid = getpid(); */
/* char parameter[200]; */
/* sprintf(parameter, "insmod ./sneaky_mod.ko sneaky_pid=%d\n", sneaky_pid); */
/* printf("parameter is : %s\n", parameter); */
/* sy... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include "bst.h"
/*
This is simple I/O test client for bst.c that
uses a very specific input format.
Failure to follow format might lead to undefined behaviour.
l: print bst_size
i INT: bst_insert
f INT: print bst_find
s INT: print... |
C | #ifndef __TYPES_H___
#define __TYPES_H___
/*!
\file types.h
\version 1.0
\date 11-06-14
\brief Contient les prototypes des types structurés utilés dans le projet
\remarks Aucune
*/
/*Librairies de base*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <malloc.h>
#include <string.h>
/*!
\struct str... |
C | /*
* 图11.8 tcp_listen函数:执行服务器程序的一般操作步骤
* */
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <strings.h>
#include <stdlib.h>
#include <unistd.h>
#define LISTENQ 5
int
tcp_listen(const char *host,const char *serv,socklen_t *addrlenp)
{
int listenfd;
int n;
... |
C | #include <stdio.h>
#include <time.h>
int main(void) {
struct tm t;
int n;
t.tm_sec = 0;
t.tm_min = 0;
t.tm_hour = 0;
t.tm_isdst = -1; // 夏令时标识符
printf("Enter month (1-12): ");
scanf("%d", &t.tm_mon);
t.tm_mon--;
printf("Enter day (1-31): ");
scanf("%d", &t.tm_mday);
printf("Enter year (1900... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct
{
int size;
int top;
int *S;
} Stack;
void init(Stack *stack, int size)
{
stack->size = size;
stack->top = -1;
stack->S = malloc(sizeof(int) * size);
}
int isEmpty(Stack *stack)
{
return stack->top == -1;
}
int isFull(Stack *stack)
{
... |
C | #include <stdio.h>
#include "BaseData.h"
int main(int argc, const char* argv[])
{
int i;
int a[10] = {3,2,1,4,5,6,8,7,9,0};
BiTree T = NULL;
Status taller;
for (i = 0; i < 10; i++) {
InsertAVL(&T, a[i], &taller);
}
Print_Tree(&T);
} |
C | /***********************************************************/
// File Name : 2.8.c
// Author : Donald Zhuang
// E-Mail :
// Create Time : Mon 30 Jan 2017 06:33:18 AM PST
/**********************************************************/
#include <stdio.h>
int int_length( void )
{
unsigned in... |
C | /** @file
* @brief Source file with cicle buffer functions
*/
#include <stdlib.h>
#include "buffer.h"
#include "assert.h"
#define BUFFER_MIDDLE (BUFFER_SIZE>>1)
typedef struct
{
uint8_t data[BUFFER_SIZE];
uint32_t lastIdx;
uint32_t curIdx;
bool ... |
C | #include <string.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/wait.h>
#define RANDOM "/dev/urandom"
#define SIZE 8
#define ESIZE 10
static const char en85[] = {
'0', '1', ... |
C | #include "final.h"
void historial (User * onlineUser){
char * string=malloc(sizeof(char)*150);
MYSQL_RES * resGeneral=NULL;
MYSQL_ROW rowGeneral;
MYSQL_RES * res=NULL;
MYSQL_ROW row;
int anio;
sprintf(string,"SELECT id, titulo, estreno, valor, fecha FROM peliculas, votos WHERE votos.user=%d AND peliculas.id=vot... |
C | #include<stdio.h>
#include<string.h>
int isprime(int n)
{
int i;
if(n<=1)return 0;
for(i=2;i*i<=n;i++)
if(n%i==0)return 0;
return 1;
}
int main()
{
int m,n;
scanf("%d %d",&m,&n);
char a[m+1];
scanf("%s",a);
int i,j;
int count=0,t=0;
for(i=0;i<strlen(a);i++)
{
... |
C | #include<stdio.h>
int main()
{
// Ʈ
// << : ǿ 2 ȯϰ, ̵Ų
// 10 << 1 : ڴ 2 Ű, 2 ( ) ڿ Ѵ
// >> : ǿ 2 ȯϰ, ̵Ų
// ݴ
printf("%d\n", 10 << 1);
printf("%d\n", 10 << 2);
printf("%d\n", 10 << 3);
printf("%d\n", 10 << 4);
printf("\n");
printf("%d\n", 10 >> 1);
printf("%d\n", 10 >> 2);
print... |
C | /**
* A simple (non-standards-compliants?) 'yes' implementation for fun
**/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define EVER ;;
int main(int argc, char **argv)
{
int current_arg;
if (argc < 2)
for (EVER) {
if (puts("y") == EOF)
goto err;
}
... |
C | /*
* Ted Meyer
*/
#include<stdio.h>
typedef enum { false, true } bool;
int main(void) {
// function declarations
void printMonth(int days, int first);
bool isLeap(int year);
int getNextStartDay(int currentStart, int month);
int year;
printf("Please enter year for this calendar:- ");
scanf("%i", &year);
pr... |
C | #ifndef UASDKIOBASE_H_
#define UASDKIOBASE_H_
#include <termios.h>
#include <stdint.h>
#include <time.h>
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
#pragma region baudrate
typedef enum {
UASDKbyteformat_N1, // no parity, 1 stop bit
UASDKbyteformat_E1, // even parity, 1 stop bit
U... |
C | #include <stdio.h>
// 迷宫问题指的是:在给定区域内,找到一条甚至所有从某个位置到另一个位置的移动路线。
// 迷宫问题就可以采用回溯算法解决,即从起点开始,采用不断“回溯”的方式逐一试探所有的移动路线,最终找到可以到达终点的路线。
typedef enum { false, true } bool;
#define ROW 5
#define COL 5
// 假设当前迷宫中没有起点到终点的路线
bool find = false;
// 回溯算法查找可行路线
void maze_puzzle(char maze[ROW][COL], int row, int col, int outrow, int ou... |
C | /* Find Minimum Cost Spanning Tree of a given undirected graph using Kruskals algorithm.*/
#include<stdio.h>
int parent[30];
int find(int i)
{
while (parent[i]!=i)
i = parent[i];
return i;
}
void unionv(int i, int j)
{
int a = find(i);
int b = find(j);
parent[a] = b;
}
... |
C | /* Purpose: sub function f(x) = x^3 + 2x^2 + 1, and return result to main */
/* File Name: hw07_05 */
/* Completion Date: 20210530 */
#include <stdio.h>
#include <stdlib.h>
int FofX(int);
int main(void)
{
int input, result;
printf("Please input an integer x for f(x) = f(x) = x^3 + 2x^2 + 1\n");
sc... |
C | #include "TimerService.h"
#include "asuro.h"
#include <stdbool.h>
#define MAX_TIMERS 5
struct _timer_entry {
unsigned int duration;
unsigned int current;
timer_func func;
void *data;
};
volatile timer_entry timers[MAX_TIMERS];
volatile bool did_init;
void init_timer() {
TCCR0 = 0b011;
TCNT0 = 130;
TIMSK |= 1;... |
C | /**
* Here we implement the Simulated Annealing algorithm with
* exponential temperature schedule with iterative restarts.
*
* The problem with simulated annealing is that it has several
* parameters that need to be configured well in order for it
* to work.
* The proper configuration of the parameters depends o... |
C | #include "main.h"
/**
* * add - add two numbers from input
* * @a: first aparamet
* * @b: second parameter
* *
* * Description: adds two numbers
* * Return: Always (0).
* */
int add(int a, int b)
{
return (a + b);
}
|
C | #include <stdio.h>
#include "interpreter.h"
#include "parser.h"
#include "tokens.h"
#include "tree.h"
// TODO: message d'erreur
static void match(enum token_type first, Token *lookahead);
static Tree statement(Token *lookahead);
static Tree expression(Token *lookahead);
static Tree id_followup(Token *lookahead, Tree... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int num, *arr, i;
scanf("%d", &num);
arr = (int*) malloc(num * sizeof(int));
for(i = 0; i < num; i++) {
scanf("%d", arr + i);
}
//Array Reversal
for (size_t j = 0; j < num/2; j++) {
int temp = *(arr+j);
*(arr+j) = *(a... |
C | #include <rmath.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <math.h>
#include <assert.h>
matf*
matf_new(const size_t rows, const size_t cols)
{
matf *C = malloc(sizeof(matf));
C->rows = rows;
C->cols = cols;
C->v = calloc(rows * cols, sizeof(float));
return C;
}
matf*
matf_cpy(matf *M)... |
C | #include <core/types.h>
#include <core/spinlock.h>
#include <core/startup.h>
#include <core/string.h>
void
spinlock_init(struct spinlock *lock, const char *name, unsigned flags)
{
ASSERT((flags & SPINLOCK_FLAG_VALID) == 0, "Must not set valid flag.");
lock->s_name = name;
lock->s_owner = CPU_ID_INVALID;
lock->s_ne... |
C | #include<linux/module.h>
#include<linux/kernel.h>
#include<linux/proc_fs.h> /* use the proc fs */
#include<asm/uaccess.h> /* for copy_from_user */
#include<linux/init.h>
#include<linux/vmalloc.h>
#include<linux/string.h>
#define PROCFS_MAX_SIZE 1024
#define PROCFS_NAME "buffer1k"
static struct proc_dir_entry *my_... |
C | /*
$Id: serpent-test.c,v 1.13 1998/06/07 08:11:09 fms Exp $
# This file is part of the C reference implementation of Serpent.
#
# Written by Frank Stajano,
# Olivetti Oracle Research Laboratory <http://www.orl.co.uk/~fms/> and
# Cambridge University Computer Laboratory <http://www.cl.cam.ac.uk/~fms2... |
C | // Lab 3.1 Questin 1
// Inbasekaran.P 201EC226
/*To determine whether a character entered is in lowercase, uppercase, digit or a
special character.*/
// For printf() and scanf()
#include <stdio.h>
// Including stdlib for system("clear") to clear the screen in the terminal.
#include <stdlib.h>
int main()
{
// To cl... |
C | #include<stdio.h>
void main()
{
char usr[20], pwd[20];
printf("Enter your username : ");
gets(usr);
printf("Enter your password : ");
gets(pwd);
if((strcmp(usr,"admin")==0)&&(strcmp(pwd,"123")==0))
{
printf("login successful!");
}
else
{
printf("login failed!");
... |
C | #include <stdio.h>
int main(){
int n, ans = 0, num;
scanf("%d",&n);
for(int i = 0; i < n; i++){
scanf("%d",&num);
ans ^= num;
}
printf("%d\n",ans);
} |
C | /*
Autor : Linda von Groote
Klasse : FI12
Dateiname : SpielerBewertung.c
Datum : 16. Mrz 2009
*/
#include "Funktionen.h"
void spielerBewertung( int iSpielTyp, int iGewonnen)
/* Ruft die Berechnung der neuen Elo-Zahlen fr den jeweiligen Gewinner des Spiels auf.
1. iSpielTyp : Typ des gespielten Spiels (z. B. Vier ge... |
C | //2015041050 허준수 임베디드 시스템 과제
#include<stdio.h> //입출력을 위한 라이브러리 선언
#include<stdlib.h> //atoi, exit을 위한 라이브러리 선언
#include<unistd.h> //서버 소켓을 닫기 위한 라이브러리 선언
#include<string.h> //문자열 처리를 위한 라이브러리 선언
#include<arpa/inet.h> //ip주소 처리를 위한 라이브러리 선언
#include<sys/socket.h> //소켓 처리를 위한 라이브러리 선언
#include<pthread.... |
C | #include<stdio.h>
struct node
{
int player_id;
struct node *next;
};
struct node *start,*ptr,*new_node;
int main()
{
int n,k,i,count;
printf("\nEnter the number of players:");
scanf("%d",&n);
printf("\nEnter the value of k (every kth players gets eliminated):");
scanf("%d",&k);
... |
C | #include "Display_Time.h"
#include <string.h>
#include "../Scenes.h"
void Display_Time_ctor(Display_Time* self, char* prefix, float* display_times, grText_Renderer* text_r, float x) {
*self = (Display_Time){
.prefix = strdup(prefix),
.prefix_length = strlen(prefix),
.display_times = display_times,
... |
C | #include <stdio.h>
#include <unistd.h>
#include <getopt.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <dirent.h>
#include <signal.h>
#include <fcntl.h>
#include <errno.h>
#define FIFO_NAME "fifo-sp06"
char file_path[PATH_MAX + 1];
int id_ = 0;
... |
C | /* Author: Rodolfo Reyes
* Lab Section: 23
* Assignment: Lab 2 Exercise 2
* Exercise Description: Parking space counter
*
* I acknowledge all content contained herein, excluding template or example
* code, is my own original work.
*/
#include <avr/io.h>
#ifdef _SIMULATE_
#include ... |
C | Bug report on Kyle's:
Bug 1:
Date: 2/20/2016
Reported By: Ava Petley
email: petleya@oregonstate.edu
File: dominion.c
Function: smithy
Description: Two tests revealed an error with smithy function. The test are cardtest1 and randomtestcard.
The handcount of the current player is incorrect and another players status ... |
C | /*
Zachary Osborne
Lab02
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void stringToNum()
{
char clearBuffer[10];
fgets(clearBuffer, 10, stdin);
char input[10];
printf("Enter a string: \n");
fgets(input, 10, stdin);
int len = strlen(input);
printf(".-----------------.... |
C | #include "libmx.h"
void *mx_memrchr(const void *s, int c, size_t n) {
char *str = NULL;
int len;
if (s) {
str = (char *) s;
len = mx_strlen(str) - 1;
while (len >= 0 && n != 0) {
if (str[len] == c)
return &str[len];
n--;
len--;
... |
C | #include "kernel/types.h"
#include "kernel/stat.h"
#include "user/user.h"
int main(int argc, char *argv[]){
if(argc<2) {
fprintf(2,"error:no argument\n");
exit(1);
}
const char * ticksStr=argv[1];
int ticks=atoi(ticksStr);
sleep(ticks);
exit(0);
} |
C | #include<stdio.h>
#include<string.h>
void main()
{
char str[100];
int i,len;
len=strlen(str);
for(i=len-1;i>0;i++)
{
printf("%c",str[i]);
}
}
|
C | // PA2
// CMPS 101 Tantalo Spring 2019
// Aaron Nguyen
// anguy200
// 1585632
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include"List.h"
#define MAX_LEN 180
int main(int argc, char* argv[]){
int linecount = 0;
FILE *in, *out;
char line[MAX_LEN];
// check command line for correct number o... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* libft.h :+: :+: :+... |
C | #include "world.h"
#include <stdlib.h>
#include <stdint.h>
#include <float.h>
typedef struct {
AbsolutePoint pos;
AbsolutePoint vel;
} VelocityPoint;
// Points at which we discovered an arena border.
static AbsolutePoint arena_border_points[MAX_BORDER_POINTS];
static unsigned num_arena_border_points;
static u... |
C | #include <stdio.h>
#include <malloc.h>
int** matMult(int **a, int **b, int size){
// (4) Implement your matrix multiplication here. You will need to create a new matrix to store the product.
//int** result;
int** result = (int**)malloc(size * sizeof(int*));
for(int i = 0; i<size; i++){
*(result+... |
C | void main()
{
int n,a=0,b=0,c=0,d=0,i,m;
double a1,b1,c1,d1;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&m);
if(m<=18)
a++;
else if(m>18&&m<36)
b++;
else if(m>35&&m<61)
c++;
else
d++;
}
a1=(double)a/n*100; b1=(double)b/n*100;
c1=(double)c/n*100; d1=(double)d/n*100;
printf("... |
C | // Histogram Equalization
#include <wb.h>
#define HISTOGRAM_LENGTH 256
//@@ insert code here
__global__ void floattochar(float *im, unsigned char *imc)
{
int i = blockDim.x*blockIdx.x + threadIdx.x;
int j = blockDim.y*blockIdx.y + threadIdx.y;
imc[j][i] = (unsigned char) (255 * im[j][i]);
}
__global__ void r... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include "lz-dict.h"
#include "debug.h"
#include "compress.h"
#include "hash.h"
#include "parse.h"
int compress(const char *inBuf,int inBufLen,unsigned char *outBuf,int outBufLen,int *pNumParsed)
{
char tempBuf[256];
char tempOutBuf[256];
int Len=inBufLen;... |
C | // Analog accelerometer app
//
// Reads data from the ADXL327 analog accelerometer
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "app_error.h"
#include "nrf.h"
#include "nrf_delay.h"
#include "nrf_gpio.h"
#include "nrf_log.h"
#include "nrf_log_ctrl.h"
#include "nrf_log_default_backends.h"
#incl... |
C | // Copyright: Ramiro Polla
// License: WTFPL
// text to image converter
#include <inttypes.h>
#include <limits.h>
#include <float.h>
#include "algo_txt2img.h"
#include "font.c"
void txt2img_convert(uint8_t *out_data, const char *in_data, size_t in_w, size_t in_h)
{
size_t out_stride = in_w * TXT2IMG_CHAR_W;
for (... |
C | #include <stdio.h>
main()
{
int contador, n, altura=0, distancia=0, direcao=0;
char comando;
scanf("%i", &n);
for(contador=1; contador<=n; contador++)
{
if(comando == 'V')
{
//Se direcao = 0, O balão está indo para frente.
//Se direcao = 1, O balão está voltando.... |
C | #include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#define BUFFER_SIZE 40
int map[50][50] = {0};
void valid (int turn, int cx, int cy, int *nx, int *ny) {
int dir[4][2] = {{1, 0}, {-1, 0}, {0, -1}, {0, 1... |
C | /*
** EPITECH PROJECT, 2017
** struct.h
** File description:
** struct declaration file
*/
#ifndef TOOLS_H_
#define TOOLS_H_
#include "main.h"
typedef struct spec_s {
char spec_pf;
int (*spec_p)(va_list ap, int ct, char *str, char *str_temp);
} spec_t;
typedef struct length_s {
char *sep_pf;
int (*sep_... |
C | #include <stdio.h>
int main(int argc, char *argv[]){
printf("El programa que estas ejecutando es: %s\n",argv[0]);
char *datos;
FILE *fp;
if(argc==2){
datos=argv[1];
printf("El nombre del archivo a abrir es: %s\n",datos);
fp=fopen(datos,"W+");//aqui se pondra todo lo que se quiere hacer...
fclose(fp);
}
else... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <sys/time.h>
#include <time.h>
#define X 640
#define Y 480
#define YMIN 0
#define YMAX 1
// #define XMAX 1.166
// #define XMIN -0.166
#define XMAX 1.166
#define XMIN -0.166
#define EPSILON 0.00000000001
#define AMBIENT .2
#define REFLECT .4
#define B... |
C | // An intro to functions
#include <stdio.h>
int get_larger(int first_num, int second_num);
int main(void) {
//int num;
//int scanf_return = scanf("%d", &num);
int num1 = 7;
int num2 = 2;
int bigger_num = get_larger(num1, num2);
printf("%d\n", bigger_num);
return 0;
}
... |
C | #include <stdio.h>
void do_loop(void)
{
static int loop = 0;
printf("-- %d --\n",loop);
switch(loop)
{
case 7:
loop = 0;
break;
default:
loop++;
break;
}
}
int main(void)
{
while(1)
{
do_loop();
sleep(1);
}
}
|
C | #include<stdio.h>
void main()
{
int n,k;
scanf("%d%d",&n,&k);
if((n+k)%2==0)
printf("Even");
else
printf("Odd");
}
|
C | #include <stdio.h>
#include <stdlib.h>
#define tSize 100 // Tree Size
typedef struct _node {
char data;
struct _node *left;
struct _node *right;
} node;
int front = 0, rear = 0; // Init with 0 - Queue Initializing
node *nBuf[2]; // nBuf[0] for Head_Node, nBuf[1] for End_Node
node *nTree[3]; // nTree[0] for parent... |
C | /*
serPASE_ver01
Interface: Linear-Algebraic (IJ)
Compile with: make serPASE_ver01
Sample run: serPASE_ver01 -blockSize 20 -n 100 -maxLevels 6
Description: This example solves the 2-D Laplacian eigenvalue
problem with zero boundary conditions on an nxn grid.
T... |
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>
#include <arpa/inet.h>
#include <netdb.h>
#define PORT 9034
// port we’re listening on
#define STDIN 0
char* get_ip(char* to){
if(strcmp(to,"shivam")==0)return "192.1... |
C | /* INSTRUCTIONS
Write a program that asks for the students' exam scores (using integers 4 to 10) and calculates the average. The program must accept scores until entry is terminated by a negative integer. Finally, the program prints out the number of scores and the calculated average with two decimal places of precis... |
C |
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <time.h>
#include <sys/time.h>
#include "pcie_memmap.h"
//#define N 13 // qtd de coeficientes
#define VERBOSO
int main()
{
unsigned int qtde_nums = 128;
FILE * fp_entrada = fopen("entrada.dat",... |
C |
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
unsigned char ubuf[6];
void led_on(int fd, int num)
{
if (num == 1)
ioctl(fd, 0, num);
else if (num == 2)
ioctl(fd, 0, num);
else if (num == 3)
ioctl(fd, 0, num);... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.