language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /*
Lee una secuencia y extrae la frecuencia relativa de ACGT
Reads a sequence and calcs ACGT frequencies
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <sys/types.h>
#include <dirent.h>
#include <math.h>
#include <time.h>
int main(int ac,char** av){
char c;
int i,j,n;
if(ac<2){
... |
C | /*2.2. Realizar un algoritmo (en seudo o en C), que lea el archivo de texto generado en el ejercicio anterior y visualice por pantalla cada registro del archivo. */
#include<stdio.h>
void imprimirArchivo(FILE *file,int *registrosLeidos);
int main(){
FILE *file = fopen("Alumnos_eje1_5.txt","r");/*Abre el archivo en mo... |
C |
#include <stdio.h>
#include <stdlib.h>
#include "thread.h"
void switch_to(struct task_struct *next); // 定义在 switch.s 中
static struct task_struct init_task = {0, NULL, 0, {0}};
struct task_struct *current = &init_task;
struct task_struct *pick()
{
int current_id = current->id;
int i = current_id;
struct t... |
C | /*
* Daniel Goncalves > 1151452@isep.ipp.pt
* ARQCP - Turma 2DK
*
* main.c
*
*/
#include <stdio.h>
#include "test_equal.h"
/*
* Module 4 - Exercise 6
*/
int main(void) {
// 1
char str1[] = "Hello";
char *ptr1 = str1;
char str2[] = "Hello";
char *ptr2 = str2;
int boolean = test_equal(ptr1, ptr2);... |
C | /**
* Take a DFA and remove indistinguishable states
* The DFA is represented as a transition table.
*/
#include "minimize_dfa.h"
#include "string.h"
#include "common.h"
#include "queue.h"
#include "is_reg_lang_empty.h"
#ifndef HOPCROFT_ALGO
/**
* An implementation of :
*
* MR403320 (53 #7132) 68A25 (94A30) ... |
C | #include<stdio.h>
int main(){
float j,r,t;
scanf("%f",&j);
scanf("%f",&r);
scanf("%f",&t);
if(j<r){
if(r<t)printf("%.1f\n",t);
else printf("%.1f\n",r);
}
else {
if(j<t)printf("%.1f\n",t);
else printf("%.1f\n",j);
}
return 0;
}
|
C | #ifndef CIRCULARLY_LIST_H
#define CIRCULARLY_LIST_H
#define CLIST_INIT(list) \
{ \
(list)->head = NULL; \
}
#define CLIST_ENTRY_INIT(entry) \
{ \
(entry)->prev = entry; \
(entry)->next = entry; \
}
#define CLIST_HEAD(list) \
(list)->head
#define CLIST_TAIL(list) \
(((list)->head != NULL) ? (lis... |
C |
#include<stdio.h>
#include<stdlib.h>
int *fun();
int main()
{
int *ptr;
ptr=fun();
printf("%d\n",*ptr);
return 0;
}
int *fun()
{
//int *point;
int *point = malloc(1*(sizeof *point));
if (point == NULL)
printf("Memory allocation failed\n");
*point=12;
return point;
}... |
C | /**Перевод температуры из градусов по Фаренгейту в градусы по Цельсию*/
#include <stdio.h>
#define LOWER 0 // нижний предел температуры
#define UPPER 300 // верхний предел температуры
#define STEP 20 // шаг изменения температуры
void convert();
int main()
{
printf("Temperature convert\n");
printf("----------------... |
C | #include <stdio.h>
#include <math.h>
#define MAX 100000000
#define LIMIT 10000
#define PRIMELEN 5761456
unsigned flag[(MAX>>6) + 1];
int primes[PRIMELEN+10], total;
#define isComposite(x) (flag[x>>6]&(1<<((x>>1)&31)))
#define setComposite(x) (flag[x>>6]|=(1<<((x>>1)&31)))
void primeSieve()
{
int i, j, k;
for(i=3;... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
///lipseste un subpunct.repetitia
void citire(char **s,char **titlu,char *numeFisier)
{
FILE *f;
f=fopen(numeFisier,"r");
if(f==NULL)
{
printf("Eroare deschidere fisier");
return ;
}
char c = fgetc(f);
int lung =... |
C | #include<stdio.h>
#include<stdlib.h>
#include<malloc.h>
#include<string.h>
typedef struct
{
char num[10];
char name[20];
char date[15];
double pay;
} employee;
typedef struct node
{
employee p;
struct node *pre;
struct node *next;
}node, *linklist;
linklist head, last;
void setData(linkli... |
C | #include <stdio.h>
int main(void){
int N,A,min=1000000010,max=0;
scanf("%d",&N);
for(int i=0;i<N;i++){
scanf("%d",&A);
if(A<min) min=A;
if(A>max) max=A;
}
printf("%d\n",max-min);
return 0;
} ./Main.c: In function main:
./Main.c:5:3: warning: ignoring return value of scanf, declared ... |
C | int removeElement(int* nums, int numsSize, int val){
int slow=0;
for (int i=0 ;i<numsSize ; i++){
if(nums[i] != val){
nums[slow] = nums[i];
slow++;
}
}
return slow;
}
|
C | #include <stdio.h>
int main(int argc, char const *argv[])
{
int len = 3;
char string[len];
int i;
for (i = 0; i < len-1; ++i)
{
string[i] = '-';
}
printf("%s\n", string);
string[2] = '\0';
string[0] = '0';
string[1] = '0';
printf("%s\n", string);
int j = 0;
string[j] = '1';
string[++j] = '2';
print... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <ctype.h>
#include <dirent.h>
#define LEN 4096
char* get_filetype(const char* file);
void send_error(int status,char* title);
void send_header(int status,char* title,... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
void freeMatrix(int row, int col, double **matrix)
{
for (int i = 0; i < (row * col); i++)
{
free(matrix[i]);
}
free(matrix);
}
void printMatrix(int row, int col, double **matrix)
{
printf("Rows: %d\n", row);... |
C | #include "monty.h"
/**
* m_pop - delete element top of stack
* @head: doble pointer to head of d linked list
* @line_count: current line of monty file
* Return: returns void
*/
void m_pop(stack_t **head, unsigned int line_count)
{
stack_t *temp;
if (!(*head) || !head)
{
dprintf(2, "L%u: can't pop an empty st... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_getval_fromabspos.c :+: :+: :+: *... |
C | /* SPDX-License-Identifier: Apache-2.0
* Copyright © 2021 VMware, Inc.
*/
#include "alloc-util.h"
#include "cli.h"
#include "macros.h"
#include "log.h"
int cli_manager_new(const Cli *cli_commands, CliManager **ret) {
_auto_cleanup_ CliManager *m = NULL;
size_t i;
assert(cli_commands);
... |
C | #include "sort.h"
/**
* bubble_sort - sorts by comparing adjacent
* numbers and swapping if prev is larger
* than next.
*
* @array: data to be sorted
* @size: size of array
*
* Return: void
*/
void bubble_sort(int *array, size_t size)
{
unsigned int flag = 1, tmp;
size_t idx = 0;
if (size < 2 || array ==... |
C | int sumarNumeros(int, int);
int sumarNumeros(int numero1, int numero2){
int resultado;
resultado = numero1 + numero2;
return resultado;
}
|
C | // Example of message queue in C.
// For educational purposes only.
// Author: Vaclav Bohac
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <signal.h>
#include <stdarg.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#define DATA_SIZE 4096... |
C | #include<stdio.h>
int main()
{
int num1,num2,num3;
printf("\nEnter three numbers:\n");
scanf("%d%d%d",&num1,&num2,&num3);
if(num1>num2&&num1>num3)
{
printf("%d is greater",num1);
}
if(num2>num1&&num2>num3)
{
printf("%d is greater",num2);
}
if(num3>nu... |
C | #include <stdio.h>
#include <stdlib.h>
#define STACK_INIT 100
#define STACK_ADD 10
typedef char type;
typedef struct
{
type *base,*top;
int stacksize;
}SqStack;
SqStack StackInit()
{
SqStack s;
s.base=(type*)malloc(STACK_INIT*sizeof(type));
if(!s.base) exit(0);
s.top=s.base;
s.stacksize=STACK_INI... |
C | #include <stdio.h>
int main()
{
char netid [7];
FILE *fptr;
if ((fptr = fopen("netid.md","r")) == NULL){
printf("Error! opening file");
// Program exits if the file pointer returns NULL.
exit(1);
}
fscanf(fptr,"%s", &netid);
printf(netid);
fclose(fptr);
return 0;
}
|
C | #include<stdio.h>
int main(int argc, char const *argv[])
{
/* code */
int i,n,sum=0;
printf("Enter you number :- ");
scanf("%d",&n);
for (i = 0; i < n+1; i++)
{
/* code */
sum +=i;
}
printf("\nSum of all Natureal number is :- %d",sum);
printf("\... |
C | 3.
#include <stdio.h>
#define NUM_BLOCKS 4
#define BLOCK_WIDTH 1
__global__ void hello()
{
printf("Hello world! I'm a thread in block %d\n", blockIdx.x);
}
int main(int argc,char **argv)
{
// launch the kernel
hello<<<NUM_BLOCKS, BLOCK_WIDTH>>>();
// force the printf()s to flush
cudaD... |
C |
/************************************************************
*
* FONCTIONS DE LECTURE/ECRITURE DANS UN FICHIER
*
************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "sgf-header.h"
#include "sgf-impl.h"
void sgf_read_block(OFILE* f... |
C | #include "dog.h"
/**
* init_dog - initialize the dog structure with input information
* @d: pointer to structure - dog
* @name: string literal containing dog name
* @age: float value age of dog
* @owner: string literal containing owner name
*
* Return: void
*/
void init_dog(struct dog *d, char *name, float age, char ... |
C | /*
Autor: Tomás de Carvalho Coelho, Eng comp, 418391
*/
#include <stdio.h>
int main() {
int i,j;
for (i = 0; i <= 20; i+=2) {
for (j = 10; j <= 30; j+=10) {
if (i == 0 || i == 10 || i == 20)
printf("I=%.0lf J=%.0lf\n", i / 10.0, (j + i) / 10.0);
else
printf("I=%.1lf J=%.1lf\n", i /... |
C | /*
Suppose you have N eggs and you want to determine from which floor in a K-floor building you can drop an egg such that it doesn't break. You have to determine the minimum number of attempts you need in order find the critical floor in the worst case while using the best strategy.There are few rules given below.
... |
C | #ifndef SIGNALS_H
#define SIGNALS_H
#include <setjmp.h>
/* variables */
extern sigjmp_buf env;
/* ============================= sig_atomic_t =============================
"sig_atomic_t" is only async-signal safe (not thread-safe)
sig_atomic_t is not an atomic data type. It is just the data type
that you are allowe... |
C | #include <stdio.h>
void helper(int b)
{
printf("Twice of given number is = %d", 2*b);
}
int main()
{
// a is pointer to void function helper
// helper functions need int input
void (*a) (int) = helper;
a(10.5); //Call fun by using pointer and input value
return 0;
}
|
C | /*
** EPITECH PROJECT, 2018
** my_revstr.c
** File description:
** reverse a string
*/
#include "mysh.h"
#include <stdio.h>
#include <stdlib.h>
char *my_revstr(char *str)
{
char *new = calloc(1, sizeof(char) * my_strlen(str) + 1);
int j = 0;
for (int i = my_strlen(str) - 1; i >= 0; i--, j++)
new... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>
//дһÿεnumֵͻ1
//void ADD(int *p)
//{
// (*p)++;
//}
//int main()
//{
// int num = 0;
// ADD(&num);
// printf("%d\n", num);
// ADD(&num);
// printf("%d\n", num);
//
// return 0;
//}
//int main()
//{
// printf("%d\n", strlen("abc")); //һķֵΪһIJ -... |
C | #include "cpu/reg.h"
#include "common.h"
#include "page.h"
#include "stdlib.h"
extern uint32_t hwaddr_read(hwaddr_t addr,size_t len);
void maptlb()
{
int i=0;
for (i=0;i<TLB_SIZE;i++) TLB[i].valid=false;
}
bool page_enable()
{
if ((cpu.CR0&0x1)&&(cpu.CR0>>31)) return true;
return false;
}
bool page_cross(uint32_t a... |
C | #include <stdlib.h>
#include "tools.h"
#include "video_draw.h"
void video_draw_pixel(unsigned char *rgb, unsigned int rowstride, unsigned int h, unsigned int x, unsigned int y, unsigned char r, unsigned char g, unsigned char b) {
if(x>=0 && x*3+2<rowstride && y>=0 && y<h) {
rgb[y*rowstride + x*3 + 0] = r... |
C | /*
* Copyright (C) 2002, Simon Nieuviarts
*/
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <errno.h>
#include <limits.h>
#include <string.h>
#include "readcmd.h"
#include "jobs.h"
#include "csapp.h"
#include <signal.h>
#define Stopped 0 //Processes Stopped in the background
#define Running... |
C | #include <stdio.h>
void sum_of_digit(int);
void main()
{
int n;
printf("Enter an integer\n");
scanf("%d", &n);
sum_of_digit(n);
}
void sum_of_digit(int n)
{
int t, sum = 0, remainder;
t = n;
while (t != 0)
{
remainder = t % 10;
printf("%d\n",remainder);
sum = sum + remainde... |
C | #include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <regex.h>
#include <string.h>
#include <ctype.h>
#include "parse.h"
#include "smallfunc.h"
/*
A place for short simple functions, counting items in strings,
converting strings to numbers.. etc.
*/
/*
Example, If you want to check if a string is... |
C | #include <stdlib.h>
#include <stdio.h>
#include "arvore_rubro_negra.h"
/* no especial que ira representar todos os nos externos (folhas) */
PNO externo = NULL;
PNO suporte_raiz = NULL;
/* inicializa uma arvore vazia */
void inicializar_arvoreRB(PNO* raiz){
externo = (PNO) malloc(sizeof(NO));
externo->cor = negro;... |
C | #ifndef _TASKS_H
#define _TASKS_H
#define MAX_TASKS 2
typedef struct
{
void(*fun)(void); // pointer to the task function
unsigned int trigger_time; // period [in ms] when task is executed
unsigned int current_time; // internal counter, set to 0 on init
} TASK;
extern TASK tasks[MAX_TASKS];
void tasks_i... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main( int ac, char **av )
{
struct tm tm ;
/* best set it, since it's not static data */
memset((void*)&tm, 0, sizeof(struct tm)) ;
strptime( "1980/06/01 01:00", "%Y/%m/%d %H:%M", &tm ) ;
tm.tm_hour -= 1 ;
time_t t = mktime(&tm) ;
... |
C | /* passed: 0ms */
/**
* Return an array of arrays of size *returnSize.
* The sizes of the arrays are returned as *returnColumnSizes array.
* Note: Both returned array and *columnSizes array must be malloced, assume caller calls free().
*/
int** generate(int numRows, int* returnSize, int** returnColumnSizes){
i... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ot_user_information.h"
ot_user_information_t *ot_user_information_create()
{
ot_user_information_t *this = malloc(sizeof(ot_user_information_t));
if (this == NULL)
{
printf("Allocation Error!\n");
}
return this;
}
void... |
C | /*************************************************************************
> File Name: stack.h
> Author:
> Mail:
> Created Time: Thu 09 Mar 2017 11:24:43 AM CST
************************************************************************/
#ifndef _STACK_H
#define _STACK_H
typedef struct _intStack{
int *elems;
i... |
C | #include <string.h>
#include "libft.h"
char *ft_strncat(char *dest, const char *src, size_t n)
{
size_t index = 0;
size_t indexx = 0;
while (dest[index] != '\0')
{
index++;
}
while (indexx < n)
{
dest[index] = src[indexx];
index++;
indexx++;
}
return dest;
}
|
C | /*#include<stdio.h>
#include<string.h>
int main()
{
int n,a,j,k,i,n1;
char s1[10],s2[10],s3[10];
printf("Enter name: ");
gets(s1);
n1=strlen(s1);
//printf("%d",n1);
for(i=0;i<=n1-1;i++)
{
printf("s1[%d]=%c\n",i,s1[i]);
s3[j]=s1[i];
j++;
}
for(i=n1-1;i>=0;i... |
C | #include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "symbol.h"
/*
Create a new SYMBOL provided the symbolName. The symbolValue will
be initialized to NULL. Use SETQ to set the symbolValue.
*/
VALUE_PTR MAKE_SYMBOL(STRING symbolName) {
assert(symbolName != NULL);
SYMBOL_... |
C | #include "hash_tables.h"
/**
* hash_table_set - adds and element to the hash table
*@ht: hash table
*@key: key of the table
*@value: value associated with the key
*
* Return: 1 on success, 0 on failue
*/
int hash_table_set(hash_table_t *ht, const char *key, const char *value)
{
unsigned long int size;
unsign... |
C | /** @brief Funciones Exclusivas para el juego.
*
* Aqui encontraras las funciones que son de utilidad para este juego y que dificilmente podran ser utilizadas
* en otros proyectos a menos que sean muy similares.
*
* @file zanahoria.h
* @version 0.1
* @date 22/04/2012
* @author JesusGoku
*
*/
#ifndef __ZANAHORIA_H__
#d... |
C | /**
* @By Jesper And Thorbjrn
*
*/
#include <stdio.h>
#include "GPIO.h"
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <signal.h>
#ifndef WIN32
#include <unistd.h>
#endif
#include <jack/jack.h>
jack_port_t **input_ports;
jack_port_t **output_ports;
jack_client_t *client;
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int i,n,c;
char word[101] = {'\0'};
scanf("%d\n", &n);
for(c=i=0; i<n; ++i){
scanf("%s", word);
if(i==n-1){
int l=strlen(word);
word[l-1] = '\0';
}
if(strcmp(word, "TAKAHASHIKUN") == 0 ||
strcmp(word, "Takahashikun") == 0 ||
... |
C | #include <stdio.h>
char nombres[3][20] = {"fulano","mengano","perano"};
int main(void){
char *a;
char (*b)[20];
char *c;
char (*d)[3][20];
a = &nombres[0][0];
printf("El nombre es %s",a);
b = nombres;
c = &nombres[0][0];
d = &nombres;
for(int i=0; i < 3;i++){
printf("... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(void)
{
int i;
char *cmd[] = {"/bin/echo", "Hello", 0};
for (i = 0; i < 10; i++) {
printf("%d\n", getpid() );
execve("echo", cmd, NULL);
sleep(1); // 1sec
}
return 0;
}
|
C | #include "socket.h"
#include <errno.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
// Siempre que halla if (0> algo) significa "Si hay error"
// Siempre que halla if (0< algo) significa "Si NO hay error"
//***************************************... |
C | #include "cfunc.h"
/*---------------------------------------------------------
// , .
---------------------------------------------------------*/
/*-----------------------------------------
-----------------------------------------*/
//
szMs cMasSizeF(char *szNameFl)
{
szMs szMass;
FILE *sf;
if( (sf ... |
C | uint32_t reverseBits(uint32_t n) {
uint32_t r = 0, x = 32;
while(x--){
r = (r << 1) | (n & 1);
n >>= 1;
}
return r;
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_split.c :+: :+: :+: ... |
C | #include <stdio.h>
int main() {
int side1, side2, side3;
printf("A: ");
scanf("%d", &side1);
printf("B: ");
scanf("%d", &side2);
printf("C: ");
scanf("%d", &side3);
if((side1 + side2 > side3) && (side1 + side3 > side2) && (side2 + side3 > side1)) {
if(side1==side2 && side2==side3) {
printf("Equilat... |
C | #include <stdio.h>
// This function takes a string (recall a string is a character array)
void write_message(char name[]) {
printf("Hello, %s\n", name);
}
int main() {
write_message((char *) "Dave");
write_message((char *) "Victoria");
return 0;
}
|
C | // Filename: cpfile.c
// Compile command: gcc cpfile.c -o cpfile.exe
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#define SIZ 128
// Copy from source file to target file. Adapted from The C Programming
//Language
// by Kernighan and Ritchie.
int main(int argc, const char *argv[]) {
int f1, f2;
//... |
C | #include <stdio.h>
#include <stdlib.h>
#include <termios.h>
#include <unistd.h>
#include <string.h>
#include "functions.c"
#include "keys.c"
#include "printing.c"
int main()
{
static struct termios oldt, newt;
tcgetattr(STDIN_FILENO,&oldt);
newt = oldt;
newt.c_lflag &= ~(ICANON|ECHO);
tcsetattr(STDIN_FILENO,TCSAN... |
C | #pragma once
#include "stdlib.h"
#include "stdio.h"
#include "string.h"
struct list
{
void * data;
struct list * next;
};
void addEnd(struct list ** head, void * element, int size);
struct list *del(struct list ** head, int i);
void delList(struct list ** head);
struct list * showElem(struct list * head, int i);
voi... |
C | #if !defined(MP6_H)
#define MP6_H
#include <stdint.h>
// Flood from (startX, startY) until meeting black (RGB=000000), filling
// with the specified RGB color.
extern void basicFlood
(int32_t width, int32_t height, const uint8_t* inRed,
const uint8_t* inGreen, const uint8_t* inBlue, int32_t startX,
i... |
C | #define MaxSize 100
#define ElementType int
#include<stdio.h>
ElementType S[MaxSize];
int top;
void main(){
top=0;
Push(S,top,9);
printf("%d",top);//˵Ӧtop ++ Dzû ˵ ڲΪرʵ
}
void Push(ElementType S[], int top, ElementType item)
{if (top==MaxSize-1) {
printf("manle"); return;
}else {
S[++top] = item;
return;
}
}
|
C | #include "length.h"
#include <stdlib.h>
#define INCH_PER_FOOT 12
#define FOOT_PER_YARD 3
#define INCH_PER_YARD (INCH_PER_FOOT * FOOT_PER_YARD)
typedef LengthPtr (*SingleAsFunc)(LengthPtr obj, UintType uint);
LengthPtr NewLength(double val, UintType uint) {
LengthPtr length = (LengthPtr) malloc(sizeof(Length));
... |
C | /*------------------Project Includes-----------------*/
#include "led.h"
/*-------------------Driver Includes-----------------*/
#include "driverlib/sysctl.h"
#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "driverlib/pwm.h"
/*-------------------HW define Includes--------------*/
#include "inc/hw_... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main() {
int i, j;
char carac;
srand(time(NULL));
do {
fflush(stdin);
printf("\n Nombre de caractere(s) : ");
}
while ((scanf("%d", &i) == 0) && i < 1);
printf("\n\n Votre code est : ");
for (j = 0; j < i; j++... |
C |
/*
Cameron Elwood
Unversity of Victoria
CSC 360
V00152812
Assignment 2
*/
#define _POSIX_SOURCE
#define _BSD_SOURCE
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <signal.h>
#include <pthread.h>
#include <unistd.h>
#include <string... |
C | #include "types.h"
#include "stat.h"
#include "user.h"
void
regular_demo()
{
int pid = getpid();
int *x = (int *)malloc(sizeof(int));
int *grade = (int*)malloc(sizeof(int));
*grade = 100;
*x = 0;
int *y = (int *)malloc(sizeof(int));
*y = 100; // GRADE?!#!##$
printf(1, "pid : %d x: %d y: %d gra... |
C | #include <stdio.h>
#include "valuenoise.h"
#include "vectors.h"
#define width 256
#define height 256
int main () {
struct double3 value;
FILE* fp = fopen ("valuenoise.pgm", "w");
fprintf (fp, "P2\n%d %d\n255\n", width, height);
for (int y = 0; y < height; y++) {
for (int x ... |
C | #pragma once
//prototypes des fonctions utilises dans l'exercice 1
int initTab(int* tab, int size);
int afficheTab(int* tab, int size, int nbElts);
int unavingtTab(int* tab, int size, int nbElts);
int* ajoutElementDansTableau(int* tab, int* size, int* nbElts, int element);
|
C | #include <stdio.h>
#include <stdlib.h>
#include "skip.h"
//Trabalho Pratico 1 de AEDS2 *** Guilherme Saulo Alves *** 20 de Novembro de 2013
int main(int argc, char **argv){
/*....................declaração das variaveis e processos iniciais......................*/
int nivel; //nivel que ira inserir uma ch... |
C | /*
* Copyright (c) 2014
*
* "License"
*
* Bug reports and issues: <"Email">
*
* This file is part of cwfragment.
*/
#include "timer.h"
#include <unistd.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
struct timer *timer = timer_new();
sleep(1);
printf("Elapsed: %lu ms\n", timer_elapsed(timer, NULL... |
C | #include<string.h>
#include<stdio.h>
#include<stdlib.h>
#include <unistd.h>
#include "curl.h"
#include "error_msg.h"
#include "log_api.h"
#include "misc_api.h"
#define CURL_METHOD_GET 0
#define CURL_METHOD_POST 1
#define BUFF_MAX_LEN 4096
/*动作*/
typedef struct curl_buff_s
{
/*缓存*/
unsigned char... |
C | #include "hexchat-plugin.h"
#include <string.h>
#define PNAME "Promiscuous"
#define PDESC "View all conversations in one tab"
#define PVERSION "0.1"
#define SERV "freenode" /* whose tab? */
static hexchat_plugin *ph; /* plugin handle */
/* https://stackoverflow.com/a/7666577 */
unsigned char hash(unsigned char *... |
C | // Trabalho Pratico Programacao - LEI
// DEIS-ISEC 2020-2021
// Tomás Gomes Silva - 2020143845
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "../headers/utils.h"
void initRandom(){
srand(time(NULL));
}
int intUniformRnd(int a, int b){
return a + rand()%(b-a+1);
}
int probEvento(float pr... |
C | #include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <errno.h>
#include <sys/stat.h>
#include <fcntl.h>
char *p_1 ="ls";
char *p_2 ="-la";
char *s_1 ="tr";
char *s_2="'d'";
char *s_3="'D'";
int main(int argc, char *argv[])
{
//inici... |
C | #include<istdio.h>
// declaring all required variables
struct process{
int process_name,
arrival_time,
burst_time,
waiting_time,
turning_time,
priority,
burst_time_copy;
}queuea[20],queueb[20];
int main(){
struct process code;
// for keeping values safe we need copy of every value, as w... |
C | #include "header.h"
int main(int argc, char** argv)
{
int server_port, client_port, server_fd, client_fd, n;
char node_id;
node_id = argv[1][0];
char *buffer = malloc(80 * sizeof(char));
size_t *t = 0;
//printf("Please enter node id:\n");
//scanf("%c", node_id);
if(DEBUG) printf("Node id: %c\n", node_id);
... |
C | /*
** double_left_redir.c for 42sh in /home/lejeun_m/Projets/PSU_2014_42sh
**
** Made by Matthew LEJEUNE
** Login <lejeun_m@epitech.net>
**
** Started on Sat May 2 19:10:52 2015 Matthew LEJEUNE
** Last update Sat May 30 15:51:08 2015 Matthew LEJEUNE
*/
#include "42sh.h"
char *get_str_stop(t_cmd *cmd)
{
int ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* loadnewUpload.c :+: :+: :+: ... |
C | ////////////////////////////////////////////////////////////////////////////////
//
// File : shellex.c
// Description : This is the source code for a Shell implementation
//
// Author : Jesus Ayala
// Last Modified : December 6th, 2019
//
// $begin shellmain
#include "csapp.h"
#d... |
C | #include<stdio.h>
int main ()
{
int a;
int b;
int x;
int y;
a = 20;
b = 39;
x = a+b;
y = b%2;
printf("\nOur sum of %d and %d is %d", a,b,x);
printf("\nWe analyze a new function, for %d and %d, a value assigned %d", a,b,y);
return 0;
}
|
C | // Fig. 5.16: fig05_16.c
// Scoping.
//Todo: Modify the code to print memory addresses of all variables/array elements and
//explain the impact of "static" keyword. Also use an extern variable and discuss how
//it impacts the memory address. Why?
#include <stdio.h>
void useLocal(void); // function prototype
void use... |
C | /***************************************************************
main.c
Program entrypoint.
***************************************************************/
#include <nusys.h>
#include "config.h"
#include "stages.h"
#include "assets.h"
/********************... |
C | /*
Matrix and vector definition
Copyright (C) 2009 Zdenek Tosner
This file is part of the SIMPSON General NMR Simulation Package
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundatio... |
C | #include "http.h"
#include <stdio.h>
#include <string.h>
#include "vector.h"
/**
* @brief splits path into fields
*
* @param path the path to be split
* @param identifier the identifier to split
* @return char** vector of strings
*/
char **path2vec(char *path, char *identifier) {
char **vec = NULL;
char *tok... |
C | /*
* Stack Min: Design a stack that returns the min value in O(1)
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
/* Define the structure for the stack */
struct Stack {
int *arr;
int top;
int size;
/*
* The idea is that for every "top"
* keep a track of the min value in the elements
... |
C | #include <stdio.h>
// control structures part 3
// loops
int main ()
{
int x =0;
int y = 0;
int z = 0;
while (x<3)
{
printf ("%d\n", x);
x++;
}
do
{
printf ("%d\n", y);
y++;
} while (y !=3);
for ( z = 0; z <3; z++)
{
printf ("%d\n", z);
}
return 0;
} |
C | #include <stdio.h>
#include <fcntl.h>
#include <string.h>
int main()
{
FILE *fp;
int fd;
char str[100] = "fdopen test string\n";
fd = open("fdopen.txt", O_RDONLY);
fp = fopen("fdopen.txt", "w");
if (fp == NULL)
return -1;
fwrite(str, strlen(str), 1, fp);
fclose(fp);
}
|
C | // C implementation of Radix Sort
#include<stdio.h>
#include<stdlib.h>
// This function gives maximum value in array[]
int getMax(int A[], int n)
{
int i;
int max = A[0];
for (i = 1; i < n; i++){
if (A[i] > max)
max = A[i];
}
return max;
}
// Main Radix Sort so... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
unsigned int csrng() {
unsigned int number;
FILE* f = fopen("/dev/urandom", "r");
if (!f) {
printf("Could not open /dev/urandom!\n");
exit(1);
}
size_t read = fread(&number, 1, sizeof numbe... |
C | #pragma once
enum class DebugOutputLevel { DEBUG_OUTPUT_NONE, DEBUG_OUTPUT_PROGRESS, DEBUG_OUTPUT_DIAGNOSTIC, DEBUG_OUTPUT_WARNINGS };
struct Options
{
// number of threads to use
int num_threads;
// terminate recursive ray tracing at this depth and return Black
int max_ray_depth;
// use distribution tracing(t... |
C | /** @file test_macros.h
* @brief
*
* @author
* @bug
* @date 17-Feb-2019
*/
#ifndef TEST_MACROS_H
#define TEST_MACROS_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stddef.h>
#include <limits.h>
#include <stdio.h>
#define TEST_FAILED(X, Y) ... |
C | #include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
main() {
int ile,fd;
char nazwa[14];
printf("Podaj nazwe pliku do utworzenia: "); scanf("%s",nazwa);
if ((fd=creat(nazwa,S_IRWXU))==-1)
printf("Utworzenie pliku %s nie powiodlo sie\n",nazwa);
else
printf("Plik %s... |
C | // calcula e soma 2 valores
#include <stdio.h>
#include <stdlib.h>
int main()
{
/* exemplo1 IF ELSE
int val1, val2, soma;
printf("digite o primeiro valor \n");
scanf("%d",&val1);
printf("digite o segundo valor \n");
scanf("%d",&val2);
if(val1 <0 || val2<0){
... |
C | /**
* Name: Eyal Cohen.
**/
#include <stdio.h>
#include <string.h>
#include<stdlib.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/wait.h>
#include<signal.h>
#define BG "&"
#define AMPERSENT "&"
#define BUFF_SIZED 1500
#define SPACE " "
#define NUM_ELEMENTS 512
#define NUM_COMMANDS 3
#define NUM_JOBS 512
#d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.