language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /*
* C Program to Implement a strpbrk() Function
*/
#include <stdio.h>
char* strpbrk(char *, char *);
int main()
{
char string1[50], string2[50];
char *pos;
printf("Enter the String:
");
scanf(" %[^
]s", string1);
printf("
Enter the Charac... |
C | #include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "cpu.h"
#define DATA_LEN 6
/**
* Load the binary bytes from a .ls8 source file into a RAM array
*/
void cpu_load(struct cpu *cpu, char *filename)
{
//open file
FILE *fptr = fopen(filename, "r");
if (fptr == NULL)
{
printf("File %s is... |
C | #include<stdio.h>
#include<conio.h>
void main()
{
char choice,answer='y';
printf("Enter a number : \n");
fflush(stdin);
scanf("%c",&choice);
do
{
if(choice=='a')
{
printf("Lower case \n");
}
else if(choice=='A')
{
... |
C | /*
* This is Linux ONLY code
* Do not compile on windows
* compile this file using the command
* g++ -fopenmp loadtest.C -o loadtest
* once compilation is successful run the test using
* ./loadtest
* Ctrl C to stop the test
*/
#include <iostream>
#include <fstream>
#include <cmath>
#include <unistd.h>
#include... |
C | /*
Copyright (c) 2002, 2004, Christopher Clark
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditi... |
C | #include <stdio.h>
int main()
{
int i,j,tam;
printf("\n entre com o tamanho do quadrado [4-80]");
scanf("%d",&tam);
for(i=1;i<=tam;i++)
{
for(j=1;j<=tam;j++)
{
if(i==1||i==tam)
printf("#");
else if(j==1||j==tam)
printf("#");
else
prin... |
C | #ifndef PARSER_H
#define PARSER_H
#include <stdlib.h>
#include "value.h"
#include "talloc.h"
/*
* Takes a linked list of tokens from a Scheme program (as in
* the output of your tokenizer), and it should return a pointer
* to a parse tree representing that program.
*/
Value *parse(Value *tokens);
/*
* display a pars... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct neighbor{
int num;
struct neighbor *next;
} AS_neighbor;
/*
* Estrutura que guarda o ASN e os vizinhos
*/
typedef struct asnode{
AS_neighbor *customers;
AS_neighbor *peers;
AS_neighbor *providers;
} AS_node;
typedef struct astopnode{
int asn;
AS_ne... |
C | #ifndef _A01b_H
#define _A01b_H
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <math.h>
#include <string.h>
#include <sys/time.h>
typedef struct{
size_t sizeX,
sizeY,
number;
double *element;
} matrix;
void init_(matrix *TARGET) {
TARGET->sizeX = 0;
TARGET->sizeY = 0;... |
C | //
// Created by Anirudh on 30/03/21.
//
#ifndef PS5_NODE_H
#define PS5_NODE_H
enum type_of_value{
OPERATOR,
NUMBER
};
enum type_of_operation{
LEFT_BRACKET,
RIGHT_BRACKET,
ADDITION,
SUBTRACTION,
MULTIPLICATION,
DIVISION,
EXPONENTIATION
};
typedef struct node{
union{
... |
C | #include<stdio.h>
#include<math.h>
void round_money(double *val)
{
*val =((int)(*val * 100 + .5) / 100.0);
}
void chargers(double h,double *charge,double *avg)
{
if(h<=10)
*charge=7.99;
else
{
double h1=ceil(h);
*charge=7.99+(1.99*(h1-10));
}
*avg=*charge/h;
round_money(charge);
round_mone... |
C | #include <stdio.h>
#include <stdlib.h>
int main(int argc, char const *argv[])
{
char c[1000];
FILE *restrict fptr;
if ((fptr = fopen("singcl.txt", "r")) == NULL)
{
printf("Error,! opening file");
exit(1);
}
fscanf(fptr, "%[^\n]", c);
printf("The string: \n%s", c);
fclo... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_parser.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdarg.h>
void printlns(char *fst, ...) {
char *str;
va_list vl;
str = fst;
va_start(vl, fst);
do {
printf("%s\n", str);
str = va_arg(vl, char*);
} while (str != NULL);
va_end(vl);
}
int main(int argc, char *argv[]) {
printlns... |
C | #include<stdio.h>
#include<string.h>
int main(void)
{
char a[100];
int i,b,count=0;
gets(a);
b=strlen(a);
for(i=0;i<=b;i++)
{
if(((a[i]>=27 && a[i]<=47) && a[i]!=32)||(a[i]>=58 && a[i]<=64)||(a[i]>=91 && a[i]<=96)
||(a[i]>=123 && a[i]<=126))
{
count++;
}
}
... |
C | #include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
void eatMem(int time,int block_num)
{
int block = block_num;
int i =0; int j = 0;
int cell = 0.1 * 1024 * 1024;
char * pMem[block];
for(i = 0; i < block; i++)
{
pMem[i] = (char*)malloc(cell);
if(NUL... |
C | #include <stdlib.h>
#include <stdio.h>
#define BLOCK 128
#define MAX 1000000
int main(void){
int i = 0;
int j = 0;
FILE *fp;
// A buffer for the filename.
char file1[BLOCK];
char buffer[MAX];
printf("Please enter file to be read:\n");
printf("\nWarning: Your file will only be read in increme... |
C | #include "libft.h"
char *ft_substr(char const *s, unsigned int start, size_t len)
{
char *sub;
char *str;
unsigned int i;
unsigned int sub_size;
if (!s)
return (NULL);
if (start >= ft_strlen(s))
return (ft_strdup(""));
if (start + len <= ft_strlen(s))
sub_size = len;
else
sub_size = ft_strlen(s) -... |
C | //369Problem
//A number is said to be a 369 number if
//The count of 3s is equal to count of 6s and the count of 6s is equal to count of 9s. The count of 3s is at least 1. For Example 12369, 383676989, 396 all are 369 numbers whereas 213, 342143, 111 are not.
//Given A and B find how many 369 numbers are there in the i... |
C | /********************************************************************************/
/*PURPOSE: Gets radius and calculates area, diameter, and circumference. */
/*IMPLEMENTED BY: DAG */
/*DATE: 12/7/15 ... |
C | #include <iostream>
#include<string.h>
#include<string>
using namespace std;
char * bubblesort(char *,int);
int main()
{
int n,l,gp=0;
cin>>n;
string s[n];
char s1[100];
char *s2;
for(int i=0;i<n;i++)
{
cin>>s1;
l=strlen(s1);
s2=bubblesort(s1,l);
s[i]=s2;
}
... |
C | /*
* FILENAME: otp_enc_d.c
* DESCRIPTION: otp_enc_d serves as a sever to encrpyt messages
* Jared Tence
*/
#include "otp_tools.h"
// Error function used for reporting issues
void parseInput(char *, char *);
//runs the server
int main(int argc, char *argv[])
{
//initalizes values later to be used
int listenSocketFD, ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_pwd.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<math.h>
int main()
{
int t,i;
double x,y;
char str[1000];
scanf("%d",&t);
while(t--)
{
scanf(" %s",str);
x=y=0.0;
for(i=0;str[i];i++)
{
switch(str[i])
{
case 'A':x+=1; y+=0; break;
case 'B':x+=0.5; y+=sqrt(3)/2; break;
case 'C':x+=-0.5; y+=sqrt(3)/2;... |
C | #ifdef __cplusplus
#include <cmath>
#else
#include <math.h>
#endif
#ifndef M_PI
/* pi */
#define M_PI 3.14159265358979323846264338327950288
#endif
#ifndef M_PIf
/* pi (float) */
#define M_PIf 3.14159265358979323846264338327950288f
#endif
#ifndef M_PI_2
/* pi/2 */
#define M_PI_2 1.57079632679489661923132169163975144
... |
C | #include <stdlib.h>
#include <stdio.h>
#include "world.h"
void AddEntity(EntityNode **head, Entity *newEntity) {
EntityNode *currNode = *head;
EntityNode *newNode = newEntityNode(newEntity);
if (currNode) {
while (currNode->next) {
currNode = currNode->next;
}
currNode... |
C | /*
* activity.h
* banker
*
* Created by Yeison Rodriguez on 12/14/09.
* Copyright 2009 New York University. All rights reserved.
*
*/
/* An activity is a struct, which contains all of the information from one typical "line" of input. It also contains a next pointer, so that activity nodes may be arranged i... |
C | /*
** my_strcat_dyn.c for strcat dyn in /lib/
**
** Made by Frederic ODDOU
** Login oddou_f <frederic.oddou@epitech.eu>
**
** Started on Mon Mar 14 17:52:04 2016 Frederic ODDOU
** Last update Thu Apr 14 09:20:38 2016 Mizibi
*/
#include <stdlib.h>
#include "my.h"
char *my_strcat_fusion(char *dest, char *src)
{
uns... |
C | #include <stdio.h>
#include <cs50.h>
int main (void) {
int x = get_int("n: ");
int y = get_int("\ny: ");
if (x > y) printf("\n\nx is greater than y\n");
else if (x < y) printf("\n\nx is less than y\n");
else printf("\n\nx is equals to y\n");
}
|
C | #ifndef SNMP_PARSE_ARGS_H
#define SNMP_PARSE_ARGS_H
/**
* @file snmp_parse_args.h
*
* Support for initializing variables of type netsnmp_session from command
* line arguments
*/
#ifdef __cplusplus
extern "C" {
#endif
/** Don't enable any logging even if there is no -L argument */
#define NETSNMP_PARSE_ARGS_NOLO... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "prog2Utils.h"
// Structs do Programa
// Cliente
struct clients{
int id;
char name[51];
char address[51];
char phone[20];
float debt;
};
typedef struct clients clients;
// Produto
struct product{
int id;
char name[31];
floa... |
C | #include <stdio.h>
#include <stdlib.h>
#include "sddapi.h"
int main(int argc, char** argv) {
// set up vtree and manager
SddLiteral var_count = 4;
SddLiteral var_order[4] = {2,1,4,3};
const char* type = "balanced";
Vtree* vtree = sdd_vtree_new_with_var_order(var_count,var_order,type);
SddManager* manager... |
C | #include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <string.h>
#include <stdbool.h>
#define MAX_LEN 128 // Leitura maxima para imprimir a Logo
#define TAM_SEMANA 7 // Quantidades de dias na semana de Domingo a Sabado
// Cores para o console em ANSII
#define COR_VERMELHA "\033[1;31m"
#define COR_ROXA "... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>
#define BRWSR "chrome"
#define NBRWSR "iexplorer"
int main()
{
char str[30];
char browser[20];
printf("-------------------------------\n");
printf("| WebsiteVisit |\n");
printf("| ... |
C | #include "philo_one.h"
void print_output(t_philo *philo, char *output)
{
printf("%ld %d %s\n", philo->action_time, philo->name, output);
}
void philo_take_forks(t_philo *philo)
{
pthread_mutex_lock(&(philo->permission));
pthread_mutex_lock(&(philo->general_info->forks[philo->left_index]));
pthread_mutex_lock(&(ph... |
C | #include"headers.h"
extern queue[];
extern int rear;
extern int front;
void dequeue(void)
{
if((rear==-1)||(front==MAX-1)||(front==rear))
{
printf("QUEUE IS EMPTY\n");
}
else
{
front++;
printf("DELETED DATA IS %d\n",queue[front]);
}
}
|
C | #include <stdio.h>
#include <stdlib.h>
/**
* \brief Solicita un nmero al usuario y devuelve el resultado
* \param mensaje Es el mensaje a ser mostrado
* \return El nmero ingresado por el usuario
*
*/
float getFloat(char mensaje[])
{
float auxiliar;
printf("%s",mensaje);
scanf("%f",&auxiliar);
retu... |
C | #include<stdio.h>
#include<stdlib.h>
struct cqueue
{
int size;
int f,r;
int *arr;
};
int isfull(struct cqueue *q)
{
if((q->r+1)%q->size==q->f)
return 1;
return 0;
}
void enqueue(struct cqueue *q,int val)
{
if(isfull(q))
printf("Circular Queue is Full.\n");
else
{
q->r=(q->r+1)%q->s... |
C | #include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
int main()
{
int i, children_number = 5;
pid_t fork_pid;
printf("Moj PID = %d\n", getpid());
for (i = 0; i < children_number; i++)
{
fork_pid = fork();
if (fork_pid == -1)
... |
C | //
// Created by 민지우 on 2019-04-10.
//
#include <stdlib.h>
#include <memory.h>
#include <sys/msg.h>
#include "mq.h"
#include "../../devices/dot/dot.h"
#include "../../services/log/log.h"
static int MQ_ID = -1;
/**
* 메세지 큐 생성
* @return 생성 성공 여부
*/
int create_message_queue () {
if (MQ_ID != -1) return MQ_ID;
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
struct employeeRank { // representation of ranks employees can have
int level;
float salary;
};
struct employee { // representation of employee information
int id;
char name[20];
int JoinYear;
struct employeeRank rank;
};
//fu... |
C | /*
* AnalogInputThread.c
*
* Created on: Mar 11, 2015
* Author: Brian
*/
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <pthread.h> // pthread_create/exit
#include <errno.h> // defines EOK
#include <sys/neutrino.h> //MsgReceive and MsgReply
#include "AnalogInputThread.h"
#includ... |
C | #include<stdio.h>
#include<pthread.h>
int x = 0; //a normal Global Variable, NOt a Mutex Variable
/*
Hence there might be a chance that Thread-swirching might happen inbetween and the OP might be 5 or 25 sometimes.
*/
void *thread_func (void * arg)
{
while(1)
{
x=5;
x+=10;
printf("x is %d\n",x);
// printf("t... |
C | #include "libdstr/libdstr.h"
derr_type_t utf8_encode_quiet(
uint32_t codepoint, derr_type_t (*foreach)(char, void*), void *data
){
derr_type_t etype = E_NONE;
unsigned char byte;
char *c = (char*)&byte;
if(codepoint < 0x80){
// 1-byte encoding
byte = (unsigned char)codepoint;
... |
C | /*
Kenneth Adair
K&R pg. 117
As far as I can tell this program lets you enter some text in the commandline.
After entering text in the initial commandline then whenever you type text
that matches the text you just entered it will echo it back out.
*/
#include <stdio.h>
#include <string.h>
#define MAXLINE 1000
int ... |
C | #include <stdio.h>
int main()
{
double data,data1,data2;
char op;
scanf("%lf%c%lf",&data1,&op,&data2);
switch(op)
{case '+':data=data1+data2;break;
case '-':data=data1-data2;break;
case '*':data=data1*data2;break;
case '/':if(data2!=0)data=data1/data2;
else{p... |
C | /*
ID: flsnnx1
LANG: C
TASK: namenum
*/
#include <stdio.h>
#include <string.h>
char mapping[10][3] = {0,0,0,0,0,0,'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','R','S','T','U','V','W','X','Y'},dict[5000][13],word[13];
int num[13],words,found = 0;
FILE *fdict,*fin,*fout;
int count = 0;
int search(in... |
C | //Gets random floats from a normal distribution with mean=0 and std,
//and then integrates (cumsum) to generate the brown noise.
//This uses modified code from PCG randoms minimal C library,
//but remains stand-alone (no install of PCG required).
//I use the textbook cos and sin formulae to make Gaussian.
//Since num... |
C | #include <stdio.h>
int len;
void printArray(int arr[]) {
for (int i = 0; i < len; i++) {
printf("%d ", arr[i]);
}
}
void mergeSort(int arr[], int low, int high) {
if (high - low <= 1)
return;
if (high - low == 2) {
if (arr[low] > arr[high - 1]) {
int t = arr[low];
... |
C | /*
* This program will be used to generate random matrices and write them to file.
* Sample usage : ./x.out <size_of_matrix> <output file for A> <output file for B>
*/
#include <stdio.h>
void writeMatrix(FILE *wptr, int x){
//initialize variables for looping
int i, j;
for(i = 0; i<x; i++){
for(j = 0; j<x; j... |
C | /*
8-8ݺӦꡢ¡աҪ͵úmonth_day ( year, yeardy, *pmonth, *pday)year꣬yearday*pmonth*pdayǼóºա磬2000612000-3-12000ĵ6131ա
*/
/* ʹָΪضֵʾ */
# include <stdio.h>
int main (void)
{
int day, month, year, yearday; /* ա¡ı*/
void month_day(int year,int yearday, int *pmonth,int *pday);/*¡յĺ*/
printf("input year an... |
C | // ColorTemperatureController
bool onColorTemperature(const String &deviceId, int &colorTemperature) {
Serial.printf("Device %s colorTemperature is set to %i\r\n", deviceId.c_str(), colorTemperature);
return true; // request handled properly
}
bool onIncreaseColorTemperature(const String &deviceId, int &colorTemp... |
C | /* https://projecteuler.net/problem=4
Largest palindrome product
Problem 4
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit numbers.
*/
#include <stdio.h>
int rever... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_ping.h :+: :+: :+: *... |
C | /*
* _| _|_|_|_| _|
* _| _|_| _| _| _| _| _|_|_| _|_|_|_|
* _| _| _| _| _| _| _|_|_| _| _| _|
* _| _| _| _| _| _| _| _| _| _| _|
* _|_|_|_| _|_| _| _| ... |
C | #include<stdio.h>
#include<sys/time.h>
int delay(int time)
{
int i,j;
for(i=0; i<time; i++)
for(j=0; j<5000; j++)
;
}
int main()
{
struct timeval start;
struct timeval end;
double msdiff, usdiff;
gettimeofday(&start, NULL);
delay(10);
gettimeofday(&end, NULL... |
C | /*
**
** һx, еҺΪx
** 27, Ϊ2~7, 8~10, 13~14
*/
#define _CRT_SECURE_NO_WARNINGS
#include "stdio.h"
#include "stdlib.h"
int main()
{
int number = 0;
int sum = 0;
int result = 0;
int j = 1;
int temp = 0;
printf("һ: \n");
scanf("%d", &number);
for (int i = j; i <= number / 2 + 2;)
{
temp = number - sum;
if... |
C | #include "queue.h"
struct s_queue_elem
{
struct s_queue_elem *next;
void *content;
};
struct s_queue
{
int nb_elem;
struct s_queue_elem *rear;
};
t_queue queue_create()
{
t_queue result;
result = malloc(sizeof(struct s_queue));
result->nb_elem = 0;
result->rear = NULL;
return res... |
C | // Simple command-line kernel monitor useful for
// controlling the kernel and exploring the system interactively.
#include <inc/stdio.h>
#include <inc/string.h>
#include <inc/memlayout.h>
#include <inc/assert.h>
#include <inc/x86.h>
#include <kern/console.h>
#include <kern/monitor.h>
#include <kern/trap.h>
#include ... |
C | #include <stdio.h>
#include "list.h"
#include <stdlib.h>
#include <assert.h>
struct node_struct * newNode(int v){
struct node_struct *n = (struct node_struct*) malloc(sizeof(struct node_struct));
assert(n != NULL);
(*n).value = v;
n->value = v;
n->next = NULL;
return n;
}
void deleteNode(struct node_struct *n){... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "3-calc.h"
/**
* get_op_func - gets the operator
* @s: string
* Return: a pointer to a function
*/
int (*get_op_func(char *s))(int, int)
{
op_t ops[] = {
{"*", op_mul},
{"+", op_add},
{"-", op_sub},
{"*", op_mul},
{"/", op_div},
{"%",... |
C | #include <stdio.h>
int x, y, z;
int xadd, yadd, zadd;
int main(void){
int line;
int i;
scanf("%d", &line);
for(i = 0; i < line; i++){
scanf("%d %d %d", &x, &y, &z);
xadd += x;
yadd += y;
zadd += z;
}
if(xadd == 0 && yadd == 0 && zadd == 0){
printf... |
C | /*
* Copyright (c) 2005 Jan Schaumann
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of condit... |
C | /*
The purpose of this program is to provide a C Language implementation to read in the
state of the switches into the MSP430 and to output a conditional string that describes
the state of the switches to HyperTerminal.
*/
//---------------------------------------------------------------
// Console I/O through the o... |
C | /*
* Demo PIC16F15376 Curiosity Nano + RDM6300 RFID reader
* Output on LCD 16x2
* This is a demo: no checksum checked, no valid tag checked. Only reading
*
* (c)2020 Bernardo Giovanni
* https://www.settorezero.com
*
*/
/* Connections:
* RD3 : LCD RS
* RC0 : LCD EN
* RB5 : LCD RW
* RD4 :... |
C | /*
** EPITECH PROJECT, 2018
** PSU_42sh_2017
** File description:
** Add new path in pipe structure
*/
#include <stdlib.h>
#include "instruction.h"
#include "globbing.h"
#include "shell.h"
static int realloc_pipe_args(args_list_t *list, pipe_t *pipe, int size)
{
args_list_t *tmp = list;
free_array_string(pipe->arg... |
C | #include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SIZE 3
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t queue_not_empty = PTHREAD_COND_INITIALIZER;
pthread_cond_t queue_free_places = PTHREAD_COND_INITIALIZER;
int queue[SIZE];
int qlen = 0;
void *producer( vo... |
C | #include <stdio.h>
int main(){
FILE *fp;
int num,i;
fp=fopen("numeric.dat","w");
for(i=0;i<5;i++){
printf("Ͽ %d :",i+1);
scanf("%d",&num);
fwrite(&num,sizeof(int),1,fp);
}
fclose(fp);
fp=fopen("numeric.dat","r");
for(i=0;i<5;i++){
printf("%d° Է :",i+1);
fread(&num,sizeof(int),1,fp);
printf(... |
C | #include <stdio.h>
#include "stack.h"
linklist link_create(){
linklist p;
p = (linklist) malloc(sizeof(linknode));
if (p == NULL){
puts("error!");
return 0;
}
p->data = 0;
p->next = NULL;
return p;
}
int push(linklist h, datatype value){
linklist q;
q = (linklist)malloc(sizeof(linknode));
... |
C | #include <stdio.h>
int main()
{
int num;
printf("Please enter a number:");
scanf("%d", &num);
int quotient = num / 2;
int remainder = num - 2 * quotient;
if ( remainder == 0 )
{
printf("%d is an even number.", num);
}
else
{
printf("%d is an odd number.", num... |
C | #include "debugger/commands.h"
#include "debugger/debugger.h"
#include <ctype.h>
#include <string.h>
int command_load_register(debugger_state_t *state, int argc, char **argv) {
if (argc != 3) {
state->print(state, "%s - Load a register with a specified value. Supports hex (i.e. 0x0000) and base-10 (i.e. 12)\n", arg... |
C | /*
* Utilizing leetcode test cases for One Edit Distance to verify the FileDescriptor API on-the-fly problem
* https://leetcode.com/problems/one-edit-distance/
*/
class FileDescriptor{
string fd;
int idx;
public:
FileDescriptor(string v){
fd = v;
idx=0;
}
bool hasNext(){
return idx<fd.size()... |
C | #include <SDL2/SDL.h>
#include <math.h>
#include <stdio.h>
#include "raycast.h"
#include "graphics/graphics.h"
#include "map/map.h"
#include "map/tile.h"
#include "math/vec2.h"
#include "util/util.h"
#define MAX_RECURSION 3
void cast(ray_t* r, hit_t* hit, map_t* map);
void raystep(ray_t* r, map_t* map);
// render a ... |
C | #include <stdio.h>
/**
* main - Entry point
*
* Return: Always 0 (Success)
*/
int main(void)
{
int num = 0;
int div, mod, aux;
while (num < 100)
{
div = num / 10;
mod = num % 10;
aux = mod * 10 + div;
if (num != aux && num < aux)
{
putchar((num / 10) + '0');
putchar((num % 10) + '0');
if ... |
C | //
// syssched.c
//
//
// Created by Neil Singh on 8/31/17.
//
//
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/fcntl.h>
#include <sys/errno.h>
#include <sys/time.h>
#include <unistd.h>
#include <sched.h>
extern unsigned int sys_nanosleep(struct timespec* req, struct timespec* rem);
extern unsigned i... |
C | #include <stdio.h>
void main();
{
int i;
for (i = 0; i < 256; i++)
{
printf("%d = %c", i, i);
}
return 0;
} |
C | #include "allowexec.h"
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <inttypes.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/resource.h>
void check_system_call(int r, const char* syscall) {
if (r == -1) {
fprintf(stderr, "%s: %s\n", syscall, strerror(errno));
exit(... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cgraph/cgraph.h"
#include "cgraph/cgen/s2i.h"
#include "cgraph/cgen/svector.h"
typedef struct _congdan
{
char ten[60];
char cmnd[20];
char sdt[20];
}congdan;
bn_tree_t s2i = NULL;
vector_t i2s = NULL;
int g_id = 0;
int get_save_id(char *key) {
... |
C | #include <stdio.h>
int main(int argc, char** argv) {
int n, fatorial = 1;
printf("Digite o valor a ser fatorado:\n");
scanf("%d", &n);
if (n < 0){
printf("Valor absurdo\n");
}
else if (n == 0){
printf("Fatorial: 1\n");
}
else{
for ( ; n>0; n--){
fatorial *= n;
}
prin... |
C | #include <unistd.h>
#include <sys/types.h>
#include <errno.h>
#include <stdio.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
//AQUI TEM A STRING DE REFERENCIA DOS ESLAIDES
int teste[20] = {7,0,1,2,0,3,0,4,2,3,0,3,2,1,2,0,1,7,0,1};
int teste2[11] = {6, 6 ,3, 0, 4, 8,... |
C | #include "generateText.c"
#ifndef GENERATETEXT_H
#define GENERATETEXT_H
//Fungsi Free List
/* Mengosongkan isi linked list yang sudah tidak diakses */
/* Input: head dari linked list, jumlah node pada linked list */
/* Hasil: memori linked list dihapus */
void freeList(node** head, int n);
//Fungsi Search Value
/* M... |
C | #include <stdio.h>
void casillas (char *argv[]);
int main(int argc, char *argv[])
{
// short int a;
//short int b;
//short int c;
//short int d;
if (argc==1)
{
printf("Debes ingresar mas parametros...\n");
return 1;
}
// else
// {
// scanf(" %hd", &a);
//}
... |
C | /* Example- Entire structure as function arguments */
# include<stdio.h>
struct book
{
char name[20];
char author[10];
int pages;
};
void display(struct book tech_book)
{
printf("Name :%s\n Author :%s\nPages :%d\n", tech_book.name, tech_book.author,tech_book.pages); ... |
C | /*====================================================
* Copyright (C) 2018 All rights reserved.
*
* 文件名称:fifo_read.c
* 创 建 者:cqb 2848319176@qq.com
* 创建日期:2018年01月10日
* 描 述:
================================================================*/
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#... |
C | #ifndef __STACK_H
#define __STACK_H
typedef void* Stack;
typedef void* InfoStack;
/*
Cria uma stack
POS: retoan a stack
*/
Stack createStack();
/*
Verifica se a stack está vazia
PRE: stack
POS: 0 se não está vazio e 1 se está
*/
int isEmptyStack(Stack stack);
/*
Retorna o tamanho da stack
... |
C | /* mpchash.c */
/* This library implements multi-probe consistent hashing */
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include "mpchash.h"
uint64_t siphash(uint64_t k0, uint64_t k1, const unsigned char *m,
size_t len);
struct bucket_t {
uint64_t point;
size_t node_id... |
C | /*
Written by Kaelen Carling and Max Weiss
*/
#include "interpol.h"
float interpol(float x1,float x2,float y1,float y2,float x)
{
// calculates slope from given coordinates
float slope = (y2 - y1)/(x2-x1);
// inerpolates the next y coordinate from the
// given coordinates using slope intercept form
float y =... |
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
/*
* \brief Solicita un numero al usuario y devuelve el resultado.
* \param mensaje Es el mensaje a mostrar.
* \return El número ingresado por el usuario.
*
*/
float getFloat(char mensaje[]){
float auxiliar;
printf("%s", mensaje);
scanf("%f", ... |
C | #include <stdio.h>
#include <stdlib.h>
float * selectionSort(float array[ ], int size)
{
int pass,item,position,temp;
/* Selection-sort the values read in. */
for(pass=0; pass<size-1; pass++){
position = pass;
for(item=pass+1; item<size; item++)
if (array[position] < array[item])
position ... |
C |
#include <stdio.h>
#define N 5
float invmat(float *a, int n) {
float aux;
int i, j, k;
for (i = 0; i < n; i++) {
aux = *(a + n * i + i);
for (j = 0; j < n; j++) *(a + n * i + j) /= aux;
*(a + n * i + i) = 1.0 / aux;
for (k = 0; k < n; k++)
if (k != i) {
aux = *(a + n * k + i);
... |
C | #pragma once
typedef int bool;
#define false 0
#define true 1
typedef unsigned char uint8; /* == 8 bits */
typedef unsigned short uint16; /* == 16 bits */
typedef unsigned int uint32; /* == 32 bits */
|
C |
/**************************************/
/*Author : PERUMAL R */
/*Date : 14-03-2019 */
/*Filename : header_lib.h */
/*Description: Prototypes */
/**************************************/
#include "headr_make.h"
int a,b;
int main()
{
printf("Enter the... |
C | #define GLFW_DLL 1
#define PI 3.14159265358979323846
#define WINDOW_WIDTH 500
#define WINDOW_HEIGHT 500
#define GL_GLEXT_PROTOTYPES
#include <GLES2/gl2.h>
#include <GLFW/glfw3.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <assert.h>
//data type to store pixel rgb values
typ... |
C | /*
* bitops.c -- bit manipulation operations.
*
* by Christopher Adam Telfer
*
* Copyright 2003-2012 See accompanying license
*
*/
#include <cat/bitops.h>
char num_bits_array[256] = {
0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,... |
C | #include <gmodule.h>
#include <stdio.h>
#include "pqueue.h"
struct pqueue {
unsigned int size;
pq_pri_t *lowest_pri;
pq_pricmp_fun pricmp;
GTree *tree;
};
static int update_min(pq_pri_t *pri, pq_val_t *val, pqueue_t *pq) {
pq_pri_t *prev_lowest = pq->lowest_pri;
if(pq->pricmp(pri, pq->l... |
C | // gcc ~/c/hexdump.c -o ~/c/hexdump
// /usr/local/gcc-3.4.5-glibc-2.3.6/arm-linux/bin/arm-linux-gcc ~/c/hexdump.c -o ~/c/hexdump_arm
// ~/c/hexdump 0 10
// ~/c/hexdump 0xc0353c30 0x50
// /home/jc235005/c/hexdump_arm 0xc0353c30 0x50
// [jc235005@brocadh fconfig]$ nm /usr/local/OLO/Intel_CE_2110-1.5.354/linux-2.6.16.16/... |
C |
#include<stdio.h>
#include<stdlib.h>
#include <string.h>
#define MAX_PRODUCTS 60 // 저장할 수 있는 레코드 최대 갯수
// 회원 정보 레코드의 데이터 타입을 정의함
typedef struct st_watch{
char name[20]; // 시계 이름
char brname[20]; // 브랜드 이름
char size[20]; // 시계 사이즈
char gender[10];// 남성용,여성용
float price; // 시계 가격
int st... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
/**
* Return an array of size *returnSize.
* Note: The returned array must be malloced, assume caller calls free().
*/
int* findDisappearedNumbers(int* nums, int numsSize, int* returnSize) {
int* ret = (int *)malloc(sizeof(int) * numsSize);
int index = 0;
... |
C | /* tanimate.c: animate several strings using threads, curses, usleep()
*
* bigidea one thread for each animated string
* one thread for keyboard contol
* shared variables for communication
* compile cc tanimate.c -lcurses -lpthread -o tanimate
* to do needs locks for shared variables
* nice to put screen hand... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.