language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /*-
* Copyright (c) 2017-2018 Razor, Inc.
* All rights reserved.
*
* See the file LICENSE for redistribution information.
*/
#include "rate_stat.h"
void rate_stat_init(rate_stat_t* rate, int wnd_size, float scale)
{
rate->wnd_size = wnd_size;
rate->scale = scale;
rate->buckets = calloc(wnd_size, sizeof(rate_bucke... |
C | /*
* 编码生成汇编代码
test:
leaq (%rdi,%rsi), %rax
addq %rdx, %rax
cmpq $-3, %rdi
jge .L2
cmpq $1, %rsi
jle .L5
movq %rsi, %rax
imulq %rdx, %rax
ret
.L5:
movq %rdi, %rax
imulq %rsi, %rax
ret
.L2:
cmpq $2, %rdi
jle .L1
leaq (%rdi,%rdi), %rax
.L1:
ret
*/
long test(long x, long y, long z)
{
long val = x + y ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* file_reader.c :+: :+: :+: ... |
C | /**
@file utility.h
@author Cristina Fabris
@author Raffaele Di Nardo Di Maio
@brief Header of utility functions.
*/
#ifndef UTILITY
#define UTILITY
#include "tsp.h"
#define LINE "----------------------------------------------------------------------------------\n"
#define STAR_LINE "****************************... |
C | /*
* gossip.h
*
* Created on: Dec 12, 2017
* Author: dmcl216
*/
#ifndef GOSSIP_H_
#define GOSSIP_H_
#include <string.h>
#include <stdint.h>
#include "networking.h"
#include "util.h"
#define GOSSIP_HEADER "gossip"
#define G_HEADER_SIZE 6 // strlen(HEADER)
enum HOST_STATE {
ONLINE = 0x01,
OFFLINE... |
C | #include <stdio.h>
#include <string.h>
int main(){
int origen[] = { 1,2,3,4,5,6,7,8 };
int numero_elementos = sizeof(origen)/sizeof(int);
int destino[numero_elementos];
reverti_dos(origen, destino, numero_elementos);
}
void reverti_dos(int* origen, int*destino,int numero_elementos){
int* ultima_posicion = orige... |
C | #include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "hash_tables.h"
/**
* main - check the code for Holberton School students.
*
* Return: Always EXIT_SUCCESS.
*/
int main(void)
{
char *value;
value = hash_table_get(NULL, "Canada");
printf("%s:%s\n", "Canada", value);
return (EXIT_SUCCESS);
}
|
C | #include <stdio.h>
#include <time.h>
int main() {
time_t start, end;
double diff;
printf("Começando o programa...\n");
time(&start);
printf("Dormir por 5 segundos...\n");
sleep(5);
time(&end);
diff = difftime(end, start);
printf("Tempo de execução = %f\n", diff);
printf("Saindo do programa...\n... |
C | #include <stdio.h>
int main()
{
int a, b, dist;
dist = (&b - &a);
printf("La distanza tra a e b è: %d byte", (unsigned)dist);
*(&b - dist)=34;
printf("Valore a: %d", a);
return 0;
}
|
C | #include "ErrorHandler.h"
/**
* 作用:
* 显示最后一次函数调用产生的错误消息。
*
* 参数:
* lpszFunction
* 最后一次调用的函数名称。
*
* hParent
* 弹出消息窗体的父窗体,通常情况下,
* 应该指定为我们应用程序的主窗体,这样
* 当消息弹出时,将禁止用户对主窗体进行
* 操作。
*
* 返回值:
* 无
*/
VOID DisplayError(LPWSTR lpszFunction, HWND hParent) {
LPVOID lpMsgBuff = NULL;
LPVOID lpDisplayBuff = NULL;
DWORD errC... |
C | /**
* Мы знаем, что функции - это поименованные блоки
* кода. Функции могут принимать данные и могут возвращать
* данные. Функции могут использовать общие данные
* посредством глобальных переменных.
* Далее рассмотрим:
* 1 - использование ключевого слова return для прерывания
* работы функции
* 2 - передачу... |
C | #ifndef __PTHREADPOOL_H_
#define __PTHREADPOOL_H_
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <errno.h>
#define DEFAULT_THREAD_VARY 10
#define true 1
#define false 0
typedef struct threadpool_t threadpool_t;
typedef struct{
voi... |
C | #include "defs.h"
#include "passenger.h"
#include "busstop.h"
#include <stdlib.h>
/*guarantees that every bus has a busstop associated with it*/
extern uint32_t global_bus_busstop;
extern pthread_mutex_t lock_bus_busstop;
extern uint32_t nthreads_passengers;
extern pthread_mutex_t lock_global_passen... |
C | #include "acorn-fs.h"
int main(int argc, char *argv[])
{
if (--argc) {
int status;
while(argc--) {
const char *fsname = *++argv;
acorn_fs *fs = acorn_fs_open(fsname, false);
if (fs) {
int astat = fs->check(fs, fsname, stderr);
if (... |
C | /*
Nome: Rafissone Manuel Macilaho
Curso: Engenharia Informática - Labora, Nível 3
Cadeira: Inteligência Artificial (INAR)
Resolućão da Primeira Tarefa
*/
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
//Estrutura de Informacao
typedef struct info
{
int value;
}Info;
//Estrutu... |
C | /* Dato un array A di n interi (positivi e negativi), scrivere un programma che identifichi il sottoarray \
di A i cui elementi hanno somma massima tra tutti gli altri sottoarray di A e ne stampi la somma.
La prima riga dell’input contiene la dimensione n dell’array. Le righe successive contengono gli elementi dell’a... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
/*如果是贪婪压缩,设置为1*/
#define GREEDY 0
/* ratio vs. speed constant */
/* 最大匹配滑动窗口大小,越大速度越慢但压缩效果越好*/
#define MAXCOMPARES 75
/* unused entry flag */
#define NIL 0xFFFF
/* bits per symbol- normally 8 for general purpose compression */
#d... |
C | #include <ctype.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <unistd.h>
#include <math.h>
#include <time.h>
#include "tar.h"
#include "pathTreatement.h"
#define BLOCKSIZE 512
/* Replace ... |
C | #include "hashmap.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//Create a hashmap with specified number of buckets
struct hashmap* hm_create(int num_buckets){
struct hashmap* hm;
hm = malloc(sizeof(struct hashmap)); //Allocate memory for Hashmap
hm->map = (struct word_node**)malloc(sizeof(struc... |
C | /*******************************************/
/* polynomial.c */
/*******************************************/
#include <stdio.h>
#include <stdlib.h>
#include "list.h"
#include "polynomial.h"
#include "listinterface.h"
extern status read_poly( polynomial *p_poly ) {
int coef ;
int degr... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <omp.h>
#include <cilk/cilk.h>
// maximum value of n
#define NMAX 75000000
//#define NMAX 200
#define CHUNKSIZE 20
typedef struct{
int lt;
int gt;
} flag;
... |
C | // Here's my iteration of the Hangman code. My approach to this is to
// count the amount of correct letters contained in the word.
// If you feel this code needs to be corrected, don't hesitate
// to do so.
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#define HANGED 6
#ifd... |
C |
//Ajout bibliothèque
#include <stdio.h>
#include <wchar.h>
#include <locale.h>
#include <string.h>
#include <stdlib.h>
#include "fonctions.h"
//Programme main
int main(void){
struct lconv *loc;
setlocale (LC_ALL, "");
loc=localeconv();
// Déclaration des variables
wchar_t message[300]={0};
wchar_t messageSan... |
C | #include<stdio.h>
#include<unistd.h>
int main()
{
int no;
printf("Parent %d \n",getpid());
no=fork();
if(no!=0)
{
printf("Parent PID %d \n",no);
}
return 0;
}
|
C | #include "./public.h"
#include "./list.h"
char *myGets(char *src, int size)
{
char *dest = src;
for(; dest<src+size-1; )
{
*dest = getchar();
if(*src == '\n')
continue;
if(*dest == '\n')
break;
dest++;
}
if(*dest != '\n')
while(getchar... |
C | //-----------------------------------------------------------------
// rLCDҲյ{
// 䤤LCD_Display_String()@|ܤ@r
// LCD_Display_Word()@|ܤ@Ӧr
//-----------------------------------------------------------------
#include <reg51.h>
//-------------------------------------------------------
void delay_time(int);
voi... |
C | /************************************************
* bigE.c
* Purpose: to print one E letter, consisting of '*',
* with a height of seven stars, and a width of five stars.
* Line 1: five stars
* Line 2: one star
* Line 3: one star
* Line 4: five stars
* Line 5: one star
* Line 6: one star
* Line 7: five stars
... |
C | #include <stdio.h>
int main(int argc, char const *argv[])
{
int horizontal, vertical, gabriel_vertical, gabriel_horizontal, possibilidade = 4;
scanf("%d %d", &vertical, &horizontal);
char labirinto[vertical][horizontal];
for(int i = 0; i < vertical; i++){
char labirinto_horizontal[horizontal... |
C | #include "stackt.h"
#include <stdio.h>
int main ()
{
Stack S,T;
CreateEmpty(&S);
CreateEmpty(&T);
int m,n,x,x2,x3;
scanf("%d",&m);
scanf("%d",&n);
if (m==0 && n==0)
{
printf("Sama\n");
}
else
{
int i=1;
while (i<=m)
{
scanf("%d",&x);
if ((x!=0))
{
if (!(IsFull(S)))
{
Push(&S,... |
C | //
// main.c
// ifndef
//
// Created by João Dematé Jr 🤠 on 27/05/20.
// Copyright © 2020 João Dematé Jr 🤠. All rights reserved.
//
/*
CONSTANTES
IFNDEF DIRETIVA DE COMPILAÇÃO
*/
#include <stdio.h>
#ifndef PI
#define PI 3.14567
#endif
int main() {
// insert code here...
int valor = 5;
... |
C | /*
* Tutorial 4 Jeopardy Project for SOFE 3950U / CSCI 3020U: Operating Systems
*
* Copyright (C) 2018, Clyve Widjaya 100590208
* Fawwaz Khayyat 100568635
* All rights reserved.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include "questions.h"
#includ... |
C | /*
* Copyright (c) 2016 Siguza
*/
#ifndef ARCH_H
#define ARCH_H
#include <stdbool.h> // bool
#include <stdint.h> // uint32_t
#include <mach/machine.h> // cpu_type_t, cpu_subtype_t
typedef uint32_t arch_t;
#define ARCH_UNKNOWN ((arch_t)0x0)
#define ARCH_I386 ((arch_t)0x1)
#de... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct node
{
int data;
struct node *next;
}Node;
Node *head = NULL;
Node *tail = NULL;
int main()
{
int choice;
void create_list();
void insertAtBeg();
void insertAtEnd();
void insertAtPos();
void deleteAtBeg();
void deleteAtEnd();
void deleteAtPos();
... |
C | #include <stdio.h>
#include <limits.h>
#include <errno.h>
#include <string.h>
#include <xlib/xerr.h>
#include <xlib/xalloc.h>
static void *
xalloc_do_alloc(xalloc_t *xa, size_t size)
{
xalloc_ops_t *ops = XALLOC_OPS(xa);
if (ops->op_alloc == NULL)
{
return NULL;
}
return (*ops->op_alloc)(... |
C | // BranchingFunctionsDelays.c Lab 6
// Runs on LM4F120/TM4C123
// Use simple programming structures in C to
// toggle an LED while a button is pressed and
// turn the LED on when the button is released.
// This lab will use the hardware already built into the LaunchPad.
// Daniel Valvano, Jonathan Valvano
//... |
C | /*
Practice 5: Dot Product
Name : Obed N Munoz
/Lecturer :
*/
#include <stdio.h>
#include <omp.h>
#define SIZE 10000
int main ()
{
int i, size, chunk;
float array_a[SIZE], array_b[SIZE], result;
size = SIZE;
chunk = 10;
result = 0.0;
printf("\n Initializing Vectors of size [%d]\n", size);
fo... |
C | /* Exam 1
Programmer: Andrew Stake
Class: CS2
Professor: Dr. Lee
File Created: Feb 28, 2017
File Updated: Feb 28, 2017
*/
#include<stdio.h>
int main(int argc, char *argv[])
{
char tbt[2][2]; //creates array for question
int i, j; //c... |
C | /*
** my_putstr.c for my_roulette in /home/m4t/etna/my_roulette/
**
** Made by Mathieu Robardey
** Login <robard_m@etna-alternance.net>
**
** Started on Thu May 14 21:39:30 2015 Mathieu Robardey
** Last update Thu May 14 21:39:30 2015 Mathieu Robardey
*/
#include "my.h"
void my_putstr(char *str)
{
int i;
i = 0... |
C | #include <mach/mach.h>
#include <mach/mach_time.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <errno.h>
#include <string.h>
static inline uint64_t
rdtsc(void)
{
uint32_t lo, hi;
asm volatile("rdtsc" : "=a" (lo), "=d" (hi));
return (uint64_t)hi << 32 | lo;
}
__attribute__((noinline)) void... |
C | #include<stdio.h>
#include<string.h>
int soma_asc(char nome[],int tamNome){
int soma=0;
int asc[tamNome];
for(int i=0;i<tamNome;i++){
asc[i] = nome[i];
}
for(int i=0;i<tamNome;i++){
soma+=asc[i];
}
return soma;
}
int main(void){
char nome[20];
scanf("%[^\n] ",nome... |
C | #include <stdio.h>
#include "status.h"
Status GameStatus;
/*** Konstruktor ***/
void InitGameStatus (int NBPeta, int NKPeta, int NBangunan) {
/* I.S. GameStatus sembarang */
/* F.S. Status GameStatus terdefinisi */
/* Proses: Melakukan alokasi, memanfaatkan konstruktor tiap komponen Status.
ActivePlayer = ... |
C | #include <stdio.h>
int main() {
float a,b,c,area,perimetro;
scanf("%f %f %f",&a,&b,&c);
if ((a+b)>c && (a+c)>b && (b+c)>a){
perimetro=(a+b+c);
printf("Perimetro = %.1f\n",perimetro);
}
else{
area = ((a+b)*c)/2;
printf("Area = %.1f\n",area);
}
return 0;
}
|
C | #include "win_functions.h"
#include "_cgo_export.h"
#include <tlhelp32.h>
boolean UpdateLoading = FALSE;
// Shuts down the program
void Exit()
{
//if (!ExitCalled){
Shell_NotifyIcon(NIM_DELETE, &nIconData);
FreeMenuIfNecessary();
UnhookWindowsHookEx(KeyboardHook);
UnhookWindowsHookEx(MouseHook);
//}
//Exit... |
C | /*
* imgops.c - Simple operations on images
*
* C laboratory exercises.
* Richard Vaughan, 2014.
*/
#include <assert.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
/*-------------------------------------------------
PART 0: OPERATIONS ON A PIXEL
*/
// get ... |
C |
/*
* Author: Alex Hiller
* Year: 2019
*
* Program Description:
* Program to demonstrate integer division.
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
int main (int argc, char *argv[]) {
int num,den;
printf("numerator\t>");
scanf("%i", &num);
printf("... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int contains_char(char *, int, char, int);
int is_unique_chars(char *, int);
int is_unique_chars2(char *, int);
int main(){
char * s;
size_t ssize = 100;
size_t num_of_chars;
s = (char *)malloc(ssize * sizeof(char));
if(s == NULL){
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include <setjmp.h>
#include <signal.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <errno.h>
#include <math.h>
#include <pthre... |
C | #ifndef ATTAQUE_H
#define ATTAQUE_H
/* attaque.c/attaque.h : permet au joueur d'attaquer un ennemi */
/* ----- A inclure ----- */
/* ----- Define ----- */
/* ----- Structure + Enumeration ----- */
typedef struct Attaque Attaque;
struct Attaque
{
unsigned int aAttaqueEnnemi;
unsigned int indexEnnemiAttaque;
};
... |
C | #include "Struct.h"
void in_die()
{
printf("\nHousekeeping...Will Exit UNIXcrt NOW");
exit(0);
}
int main (int argc, char * argv[]){
sigset(SIGINT,in_die); //Define signal handling
int parent_id, file_id;
int bufferSize = BUFFERSIZE;
caddr_t mmap_ptr;
struct Buffer * output_mem_p;
char output_text... |
C | #include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#define BUF_SZ 1024
int fileread(int fdin, int fdout);
int main(int argc, char *argv[])
{
int in;
int out = STDOUT_FILENO;
in = open(argv[1], O_RDONLY);
if (in == -1)
{
perror(argv[1... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <netdb.h>
#include <netinet/in.h>
#include <string.h>
int main(int argc, char *argv[]) {
int sockfd, portno, n;
struct sockaddr_in serv_addr;
struct hostent *server;
char buffer[256];
if (argc < 3) {
fprintf(stderr,"usage... |
C | #ifndef PLATEAU_H
#define PLATEAU_H
#include "I_Plateau.h"
#include <math.h>
#include<stdio.h>
#include <stdlib.h>
void pose_pion(plateau *p, Position p1, Position p2){
if(verifier_possibilite(p, p1, p2)==0 ){
return;
}
Pion pion_vide;
pion_vide.couleur=VIDE;
pion_vide.role=RIEN;
p->echiquier[... |
C | //
// Use USART serial communication between ATmega168 and PC
// Use external interrupt INT0 and INT1 on ATmega168
// Use Interrupt Service Routine (ISR)
//
// Connecting ATmega168 with PC use USB serial adaptor (for Mac)
// 1. In terminal, type: ls /dev/*usbserial*
// 2. Find: cu.usbserial-XXXX
// 3. conne... |
C | #include <stdio.h>
#include <stdlib.h>
#include "mpi.h"
#define N 1000000000
#define CHUNK_SIZE 50000
int main(int argc, char *argv[]) {
double t_inicial, t_final;
int cont = 0, total = 0;
int i;
int meu_ranque, num_procs, inicio, dest, raiz=0, tag=1, stop=0;
double pi_partial = 0.0f;
double pi... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <getopt.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <ifaddrs.h>
#include "sniffer_ioctl.h"
#include <netinet/in.h>... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* instructions.c :+: :+: :+: ... |
C | #include <stdio.h>
int naturalSum(int);
int main() {
int n = 10;
int sum = naturalSum(n);
printf("sum of %d natural numbers is %d\n", n, sum);
return 0;
}
int naturalSum(int n) {
if (n == 1) // TERMINAL CONDITION
return 1;
return n + naturalSum(n - 1);
}
|
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int heap[1000],len=0;
int insert(int no) {
heap[len++] = no;
int parent,temp;
for(int i=len-1;i>0;i--) {
parent = (i&1)?(i-1)/2:(i-2)/2;
if(parent>=0 && heap[parent]<heap[i]) {
temp = heap[i];
heap[i] = heap[pa... |
C | /**
* Matt Martin, Makoto Kinoshita
* Mar 26, 2017
* CS363 Robotics
* utility function file
*/
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#include <string.h>
#include <sys/time.h>
#include <math.h>
#include <SVM_VisionModule.h>
#include <map.h>
#include "Mage.h"
#include "socket... |
C | #include <value.h>
#include <basic.h>
#include <num.h>
#include <output.h>
#include <str.h>
#include <type_num.h>
#include <type_output.h>
#include <type_str.h>
static void putv(value x)
{
x = eval(hold(x));
while (1)
{
if (x->T == type_str)
put_str(data(x));
else if (x->T == type_num)
put_num(data(x));... |
C | /* Lista de exerccios 3
Exerccio 1 - Programa que cadastra as notas de n alunos de uma disciplina
e retorna os alunos que obtiveram a maior e a menor nota */
#include <stdio.h>
#include <stdlib.h>
#define TAMANHO 100 // O vetor nota guardara a nota de no maximo 100 alunos
int main(){
int n, i, ... |
C | //
// Created by q on 4/10/2020.
//
#ifndef ASSIGNMENT5_GRAPHALGORITHMS_H
#define ASSIGNMENT5_GRAPHALGORITHMS_H
#include "matrix.h"
#include "node.h"
#include "traversGraph.h"
#include "edge.h"
#define UNDEFINED -1
#define MAX_LIMIT 9999
/*
* kruskal
*/
void kruskal(int N, int ** A);
// find parent of node
int fi... |
C | #include "utils.h"
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdint.h>
#include "app-error.h"
char *read_line(int *len) {
return file_read_line(stdin, len);
}
char *file_read_line(FILE *f, int *str_len) {
size_t buf_size, new_buf_size, i;
char c, *new_str, *str;
int will_o... |
C | #include <errno.h>
#include <string.h>
#include <unistd.h>
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/select.h>
#include <stdlib.h>//Linux
#include <stdio.h>//Linux
int g_id = 0;
typedef struct s_c{
int fd;
int id;
char *rcvBuf;
struct s_c *nxt;
}t_c;
typedef struct s_info{... |
C | #include <stdio.h>
#include <stdlib.h>
#include<math.h>
void giaipt(float a,float b,float c)
{
if(a==0)
{
if(b==0)
{
if(c==0)
printf("phuong trinh co vo so nghiem ");
else
printf("phuong trinh vo nghiem ");
}
else
{
printf("phuong trinh co 1 nghiem x=%f ",-c/b);
}
}
else
{
float del... |
C | int check_buf(char *buf, char **line, char *p)
{
if (p)
{
*p = '\0';
if (!(*line = free_set(*line, ft_strjoin(*line, buf))))
return (-1));
while (*++p)
*buf++ = *p;
*buf = '\0';
return (1);
}
else if (!(*line = free_set(*line, ft_strjoin(*line, buf))))
return (-1));
return (0);
}
int get_next_... |
C | /* Largest Independent Set in a BT
Given a binary tree, find the size of the largest independent set [LIS] in it.
Independent set: Subset of all tree nodes such that there is no edge between any two nodes \
of the subset.Refer q11 for explanation. Instead of taking the root->data in this ques, we need
to count that n... |
C | #include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <unistd.h>
#include "ThinkGridWorldShell.h"
#define INPUT_BUFF_SIZE 1024;
#define PARAM_BUFF_SIZE 64;
#define NUM_BUILTINS 1;
int toExit = 0;
/*
*/
char *BUILTIN_COMMANDS[] = {"cd"};
/*
*/
int (*BUILTIN_COMMAND_FUNCTIONS[]) (c... |
C | #include <stdio.h>
#include <math.h>
int isprime(int num);
int main(void)
{
int n;
printf("Enter a number: ");
scanf("%i",&n);
if(n>1)
{
if(isprime(n))
{
printf("Prime\n");
}
else
{
printf("Not prime\n"... |
C | #include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <math.h>
int main(void)
{
//get input
string text = get_string("Text: ");
int num_letras = 0;
int num_palabras = 1;
int num_sent = 0;
//loop to get letters
for (int i = 0; text[i] != '\0... |
C | // Hopefully useful code for C (memory block movers)
// Copyright (C) 2022 Recherche en Prevision Numerique
//
// This code is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation,
// version 2.1 of the Licen... |
C | /*
* Lift.c
*
* Created on: Mar 12, 2015
* Author: Erik
*/
#include "main.h"
Pickup initPickup(PantherMotor motor)
{
Pickup newPickup = {motor};
return newPickup;
}
void clawAtSpeed(Pickup pickup, int speed)
{
setPantherMotor(pickup.motor, limit(speed, 127, -127));
}
void openPickup(Pickup pickup)
{
... |
C | #include "genotype.h"
#include <math.h>
#include <assert.h>
#include <stdlib.h>
static const double MUTATION_PROBABLITY = 0.1;
static const double MUTATION_DEVIATION = 0.2;
struct _Genotype_ {
double *genes; // genome
double fitness; // fitness
};
static int genotype_size = -1;
int genotype_get_size() {
r... |
C | ////////////////////////////////////////////////////////
/// (c) 2014. My-Classes.com
/// Basic version of fusing the ZMQ raw ROUTER (frontend) socket and NanoMsg REQ-REP (backend) sockets.
///
/// Read More at:
/// http://my-classes.com/2014/04/26/combining-zeromq-and-nanomsg-for-serving-web-requests/
///
////////////... |
C | /*
============================================================================
Name : libreriaKeAprobo.c
Author :
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
============================================================================
*/
#include "... |
C | #include<stdio.h>
int main()
{
int liter,km;
float Avg;
printf("Enter total distance: ");
scanf("%d",&km);
printf("Enter liter: ");
scanf("%d",&liter);
Avg=km/liter;
printf("Average consumption: %.3f",Avg);
} |
C | // Dem so ky tu
#include <stdio.h>
#include <string.h>
//check a char 'ch' in string s
int check(char ch, char s[])
{
for (int i = 0; i < strlen(s); i++)
if (ch == s[i])
return 1;
return 0;
}
int countWords(char st[],char s[])
{
int i = 0, n = strlen(st), d = 0;
while (i < n)
{
while ((check(st[i], s) == 1)... |
C | #ifndef FILAS_H_INCLUDED
#define FILAS_H_INCLUDED
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct _Nodo
{
char dato[20];
int edicion;
struct _Nodo *siguiente;
}
Nodo;
Nodo* crearNodo(char d[20],int e)
{
Nodo *nuevo;
nuevo=(Nodo*)malloc(sizeof(Nodo));
strcpy(nuevo->d... |
C | #include "PCA9655.h"
const unsigned char ADDR_ARRAY [9] =
{
0x40, 0x42, 0x44,
0x46, 0x4C, 0x48,
0x4E, 0x4A, 0x50
};
const unsigned char PCA_REG_READ [2] =
{
0,1
};
const unsigned char PCA_REG_WRITE [2] =
{
2,3
};
const unsigned char PCA_REG_POLARITY [2] =
{
4,5
};
const unsigned char PCA_REG_CONFIG [2] =
{
... |
C | #include "exterior.h"
int IsBackground(char command[1024])
{
int i = 0;
while(command[i] != '\0')
i++;
if(command[i-2] == '&')
return 1;
return 0;
}
char* MakeString(char command[1024], int startidx, int endidx)
{
char* ret = (char*)malloc(sizeof(char) * (endidx - startidx));
int retcnt = 0;
for(int i = ... |
C | #include<stdio.h>
int main(void){
static int a[] = {0,1,2,3,4};
static int *p[] = {a, a+1, a+2, a+3, a+4};
int **ptr;
ptr = p;
**ptr++ ; // * has more precedence than ++ operator
printf("%d\t%d\t%d\n", ptr - p, *ptr - a, **ptr);
*++*ptr;
printf("%d\t%d\t%d\n", ptr - p, *ptr - a, *... |
C |
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/types.h>
#include <signal.h>
#include <string.h>
#include <pthread.h>
struct Shm {
pthread_mutex_t mutex;
pthread_cond_t cond;
char buff[1024];
};
struct Shm *share_memory = NULL;
voi... |
C | #pragma config(Sensor, dgtl1, backLeft, sensorQuadEncoder)
#pragma config(Sensor, dgtl3, backRight, sensorQuadEncoder)
#pragma config(Motor, port2, frontRightMotor, tmotorServoContinuousRotation, openLoop)
#pragma config(Motor, port3, backRightMotor, tmotorServoContinuousRotation, ope... |
C | /*
* File: C_Lab_9.c
* Author: Ugur Ozkan
*
* Created on 27 Agustos 2019 Persembe
*
* Konu : Pointer kullanimi ve pointer fonksiyonlri
*
*/
/*
* Pointer tanimlama
* char *s; // Pointer tanimlandi
* s= (char *) 0x4fc0; // S isimli gstericinin iine adres yerlestiriliyor
* *s = 'a'; ... |
C | /*
From:ITC
3
Inappropriate code
3.1
Dead code
3.1.4
"if statement Function arguments"
*/
void dead_code_004_func_001 (int flag)
{
int a = 0;
int ret;
if (flag)
{
a ++; /*Tool should detect this line as error*/ /*ERROR:Dead Code*/
}
ret = a;
sink = ret;
}
void dead_code_004 ()
{
dead_code_004_func_001... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
int main(int argc, char *argv[]) {
int r_count = 0, w_count = 0, fd1 = 0, fd2 = 0;
char buff[BUFSIZ];
if(argc != 3) {
fprintf(stde... |
C | //
// Static_Variable.c
// C_Learning
//
// Created by shiji zhao on 12/19/19.
// Copyright © 2019 shiji zhao. All rights reserved.
//
#include <stdio.h>
void display(void);
int main(){
display();
display();
}
void display(){
static int c = 1;
c += 5;
printf("%d\n", c);
}
|
C | #include <stdio.h>
int main()
{
long long int n , i , j;
scanf( "%lld", &n );
for( i = 1 ; i <= n ; ++i) //Printing first n rows
{
for( j = 1 ; j < i ; ++j )
printf(" ");
for( j = 1 ; j <= i ; ++j )
printf("#");
j = ( 4 * ( n - i ) ); //Number of spaces to be left between Hashes
for( ; ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <assert.h>
/* each node contains a value and a next pointer */
typedef struct dll_node_t {
int val;
struct dll_node_t *next;
struct dll_node_t *prev;
} dll_node;
/* to make tail and head insertion fast, keep head and tail pointers */
typedef struct dll... |
C | #include <stdio.h>
int main()
{
float celsius, fahrenheit;
printf("Escreva qual temperatura eh ideal para voce em celsius: " );
scanf("%f", &celsius);
getchar();
fahrenheit = (celsius * 9 / 5) +32;
printf("%.1f graus Celsius equivalem a %.1f graus Fahrenheit", celsius, fahrenheit);
return 0;
... |
C | #include "main.h"
#include "htable.h"
static void
dump_buckets(htable *t){
for(size_t i = 0; i < t->m_max_size; i++){
if(t->m_array[i]){
printf("%3zu: %zu\n", i, t->m_array[i]->size);
}
}
}
static void
test_insert_many(){
htable *t = htable_new(128, &aLong_type.compare);
const size_t NUMS = 40000;
const s... |
C | #include <stdio.h>
int main(int argc, char *argv[])
{
long input;
long result;
scanf("%ld", &input);
result = input * input * input;
printf("%ld\n", result);
return 0;
}
/* #include <stdio.h> */
/* #include <stdlib.h> */
/* #include <limits.h> */
/* #include <errno.h> */... |
C | // auxiliary serial functions for supporting tiled Cholesky factorization.
// written by Peter Strazdins, May 20 for COMP4300/8300 Assignment 2
// v1.0 08/05/20
/**** square tiled algorithm support functions ****/
// returns a, where void a[nT][nT] is an array with element size eltSize,
// and a[i][j] = 0
void **... |
C | /*
** EPITECH PROJECT, 2017
** PSU_my_sokoban_2017
** File description:
** PSU_my_sokoban_2017 made by Sanchez Lucas
*/
#include "my.h"
char *load_file_in_mem(char const *filepath)
{
int fd = open(filepath, O_RDONLY);
char *buf = malloc(sizeof(char) * 100010006);
int size = read(fd, buf, 100010006);
buf[size] = ... |
C | #ifndef TEST_H_
#define TEST_H_
#include "util.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static inline void assert_die(const char *file, unsigned line, const char *func,
const char *expr) {
fflush(NULL);
fprintf(stderr, "ASSERT FAILED %s:%u in %s(): %s\n", fi... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* load_data.c :+: :+: :+: ... |
C | inherit "/bldg/wall/wall";
#include <shape.h>
NAME( "pad" )
DISTANT( 0 )
SPECIFIC( "the pad" )
PLURAL( "pads" )
LOOK( "It's a pad on the ground. It has seams around the edge, suggesting it might depress if stepped upon." )
PHRASE( 0 )
int color;
symbol trigger_object;
// Note: The reason I am not using a closure for ... |
C | /** @file sal_structure.h
* @brief Function prototypes for sal_structure
*
*
* This header file is used to define the
* structure of salary
*
*/
#ifndef sal_h
#define sal_h
struct sal
{
int id; /* employee id*/
char name[40]; /* name of employee*/
float hours; /* n... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <mpi.h>
// $mpiexec mergeMPI.c
void merge(int vetor[], int comeco, int meio, int fim) {
int com1 = comeco, com2 = meio+1, comAux = 0, tam = fim-comeco+1;
int *vetAux;
vetAux = (int*)malloc(tam * sizeof(int));
while(com1 <= meio && co... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_validation.c :+: :+: :+: ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.