language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /*
* File: main.c
* Author: Felipe Costa
*/
/*Cap4, ex18, proposto*/
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv) {
int idade;
printf("\nInforme a idade: ");
scanf("%d*c", &idade);
if (idade >= 18) {
printf("\n\tMAIOR DE IDADE");
} else ... |
C | #pragma once
#include <stdbool.h>
//
struct StackElement
{
int value;
struct StackElement* next;
};
//
struct StackElement* push(struct StackElement* head, int element);
//
int pop(struct StackElement** head);
//
bool isEmpty(struct StackElement* head);
//
void deleteStack(struct StackEl... |
C | #ifndef employee_H_INCLUDED
#define employee_H_INCLUDED
typedef struct
{
int id;
char nombre[128];
int horasTrabajadas;
int sueldo;
}Employee;
Employee* employee_new();
int employee_delete(Employee* this);
void employee_setId(Employee* this,int id);
int employee_getId(Employee* this);
void employee... |
C | #include "headers.h"
#include "emlparser.h"
int emlparser(eml_s *s){
assert(s->fullfilename);
FILE *stream = fopen(s->fullfilename, "r");
if(!stream) return IOError;
int c=0;
asprintf(&s->email_text,"");
while((c=fgetc(stream))!=EOF){
asprintf(&s->email_text,"%s%c",s->email_text,c);
... |
C |
#include "neupdu.h"
#include "logger.h"
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#define NEUPDU_SLICE_MAX (1024*16)
neupdu_t *neupdu_chunk_new(int size, int slice, int alloc_mem){
neupdu_t *pdu;
int num, len, i;... |
C | #include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#define limpiar "cls"
#define parar "pause"
// Grupo: 160501
// Jesus Angel de la luz Hernandez
// Francisco Said Campuzano Torres
int opc = 0;
int total = -1;
char nombre[50][30];
float precio[50];
float peso[50];
int calidad[50];
int a... |
C | /* lab3.c
* Zice Wei <--- replace with your name!
* zicew <--- replace with your user name!
* ECE 2230 Fall 2018
* MP3
*
* NOTE: You must update all of the following comments!
*
* Propose: The aim of lab3 is to use linked-list to sort CSRB imformation.
*
* A... |
C | #include <stdio.h>
int main()
{
int a, day = 1;
scanf("%d", &a);
while(a != 1) {
a /= 2; day++;
}
printf("%d\n", day);
return 0;
} |
C | #include "holberton.h"
/**
*_isalpha - checks for alphabetic character
*@c: The alphabetics character to check
*Return: 1 if is a leter lowercase or uppercase and 0 otherwise
*/
int _isalpha(int c)
{
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
{
return (1);
}
else
{
return (0);
}
}
|
C | #include <stdio.h>
#include <ctype.h>
#define IS_HEX(x) (isxdigit(x) != 0)
int main(){
char *p = "1234567890abcdefgh";
int a[3] = {1,2,3};
while(*p != '\0'){
printf("p = %p, p = %s, is_hex = %d\n", p, p, IS_HEX(*p));
p++;
}
return 0;
}
|
C | /* dynamic_list.c -- implementations for list. author: yongy vers
** <yongy-vers@outlook.com>
*/
bool isEmpty(const list L) /* L is the head node pointed to the first element onde in the list */
{
if(L == NULL)
return true;
else
return false;
}
int elemNum(const list L)
{
list p = L;
int i = 0;
while(p != ... |
C | /*
* waveform_peak_find.c applies search algorithm for detection of
* waveform excursions corresponding to peak and trough values.
*
* Waveform excursion algorithm selects maxima and minima in
* waveforms that meet the condition that the associated excursion
* in signal level between maxima and minima excee... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
int
main(void)
{
const pid_t pid = fork();
if (pid < 0) {
perror("fork");
return 1;
}
if (pid == 0) {
char buffer[128];
if (setsid() < 0) {
perror("setsid");
return 1;
}
snprintf(buffer, si... |
C | /*
* Inspired by
* http://thedailywtf.com/Articles/Confessions-The-Soft-CPU-Upgrade.aspx
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/smp.h>
#define NEWCPU_MODEL_ID_LENGTH 48
#define NEWCPU_DEFAULT_NAME "HyperScale"
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Change the CPU name");
MODUL... |
C | /*
* Demonstrates:
* - relationship between strings, arrays, and pointers
*/
#include <stdio.h>
void strcpy_v1(char dst[], char src[]) {
int i=0;
do {
dst[i] = src[i];
} while (src[i++] != '\0');
}
void strcpy_v2(char dst[], char src[]) {
int i=0;
while ((dst[i] = src[i]) != '\0')
... |
C | #include <string.h>
#include <math.h>
#include <human_100K_regions.h>
int flipSign(const char *genome, double *x, int n, char *chr, int binsize) {
int *starts;
int i,j,l;
for (i=0;i<24;i++) if (strcmp(chr,hchroms[i]) == 0) break;
if (i == 24) return(0);
if (strcmp(genome,"hg19") == 0) starts = hg19[i];
else if ... |
C | #include <stdio.h>
#include <stdlib.h>
//Prctica 4, ejercicio 1.
int main()
{
int i=0,k=0, num;
int primo = 1;
/* // EN CASO QUE SEPAN UNA SCANF //
printf("Ingrese un Numero ");
scanf("%d",&num);
*/
num = 15; // Valor para modificar
printf("El numero ingresado es %d, y tenemos que: \n\n... |
C | #include <stdio.h>
#include <limits.h>
int main(void)
{
printf("\t\t----------Signed----------\n");
printf("char: %d %d\n", (int) SCHAR_MAX, (int) SCHAR_MIN);
printf("short: %d %d\n", (int) SHRT_MAX, (int) SHRT_MIN);
printf("int: %d %d\n", INT_MAX, INT_MIN);
printf("long: %ld %ld\n\n", LONG_MAX, L... |
C | #include <stdio.h>
typedef struct point
{
int xpos;
int ypos;
} Point;
typedef struct rectangle
{
Point leftLow;
Point rightHigh;
} Rectangle;
void ShowRectangleInfo(Rectangle * rptr)
{
printf(" ϴ: [%d, %d] \n", (rptr->leftLow).xpos, (rptr->leftLow).ypos);
printf(" : [%d, %d] \n", (rptr->leftL... |
C | #include <stdio.h>
#include <assert.h>
#include <stdlib.h>
typedef int ComplexLinkType;
typedef struct ComplexLinkNode
{
ComplexLinkType data;
struct ComplexLinkNode* next;
struct ComplexLinkNode* sibling;
}ComplexLinkNode;
//初始化链表
void ComplexLinkInit(ComplexLinkNode** head)
{
assert(head);
*hea... |
C | #include "raidTen.h"
#include "raid_handler.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/* TODO We need to do some bookeeping right away.
* Setup the disk structure before hand which will
* provide the mapping of the LBA to the proper (disk,block) address
* Then read/write can just iterate withou... |
C | #include "holberton.h"
/**
* _strchr - search the position of a char into "s" if
* find a "*" jump it if jump = 1
* @s: string address
* @c: character to search
* @jump: jump or noy (no usable, will be deleted on next releases)
*
*
* Return: address of character on "s"
* On error: -1 inapropiate entry
*/
ch... |
C | #include<windows.h>
/* This function is used to change characters color in the console */
/*
0 = Black 8 = Gray
1 = Blue 9 = Light Blue
2 = Green A = Light Green
3 = Aqua B = Light Aqua
4 = Red C = Light Red
5 = Purple D = Light Purple
6 = Yellow E = Light Ye... |
C | #include <stdio.h>
int main()
{
int t,T,X,R,C,min,max;
scanf("%d", &T);
for(t=1;t<=T;t++)
{
scanf("%d%d%d", &X, &R, &C);
min = (R<C)?R:C;
max = (R>C)?R:C;
if (X>6 || X>max || X>2*min || (R*C)%X!=0)
{
printf("Case #%d: RICHARD\n", t);
continue;
}
if (X<4 || X<=min)
{
printf("Case #%d: G... |
C | /*
这里可以写相关文件描述 协议等等信息
如:
按照C语言的语法 规范编程
一个良好的书写规范决定一个程序的好坏
源代码不仅仅给自己看有可能给别人看
*/
/*1、头文件*/
#include <stdio.h>
#include <string.h>
#include "main.h"
/*2、宏定义
#define TEMPLATE XXXXXX
*/
/*3、结构体声明
typedef struct{
int xxx_xxx;
char *xxx_xxx;
}TEMPLATE_T;
*/
/*4、函数和变量声明
int Template(TEMPLATE_T xxx_xxx );
*/
/*5、函数... |
C | #include <unistd.h>
#include <assert.h>
#include <sys/socket.h>
#include <netinet/in.h>
void handle(int fd);
void
netserv(void)
{
int srv = socket(AF_INET, SOCK_STREAM, 0);
assert(srv >= 0);
int reuse = 1;
assert(setsockopt(srv, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse)) >= 0);
struct sockaddr_in si... |
C | /*Задача 5 Дефинирайте потребителски тип
към масив. Инициализирайте масива, изведете на
конзолата.*/
#include <stdio.h>
typedef int ARR[3];
int main()
{
ARR a[3] = {{1, 2, 3}, {1, 2, 3}, {1, 2, 3}};
for (int i = 0; i < 3; i++)
{
printf("[%d] {%d, %d, %d}\n", i, a[i][0], a[i][1], a[i][2]);
}
... |
C | #include <stdio.h>
int main(){
char *profile_name = "Daily00to08";
char *day_string = "1111111";
char *start_time = "08:00";
char *end_time = "18:00";
char nvram_buf[64]={};
char schedule_list[32]={};
int index=0;
sprintf( schedule_list, "schedule-rule_%02d", index);
sprintf( nvram_buf, "%s/%s/%s/%s", prof... |
C | #include <stdio.h>
#include <sys/timeb.h>
int main()
{
struct timeb start, end;
int diff;
ftime(&start);
getchar();
ftime(&end);
diff = (int) (1000.0 * (end.time - start.time) + (end.millitm - start.millitm));
printf("\nOperation took %u milliseconds\n", diff);
return... |
C | int InterpolationSearch( int a[], int n, int key )
{
int left = 0, right = n - 1, middle;
while ( left <= right ) {
middle = ( ( key - a[ left ] ) / ( a[ right ] - a[ left ] ) )
* ( right - left ) + left;
if ( key == a[ middle ] )
return middle;
if ( key > a[ middle ] )
left = middle + 1;
else
... |
C | #include "libft.h"
wchar_t *ft_wstrcpy(wchar_t *dst, const wchar_t *src)
{
size_t i;
i = -1;
while (*(src + ++i))
*(dst + i) = *(src + i);
*(dst + i) = '\0';
return (dst);
} |
C | #include <native/task.h>
#include <native/timer.h>
#include <sys/mman.h>
#include <rtdk.h>
#include "io.h"
#include <pthread.h>
#include <unistd.h>
#define DURATION 60000000000
void timeout(long endTime) {
if (rt_timer_read() > endTime) {
rt_printf("Time expired\n");
rt_task_delete(NULL);
}
... |
C | #include<stdio.h>
int main()
{
char s1[45],s2[37];
int i,j,c=0;
printf("enter the two string:");
scanf("%s%s",&s1,&s2);
for(i=0;s1[i]!='\0';i++)
{
for(j=0;s2[j]!='\0';j++)
{
if(s1[i]==s2[j])
{
c=c+1;
}
}
}
if(c>=... |
C | #ifndef TIME_H
#define TIME_H
#include "types.h"
static uint32_t get_tick()
{
unsigned long result;
asm volatile ("push %%es\n"
"mov $0,%%bx\n"
"mov %%bx,%%es\n"
"mov $0x046C,%%bx\n"
"mov %%es:(%%bx),%%eax\n"
"p... |
C | #include <cs50.h>
#include <stdio.h>
#include <math.h>
bool isPrime(int num);
int sumPrimes(int num);
int main(void)
{
int num = get_int("Enter a positive number: ");
isPrime(num);
sumPrimes(num);
}
// Check numbers 2 through input - 1
// Check if input is divisible by number
// Not prime (retur... |
C | /*
Nombre : AmuletoContenedorVital
Zona : Poblado de Enalel
Autor : Tyflos
Fecha : 14/01/2005
Descripcin : Amuleto que almacena y devuelve puntos de vida.
Almacenar vida de todos los personajes.
Devolver vida a todos los personajes.
Podr almacenar un mximo de 500 PV.
Slo funcionar con su dueo.
... |
C | //
// question-39.c
// algorithm
//
// Created by Kai on 2019/8/19.
// Copyright © 2019 kai. All rights reserved.
//
#include "question-39.h"
#include <stdbool.h>
bool checkMoreThanHalf(int *nums, int length, int target);
int moreThanHalfNum(int *nums, int length) {
if (nums == NULL || length <= 0) {
... |
C | /*
* Vector3.h
*
* Created on: Jan 23, 2021
* Author: Ivan Khodyrev
*/
#ifndef VECTOR3_H_
#define VECTOR3_H_
struct Vector3 {
double x, y, z;
Vector3();
Vector3(double x, double y, double z);
~Vector3();
Vector3& operator=(const Vector3 &right);
friend Vector3 operator+(const Vector3 &left, const ... |
C | #include "mini.h"
int ft_envp_listlen(t_envp *envp, int envp_id)
{
t_envp *copy;
int len;
copy = envp;
len = 0;
while (copy)
{
if (copy->id == envp_id)
++len;
copy = copy->next;
}
return (len);
}
char **ft_clone_envp(t_envp *envp)
{
char **result;
t_envp *copy;
int size;
int a;
copy = envp... |
C | /**
* Replace the space with %20 in a given string
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int count_space(char *str)
{
if (str == NULL)
return 0;
int count = 0;
int sz = strlen(str);
for (int i = 0; i < sz; i++)
if (str[i] == ' ')
++count;
retur... |
C | #include "debug.h"
#include <stdio.h>
void debug_print_keys(int* const keys, const int key_count)
{
printf("{");
const int last_key_index = key_count - 1;
for (int key_index = 0; key_index < last_key_index; ++key_index)
{
printf("%d, ", keys[key_index]);
}
printf("%d}", keys[last_key_i... |
C | #include <fe.h>
#include <sodium.h>
#include <xeddsa.h>
/**
* Convert a Curve25519 public key into an Ed25519 public key.
*
* @param ed25519_pub (out): The Ed25519 public key corresponding to the Curve25519 public key.
* @param curve25519_pub (in): The Curve25519 public key to convert into its Ed25519 equivalent.... |
C | /*
* This Code Was Created By Pet & Commented/Cleaned Up By Jeff Molofee
* If You've Found This Code Useful, Please Let Me Know.
* Visit NeHe Productions At http://nehe.gamedev.net
*/
#include <math.h> // Header File For Windows Math Library
#include <stdio.h> // Header File For Standard Input/Output
#ifdef... |
C | # include "../../pipes.h"
# include "../../ingres.h"
# include "IIglobals.h"
/*
** RESYNCHRONIZE PIPES AFTER AN INTERRUPT
**
** The pipes are all cleared out. This routines must be called
** by all processes in the system simultaneously. It should be
** called from the interrupt catching routine.
**
** History:
** ... |
C | #include "holberton.h"
#include <stdlib.h>
#include <stdio.h>
char *rot13(char *)
{
int x, y;
char arr[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
char arr2[] = "nopqrstuvwxyzabcdefghijklm";
for (x = 0; arr[x]; x++)
{
for (y = 0; arr2[y]; y++)
{
if (arr[x] == arr[y])
{
arr[x] = ar... |
C | #include<stdio.h>
#include<string.h>
main(){
char *line="TCP:16883:BitSpirit - Powered by LANSPIRIT.NET!";
char protocol[128] = {0};
char port[128] = {0};
char name[128] = {0};
sscanf(line,"%[^:]:%[^:]:%[^\n]",protocol,port,name);
printf("the protocol is %s\n",protocol);
printf("the port is %s\n",port);
prin... |
C | /*-------------------------------------------------------------------------*
*--- ---*
*--- babyFTPHeader.h ---*
*--- ---*
*--- This file defines common constants for a very simple remote ---*
*--- file listing server. ---*
*--- ---*
*--- ---- ---- ---- ---- ---- ---... |
C | #include "../include/arraylist.h"
#include <stdlib.h>
#define DEFAULT_ARRAYLIST_SIZE 10
arraylist *create_arraylist() {
arraylist *list = malloc(sizeof(arraylist));
list->size = 0;
list->max_size = DEFAULT_ARRAYLIST_SIZE;
list->list = malloc(sizeof(int) * list->max_size);
return list;
}
void expa... |
C | #include<stdio.h>
void main()
{
float x,y;
printf("please input a x");
scanf("%f",&x);
if (x<1)
y=x;
else if(x>=1&x<10)
y=2*x-1;
else
y=3*x-11;
printf("the answer is : %f",y);
}
|
C | #ifndef TABLE_H
#define TABLE_H
#include "common.h"
struct symbol {
struct symbol *next;
struct type *type;
char *reg;
};
struct sym_bucket {
struct symbol *elem;
struct sym_bucket *next;
};
#include "type.h"
struct symbol *table_add_symbol (struct symbol *table, struct type *type);
struct sym_bucket *table_a... |
C | #include <stdio.h>
#define MAX 1024
int main()
{
char str1[MAX];
char c;
int i = 0;
while (( str1[i++] = getchar() ) != '\n')
{
if (str1[i-1] == ' ' || i >= 20)
{
str1[i] = '\0';
printf("str you input is:%s", str1);
... |
C | #include "unity.h"
#include "Stack.h"
#include <malloc.h>
#include <stdio.h>
#include "CException.h"
#include "ErrorCode.h"
void setUp(void)
{
}
void tearDown(void)
{
}
void test_stackIsEmpty_should_return_1_for_empty_stack()
{
Stack *stack = stackNew(6);
TEST_ASSERT_EQUAL(1,stackIsEmpty(stack));
stackDel... |
C | /*
* tgaUtils.c
*
* Created on: Apr 24, 2015
* Author: simon
*/
#include <stdio.h>
#include <stdlib.h>
#include "globalDefines.h"
#include "tgaUtils.h"
extern int isLog;
void tgaImageProperties(TgaImage* tgaImage)
{
printf("- - - - - - - - - - - - - - - - - - -\n");
printf("TGA Image Properties:\n");
... |
C | #include<stdio.h>
#include<string.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
int main()
{
char buf[1024];
ssize_t s=read(0,buf,strlen(buf));
if(s>0){
buf[s]=0;
write(1,buf,strlen(buf));
write(2,buf,strlen(buf));
}
return 0;
}
|
C | #include<stdio.h>
void main(){
int r,c,sum=0,i,j;
printf("r : ");
scanf("%d", &r);
printf("c : ");
scanf("%d", &c);
int a[r][c];
int b[r][c];
for(i=0; i<r; i++){
for(j=0; j<c; j++){
printf("a[%d][%d] ", i,j);
scanf("%d", &a[i][j]);
a[i][j] =... |
C | #include <stdio.h>
#define MAX 100
int repetidos(int vec[],int size){
for(int i = 0; i < size; i++){
for(int j = i+1; j < size; j++){
if(vec[i] == vec[j])
return 1;
}
}
return 0;
}
int main(void){
int val_lido[MAX], i = 0;
printf("Indique os valores(termina em 0 ou max de 100 val): ");
scanf("%d", ... |
C | #ifndef __MATRICECREUSE_H__
#define __MATRICECREUSE_H__
typedef struct matriceCell MatriceCell;
typedef struct matriceinfo MatriceInfo;
struct matriceCell
{
int x;
int y;
MatriceCell* nextCellrow;
MatriceCell* nextCellcol;
MatriceCell* precCellRow;
MatriceCell* precCellcol;
int value... |
C | #include "../library/commonUtils/numericOperations.h"
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int n = 0;
printf("Enter n:\n");
scanf("%d", &n);
int minimum = 0, maximum = 0;
printf("Enter an array:\n");
int* array = (int*)calloc(n, sizeof(int... |
C | #ifndef STD_H
#include "std.h"
#endif
#include "ord_arraylist.h"
/*
* Pointer: Node
* -------------------------
* _node structure pointer.
*
*/
typedef struct _node* Node;
/*
* Struct: _node
* -------------------------
* _node structure definition, an N-ary tree.
*
* value: the value of the current node,
*... |
C | #include <stdio.h>
#define forever for (;;) /* [v */
int main(void)
{
int i = 0;
forever {
if ( ++i == 10 )
break;
}
printf("i = %d\n",i);
return 0;
}
|
C | #include "holberton.h"
/**
* print_line - prints a line in the terminal
* @n: number of lines
* Return: nothing
*/
void print_line(int n)
{
int a = 0;
for (a = 0; a < n; a++)
{
if (n <= 0)
break;
else
{
_putchar(95);
}
}
_putchar('\n');
}
|
C |
#include <sys/time.h>
#include <stdio.h>
#include <string.h>
#include <pthread.h>
#include <stdlib.h>
#include <limits.h>
#if 1
#define THREADS 4
#define debug(f,a...) do{}while(0)
#else
#define DEBUG
#define THREADS 1
#define debug(f,a...) printf("%16s.%-4d."f,__func__, __LINE__,##a)
#endif
#define error(f,a...) pri... |
C | #ifndef __STRUCT_H__
#define __STRUCT_H__
typedef enum boolean
{
false = 0,
true = 1
} bool;
typedef struct node
{
char *part_of_string;
struct node *next_node;
} node_t;
typedef struct
{
char *value;
int key;
} keys_table_t;
#endif
|
C | // C program to demonstrate GCD Algorithms
#include <stdio.h>
// Function to return gcd of a and b
int euclid(int a, int b)
{
if (a == 0)
return b;
return euclid(b%a, a);
}
int linear(int a, int b){
int max = a >= b? a : b;
int gcd = 1;
for(int i = 2; i <= max; i++){
if(a % i == 0 && b % i == 0)
g... |
C | #include<stdio.h>
int gcd(int a, int b)
{
if (a == 0 || b == 0)
return 0;
if (a == b)
return a;
if (a > b)
return gcd(a-b, b);
return gcd(a, b-a);
}
int main()
{
int a,b;
scanf("%d %d",&a,&b);
printf("GCD of %d and %d is %d ", a, b, gcd(a, b));
return 0;
}
|
C | #include <pthread.h>
#include <stdio.h>
#define NUM_THREADS 4
struct thread_arg
{
int num;
};
void *thread_func (void *varg)
{
struct thread_arg *arg = varg;
printf("I am thread %d\n", arg->num);
for (;;) {
sleep (1);
}
}
int main (int argc, char *argv[])
{
pthread_t thread... |
C | /*
利用所学知识,输入一个日期(y/m/d),计算这是这一年中的
第几天(2020/10/26)
*/
#include <stdio.h>
int main(void)
{
int y, m, d;
int days = 0;
printf("输入日期(y/m/d):");
scanf("%d/%d/%d", &y, &m, &d);
switch (m-1) {
case 11:
days += 30;
case 10:
days += 31;
case 9:
days += 30;
case 8:
days += 31;
case 7:
days += ... |
C | #include <stdlib.h>
#include <stdio.h>
#ifndef LINKEDLIST_H
#define LINKEDLIST_H
#endif
#include "SongLib.h"
int main(){
// LINKED LIST TESTS
srand(time(NULL));
printf("\nLINKED LIST TESTS \n");
printf("***************************************************************************\n");
//Constructing nodes
s... |
C | #include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
float arr[n][2];
// Inputing value in array
for(int i=0 ; i<n ; ++i)
{
for(int j=0 ; j<2 ; ++j)
{
scanf("%f",&arr[i][j]);
}
}
// Printing the table
printf("\n");
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* checking.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <hiredis.h>
#include <hiredis_ssl.h>
#ifdef _MSC_VER
#include <winsock2.h> /* For struct timeval */
#endif
int main(int argc, char **argv) {
unsigned int j;
redisSSLContext *ssl;
redisSSLContextError ssl_error = REDIS_SSL_CTX_NONE;
r... |
C | #ifndef STRUTTURE_H
#define STRUTTRE_H
#include <getopt.h>
#include <errno.h>
#include <malloc.h>
#include <pthread.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sysexits.h>
#include <time.h>
#include <unistd.h>
... |
C | #include <stdio.h>
int main(void) {
int input;
while (1) {
printf("please enter a ASCII number: \n");
scanf("%d", &input);
printf("input = %d\n", input);
if (input == 'q') {
printf("q is entered, quit.\n");
break;
}
printf("the char of ASCII is %c.\n", input);
}
return 0;
}
|
C | /*
NOME: Jingrui
Cognome: Zhu
Progetto: The Dune
*/
#include "gamelib.h"
int main(){
time_t t;
srand((unsigned) time(&t));
int page;
//la storia del gioco
system("clear");
printf("\033[1;32m");
printf("\n\nWelcome to the world of The Dune\n\n");
sleep(1);
printf("\033[0mYou find yourself on the on... |
C | //
// Created by xieyipeng on 2019/10/27.
//
#include <mbstring.h>
#include <stdbool.h>
#include "matrix.h"
/**
* 邻接矩阵创建图
* @param graph
* @param c 有向(1)或无向(0)图
*/
void create(MGraph *graph, int c) {
graph->n = 0;
graph->e = 0;
int i, j;
char ch[20];
FILE *edge = fopen("E:\\DataStructure\\Post... |
C | #include<stdio.h>
int max(int x,int y);
int min(int x,int y);
void main()
{
int a,b,c,d;
scanf("%d,%d",&a,&b);
c=max(a,b);
d=min(a,b);
printf("max is %d\n",c);
printf("min is %d",d);
}
int max(int x,int y)
{
int t1=0,t2=0,m=0,j;
j=y;
for(;j>0;j--)
{
t1=y%j;
t2=x%j;
if(t1==0&&t2==0)
{
m=j;
... |
C | //
// Created by Jakob Rieck on 19.02.18.
//
#include "regex.h"
#include <misc/argument_handling.h>
#include <scheme_interpreter/scheme-private.h>
#include <stdlib.h>
#include <string.h>
static char *regex_quote_internal(const char *input) {
const size_t in_len = strlen(input);
// These are the characters the sa... |
C | #include<stdio.h>
#include<fs.h>
long getFileSize(const char * fileName) {
FILE *f = fopen(fileName, "rb");
if (!f) return -1;
fseek(f, 0, SEEK_END);
long fsize = ftell(f);
fclose(f);
return fsize;
}
int readFileToBuffer(const char * fileName, char * buffer, int bufferLength) {
FILE *f = f... |
C | #include <stdio.h>
#include <stdlib.h>
int main(void)
{
int input;
while(scanf("%d",&input)!=EOF)
{
printf(input % 2 == 0 ? "Even\n":"Odd\n");
}
return 0;
}
|
C | #include "interp.h"
#define MEM_CHUNK 256
void process(FILE *stream) {
char c;
char *memory = (char *) malloc(MEM_CHUNK);
char *p = memory;
int curchar = 0;
int *bracks = (int *) malloc(MEM_CHUNK * sizeof(int));
int *bp = bracks;
*memory = 1;
p++;
*bracks = 1;
bp++;
while ((c = getc(stream)) != EOF) {
#... |
C | enum TextQuality{
SLOW, MEDIUM, FAST
};
TTF_Font *loadFont(const char* path, Uint32 size) {
return TTF_OpenFont(path,size);
}
SDL_Texture* renderText(SDL_Renderer *renderer,const char *text, TTF_Font* font, Color c, TextQuality flags) {
SDL_Texture* out;
SDL_Surface* primary;
if (flags == FAST) {
primary ... |
C | #include "header.h"
/* Status of the operation requested */
#define VALID (1)
#define INVALID (0)
/* Calculator operation requested by user*/
unsigned int financial_calculator_operation = 0;
/* Operands on which calculation is performed */
long int amount=0;
long int number_of_years = 0;
long int number_of_months=... |
C | /*
* str_buf.h
*
* Description
* API for the dynamic string buffer.
*
* Copyright 2010 Dan Rinehimer
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.or... |
C | /*
** EPITECH PROJECT, 2019
** MUL_my_rpg_2019
** File description:
** itoa.c
*/
#include "stdlib.h"
#include "unistd.h"
char *itoa(int nb)
{
char *str = NULL;
int i = 0;
if (nb == 0)
return "0\0";
for (int cp = nb; cp > 0; i++, cp /= 10);
str = malloc(sizeof(char) * i + 1);
str[i] = ... |
C | /*
* strclithread.c
*
* Created on: Dec 7, 2018
* Author: yifeifan
*/
#include "network.h"
static int sockfd;
static FILE *fp;
static stdineof_thread = 0;
void *copyto(void *);
void str_cli_thread(FILE *fp_arg, int sockfd_arg)
{
char recvline[MAXLINE];
int rc;
pthread_t tid;
sockfd = sockfd_arg;
fp ... |
C | #include <stdio.h>
int main(void) {
char str[] = "Hello 1968 This is 45";
int i, j;
char st[16];
sscanf(str, "%s %d %*s %*s %d", st, &i, &j);
printf("String: %s \n", st);
printf("Number: %d \n", i);
printf("Number: %d \n", j);
return 0;
}
|
C | #include<stdio.h>
#include<assert.h>
/*char *my_strcpy(char *a1,const char *a2)//ģstrcpy
{
if (*a2 == '\0')
{
*a1 = *a2;
return *a2;
}
*a1 = *a2;
my_strcpy(++a1, ++a2);
}*/
char *my_strcpy(char *strDest, const char *strSrc)//ģstrcpy
{
assert(strDest != NULL && strSrc != NULL);
char *res = strDest;
whil... |
C | /******************************************************************************
Given three integers x,y and z you need to find the all the possible combination of numbers having 4 at most x times, having 5 at most y times and having 6 at most z times as a digit.
Example:-
input x=1,y=1,z=1
output
4
5
6
45
... |
C | #include "../internal.h"
#include <string.h>
#include <errno.h>
size_t fwrite(const void *restrict buf, size_t size, size_t nmemb, FILE *restrict f) {
// If the stream is already in error state, just return error
if (f->flags & FLAG_ERR) {
errno = EIO; // TODO
return 0;
}
size_t writeSize = nmemb * size;
if ... |
C | #include<stdio.h>
void Pattern(int iRow, int iCol)
{
int iCnt=0,jCnt=0;
for(iCnt=1;iCnt<=iRow;iCnt++)
{
for(jCnt=1;jCnt<=iCol;jCnt++)
{
if(iCnt==1||iCnt==iRow||jCnt==1||jCnt==iCol)
{
p... |
C | #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <wchar.h>
#include <locale.h>
#include <unistd.h>
#include "postprocess.h"
const char *file_name_prefix = "./data/ettoday";
const char *temp_out_file = "./sentences.txt";
const char *final_out_file = "./dataset.txt";
const char *fil... |
C | #include <stdio.h>
#include <math.h>
double f_taylor(double x){
return (double) -1/2 + pow(x,2)/24;
}
int main(int argc, char const *argv[])
{
FILE * sortida;
sortida = fopen("exercici2.txt","w");
double x = -0.001;
while(x<=0.001){
fprintf(sortida,"%.11le %.11le\n",x,f_taylor(x));
... |
C | /*
* realtimeclock_main.c
*
* Created on: Sep 15, 2017
* Author: superman
*/
#include "xgpio.h" // Provides access to PB GPIO driver.
#include <stdio.h> // xil_printf and so forth.
#include "platform.h" // Enables caching and other system stuff.
#include "mb_interface.h" // provide... |
C | /*
* e63_display_driver.c
*
* Created on: Jun 11, 2021
* Author: Trevor Attema
*/
#include "e63_display_driver.h"
#include "MC2PA8201.h"
static int isTransmittingData = 0;
int touchgfxDisplayDriverTransmitActive()
{
return isTransmittingData;
}
void touchgfxDisplayDriverTransmitBlock(... |
C | #include <stdio.h>
#include <unistd.h>
int main(){
int i=0;
int id; /** 0, ha ő a gyerek, a gyerek PID-je, ha ő a szülő. */
printf("%d\n", i);
id = CreateProcess();
//printf("%d\n", id);
if(id==0){
printf("\nGyerek vagyok, a PID-em %d\n", getpid());
while(i<10){
printf("%d\t", i);
i++;
}
} else{
... |
C | /*
* =====================================================================================
*
* Filename: hwpam6.c
*
* Description:
*
* Version: 1.0
* Created: 02/15/2018 09:39:18 AM
* Revision: none
* Compiler: gcc
*
* Author: Bo Christensen (), BowmanChris... |
C | #include <stdio.h>
#include <unistd.h>
#include "heat.c"
int main() {
main_out out;
main_mem mem;
main_reset(&mem);
// Let's heat up to a cozy 27C
float target = 27;
while(1) {
main_step(target, &mem, &out);
printf("Temp: %f\n", out.temp);
usleep(100000);
}
return 0;
}
|
C | /*
NFA --> DFA conversion program
δб ǻͰк ½
Email: sskang@kookmin.ac.kr
Ϸ ī -- http://cafe.daum.net/sskang-compiler
Ȩ -- http://nlp.kookmin.ac.kr/
*/
#include <stdio.h>
#include <string.h>
#define STATES 256
#define SYMBOLS 20
int N_symbols; /* number of input symbols */
int NFA_states; /* number of NFA states */
ch... |
C | #include<stdio.h>
#include<stdlib.h>
typedef struct element{
int key;
}element;
struct queue{
element data;
struct queue *link;
};
typedef struct queue *queueptr;
queueptr front[100], rear[100];
void addq(element item,int i){
queueptr temp=(queueptr)malloc(sizeof(struct queue));
temp->data=item;
if(!front[i])
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <locale.h>
void main() {
// caracteres especiais
setlocale(LC_ALL, "Portuguese");
int fatorial,
resposta = 1;
printf("Digite um numero inteiro:\t");
scanf("%i", &fatorial);
for (; fatorial >= 1; --fatorial) {
resposta = respo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.