language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdlib.h>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include "tree.h"
#include "test.h"
char * rand_str(int len) {
char * str = (char *)calloc(len + 1, sizeof(char));
if (!str) return NULL;
char * cur = str;
int n = 26;
int d = 'a';
for (int i = 0; i < le... |
C | // *** 29/03/2019 *** --> BATCHED WITH STREAMS
// [1] Race condition
#include <cstdio>
#include <cstdlib>
#include <math.h>
#include <time.h>
#include <cublas_v2.h>
#include <cuComplex.h>
#define BLOCK_SIZE 32
__global__ void ell_kernel(cuDoubleComplex* A, cuDoubleComplex* B, int dim, int* m_val, int k, int val){
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
int suma(int);
void salida(int);
int main(int argc, char const *argv[]){
pid_t pid;
int input = 1;
int pipeline[2];
pipe(pipeline);
while (input != 0){
printf("Inserte un número: ");
s... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX 100
#define MAX_KAR 21
typedef struct {
float po;
char prez[MAX_KAR];
} STUDENT;
int poredi(const void* a, const void* b);
int main() {
int i = 0, j;
char pre[MAX_KAR];
STUDENT niz[MAX];
STUDENT *k;
FILE *f = fopen("/ho... |
C | #include "lib.h"
#include <sys/times.h>
#include <time.h>
#include <unistd.h>
#include <sys/wait.h>
double time_difference(clock_t time1, clock_t time2) {
return (double)(time2-time1) / CLOCKS_PER_SEC;
}
double real_time_difference(clock_t time1, clock_t time2) {
return (double) (time2-time1) / sysconf(_SC_CL... |
C | /* 15) Faa um algoritmo para imprimir o nmero de palavras (de no mximo 20 caracteres) presentes no arquivo "Texto.txt".
Considere que o arquivo no possui qualquer nmero, somente palavras. */
#include <stdio.h>
int main(){
char palavra[20];
int total=0;
FILE *arqPalavras;
arqPalavras=fopen("Texto.txt", "r");
if(a... |
C | //Strcmp to sort a string
main(){
char s[10],c;
int i,r,j,round;
printf("Enter a string");
gets(s);
for(i=0;i<=10;i++){
for(j=1;j<=10-round;j++){
r=strcmp(s[i],s[j]);
if(r>0){
strcpy(c,s[i]);
strcpy(s[i],s[i+1]);
... |
C | //
// Created by heymind on 2020/3/1.
//
#include "ast.h"
ASTNodePos *ast_node_pos_create(int start_row, int start_column, int end_row, int end_column) {
ASTNodePos *pos = malloc(sizeof(ASTNodePos));
pos->start_row = start_row;
pos->start_column = start_column;
pos->end_row = end_row;
pos->end_col... |
C | #define UPPER 100 //Số phần tử tối đa
#define ZERO 0 //Giá trị 0
#define MAX 20 //Số đỉnh tối đa
#define INF 1000 //Vô cùng
#define YES 1 //Đã xét
#define NO 0 //Chưa xét
#define NULLDATA -1 //Giá trị rỗng
typedef char LabelType;
typedef int CostType;
typedef CostType Matrix[MAX][MAX];
//Định nghĩa... |
C | #include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
#include <sys/stat.h>
#include <errno.h>
#define BUFF_SIZE 512
int main(int argc, char * argv[], char * envp[]) {
if(argc != 3) {
printf("Usage: %s <src_dir> <de... |
C | int razmermassiva(int a[],int n)
{
for(int i=0; i<10; ++i)
{
printf("Enter %d element of array: ", i+1);
scanf("%d", &a[i]);
}
}
int vivodmassiva (int a[], int n)
{
for(int i=0; i<10; ++i)
{
printf("%d element = %d\n", i+1, a[i]);
}
}
int nomervmassive (int p, int a[]... |
C | #include<stdio.h>
#include<time.h>
#include<stdlib.h>
#define NUMBER 20000
//クイックソート
void Q_sort(int data[],int left ,int right){
int i = left; //左端
int j = right; //右端
int pivot;
pivot = data[(left+right)/2]; //中央値を軸に
while(1){
while(data[i]<pivot){i++;} //軸より大きい値を探す
while(data[j]>pivot)... |
C | #ifndef _MYMALLOC_H
#define _MYMALLOC_H
#include <stdio.h>
#include <limits.h>
#define malloc(x) mymalloc((x), __LINE__, __FILE__)
#define free(x) myfree((x), __LINE__, __FILE__)
/*
The size attribute of metadata is a signed short, conveying information about block size and usage.
block size: magnitude of metadata.si... |
C | #include <stdio.h>
#define SIZE 3
void matrixPrint(FILE *out, int matrix[SIZE][SIZE], int size) {
int last = size - 1;
for ( int row = 0; row < size; row++ ) {
for ( int col = 0; col < last; col++ ) {
fprintf(out, "%d ", matrix[col][row]);
}
fprintf(out, "%d\n", matrix... |
C | /** @file
* @brief ؿ nusdas_snprintf() μ
*/
#include "config.h"
#include "nusdas.h"
#include <stddef.h>
#include <stdarg.h>
# define NEED_VSNPRINTF
#include "sys_err.h"
/** @brief Хȿб snprintf()
*
* @p fmt ˽ʹߤΰʸ
* Ĺ @p bufsize @p buf ˳Ǽ롣
* printf(3) Ʊ͡Ѵ `%' ʸե饰 (ץ)
* (1--9) ˤ (ץ)
* ԥꥪ (`.') ֤ˤ (ץ)
* (ץ... |
C | #include<stdio.h>
#include<conio.h>
int main()
{
float a;
printf("enter the number:");
scanf("%d",&a);
printf("%.0f",round(a));
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
enum { MAXNAMESIZE = 100 };
typedef struct
{
unsigned long phone;
char name[MAXNAMESIZE];
} Data;
typedef struct Node
{
struct Node *left, *right;
Data data;
} Node;
void insert(Node **nodeptr, Data data)
{
Node *node = *nodeptr;
if (!node)
{
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "empleado.h"
#include "utn.h"
#define CANTIDAD_EMPLEADOS 5
static int getNextId()
{
static int ultimoId=-1;
ultimoId++;
return ultimoId;
}
static int getLugarLibre(Empleado* array, int len)
{
int retorno = -1;
int i;
... |
C | #include<stdio.h>
#include<stdlib.h>
#define SIZE 100
typedef struct
{
char item[SIZE];
int top;
}operatorStack;
/*Function prototype*/
void push (operatorStack *, char);
char pop (operatorStack *);
int isEmpty(operatorStack *);
int prcd(char, char);
void convert(char[], char[]);
... |
C | #include <stdio.h>
#include <unistd.h>
#include <pthread.h>
typedef struct thread
{
int thread_No;
thread()
{
thread_No = -1;
}
}THREAD;
void* thread_start(void* arg)
{
THREAD* th = (THREAD*)arg;
while(1)
{
printf("this is work thread: %d\n", th->thread_No);
sleep(1... |
C | #include <stdint.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
/*
* Function Prototypes
*/
void setVolume(int volume);
int getVolume(void);
/*
* Global Variables
*/
int masterVolAddr = 47; //0x2F
float lsbVal = pow(2,-24);
/*
* Main function
* Accepts either a get command or p... |
C | #include <sys/time.h>
#include <stdio.h>
#include <unistd.h>
int main(){
struct timeval start, end;
double delta;
gettimeofday(&start, 0);
sleep(5);
gettimeofday(&end, 0);
delta =((end.tv_sec - start.tv_sec) * 1000000u + end.tv_usec - start.tv_usec) / 1.e6;
printf("time : %f\n",delta);
}
|
C | //*****************************************************************************
// # # Name : LedCtrl.c
// # # Date : Nov. 14, 2020
// # # # # # Author : Qiwei Wu
// # # # # # # Version: 1.0
// # # # # #
// The LED control.
//*******************************... |
C | #include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
/* Keys */
#include <stdlib.h>
#include <unistd.h>
#include <limits.h>
/* I/O */
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <time.h>
/* Constants */
#include "ServerConstants.h"
void endWithError(int n);
struct msgbuf msgCliQue(... |
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 "queue.h"
#include "List.h"
#include <stdio.h>
#include <stdlib.h>
queue* queue_new()
{
queue* q;
q= (queue*)malloc(sizeof(queue));
q->front = (LList*)malloc(sizeof(LList));
q->rear = (LList*)malloc(sizeof(LList));
return q;
}
void enqueue(queue* q, int n)
{
llist_append(q->front,n);
Node* a=q->front->... |
C | #include <stdio.h>
#include <string.h>
struct user {
char name[20];
char phone[12];
int bell;
};
void main(void) {
struct user u;
scanf("%s", u.name);
strcpy(u.phone, "01012345678");
u.bell = 1;
printf("u.name = %s\n", u.name);
printf("u.phone = %s\n", u.phone);
} |
C | #include <stdio.h>
#include <string.h>
int get_decimal_position(char[]);
int get_numeric_rep(char[]);
void strip_trailing_zeros(char[]);
void multiply(int[], int);
int result[151];
int len_result;
int main(int argc, char *argv[])
{
int i;
int n;
char r[7];
int decimal_pos, decimal_pos_in_res;
int numeric_r... |
C | #include <stdio.h>
int main(void) {
int card[4][13] = {0};
int i, j;
int n;
char cd;
int num;
scanf("%d", &n);
// printf("n; %d\n", n);
for (i = 0; i < n; i++) {
scanf("%*c%c%d", &cd, &num);
// printf("i: %d\n", i);
if (cd == 'S') {
card[0][num - 1] = 1;
// printf("S[%d][%d]: %... |
C | #include <stdio.h>
#include<stdlib.h>
#include <time.h>
#define MAX 20 /*ԱԪظ*/
typedef int KeyType;
typedef char InfoType[10];
typedef struct
{
KeyType key;
InfoType data;
}RecType;
void InsertSort(RecType R[], int n,int compare,int move)
{
int i, j, k;
RecType temp;
for (i = 1; i < n; i++)
{
temp = ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* print_formated_unsigned.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "listSimpleChain.h"
#include "tableHachage.h"
int main(){
int taille1 = 5;
TableHachage t = tableHachage_creer(taille1);
ELEMENT e1;
e1.nbnote=1;
e1.moy=1;
e1.clef="clef1";
ELEMENT e2;
e2.nbnote=2;
e2.moy=2;
e2.clef="clef2";
ELEMENT* e3 ... |
C |
int1 normal_state = 1;
// Returns true (1) if one of the side ground sensors is on black.
int1 black_detected()
{
return KJunior_get_proximity(GROUNDLEFT) < bw_threshold_left ||
KJunior_get_proximity(GROUNDRIGHT) < bw_threshold_right;
}
// Returns true (1) if both side ground front senso... |
C | #include <stdio.h>
void kalimera()
{
static int i;
printf("value of i is: %d\n", i++);
}
int main(int argc, const char *argv[])
{
int j;
j = 0;
while (j++ <= 10) {
kalimera();
printf("******\n");
}
return 0;
}
|
C | typedef struct SERVICO
{
int dia, mes, ano;
char descricao[80];
struct Recebidos *R;
struct Prestados *P;
struct SERVICO *nseg;
struct SERVICO *nant;
} Servico;
typedef struct RECEBIDOS
{
struct Pessoa *person;
struct RECEBIDOS *nseg;
} Recebidos;
typedef struct PRESTADOS
{
struct ... |
C | #include<stdio.h>
int main()
{
int num=0,no1=1;
printf("Enter a number: ");
scanf("%d",&num);
printf("Table of number %d is :\n",num);
while (no1<101)
{
int no2=1;
while (no2<=10)
{
printf("%d\t",no1*no2);
if (no2==10)
printf("\n"... |
C | #ifndef LED_DEBUG_H__
#define LED_DEBUG_H__
#include <avr/io.h>
#include <util/delay.h>
//to do #define PORT (B)
#define LED_PORT (PORTB)
#define LED_PIN (5)
#define LED_DIR (DDRB)
#define LED_PORTPIN (PINB)
#if defined(MODULE_LED_DBG)
#define LED_DEBUG_INIT() ... |
C | #include "tree.h"
//求先序遍历中第k个节点的值
ElemType queue[100];
int rear = 0;
void PreOrder3(Tree T) {
if(T) {
queue[rear++] = T->data;
PreOrder3(T->lchild);
PreOrder3(T->rchild);
}
}
ElemType KthPreOrder(Tree T, int k) {
PreOrder3(T);
return queue[k-1];
}
//王道答案
int i=1;//递归序号,全局变量
ElemType P... |
C | //Button.c
//Dung Nguyen
//Wally Guzman
#include "tm4c123gh6pm.h"
#include <stdint.h>
#include "Button.h"
#include "Settings.h"
#include "HeartBeat.h"
#define PE0 (*((volatile uint32_t *) 0x40024004))
#define PE1 (*((volatile uint32_t *) 0x40024008))
#define PE2 (*((volatile uint32_t *) 0x40024010))... |
C | #include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include <termios.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <stdbool.h>
#include <fcntl.h>
#define INPUT_STRING_SIZE 80
#define MAX_DIR_STRING_SIZE 255
#define PATH_S... |
C | // 5-card draw
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "poker.h"
#include "pokersrv.h"
#define DRAW_HAND_SIZE 5
#if DRAW_HAND_SIZE > MAX_HAND_SIZE
#error DRAW_HAND_SIZE is too large
#endif
void
PlayerDraw(PLAYER_LIST *first_to_draw)
{
PLAYER_LIST *pl_current = f... |
C | // From Reddit...
#include <stdio.h>
int main(void) {
char *text = "Welcome, %s.\n";
printf((const char *) text, "Vulner");
for (int i = 0; text[i] != 0; i++)
printf("Forms a triangle.\n" + i); // warns
}
|
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<assert.h>
#include<stdbool.h>
#include<limits.h>
#define clr(arr)do{ memset(arr, 0, sizeof(arr)); }while(0)
#define pb(zpv, zvv) zpv.ptr = pushback(zpv.ptr, &zpv.sz, zvv)
#define resizeArray(ptr, type, size) ((type*)realloc(ptr, (size) * ... |
C | #include<stdio.h>
#include<stdlib.h>
void combination(int level);
int T, n , A[50],B[50],P[50],i,j,flag[50];
double final;
double ans=0;
int main()
{
scanf("%d",&T);
for(i=0;i<T;i++)
{
scanf("%d",&n);
for(j=0;j<n;j++)
{
scanf("%d%d%d",&P[j],&A[j],&B[j]);
}
... |
C | /*
Programmer: Grant Ogden
Date: 3/5/2019
Filename: quiz2.c
Reason: To better understand conditional inside loops and flow control.
Instruction: A class of ten students took a quiz. The grade (integers in the range 0 to 100)for
this quiz are available to you. Determine the class averae on the q... |
C | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "node.h"
#include "linked_list.h"
#define TRUE 1
#define FALSE 0
l... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <fcntl.h>
#include <time.h>
#include <unistd.h>
#include <signal.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <pthread.h>
#define IP_SERVER "127.0.0.1"
#define PORT 12345
#define DELIM_STR '\n'
#define PRINTFF pri... |
C | #include <stdio.h>
#include <stdlib.h>
#include "Compounds.h"
#include "InputOutput.h"
#include "Operations.h"
/*
* Função que recebe um ponto (dois números)
*/
Ponto recebePonto(){
Ponto ponto;
scanf("%lf",&ponto.x);
scanf("%lf",&ponto.y);
return ponto;
}
/*
* Função que recebe os pontos de um quadrilát... |
C | /*
Author:Kalpana Baigar
Program to print following Pattern
1
2 1
3 2 1
4 3 2 1
5 4 3 2 1
*/
#include<stdio.h>
void display(int num)
{
int i,j;
for(i=1;i<=num;i++)
{
for(j=i;j>=1;j--)
{
printf("%d ",j);
}
printf("\n");
}
}
int main()
{
int no;
printf("enter num... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/msg.h>
#include <sys/sem.h>
#include <unistd.h>
#include <time.h>
#include "ipc_hash.h"
#define PAUSE printf("Press Enter key to continue..."); fgetc(stdin)
static int __read_specif... |
C | #include "tree.h"
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
#define MAX_HEIGHT 50
node *create_node(int data) {
node *n = (node *)malloc(sizeof(node));
assert(n != NULL);
n->data = data;
n->left = NULL;
n->right = NULL;
return n;
}
void display_prefix(node *t)
{
if ( t == NULL ) return;... |
C | #include <stdio.h>
int main()
{
float x;
printf("informe o valor em metros para que ele seja convertido em centimetros");
scanf("%f", &x);
printf("O valor convertido igual a %f", x * 100);
return 0;
}
|
C | #include "pthread_shop.h"
shop shops[SHOPS_COUNT];
client clients[CLIENTS_COUNT];
deliver delivers[DELIVERS_COUNT];
pthread_mutex_t mutexes[SHOPS_COUNT];
int shop_initialization(shop* shops, client* clients, deliver* delivers) {
srandom((unsigned int)time(NULL));
int i;
for(i =... |
C | #include <stdio.h>
int IsPrime(int n){
int i;
if(n < 2)
return 0;
else if(n == 2)
return 1;
if(n % 2 == 0)
return 0;
for(i = 3; i * i <= n; i += 2){
if(n % i == 0){
return 0;
}
}
return 1;
}
int main(void)
{
int i = 0,
j = 0;
char ... |
C | #include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
int64_t* stack_ptr;
void push(int64_t a) {
// note that in any real appilcation overflow check is MANDATORY here
*stack_ptr++ = a;
}
int64_t pop() {
// underflow check
return *--stack_ptr;
}
void xor() {
push(pop() ^ pop());
}
void add() {
push(po... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lst.c :+: :+: :+: ... |
C | /* Script: DrawResource.c
Draws a resource vein.
The algorithm draws a vein in consecutive triangles, clockwise, around a central point.
This algorithm was originally implemented by <Zapper at http://www.clonkforge.net/user.php?usr=533>. */
#strict 2
/* Function: DrawResource
Draws a resource vein around a centr... |
C | /* File: mesinkata.h */
/* Definisi Mesin Kata: Model Akuisisi Versi I */
#ifndef __MESINKATA_H__
#define __MESINKATA_H__
#include "boolean.h"
#include "mesinkar.h"
#include "STATE.h"
#define NMax 50
#define BLANK ' '
#define ENTER '\n'
typedef struct {
char TabKata[NMax+1]; /* container penyimpan kata, indeks ya... |
C | #include "pwm.h"
//pwm百分比
u8 pwm=50;
/*
* pwm初始化
*/
void PWM_Init(void)
{
GPIO_InitTypeDef GPIO_PWM;
TIM_TimeBaseInitTypeDef TIM_BasePwm;
TIM_OCInitTypeDef TIM_OCPwm;
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3,ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE);
GPIO_PWM.GPIO_Pin=PWM_PORT;
GPIO_PWM.... |
C | /***************************************
* EECS2031M - Lab3
* Author: Hussain, Sayeda
* Email: sayedah@my.yorku.ca
* eecs_username: sayedah
* York Student #: 215427214
****************************************/
#include <stdio.h>
#define SIZE 16
void printBinary(short int);
/*counting digits*/
int main ... |
C | #include <stdio.h>
int main()
{
unsigned int x = 0x1BC5; /* x = 0001 1011 1100 0101 */
unsigned int y = 0X3A0D; /* y = 0011 1010 0000 1101 */
unsigned int z;
printf("x=%X\ny=%X\n",x,y);
z = x & y; /* z = 0001 1010 0000 0101 */
printf("\nx VE y = %X",z); /* z = 0x1A05 */
z = x | y; /* z = 0011 1011 11... |
C | /*
* UdpServer.c
*
* Created on: Jul 11, 2019
* Author: 95776
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#define BUFFER_SIZE 1024
#define SERVER_PORT 11122
void extract_name(char* buffer) {
unsigned long len = strlen(buffer);
int i = (i... |
C | #include <stdint.h>
#include "memory.h"
#include "memoryMappedIO.h"
#include "registers.h"
#include "MMC1.h"
extern struct registers regs;
// Declaring components of CPU memory.
uint8_t ram[0x0800];
extern MemoryMappedRegisters ppuRegisters;
uint8_t apu_io_reg[0x0020];
uint8_t exp_rom[0x1FDF];
uint8_t sram[0x2000];... |
C | /**
* 어떤 수열을 만들어 내는 다음과 같은 알고리즘을 생각해보자. 어떤 정수 n에서 시작해 n이 짝수 이면
* 2로 나누고, 홀수면 3을 곱한 다음 1을 더한다. 이렇게 해서 새로 만들어진 숫자를 n으로 놓고 n=1이
* 될 때까지 같은 작업을 계속 반복한다. 예를 들어, n = 22이면 다음과 같은 수열이 만들어진다.
* 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1
* 아직 증명되지 않았지만, 모든 정수 n에 대해 이알고리즘을 적용 시키면 결국에는 n = 1에 이르게 되는 것으로
* 추측된다. 그리고 이 가설은 적... |
C | #include <stdio.h>
// Utility function to find minimum of two integers
int max (int x, int y)
{
return (x > y) ? x : y;
}
// This code handles the case of both array. This is noyt just about choosing one array. What happens is we take iterators to both the arrays then we move them until they reach common element... |
C | #include "stack.h"
offsetStack* initOffsetStack(){
offsetStack *tmp = (offsetStack*) malloc(sizeof(offsetStack));
tmp->next = NULL;
return tmp;
}
int isEmptyOffset(offsetStack *root){
if(root == NULL)
return 1;
else
return 0;
}
unsigned int peekOffset(offsetStack *root){
if(is... |
C | #include <stdio.h>
//################################################
//# Setup the tic marks for every 1/16 inch with #
//# different lengths depending on magnitude #
//################################################
int main() {
int n,h;
FILE *fp;
fp=fopen("inches.tex","w");
for(n=1;n<=191;n++) {
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include "incr_3Subseq.h"
bool impl1(int *nums, int size) {
int a = 0;
int b = 0;
int min = nums[0];
int second_min = nums[0];
int t1 = 0;
int t2 = 0;
for (int i = 0; i < size; ++i) {
if (nums[i] > sec... |
C | #include <stdio.h>
struct Day
{
int year;
int month;
int day;
}s;
int main()
{
int days(int y, int m, int d);
int sum;
printf(":\n");
scanf("%d%d%d", &s.year, &s.month, &s.day);
sum = days(s.year, s.month, s.day);
printf("%d%d%d ǵ %d ", s.year, s.month, s.day, sum);
}
int days(int ... |
C | #include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <list>
#include <numeric>
#include "trimData.C" //File with function trim() that executes bash script
//trimData.sh that cuts the dataset I've chosen to not contain any text.
using namespace std;
#include <TF1.h> // 1d function class... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int edad ;
scanf("%d",&edad);
while(edad < 0 || edad > 100)
{
printf("La edad NO ES VALIDA");
scanf("%d",&edad);
}
printf("La edad es: %d",edad);
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "word.h"
int main() {
freopen("testfile.txt", "r", stdin);
freopen("output.txt", "w", stdout);
c = getchar();
while (1) {
while (isspace(c)) {
c = getchar();
}
if (c == EOF) break;... |
C | /* strings-and-printf.c */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main( int argc, char * argv[] )
{
char name[80];
sprintf( name, "David %s", argv[1] );
char name2[80];
strcpy( name2, name );
strcpy( name2, "ABCDEFGHIJKLMNOPQRSTUVWXYZ" );
printf( "name is: %s\n", name );
printf... |
C | #include <stdio.h>
int main(void)
{
int arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
printf("Size of arr = %d", sizeof(arr) / sizeof(int));
} |
C | /* Program to create multiple thread and pass the argument
* All the thread is running in a parraly
* Author : Lal Bosco Lawrence
* Date : 19-oct-2017
*/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<pthread.h>
#define NUM_OF_THREAD 3
#define THREAD_RUN 6
/* Thread fuction declaration... |
C | #include <stdio.h>
#include <math.h>
#include<stdlib.h>
float a,b,c;
void leia ()
{
printf("Digite um lado do triangulo:");
scanf("%f",&a);
printf("Digite outro lado do triangulo:");
scanf("%f",&b);;
}
void calcule()
{
c = sqrt(a*a + b*b);
}
void imprime()
{
printf("\no tamanho da hipotenusa... |
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 <libopticon/var.h>
#include <libopticon/hash.h>
#include <libopticon/util.h>
#include <string.h>
#include <assert.h>
/** Allocate a var object */
var *var_alloc (void) {
var *self = (var *) malloc (sizeof (var));
if (! self) return NULL;
self->next = self->prev = self->parent = self->root = N... |
C | #include <stdio.h>
#include <stdint.h>
uint8_t and_gate(uint8_t a, uint8_t b){
return ((a >> 0) & 0x01) & ((b >> 0) & 0x01);
}
uint8_t xor_gate(uint8_t a, uint8_t b){
return ((a >> 0) & 0x01) ^ ((b >> 0) & 0x01);
}
uint8_t or_gate(uint8_t a, uint8_t b){
return ((a >> 0) & 0x01) | ((b >> 0) & 0x01);
}
uint8_t ... |
C | #include <stdio.h>
int main(){
int N = 0;
int arr[105];
while (scanf("%d", &arr[N]) != EOF){
N++;
}
N--;
while (N >= 0)
{
printf("%d\n", arr[N]);
N--;
}
} |
C | #include <stdio.h>
int main()
{
/* Assume name shorter than 20 chars. */
char ex[20];
puts("Enter boyfriend's name: ");
scanf("%19s", ex);
printf("Dear %s.\n\n\t You're history.\n", ex);
return 0;
}
|
C | #include <stdio.h>
int main()
{
int no = 100, val ;
asm ("movl %1, %%ebx;"
"movl %%ebx, %0;"
: "=r" ( val ) /* output */
: "r" ( no ) /* input */
: "%ebx" /* clobbered register */
);
printf("val=%d\n", val);
}
|
C | #include "pixel_map.h"
int read_pixel_8bit(int fd, struct pixel_map *map)
{
struct pixel_8bit pixel;
if (read(fd, &pixel.color, 1) != 1)
return -1;
push_pixel_8bit(map, &pixel);
return 1;
}
void push_pixel_8bit(struct pixel_map* map, struct pixel_8bit *pixel)
{
*(map->data_store_8bit + map->size) = pixel;
map... |
C | #include "picosat.h"
#include <assert.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#define GUNZIP "gunzip -c %s"
#define BUNZIP2 "bzcat %s"
#define GZIP "gzip -c -f > %s"
FILE * popen (const char *, const char*);
int pclose (FILE *);
static int lineno;
static FILE *input;
static int inputid;
static ... |
C | /**
*ֲJaap ScherphuisĽħ㷨ԴļԴjaapļҵ
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define SWAP(a,b) TEMP=a;a=b;b=TEMP;
#define CHAROFFSET 65
#define swap(a) switch (a)\
{case 0:a='F';break;\
case 1:a='U';break;\
case 2:a='D';break;\
case 3:a='L';break;\
case 4:a='R';break;\
case 5:a='B';break;\
defau... |
C | #include "expert.h"
char ft_match(char *temp, t_g *all)
{
int j, fmax, fpos;
fmax = all->fcount;
fpos = 0;
while (fpos <= fmax)
{
//ft_putstr("this is all->facts[fpos] in ft_match: ");
//ft_putchar(all->facts[fpos]);
//ft_putchar('\n');
j = 0;
while (temp[j] == ' ')
j++;
if (temp[j] == all->fact... |
C | #include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <assert.h>
#include "adtree.h"
#define BLOCKSIZE 10000
#define MAXARITY UCHAR_MAX
typedef unsigned int VARIABLE; /**< Variable in the data */
/* indexing with "int" is supposed to be quicker but empirically
it has been shown that "unsigned char"... |
C | #include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define NUM_THREADS 8
#define TOT_COUNT 10000055
float randNumGen()
{
int random_value = rand();
float unit_random = random_value / (float) RAND_MAX;
return unit_random;
}
void *doCalcs(void *threadid)
{
long l... |
C | #include "smsh.h"
void redirect(char *src, int srcfd, char *dst, int dstfd, bool is_append, bool is_background) {
int flag, fd;
if ( srcfd == 0 && is_background ) {
strcpy(src, "/dev/null"); // always empty space
srcfd = CLOSEFD;
}
if ( srcfd != 0 ) {
if ( close(0) == -1 ) {
perror(... |
C | /* De:Lucas Tatsuya Tanaka */
/* DRE:118058149 */
/* Email:tanaka@dcc.ufrj.br */
/* Github:https://github.com/tatsutanka */
/* Data:23/04/2021*/
/*O objetivo do trabakho é o calculo do determinante de uma matriz atravez do
metodo de Sarrus e Laplace */
#include<stdio.h>
#include<stdlib.h>
double detLaplace(int n, do... |
C | /**Estrutura de dados em C. ENC 2016/1
Gabriel Velho Ghellere 14202480
Luan Lorenzo dos Santos Borges 15104328
Pedro Dias Mendonça 13104556
ALGORITMO DE ORDENAÇÃO POR QuickSort data de entrega 25/06/2016**/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
struct cel_{
int conteudo;
struct cel_ *seg;
... |
C | #include <stdlib.h>
/**
* alloc_grid - Create a grid
* @width: width of the array
* @height: height of the array
*
* Return: On success 1.
* On error, -1 is returned, and errno is set appropriately.
*/
int **alloc_grid(int width, int height)
{
int **p, i, j, ver = 0;
if (width <= 0 || height <= 0)
{
return (NULL... |
C | /*
types and constants of use in the Smalltalk Virtual Machine
$Header: ST.h,v 2.1 85/11/19 17:42:17 miw Exp $
$Log: ST.h,v $
* Revision 2.1 85/11/19 17:42:17 miw
* Stabilised with all other modules at Rev 2.1
*
* Revision 1.4 85/07/23 21:00:09 miw
* Changed ADDR to be a direct pointer into object memory... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#define MAX(a , b) a > b ? a : b
typedef struct _binary_tree binary_tree;
typedef struct _node node;
typedef struct _queue queue;
//################PARTE DA FILA #########################
struct _node
{
int item;
int priority;
... |
C | #include <stdio.h>
#include <stdbool.h>
#include <math.h>
void printBinary(long long number){
int i, binary_number[10];
for (i=0; number>0; i++){
binary_number[i] = number%2;
number/=2;
}
// print number in right order
for (i=i-1; i>=0; i--){
printf("%d", binary_number[i]);... |
C | void init(int* a, int* b) {
*a = 10;*b = 10;
}
int main() {
int *a, *b;
init(a, b);
printf("%d, %d", *a, *b);
return 0;
} |
C | /* bo3-1.c ˳ջ洢ṹc3-1.h壩Ļ9 */
Status InitStack(SqStack *S)
{ /* һջS */
(*S).base=(SElemType *)malloc(STACK_INIT_SIZE*sizeof(SElemType));
if(!(*S).base)
exit(OVERFLOW); /* 洢ʧ */
(*S).top=(*S).base;
(*S).stacksize=STACK_INIT_SIZE;
return OK;
}
Status DestroyStack(SqStack *S)
{ /* ջSSٴ */
free(... |
C | /* box_main.c
Performs calcuation about boxes using the remote procedure calls
This is the client code
Compile it with the rpcgen-ed code
cc box_main.c box_clnt.c box_xdr.c -o box_client
*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include"box.h"
/* Print out the details of the box
Input... |
C | #include <math.h>
#include "maths.h"
#include "common.h"
#ifdef DEBUGGING
#include <stdio.h>
void vec2_print(float* v)
{
double m = (double)vec2_mag(v),
x = (double)v[0],
y = (double)v[1];
printf("[Vec2D(%.3f): %.3f|%.3f]\n", m, x, y);
}
void vec3_print(float* v)
{
doub... |
C | /* math.c
======
Author: R.J.Barnes
*/
/*
(c) 2010 JHU/APL & Others - Please Consult LICENSE.superdarn-rst.3.1-beta-18-gf704e97.txt for more information.
*/
#include <stdlib.h>
#include <math.h>
double sgn(double a,double b) {
double x=0;
x=(double) (a>=0) ? a : -a;
return (double) (b>=0) ? x: ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.