language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
int main()
{
long long a;
int count=0;
printf("enter the integers");
scanf("%lld",&a);
while(a!=0)
{
a /=10;
++count;
}
printf("the integers are %d",count);
getch();
}
|
C | float avgHw(float hw1, float hw2, float hw3){
float result = (hw1 + hw2 + hw3) / 3;
return result;
}
float avgEx(float ex1, float ex2, float ex3){
float result = (ex1 + ex2 + ex3) / 3;
return result;
}
float totalScore(float hw, float ex, float mid, float final){ //Function to calculate total score
float result ... |
C | #include "sdl.h"
SDL_Surface *init ( char * imgFond_filename, SDL_Surface **pFond )
{
SDL_Surface *fond;
fond = SDL_LoadBMP(imgFond_filename);
if (fond == NULL)
{
fprintf(stderr, "Impossible de charger le fichier %s: %s\n", imgFond_filename, SDL_GetError());
exit(EXIT_FAILURE); // On quitte le programme
... |
C | #include "Common.h"
#include "Socket_Process.h"
#include "Dispatcher.h"
#include "Worker.h"
//Esta funcion cierra y borra la mqueue asociada al cliente, luego envia un broadcast
//que cierra los archivos abiertos por el cliente que se desconecta y borra los registros
//correspondientes que pudieran haber quedado (en c... |
C | /* Partner(s) Name & E-mail: None
* Lab Section: 22
* Assignment: Lab # 2 Exercise # 1
* Exercise Description: [optional - include for your own benefit] A garage door sensor connect to PA0 (1 means door is open), and a light sensor connects to PA1 (1 means light is sensed). Write a program that illuminates an LED co... |
C | #include "statickStack.h"
void init(StaticStack *stack) {
for (int i = 0; i < MAXTAM; i++) {
Object x;
x.key = 0;
stack->array[i] = x;
}
stack->top = 0;
}
bool isEmpty(StaticStack *stack) {
return (stack->top == 0) ? true : false;
}
bool isFull(StaticStack *stack) {
return... |
C | #include "push_swap.h"
int cost(tree_node *tree)
{
int bigger;
bigger = select_bigger_num(tree->remaining_array1, tree->remaining_array2);
return(tree->moves + bigger);
}
int count_remaining_array1(tree_node *tree, int inst)
{
if(inst == RR || inst == RRR || inst == SS || inst == PP)
return(tree->remaining_ar... |
C | #include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "QueueArray.h"
int queue_array_size(struct queue_array_s *q)
{
return q->nb_elements;
}
bool queue_array_is_empty(struct queue_array_s *q)
{
return q->nb_elements == 0 ? true : false;
}
bool queue_array_is_full(struct queue_array_s *q)
{
... |
C | #include "routing.h"
int main()
{
printf("route struct size : %d bytes - message size : %d bytes\n", sizeof(struct route), sizeof(struct message));
printf("taille max de la table de routage : %f kB\n",(sizeof(struct route)*255+4)/1024.0);
struct routing_table* table = NULL;
struct message msg1,msg2,msg... |
C | #include <stdio.h>
int cashbox(float shortChange, int max, int count);
int main()
{
int result;
float shortChange;
printf("input short change: ");
scanf("%g", &shortChange);
result = cashbox(shortChange, 0, 0);
printf("\n result: %d", result);
return 0;
}
int cash... |
C | #include<stdio.h>
int main()
{
char a[100];
int i;
while(scanf("%s",a)!=EOF)
{
for(i=0;a[i];i++)
{
if(a[i]>='a'&&a[i]<='y')
a[i]+=1
else
if(a[i]=='z')
a[i]='a';
}
printf("%s ",a);
}
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include "ProductIdentifier.h"
void InitProductIdentifier(ProductIdentifier *identifier)
{
identifier->productSystemId = NULL;
identifier->productSystemCustomerId = NULL;
identifier->productNumber = NULL;
}
void DeinitProductIdentifier(ProductIdentifier *identifier)
... |
C | #include <stdio.h>
/*
verify that the expression 'getchar() != EOF' is 0 or 1
*/
int main(void)
{
printf("%d",(getchar() != EOF));
printf("%d",(getchar() == EOF));
printf("\n");
} |
C | #include "../HEADERS/ui.h"
#include "../HEADERS/headers.h"
void Login_UI() //打印登录输入用户名和密码界面
{
system("cls");
for(int i=0; i<=ROW; i++)
{
if(i==3)
{
printf("* Please enter your USERNAME and PASSWORD *");
}
else if(i == 5)
{
... |
C |
/**
* Note: The returned array must be malloced, assume caller calls free().
*/
int* countBits(int n, int* returnSize){
*returnSize = n+1;
int *ans = malloc((*returnSize) * sizeof(int));
ans[0] = 0;
if (n>0) ans[1] = 1;
for (int i = 2; i <= n; i++){
ans[i] = ans[i/2] + (i%2);
}
... |
C | #include <stm32f10x.h>
#include "system.h"
#include "led.h"
#include "gui.h"
#include "usart.h"
/****************************************************************************
* Function Name : main
* Description : Main program.
* Input : None
* Output : None
* Return : None
****************... |
C |
// warning: mq_receive not working!! (the rest is ok)
/*
* gcc -lrt mqueue.c
*/
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h> /* For O_* constants */
#include <sys/stat.h> /* For mode constants */
#include <mqueue.h>
int main... |
C | /*
* ASN.1 Parser node types
*
* Copyright (c) 2017 Alexei A. Smekalkine
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "asn1-se.h"
static void indent (int level)
{
printf ("%*s", level * 4, "");
}
void se_free (struct se *o)
{
if (o == NULL)... |
C | #include <string.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
int main(int argc,char* argv[])
{
int pid;
char *prog_argv[4];
/* 建立参数表 */
prog_argv[0]="/bin/ls";
prog_argv[1]="-l";
prog_argv[2]="/";
prog_argv[3]=NULL;
int pipe_fd[... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "utlist.h"
#define BUFLEN 20
typedef struct el {
char bname[BUFLEN];
struct el *next, *prev;
} el;
int main(int argc, char *argv[])
{
el *name, *tmp;
el *head = NULL;
char linebuf[BUFLEN];
FILE *file;
file = fopen( "tes... |
C |
//
// specifying djan
//
// Sun Jun 29 10:42:47 JST 2014
//
#include "djan.h"
context "parsing radial"
{
before each
{
fdja_value *v = NULL;
}
after each
{
fdja_value_free(v);
}
describe "fdja_parse_radial()"
{
it "returns NULL when failing to parse"
{
// another method for po... |
C | #include "header.h"
extern int charType(const char *);
/*
* 函数名称:charToInt
* 函数功能:将字符串读为整数 返回
* 输入参数:输入位数和字符串指针
* 返回值:整数
*/
static int charToInt(int i,char* pchar)
{
int rate = 0;
for (;pchar[i] <= '9' && pchar[i] >= '0';i++)
rate = rate*10 + (pchar[i] - '0');
return rate;
}
/*
* 函数名称:setRate
* ... |
C | #include <stdio.h>
#include <stdlib.h>
#define MAX_SIZE 5
void push(int S[MAX_SIZE],int *top)
{
int ele;
printf("enter the elem to insert\n");
scanf("%d",&ele);
if(*top< MAX_SIZE-1)
{
//insert is
(*top)++;
S[*top]=ele;
}
else
printf("stack over ... |
C | #include <stdio.h>
/*
1.8 дһͳƿոƱ뻻зij
*/
main()
{
int c, nb, nt, nl;
nb = 0; /*ո*/
nt = 0; /*Ʊ*/
nl = 0; /*и*/
while((c = getchar()) != EOF) {
if (c == ' ')
++nb;
if (c == '\t')
++nt;
if (c == '\n')
++nl;
}
printf("%d %d %d\n", nb, nt, nl);
}
|
C | #ifndef FUNC_H
#define FUNC_H
#include <stdio.h>
#include <math.h>
typedef struct arglist
{
struct node* ptr;//Points to type of arg in sym table
struct arglist* next;//for linked list purpose
} argListNode;
typedef struct snode
{
int id;
struct snode* next;
} sNode;
typedef struct node
{
char* na... |
C | #include <stdio.h>
#include <stdlib.h>
#define _CRT_SECURE_NO_WARNINGS
#include <string.h>
#include <strings.h>
#include <sys/time.h>
#define MAXLEN 256
double wtime()
{
struct timeval t;
gettimeofday(&t, NULL);
return (double)t.tv_sec + (double)t.tv_usec * 1E-6;
}
int return_min(double tt)
{
if (tt < ... |
C | #include<stdlib.h>
#include<stdio.h>
#include<unistd.h>
//typedef char[100] comandi;
typedef char stringa[10];
typedef stringa sstr[3];
int main()
{
int i,status,pid,n;
sstr str;
printf("inserisci i tuoi 3 comandi\n");
for(i=0;i<3;i++)
scanf("%s",str[i]);
//comandi cmd[2] = {"ls", "ls | grep sequenza"};
for(i=0;i... |
C | #include "../header/constraint.h"
static struct constraint * initializeConstraint(int rows) {
struct constraint *constraint = malloc(sizeof *constraint);
constraint->rows = rows + 2;
constraint->matrix = malloc(sizeof *constraint->matrix * constraint->rows);
return constraint;
}
static void fillCon... |
C | #include <stdio.h>
struct empleado
{
char nombre;
char sexo;
int sueldo;
};
struct empleado sueldoMayor;
struct empleado sueldoMenor;
main ()
{
struct empleado currito[10];
int contador;
contador = 0;
for(contador=0;contador<10;contador++)
{
printf("Introduce un nombre:");
scanf("%s",currito[contador].nombre... |
C | /*
Name: Pedro Zelada Souza
Student number: 116427188
Email: pzelada-souza@myseneca.ca
Workshop: 05 - Structures
Section: SQQ
Date: 10-10-2018
*/
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include "Employee.h" // Include the header file that has the declaration of the structure Employee
#define SIZE 2 /... |
C | #include <stdio.h>
#include <stdlib.h>
#define NB_RELEVE 5
int main()
{
int nuagePoints[NB_RELEVE];
int indice;
float somme = 0;
float moyenne;
for(indice=0; indice<NB_RELEVE; indice++){
printf("Saisir valeur : ");
scanf("%i", &nuagePoints[indice]);
}
int min = nuag... |
C | /*
** EPITECH PROJECT, 2019
** PSU_minishell2_2018
** File description:
** pipe
*/
#include "mysh.h"
int exec_pipe(int *fds, int nmemb, int index, shell_t *shell)
{
int index_close = 0;
int status = 0;
if (fork() == 0) {
if (index > 0)
dup2(fds[(index - 1) * 2], 0);
if (index ... |
C | #include"stdio.h" //Ϊʹ FILE,ļ
#include"stdlib.h" //ΪʹINT_MAX, INT_MIN
//ĺʹԷطintֵ
typedef struct FileReaderContext
{
const char* const pFname;
void(*const processor)(struct FileReaderContext *pThis, FILE *fp);
}FileReaderContext;
typedef struct {
FileReaderContext base;
int result;
} MyFileReaderContext;
int rea... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* check_map_intersections.c :+: :+: :+: ... |
C | /*
* Escreva um programa para fazer conversões entre diferentes unidades. As opções
* do programa devem ser exibidas em forma de um menu apresentado na tela, em dois
* níveis. No primeiro nível, o usuuário escolhe a classe de unidade; no segundo nível,
* o usuário escolhe a conversão que deseja, fornecendo então o ... |
C | Item *create_item(char *sender, char *subject, char *content) {
Item *temp = malloc(sizeof(Item));
temp->sender = malloc(sizeof(char) * rlp_strlen(sender));
temp->message = malloc(sizeof(Message));
temp->message->subject = malloc(sizeof(char) * rlp_strlen(subject));
temp->message->content = malloc(sizeof(char... |
C | #include <stdio.h>
int main()
{
unsigned int int_v;
unsigned long int long_v = 0x0102030405060708;
unsigned long long int longlong_v;
unsigned short int short_v;
printf("int size: %d\nlong size: %d\nlong long size: %d\nshort size: %d\n",
(int)sizeof(int_v), (int)sizeof(long_v), (int)sizeof(longlong_v), (int)si... |
C | #include "internal_dgraph.h"
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <assert.h>
#define realloc_node(node, size) \
graph->alloc(graph->ud_alloc, node, sizeof(struct dgraph_node_list) + (size - FAKE_DGRAPH_NODE_LIST_SZ)*sizeof(int));
int dgraph_compar_integers(const void *p1, const void ... |
C | //QUESTION:
//(2) Ascending Order sort and Descending order sort
//here i have created 2 threads ,where 1st thread is assigned to carry out asceding order sort for the input array
//and 2nd thread is assigned to carry out descending order sort for the input array
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h... |
C | #include<stdio.h>
int main()
{
int p[110];
int i,j,ans1,ans2;
for(i=2;i<=100;i++)p[i]=1;
for(i=2;i<=100;i++)
{
for(j=2*i;j<=100;j=j+i)p[j]=0;
}
for(i=2;i<=100;i++)if(i%2==0)
{
for(j=2;j<=50;j++)
if(p[j]&&i-j>1&&p[i-j])
{
ans1=j;
ans2=i-j;
printf("%d=%d+%d\n",i... |
C | #include<stdio.h>
#include<conio.h>
#define stdno 3
#define subno 4
void main ()
{
int i,j;
float sumsub[stdno]={0},avgsub[stdno]={0},sumstd[subno]={0},avgstd[subno]={0},deg[stdno][subno]={0};
clrscr();
for(i=0;i<stdno;i++)
{
for(j=0;j<subno;j++)
{
printf("\nenter the deg [%d][%d]:",i,j);
scanf... |
C |
#include<stdio.h>
#include<string.h>
#include<assert.h>
char my_strcpy(char* dest, const char*src){
char *ret = dest;
assert(dest != NULL);
assert(src != NULL);
while (*dest++ = *src++){
;
}
return ret;
}
int my_strlen(const char *str)
{
int count = 0;
assert(str != NULL); //
while (*str++){
count++;
}... |
C | #ifndef Header_h
#define Header_h
#include<stdlib.h>
#include<stdio.h>
#include<assert.h>
#include<string.h>
#include<time.h>
#include<vld.h>
//definicje struktur -------------------------------
//strutura do tworzenia listy lotnisk
struct baza {
char nazwa[15];
int id;
struct baza *next;
};
//struktura do tworzeni... |
C | #include<stdio.h>
#include<dirent.h> // For directory stream, dirent is defined here
int main(int argc, char* argv[]){
DIR* dir; // Structure for directory descriptor
struct dirent* nextfile;
int ret=0;
if(argc != 2){
printf("Error: Unmatched arguments\n");
printf("Run through make file ... |
C |
long filelength(int f) {
struct stat buf;
fstat(f, &buf);
return(buf.st_size);
}
int load3ds (char *p_filename, struct model_type * model)
{
int i; //Index variable
FILE *l_file; //File pointer
float *ptmp;
float tmpval = 0;
ptmp = &tmpval;
unsigned short l_chunk_id; //Chunk iden... |
C | /*
** x_functions.c for asm in /home/emad_n//v5.00/src/library
**
** Made by navid emad
** Login <emad_n@epitech.net>
**
** Started on Sun Mar 24 20:40:18 2013 navid emad
** Last update Mon Mar 25 19:05:22 2013 navid emad
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#includ... |
C | #include<stdio.h>
#include<unistd.h>
#include<sys/socket.h>
#include<string.h>
#include<sys/types.h>
#include<netdb.h>
#include<netinet/in.h>
#include<pthread.h>
#include<stdlib.h>
#include<arpa/inet.h>
#define PORT 8000 //port
#define MAX 3
FILE *fp;
pthread_mutex_t lock;
char name[30],name1[30];
//char str[1024],s... |
C | #include <stdio.h>
/**
* main - Will print the first 98 fibonacci numbers.
* Return: 0
*/
int main(void)
{
int i = 0;
unsigned long u = 0, h = 1, q, t, l, b, c;
for (i = 1; i <= 91; i++)
{
q = u + h;
u = h;
h = q;
printf("%lu, ", q);
}
t = u % 1000;
u = u / 1000;
l = h % 1000;
h = h / 1000;
while ... |
C | #include "holberton.h"
/**
* print_last_digit - Prints the last digit of a number
* @n: character
* Return: returns the value of the last digit
*/
int print_last_digit(int n)
{
int r = n % 10;
if (r < 0)
{
r *= -1;
}
_putchar('0' + r);
return (r);
}
|
C | #include<stdio.h>
int main(int argc,char *argv[])
{
int i;
for(i=argc-1;i>0;i--)
printf("%s ",argv[i]);
puts("");
return 0;
}
|
C | /*
Harleigh Abel
Feb. 6, 2017
C Basics Review
C Programming Absolute Beginner's Guide pg 21
A program that Uses the Characters, Integers, and Floating-Point Data Types */
#include <stdio.h>
int main(void)
{
// prints out a statement about c programming to keep c syntax and formatting
// fresh in my mind
printf(... |
C | void paixu(int a[],int n){
int e,k,i;
if(n>1){
for(k=1;k<n;k++){
for(i=0;i<n-k;i++){
if(a[i]<a[i+1]){
e=a[i+1];
a[i+1]=a[i];
a[i]=e;
}
}
}
}
}
void match(int a[],int b[],int n){
int num=0;
int money=0;
int afr=0,bfr=0;
int ata=n-1;
int bta=n-1;
int c=1;
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h>
main(){
setlocale(LC_ALL, "Portuguese");
int numero = 0;
printf("Informe um valor. \n");
scanf("%d", &numero);
if(numero >= 0){
if(numero % 2 == 0){
printf("O valor informado p... |
C | #include<stdio.h>
float s(float num)
{
float r1,r2;
r1=1;
r2=num;
float diff=(fabs(r1-r2));
while(diff>0.0000001)
{
r1=(r1+r2)/2;
r2=num/r1;
diff=(fabs(r1-r2));
}
return r1;
}
int main()
{
float num,r;
printf("enter the number\n");
scanf("%f",&n... |
C | //
// MathCalc.h
// NeuroProject
//
// Created by Хайкова Светлана and Мансуров Рустам on 04.06.2018.
// Copyright © 2018 Khaykova Svetlana and Mansurov Rustam. All rights reserved.
//
#ifndef MathCalc_h
#define MathCalc_h
ld max (ld a, ld b)
{
if (a > b)
return a;
return b;
}
ld min (ld a, ld b)... |
C | //
// RingBuffer.c
// ConcatenationRewrite
//
// Created by Edward Costello on 26/01/2013.
// Copyright (c) 2013 Edward Costello. All rights reserved.
//
#import "RingBuffer.h"
#import <stdio.h>
#import <Accelerate/Accelerate.h>
size_t RingBuffer_countLeadingZeroes(size_t arg)
{
if (arg == 0) {
... |
C | #include<stdio.h>
int Sort(void const*a,void const*b)
{
return (*(int*)a - *(int*)b);
}
int main()
{
int n;
scanf("%d",&n);
int a[n];
for(int i=0; i<n; i++)
scanf("%d",&a[i]);
qsort(a,n,sizeof(int),Sort);
long long ans = 0,count = 1;
for(int i=0; i<n-1; i++)
{
if... |
C | /*
To be linked with the file produced when usint Intrumentation.so -funcalls or -symglob for native runs
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#ifdef LT_CONSTRAIN
#include "constrainers/lt.h"
#endif
#ifdef LTE_CONSTRAIN
#include "constrainers/lte.h"
#endif
#ifdef ... |
C | //funo: Definir se o valor inserido positivo ou negativo
//autor: Joo Cndido
#include <stdio.h>
#include <locale.h>
int main (){
setlocale(LC_ALL, "portuguese");
int valor, a, b;
printf("Inserir valor: ");
scanf("%d", &valor);
if (valor > 0){
a = valor;
printf("%d um valor positivo", a);
}else{
b ... |
C | #include "hj80_socket.h"
/*create a socket data structure*/
status_t create_socket_tcp_data(hj_socket_data_t ** pp_socket_data)
{
(*pp_socket_data) = (hj_socket_data_t * ) malloc(sizeof(hj_socket_data_t));
if((*pp_socket_data)==NULL_T){
return ERROR_T;
}
memset((*pp_socket_data), 0, sizeof(hj_socket_data_t));
... |
C | /*This program is implemented by Ojas Kapre*/
#include<stdio.h>
#include<conio.h>
int input()
{
int ele;
scanf("%d", &ele);
return ele;
}
int hash(int ele, int m)
{
int r = ele % m;
return r;
}
int rehashq(int ele, int m, int j)
{
int r = (ele+j*j) % m;
return r;
}
int rehash(int ele, int m)
... |
C | /*
* Filename: findAnagrams.c
* Author: Xiaolong Zhou
* Userid: cs30xaeo
* Description: This function promts the user to enter a word to search for
* anagrams of. It then gets the word input from the user(from
* stdin) and prints any matching anagrams.
* Date: May 14, 2016
* Sourc... |
C | /*
============================================================================
Name : Assign4.c
Author : Rucha Shinde
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
============================================================================
*/
#includ... |
C | #include <stdio.h>
#include <string.h>
char str_clean0(char a[], char b[])
{
int Tam = strlen(a);
int i, j;
for (i = 0; i < Tam; i++)
{
if (a[i] == b)
{
for (j = i; j < Tam; j++)
{
a[j] = a[j + 1];
}
Tam--;
i-... |
C | #include<stdio.h>
int main(int argc, char const *argv[])
{
int integer;
printf("Type an integer:\n");
scanf("%d", &integer);
if((integer%3 == 0) && (integer%5 != 0))
{
printf("The number is divisible by 3, but not by 5!/n");
}
else
{
if ((integer%5 == 0) && (in... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <pthread.h>
#include "process.h"
#include "jpeg_const.h"
#include "jpeg_reader.h"
#include "extract_image.h"
#include "iqzz.h"
#include "loeffler.h"
#define NTHREADS 1
/* Blocs swap */
// -> Loeffler
static float loeffler_swp[BLOCK_PIXELS];
static f... |
C | /*
** my_print_alpha.c for my_print_alpha in /home/clemsx/delivery/CPool_Day03/task01
**
** Made by clement xia
** Login <clemsx@epitech.net>
**
** Started on Wed Oct 5 09:43:23 2016 clement xia
** Last update Thu Oct 6 08:09:45 2016 clement xia
*/
int my_print_alpha()
{
int x;
int y;
x = 97;
y = 1... |
C |
#include "utils.h"
int createSocket(char host[], char port[], int ai_flags, struct addrinfo *servinfo, struct addrinfo **p)
{
struct addrinfo hints;
int rv, sockfd;
memset(&hints, 0, sizeof hints);
hints.ai_family = AF_INET;
hints.ai_socktype = SOCK_DGRAM;
hints.ai_flags = ai_flags; // use my... |
C | #include <stdio.h>
#include <stdlib.h>
void parse(char record[], int *acct, float *amnt){
char account[10], amount[10]; // initializing fields
for (int i=0; i<10; i++) account[i] = '\0'; // wiping arrays at each read
for (int i=0; i<10; i++) amount[i] = '\0';
sscanf(record, "%s %s", account, amount)... |
C | #include <getopt.h>
#include <unistd.h>
#include "heap.c"
int main(int argc, char *argv[]){
int minima = 0;
int c;
int hflg = 0, fflg = 0, oflg = 0, mflg = 0;
heap h;
printf("Digite -h para comandos de ajuda\n");
while((c = getopt(argc, argv, "hf:o:m")) != -1){
switch(c){
case 'h':{
hflg = 1;
p... |
C | #include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <stdarg.h>
#include <assert.h>
#include "../include/util.h"
/* YYYYMMDDhhmmss */
void get_localtime(char *time_str, int len) {
assert(len > 14);
struct tm when;
time_t now;
time( &now );
when = *localtime(... |
C | /*
--------------------written by KISHORE VARMA-------------------------------
**************************************************************************
Multiples of 3 and 5 Problem 1
If we list all the natural numbers below 10 that are multipl... |
C |
cbuffer PhongMaterialConstants : register (cb1)
{
float4 Diffuse;
float4 Ambient;
float4 Specular;
float4 Emission;
float Shine;
int HasNormalMap;
int HasDiffuseMap;
int HasSpecularMap;
int ShaderType;
};
struct LightConstants
{
int LightType;
int Decay;
float InnerAngle;
float ... |
C | #include "uv.h"
#ifdef __CYGWIN__
/* taken from http://howforge.com/implementing-barrier-in-pthreads */
int barrier_init(barrier_t *barrier, int needed) {
barrier->needed = needed;
barrier->called = 0;
pthread_mutex_init(&barrier->mutex, NULL);
pthread_cond_init(&barrier->cond, NULL);
return 0;
}
int barrie... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#define PORT 8888
#define LEN 512
struct FILEINFO
{
char filename[256];
int szofile;
};
int main(i... |
C | #include<stdio.h>
#include<unistd.h>
#include<sys/wait.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<string.h>
int main()
{
int pipefd[2], p, pid, status;
char data[100];
p = pipe(pipefd);
if (p == -1)
{
printf("Error in creation of pipe!\n\n");
}
else
{
pid = fork();
if (pid == -1)
{
printf("E... |
C | #include<stdlib.h>
#include<stdio.h>
#include<string.h>
typedef struct Node
{
struct Node *right,*left,*prev;
char data;
} Node;
typedef struct node{
char data;
struct node* link;
}node;
typedef struct List {
Node *head;
int number_of_Nodes;
};
typedef struct Stack {
List *ptr_list;
} Stack;
//Create B... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
long long int main()
{
long long int a, b;
scanf_s("%d + %d", &a, &b);
printf("%d", a + b);
return 0;
} |
C | #ifndef _RECORD_H_
#define _RECORD_H_
#define MAX_NAME_LEN 15
// a struct to hold the name and mark of a single student
struct StudentRecord {
char name[MAX_NAME_LEN+1];
int mark;
};
// creates a struct with the students name and grade
// assumes the name is at most 15 characters long
StudentRecord createRecord(co... |
C | #include <utility>
#include <vector>
#include <iostream>
int bad_i = -1;
class C {
public:
explicit C() : i_() {}
explicit C(int i) : i_(i) {}
C(const C& rhs) : i_(rhs.i_) { if (i_ == bad_i) throw i_; }
int i_;
};
typedef std::vector<C> vec;
C transmogrify(C x) { return C(2*x.i_); }
void trans... |
C | #include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#define HASH_BUCKETS 10000
#include "networknode.h"
#include "heap.h"
#include "hash.h"
heap_t *make_heap() {
heap_t *h = (heap_t*) malloc(sizeof(*h));
if(!h) {
fprintf(stderr, "Out of Memory.\n");
exit(1);
}
h->total_mass = 0;
h->n_nodes =... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "encrypt.h"
#define DB_NAME "./database.txt"
#define MAX_NAME_LENGTH 20
#define MAX_USER_LENGTH 20
#define MAX_PASS_LENGTH 20
#define MAX_SERVICES 100
#define MAX_ENCRYPT_LENGTH 20
struct service{
char name[MAX_NAME_LENGTH+1];
char u... |
C | #include <stdio.h>
#include <assert.h>
void *my_strcpy(void *dst,void *src,int len)
{
char *ret=dst;
assert(dst);
assert(src);
while(len--)
{
*(char*)dst=*(char*)src;
dst=*(char*)dst+1;
src=*(char*)src+1;
}
*(char*)dst='\0';
return ret;
}
int main()
{
int n=0;
char *src="Hello,Bit";
char dst[50]="... |
C | #include "main.h"
#include "screen.h"
#define PAGE_BIT 21
#define PAGE_SIZE 0x200000
#define KERNEL_PAGES 10
#define HEAP_BASE (PAGE_SIZE * KERNEL_PAGES) //0X140 0000
#define MAX_MEM (PAGE_SIZE * 256)
QWORD pyshical_page_bitmap[4] = { 0 };// 0b1111111111; //first 3 used by kernel
#define QW_OFFEST(b) ((b) ... |
C | /*
* Program.c
*
* Created on: Dec 9, 2019
* Author: micheal_onsy
*/
// Iam using TIMER1 , External INT0=> reset,INT1=> Pause & INT2=> resume
// F_CPU=1 MHZ , Prescaler= 1024 , to make increment every one second put 977 in OCR1
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#define ... |
C | #include "holberton.h"
/**
* helper_4_palindrome - function will help test if string is palindrome
* @s: represents string fed from other function
* @beg: represents beginning of string
* @length: represents the end of the string
* Return: function will return 1 if palindrome, 0 if not
*/
int helper_4_palindrome... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ast.h"
struct valor_lexico_t *lex_int(int int_value, Tipo_val_lex tipo_tk, int linha) {
struct valor_lexico_t *val_lex = (struct valor_lexico_t*) malloc (sizeof(struct valor_lexico_t));
val_lex->valor.val_int = int_value;
val_lex->tipo = ... |
C | #include <stdio.h>
#include <math.h>
void main(){
float a,b,c;
scanf("%f %f %f", &a,&b,&c);
if(a >= b+c){
printf("NAO FORMA TRIANGULO\n");
}else if(pow(a,2) == pow(b,2) + pow(c,2)){
printf("TRIANGULO RETANGULO\n");
}else if(pow(a,2) > pow(b,2) + pow(c,2)){
printf("TRIANGULO OBTUSANGULO\n");
}e... |
C | int gcd(int a, int b)
{
int temp;
if(a>b)
{
while(a%b != 0)
{
temp = a;
a = b;
b = temp%b;
}
return (b);
}
else
{
while(b%a != 0)
{
temp = b;
b = a;
a = temp%a;
}
return (a);
}
} |
C | #include <math.h>
int satisfies2(int x, int y) {
int result1, d, k;
{
d = abs(y)%8;
switch (d)
{
case 0: k=sizeof(char); break;
case 1: k=sizeof(signed char); break;
case 2: k=sizeof(short); break;
case 3: k=sizeof(unsigned int); break;
cas... |
C | #include <stdio.h>
#include <stdlib.h>
#include "LinkedList.h"
#include "cliente.h"
#include "parser.h"
#include "entradaValidada.h"
#include "controller.h"
void printMenu()
{
printf("1. Leer archivo binario\n");
printf("2. Alta cliente\n");
printf("3. Modificar cliente\n");
printf("4. Baja cliente\n")... |
C | #include "stdio.h"
#include "clib.h"
extern int _nextc[];
/*
** Character-stream input of one character from fd.
** Entry: fd = File descriptor of pertinent file.
** Returns the next character on success, else EOF.
*/
fgetc(fd) int fd; {
int ch; /* must be int so EOF will flow through *... |
C | /******************************************************************************/
/* Grupo 2: */
/* Felipe Augusto da Silva RA 096993 */
/* Lucas Barbi Rezende RA 097042 ... |
C | /*
* split.c
*
* Split a double-sided .dsd BBC Disk image file into two single-sided (.ssd)
* ones.
*
* J.Macfarlane November 2020
*/
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <assert.h>
#include "dfs.h"
int main(int argc, char **argv)
{
if (argc <= 3) {
... |
C | /**********************************
* client.c
* Created on: Apr 4, 2017
* @Author: Truc Chau
**********************************/
#include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#include<unistd.h>
#include<string.h>
#include <time.h>... |
C | /*
filename: string.h
author: wei-coder
date: 2017-12
purpose: ַغ
*/
#pragma once
#include <types.h>
int memcmp(const void *s1, const void *s2, size_t len);
void memset(void * dest, u8 value, size_t len);
void memcpy(void * dest, void * source, size_t len);
void strcpy(char * dst, char * src);
... |
C | #include<stdio.h>
#include<string.h>
#define FILE -1
#define NULL 0
typedef struct node
{
char drn[10];
struct node *link,*subdir;
}node;
int geti(node *first,char ele[],int po)
{
int i=1;
while(strcmp(first->drn,ele)!=0&&first!=NULL)
{
first=first->link;
i++;
}
if(first==NULL)
return -1;
if(po==0)
retur... |
C |
int A[10] = {5,3,-3,54,2,-56,7,9,11,11};
int N=10;
int (*funcptr)(int *, int *);
void swap(int *a, int *b) ;
bubblesort (int *A, int nelems, int (*compar)(int *, int *)) {
int *outer,*inner,temp;
int *last=&A[nelems];
//for (outer=A; outer<last; outer++) {
outer=A;
Louter:
if (outer >= last) goto... |
C | #include <stdio.h>
#include <sys/stat.h>
#include <unistd.h>
int main() {
FILE *fp;
char *file_name = "./test.txt";
fp = fopen(file_name, "w+");
//将内容写入文本
fputs("hehehe,hei boy", fp);
//将文本指针移动至第7位
fseek(fp, 7, SEEK_SET);
//将666666从第7位开始覆盖写入
fputs("666666", fp);
//指针回归文本开始
fseek(fp, 0, SEEK_S... |
C | #include <stdio.h>
#include <limits.h>
#include <time.h>
int licz(unsigned int tablica[], int size ){
int count=0;
for (int i = 0; i < size; i++)
{
unsigned int x= ~(tablica[i]);
if((x!=0 )&&( (x&(x-1))!=0)){
count++;
}
}
return count;
}
int licz2(unsigned int tablica[], int size ){
int count=0;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.