language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h> //This is a preprocessor directive
int main(void) //This identifies the function main()
{ //This marks the beginning of main()
printf("Beware of the flying spaggetti monster");
return 0; //This returns control to the operating system
} |
C | /*
** my_wait.c for my_wait in /home/loisel_k/taff/C/Systeme-Unix/minishell1/tp
**
** Made by Kevin LOISELEUR
** Login <loisel_k@epitech.net>
**
** Started on Tue Dec 17 18:49:58 2013 Kevin LOISELEUR
** Last update Tue Dec 17 19:07:27 2013 Kevin LOISELEUR
*/
#include <sys/types.h>
#include <sys/wait.h>
#include <... |
C | // PR c++/93807
// { dg-do compile { target c++11 } }
// In C++17, we need the following declaration to treat operator== as
// a template name. In C++20, this is handled by [temp.names]/2.
#if __cplusplus <= 201703L
template <typename T>
class Foo;
template <typename T>
constexpr bool operator==(T lhs, const Foo<T>& ... |
C | #include "get_next_line.h"
#include <fcntl.h>
#include <stdio.h>
int main(int argc, char **argv)
{
int fd;
char *line;
int i;
int ret;
i = 1;
ret = 1;
if (argc > 2)
{
ft_putstr("Too many arguments.\n");
return (0);
}
else if (argc < 2)
{
ft_putstr("File name missing.\n");
return (0);
}
else
{
... |
C | #include "hash_tables.h"
/**
* str_copy1 - Creates a copy of a given string.
* @s: The string to copy.
*
* Return: A pointer to the created string, otherwise NULL.
*/
char *str_copy1(const char *s)
{
int i, len;
char *s_c = NULL;
if (s != NULL)
{
len = strlen(s);
s_c = malloc(sizeof(char) * (len + 1));
... |
C | /**
* @file addr_mng.c
* @brief address management functions (init, print, etc.)
*
* @author Juillard Paul, Tafti Leo
* @date 2019
*/
#include <inttypes.h>
#include "addr.h"
#include "addr_mng.h"
#include "error.h"
#define MAX_9BIT_VALUE 0x1FF
#define MAX_12BIT_VALUE 0xFFF
int init_virt_addr(virt_addr_t * vad... |
C | #include<stdio.h>
#include<stdlib.h>
#define max 50
int queue[max];
int rear,front;
void enqueue(int data)
{if(rear==max-1)
printf("\n queue is full ");
else
{
rear+=1;
queue[rear]=data;}
if(front==-1)
front=0;
}
void dequeue()
{if(front==-1 || front==rear+1)
printf("queue is empty");
else
{
queu... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include "BFINode.h"
#define SIZE 20
struct DataItem {
struct BFINode *data;
int key;
};
//struct DataItem* hashArray[SIZE];
struct DataItem* dummyItem;
struct DataItem* item;
int hashCode(int key);
struct BFINode *searchHash(str... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#define MAX_ELEMENT 200
#define TRUE 1
#define FALSE 0
#define MAX_VERTICES 15 //정점의 수
#define INF 1000000 /* 무한대 (연결이 없는 경우) */
char *region_list[]={"인천", "서울", "속초", "보령", "천안", "공주", "대전", "동해", "군산", "논산", "대구", "포항", "목포", ... |
C | #include <stdio.h>
#include <FreeRTOS.h>
#include <task.h>
extern uint8_t _heap_start;
extern uint8_t _heap_size; // @suppress("Type cannot be resolved")
extern uint8_t _heap_wifi_start;
extern uint8_t _heap_wifi_size; // @suppress("Type cannot be resolved")
static HeapRegion_t xHeapRegions[] =
{
{&_heap_st... |
C | /**
* @input A : Integer
*
* @Output string. Make sure the string ends with null character
*/
char* convertToTitle(int A) {
// SAMPLE CODE
/*
* char *result = (char *)malloc(100 * sizeof(char));
* // DO STUFF
* return result;
*/
int n=A;
char *result=(char*)malloc(sizeof(char)*10);
int count=0;
... |
C | // Adapted from https://github.com/bigmagic123/d1-nezha-baremeta
#include "uartinit.h"
#include "clk.h"
#include "gpio.h"
#define UART0_MODE_TX (6)
#define UART0_MODE_RX (6)
void sys_uart_putc(uint8_t uart_num, char c)
{
virtual_addr_t addr = UART_BASE + uart_num * 0x4000;
while((read32(addr + UART_LSR) ... |
C | #include "ast.h"
/* Construction AST */
struct ast* newast(int nodetype, struct ast* l, struct ast* m, struct ast* r)
{
struct ast* a = malloc(sizeof(struct ast));
if(!a) {
fprintf(stderr,"out of space");
exit(0);
}
a->nodetype = nodetype;
a->l = l;
a->m = m;
a->r = r;
return a;
}
struct ast... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int *i;
char *c;
float *f;
double *d;
printf("int*\t%u\nchar*\t%u\nfloat*\t%u\ndouble*\t%u\n",sizeof(i),sizeof(c),sizeof(f),sizeof(d));
return 0;
}
|
C | /*11) Yerden yuksekligi ve ilk hizi girilen cismin havada kalma suresini, yatayda alacagi yolu ve yere carpma hizini hesaplayan program
*/
/* h= 1/2 g t^2
t = (2h/g)^1/2
x = v.t
vx vy
vx = x
vy = gt
*/
#include <stdio.h>
#include <math.h>
int main(){
const float g = 9.8;
float heig... |
C |
#include <stdio.h>
int my_str_isnum ( char const * str )
{
char *p=str;
while(*p!='\0')
{
if(!(*p>='0'&&*p<='9'))
return 0;
p++;
}
return 1;
}
|
C | #include "check_pid.h"
#include "check_tcp.h"
#include "debug.h"
#include "hook.h"
#include "log.h"
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <sys/wait.h>
#include <limits.h>
static int interval = 10;
int program_... |
C | /*
============================================================================
Garcia, Magali 1E
Ejercicio 1:
Ingresar nmeros enteros, hasta que el usuario lo decida. Calcular y mostrar:
a) El promedio de los nmeros positivos.
b) El promedio de los nmeros negativos.
==============================================... |
C | #include<stdio.h>
#include<conio.h>
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
struct emp
{
char fname[20];
char nm[20];
char sub_taken[20];
char last_edu[20];
char join_date[20];
int sno;
int age;
char password[32];
long int bs;
int flg;
}rec;
FILE *fa,*ft;
//search roll no
int... |
C | #include <stdio.h>
int main() {
int i, j;
for( i = 0; i < 10; i++ ) {
for( j = 0; j < 10; j++ ) {
printf( "(%d, %d) ", i, j );
}
printf( "\n" );
}
return 0;
}
/* Ajuda! */
/* Objetivo do programa: imprimir pares ordenados da forma (linha,coluna) */
/* As linhas sao... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fdf_parsing_2.c :+: :+: :+: ... |
C | #include <math.h>
float b;
float tol=0.01;
int avg=25;
void Sharp_Init()
{
ANSEL=0x00;
ANSELH=0x00;
TRISA=0xFF;
TRISAbits.TRISA2=1;
ANSELbits.ANS2=1;
ADCON1bits.ADFM=1;
ADCON1bits.VCFG0=0;
ADCON0bits.ADCS=0b101;
ADCON0bits.CHS=2;
ADCON0bits.ADON=1;
}
int analogRead(int channel)
{ int r... |
C | #include <stdio.h>
main()
{
FILE *fp_file = NULL;
char sz_file_name[256] = {0};
printf("Ҫļ:\n");
gets(sz_file_name);
fp_file = fopen(sz_file_name, "r");
if (NULL == fp_file)
{
printf("ʧܣļǷ\n");
}
else
{
printf("ļɹ\n");
fclose(fp_file);
}
getchar();
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sqlite3.h>
#include "builders.h"
#include "compares.h"
#include "team.h"
#include "unit_test.h"
static sqlite3 *db;
static char *result;
static int load_team_game_defense_stats_data( void *output, int cols, char *data[], char *names[] )
{
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
// !!!!!!!!!!!!! complique malloc pour struct
struct Time{
char *sec;
char *min;
char *hour;
char *mday; /* day of the month, range 1 to 31 */
char *mon;
char *year;
char *wday;
char *yday; // n'utilise pas
char *isdst... |
C | // Jonathan Coutinho Alves Santos
#include <stdio.h>
int main(void){
int cont = 0;
unsigned long long int rep = 0;
unsigned long long int i, hash;
unsigned long long int a, b, x, n, c, d, m;
scanf("%d", &cont);
while (cont > 0){
scanf("%lu %lu %lu %lu %lu %lu %lu", &a, %b, &x, &n,... |
C | #include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <avr/pgmspace.h>
#include "MENU_utils.h"
#include "../drivers/HID_driver.h"
#include "../drivers/OLED_driver.h"
#include "../utils/OLED_utils.h"
#include "DEBUG_utils.h"
const char mainmenu[] PROGMEM = "Main Menu\0";
const char utilsmenu[] PROGMEM =... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* heredoc_fill.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
int main(){
double a;
scanf("%lf",&a);
if(a <= 800)
a = a * 0.9;
if(a > 800 && a < 1500)
a = a * 0.81;
if(a >= 1500)
a = a * 0.9 * 0.79;
printf("%0.1lf\n",a);
return 0;
} |
C | #include <stdlib.h>
#include <stdio.h>
/* C provides a way to create new data types with the `typedef` declaration.
*
*/
struct int_vector_struct {
int *array;
int size;
};
typedef struct int_vector_struct int_vector;
int_vector build_int_vector(int array[], int size) {
int_vector vector = {array, size};
r... |
C | #pragma once
#include "../headers/SMatrix.h"
SMatrix generate_SMatrix(UTYPE n, UTYPE m)
{
SMatrix newmatrix;
newmatrix.rows = m;
newmatrix.columns = n;
newmatrix.mas = (DTYPE **)malloc(sizeof(DTYPE *) * m);
for (UTYPE _m = 0; _m < m; ++_m)
{
newmatrix.mas[_m] = (DTYPE *)malloc(sizeof(DTYPE) * n);
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ctrl_up.c :+: :+: :+: ... |
C | #include "box.h"
#include "scroll.h"
#include "imagemgr.h"
#include "log.h"
struct scrollabledata_s
{
struct Box_s *entry;
struct Box_s *scroll;
int stickybottom;
};
void Scrollable_Refresh(struct Box_s *pbox)
{
struct scrollabledata_s *data = pbox->boxdata;
struct Box_s *scroll;
if (da... |
C | #include <stdio.h>
#define SIZE 10
int print_arr(int* arr){
for(int i=0; i<SIZE; i++){
printf("%d ,", *(arr+i));
}
}
int main(){
int arr[SIZE] = {1,};
for(int i=0; i<SIZE; i++){
*(arr+i) = *(arr + (i - 1)) + (i+1);
printf("%d : %d, %d\n",i,(*arr+i), *(arr+i-1... |
C | #include<stdio.h>
#include<string.h>
#include<ctype.h>
int main (){
int i, j, k, l;
int a[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
for (i=0; i<10; i++)
{
for (j=0; j<10 - i - 1; j++)
{
if(a[j] < a[j+1])
{
k = a[j];
a[j] = a[j+1];
a[j+1] = k;
}
}
}
for(i=0; i < 10; i++)
{
printf("%d\t... |
C | /*******************************************************************************
*
* File: strncpy.c
*
* Author: Alexy Torres Aurora Dugo
*
* Date: 03/10/2017
*
* Version: 1.0
*
* strncpy function. To be used with string.h header.
*
***************************************************************************... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main_alt.c :+: :+: :+: ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_swap.c :+: :+: :+: ... |
C | # include <stdio.h>
# pragma warning (disable:4996)
int main(void) {
float n1, n2;
printf("Enter a floating number: ");
scanf("%f", &n1);
printf("Enter a floating number: ");
scanf("%f", &n2);
if (n1 > n2)
printf("The smaller number is %.2f", n2);
else
printf("The smaller number is %.2f", n1);
return ... |
C |
/* Define heap */
typedef struct min_heap {
int heap_size;
int array_length;
int *array;
void min_heapify(int idx);
void build_min_heap();
int extract_min();
min_heap(int *_array, int _array_length) {
array = _array;
array_length = _array_length;
heap_size = 0;
build_min_heap();
}
... |
C | #include <stdio.h>
#include <string.h>
int main() {
int i;
char a[9][9];
char gl[]={'r','n','b','q','k','b','n','r'};
char p='p';
memset(a, ' ', sizeof(a));
//цыфры
for (i=0; i<8; i++) {
a[i][0]=56-i;
}
// буквы
for (i=1; i<9; i++){
a[8][i]=96 + i;
}
for (i= ... |
C | #include <avr/io.h>
#include "main.h"
#include "gpio.h"
//Setting our pin i/o
//The directoriess
void setDDRB(int newDDRB){
DDRB |= newDDRB;
}
void setDDRC(int newDDRC){
DDRC |= newDDRC;
}
void setDDRD(int newDDRD){
DDRD |= newDDRD;
}
//Sensing pins
int senseB(int pin){
if(PINB & 1<<pin == 0){
return 0;
}
e... |
C | #include <stdint.h>
#include <stddef.h>
#include <string.h>
#include "../include/mcnet/error.h"
#include "../include/mcnet/read.h"
#include "../include/mcnet/write.h"
#include "../include/mcnet/metadata.h"
#ifdef __cplusplus
extern "C" {
#endif
size_t mcnet_metadata_parser_parse(mcnet_metadata_parser_t* parser, uint... |
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | #include<stdio.h>
#include<string.h>
void espacios(char string[], int array[], int *j);
void cambiar(char string[],int array[],int j);
int main(void){
char string[200];
int array[200],i,j=0;
printf("Dame una frase: ");
gets(string);
espacios(string,array,&j);
for(i=0;i<strlen(string);i++){
string[i]=t... |
C | #include <stdio.h>
#include <math.h>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_blas.h>
#include "kjg_geno.h"
#include "kjg_genoIO.h"
#include "kjg_geno_gsl.h"
void
main (int argc, char **argv)
{
if (argc != 5)
{
exit (1);
}
FILE *fh_weight = fopen (argv[1], "r");
... |
C | #include<stdio.h>
char nextGreatestLetter(char* letters, int lettersSize, char target) {
char ret = letters[0];
for (int i = 0; i < lettersSize; i++) {
if (letters[i] > target) {
return letters[i];
}
}
return ret;
}
int main() {
return 0;
} |
C | /*
* A program with lock contention
*/
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
pthread_mutex_t lock;
void *hold(void *arg) {
pthread_mutex_lock(&lock);
usleep(10000);
pthread_mutex_unlock(&lock);
return arg;
}
void *wait(void *arg) {
pthread_mutex_lock(&lock);
pthread_m... |
C |
#include<stdio.h>
struct testcase{
char str[100];
int k;
int res;
}t[5]={{"41",3,0},{"61345",200,-1},{"41",1,-1},{"0000",10,0},{"22052015",21,0}};
int repeatAndDivideBy3(char *s,int k)
{
int i=0,sum=0;
for(i=0;s[i]!='\0';i++)
{
int num=s[i]-'0';
sum+=num;
}
if((sum*k)%3==0)
return... |
C | #include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <assert.h>
#include <limits.h>
#include <unistd.h>
#include <dirent.h>
#include "filelist.h"
#include "process.h"
struct process_t
{
int pid;
char file[PATH_MAX+1];
file_list_node_t* open_file_list;
};
process_t* create... |
C | #include <system.h>
#include <list.h>
#include <lib.h>
#include <stddef.h>
#include <st.h>
#include "memlayout.h"
#define MAX_THREADS 16
#define SCHEDULER_TIMESLIZE_MS 500
enum thread_status {
thread_finished = 0,
thread_ready,
thread_is_idle_process,
};
struct tcb {
struct list_node node;
/* Verwaltungsd... |
C |
#include "push_button.h"
/**
* @brief
* @param
* @param
* @retval
*/
button_status_t read_push_button(Register_t *reg, pins_t pin){
switch(pin){
case PIN0 : return reg->Register_Bits.Bit0; break;
case PIN1 : return reg->Register_Bits.Bit1; break;
case PIN2 : return reg-... |
C | // author: Charles Smith <cas275@pitt.edu>
#include <stdio.h>
#include "matrix.h"
int main(){
int a[10] = {0,5,3,6,7,8,9,4,1,2};
sort(10, a);
int i;
for(i=0; i<10; i++){
printf("%d ", a[i]);
}
printf("\n");
}
|
C | #include "activations.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char *get_activation_string(ACTIVATION a)
{
switch(a){
case LOGISTIC:
return "logistic";
case LOGGY:
return "loggy";
case RELU:
return "relu";
c... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fill.c :+: :+: :+: ... |
C | /*
** EPITECH PROJECT, 2021
** wise_text
** File description:
** handle wise text
*/
#include "rpg.h"
static char *get_class_text(int key)
{
if (key == 0)
return ("ERREUR : Tu n'es pas assez malin !");
else if (key == 6)
return ("ERREUR : Tu n'es pas assez fort !");
else
return ("E... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "ext/snt/utils.h"
#include "ext/snt/color.h"
#include "ext/snt/rectangle.h"
#include "ext/snt/image.h"
#include "ext/snt/driver.h"
#include "gastuff.h"
static struct {
bool console_mode;
image* target;
int ... |
C | #include <stdio.h>
#include <ctype.h>
#define MAX 128
int getline(char s[],int lim);
void main(void){
int i,hossz,joe;
char s[MAX];
joe =1;
//Vals bankszmlaszm formtum megadsa
printf("Add meg a bankszamlaszamod: ");
hossz = getline(s,MAX);
//Karakterlncot megvizsgljuk, hogy a megfelel helyeken "-" karak... |
C | #include <stdio.h>
void EncryptCaesar(char* ,int ); // FUNCTION PROTOTYPE
int main(void)
{
int number = 1;
char statment[100] = "ABCD";
DecryptCaesar(statment,number); // calls the function below up into the main fuction
return 0;
}
void DecryptCaesar(char* message, int key) // the function definition
{... |
C | #include "dataLinkLayer.h"
/* Global and Const variables */
const unsigned char SET[] = {FLAG, A_TRANSMITTER, C_SET, A_TRANSMITTER^C_SET, FLAG};
const unsigned char UA_TRANSMITTER[] = {FLAG, A_TRANSMITTER, C_UA, A_TRANSMITTER^C_UA, FLAG};
const unsigned char UA_RECEIVER[] = {FLAG, A_RECEIVER, C_UA, A_RECEIVER^C_UA, F... |
C | #include <stdio.h>
void statement_do_while()
{
int count = 0;
int sum;
sum = 0;
printf("[ statement do while ]\n");
printf("count = %d, sum = %d\n", count, sum);
do {
count++;
sum += count;
} while (count < 10);
printf("count = %d, sum = %d\n", count, sum);
}
void main(void)
{
... |
C | /*Given the coordinates (x, y) of a center of a circle and it’s radius, write a program
which will determine whether a point lies inside the circle, on the circle or outside
the circle.
(Hint: Use sqrt( ) and pow( ) functions)*/
#include<stdio.h>
int main()
{
int x,y;
printf("Enter co-ordinate(x1,y1)to check posi... |
C | /* File:
* ---------------
* 调用openssl提供的MD5函数
*/
#include <stdint.h>
#include <assert.h>
#include <string.h>
#include <openssl/md5.h>
void FillMD5Area(uint8_t digest[], uint8_t id, const char passwd[], const uint8_t srcMD5[])
{
uint8_t msgbuf[128]; // msgbuf = ‘id‘ + ‘passwd’ + ‘srcMD5’
size_t msglen;
size_t... |
C | int ae(double *in_data, int in_time, double *out_data, float alfa)
{
double St_1=0; //Stores value of S(t-1)
double St=0; //Stores value of S(t)
int i=0;
if(in_time==0) //Used on the first forecast
{
*out_data=in_data[0];
return 0;
}
else if(in_time<0) //Erro: negative time
... |
C | #include <stdio.h>
int main(int argc, char const *argv[])
{
int num;
int i1 = scanf("%i", &num);
int i2 = printf("%d\n", num);
printf("%d:%d", i1,i2);
return 0;
}
|
C | #include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<math.h>
int main()
{
int x1,y1,c,i,px1,py1,xp1,yp1,xp2,yp2;
int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,"C:\\TC\\bgi");
printf("enter coeff of x:");
scanf("%d",&x1);
printf("enter coeff of y");
scanf("%d",&y1);
printf("enter ... |
C | #include <stdio.h>
int main()
{
short **presscode;
printf("size of (void *) = %d\n", sizeof(void *));
printf("size of presscode[0] = %d\n", sizeof(presscode[0]));
printf("size of presscode = %d\n", sizeof(presscode));
printf("size of *presscode = %d\n", sizeof(*presscode));
printf("size of **presscode = %d\n",... |
C | /*-------------------------------------------
* Merge Two sorted array
* Sept 17th, 2019
*-------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
// Merge two sorted arrays into a third array while removing redundant values. Return size of merged array C.
// Either list may be em... |
C | #include "userFileSystem.h"
#include "kernelFileSystem.h"
#include "kernel.h"
#include "signals.h"
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#define TRUE 1
#define FALSE 0
in... |
C |
#include <stdio.h>
#include "io.h"
int main(void) {
DDRC = 0xFF; PORTC = 0x00;
DDRD = 0xC0; PORTD = 0x7F; //PD6 and PD7 are set for input
//custom characters to be used with 16x2 LCD
unsigned char motherShip[] = { 0x09, 0x1C, 0x0E, 0x0F, 0x0F, 0x0E, 0x1C, 0x09 };
unsigned char basicLaser[] = { 0x00, 0x00, 0x00... |
C | #include <bpf/libbpf.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/stat.h>
#include <fcntl.h>
int main(int argc, char **argv)
{
struct bpf_object *obj = NULL;
struct bpf_link *link = NULL;
struct bpf_program *prog;
int err = 0, fd;
char buf[100];
ssize_t len;
char *c;
fd = open("... |
C | #include "TriangleFactors.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
// checks if a number is prime.
int isPrime(long n) {
int i;
for(i=2; i < ceil(sqrt(n)); i++) {
if(n%i == 0)
return 0;
}
return 1;
}
// gets the nth triangle number
long getNthTriangleNumbers(int n) {
return (n*(n+1)) /... |
C | #ifndef _ELF_COMMON_H_
#define _ELF_COMMON_H_
#include <elf.h>
#include "section.h"
/**
* Lis l'en-tête d'un fichier ELF 32 bits et stocke les informations dans une structure
*
* @param fd: un descripteur de fichier (ELF32)
* @retourne un pointeur sur une structure de type Elf32_Ehdr
**/
Elf32_Ehdr *read_elf_h... |
C | // Thom Wiggers <thom@thomwiggers.nl>
// Available under the New BSD licence
//
// Solution to Hackover 2016's 'guessr' challenge
// C version of the Python solution, because this is much, much faster.
//
#include <stdio.h>
const unsigned long m = 2147483648L;
//const unsigned long m = 65536;
const unsigned int a = 11... |
C | #include <stdio.h>
int main()
{
int c, i, nc, a;
int ndigit[30];
for(i = 0; i < 30; ++i)
ndigit[i] = 0;
nc = 0;
while((c = getchar()) != EOF) {
++nc;
if(c == '\n' || c == '\t' || c == ' ') {
++ndigit[nc];
nc = 0;
}
}
for(i = 0; i < 30;... |
C | #include <stdio.h>
#include <string.h>
int compare ( int x, int y ){
if ( x > y){
return x;
}else{
return y;
}
}
int maxN ( int *A, int length){
int max = *(A+0);
for (int i = 1; i < length; i ++ ){
max = compare (max, *(A+i));
}
return max;
}
int main () {
int array[10] = {1,2,3,4,5,6,7,8,9,0};
in... |
C | /*
* NFC_lib_test.c
*
* Created: 3/1/2017 3:53:59 PM
* Author: JanAriel
*/
#ifndef F_CPU
#define F_CPU 16000000UL
#endif
#include <avr/io.h>
#include "m24sr.h"
/*
Example:
Writing onto Ndef File
Need-to-know functions:
M24SR_init();
Initializes the necessary parameters for com... |
C | #include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
int g = 0;
//So, static variables will be shared with the all threads but not globally with the whole system it has its own scope
//It cannot be called outside the function
void *thread_func(void *vararg){
int i = 0;
for(i = 0 ; ... |
C | #include <stdio.h>
int top;
void push(int n, int *stack)
{
top++;
stack[top] = n;
}
void pop(int *stack)
{
top--;
}
int explore(int x, int n, int arr[n][n], int *v_to_go, int *stack, int *visited)
{
int i, j, ans=-1;
for( i=1; i<n; i++)
{
if(arr[x][i]==1)
{
for( ... |
C | /******************************************************************************
cs2123p5Driver.c by Abit Gurung
Purpose:
Command Parameters:
Input:
Reads input from a .txt file
Results:
Returns:
returns 0 if everything runs correctly!
Notes:
******************************************************************... |
C | /*
** my_print_comb.c for my_print_comb in /home/clement/Piscine/CPool_Day03
**
** Made by clement girard
** Login <clement@epitech.net>
**
** Started on Wed Oct 5 09:54:23 2016 clement girard
** Last update Thu Oct 6 22:40:44 2016 clement girard
*/
void my_putchar(char c);
int print_putchar(int i, int j, int ... |
C | #include <stdio.h>
#define alturaMaxima 255
typedef struct
{
int peso;
int altura;
}PesoAltura;
typedef int CHAVE;
int main(){
PesoAltura pessoa1;
pessoa1.peso = 80;
pessoa1.altura = 185;
printf("Pesso: %i, Altura: %i. ", pessoa1.peso,pessoa1.altura);
if (pessoa1.altura>alturaMaxi... |
C | #include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <unistd.h>
#include <strings.h>
#include "stack.h"
#define BOARD_WIDTH 80
#define BOARD_HEIGHT 30
#define COLOR_RED "\x1b[32m"
#define COLOR_RESET "\x1b[0m"
#define COLOR_SELECTED "\x1b[1m\x1b[43m"
#define CLEAR "\x1b[2J\x1b[;H"
// Microseconds, wo... |
C | #include<stdio.h>
#define MAXLEN 100;
int main(void)
{
int a=MAXLEN;
printf("MAXLEN IS\t%d",a);
a=20;
printf("A IS\t%d",a);
//printf("MAXLEN IS\t%d",MAXLEN);
} |
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | struct process{
int atime,btime,wtime,ctime,tat,btemp,priority,done,chosen;
char pid[3];
struct process* link, *qnext, *self, *next;
} *fcfs=NULL, *sjf=NULL, *priority=NULL, *srtf=NULL, *rr=NULL, *q_add=NULL, *q=NULL;
typedef struct process process;
process p[50], h[50];
int i=0, count = 0 ,hs = 0, n=0;
void gc_... |
C | #include <stdio.h>
int main(void)
{
int x = 1, i, key 4; // change x to 1 for encryption or 2 of decryption
char message[100] = "CLONE";// imputed string must be in capitals
switch(x){
case 1:
for (i=0;(message[i]!=0);i++){ // loop for the entire string
if (message[i]>65 && m... |
C | #include <sys/types.h>
#include <sys/wait.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
int main() {
int a = 10, b = 25, fq = 0, fr = 0 ;
fq = fork();
if(fq == 0) {
a = a + b;
printf("(a = a + b)\na = %i\nb = %i\nprocess id = %i\n", a,b,getpid());
fr = fork();
if(fr != 0) ... |
C | /**
* A basic retro-style raycasting game engine implemented
* entirely in SDL2. Uses textures and renderer for
* hardware acceleration. Also implements my PixBuffer
* effects for most of the graphics, shaders, etc.
*
* @author Connor Ennis
* @date 11/1/2019
**/
#include "rayengine.h"
const static SDL_Color ... |
C | /* Simp
https://www.hackerrank.com/contests/sdd-m3/challenges/simp
Taruh dan cari data di AVLTree
*/
#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
typedef struct AVLNode {
int value, height, BF;
int leftSize, rightSize;
struct AVLNode *left, *right;
} AVLNode;
typedef s... |
C |
#include <stdio.h>
#include <unistd.h>
int main(int argc, char **argv)
{
int ch;
opterr = 0;
while((ch=getopt(argc, argv, "abcdef"))!= -1)
switch(ch)
{
case 'a' :
printf("here is a %s \n", optarg);
break;
case 'b' : printf("here is b %s \n ",optarg); break;
case 'c' : printf("here is c%s\n",optarg); ... |
C | // 3.Write a program which accept string from user and toggle the case.
// Input : “Marvellous Multi OS”
// Output : mARVELLOUS mULTI os
#include<stdio.h>
void DisplayToggle(char *p)
{
int iCnt=0;
while(p[iCnt]!='\0')
{
if((p[iCnt]>=97)&&(p[iCnt]<=122))
{
printf("... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include "Lista_Duplamente_Encadeada_Circular.h"
int main(void){
no *P;
char aux[10];
int x, c;
char choice[10];
inicializa_Pilha(&P);
do{
printf("\n------------------------------------\n");
pr... |
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
unsigned int Key[9];
int main() {
int i,j;
int tmp = 0;
int tmp_i = 0;
int tmp_j = 0;
int Sum = 0;
for (i = 0; i < 9; i++) {
scanf("%d", &Key[i]);
Sum += Key[i];
}
for (i = 0; i < 9 - 1; i++) {
for (j = 0; j < 9 - 1; j++) {
if (Key[j] > Key[j + 1]) {... |
C | #include "libft.h"
t_list *ft_lstmap(t_list *lst, void *(*f)(void*), void (*del)(void*))
{
t_list *newdst;
t_list *first_dst;
if (!lst)
return (NULL);
first_dst = NULL;
while (lst)
{
newdst = ft_lstnew(lst->content);
if (!newdst)
{
ft_lstclear(&first_dst, del);
return (NULL);
}
newdst->content... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
typedef struct node
{
char data;
struct node *l,*r;
}Tree;
Tree *create(int n,char*pretravel,char*intravel)
{
Tree *root;
char *p;
if(n==0)
return NULL;
root=(Tree*)malloc(sizeof(Tree));
root->data=pretravel[0];
for(p=intra... |
C | #include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
#include <stdio.h>
void save(AVFrame *frame, int width, int height, int num)
{
AVCodec *codec;
AVCodecContext *context;
AVPacket packet;
FILE *file;
char file_name[32];
int ones, tens, hundreds, output;
... |
C | #include<stdio.h>
#include<math.h>
#define pi 3.1416
int main()
{
int t,i;
double r1,r2,r3,a,b,c,A1,A2,A3,A4,A,s,x,y,z,l,m,n;
scanf("%d",&t);
for(i=1;i<=t;i++)
{
scanf("%lf %lf %lf",&r1,&r2,&r3);
a=r1+r2;
b=r2+r3;
c=r3+r1;
s=(a+b+c)/2;
A4=sqrt(s*(s-a)... |
C | // Arrays, struct, cadenas de caracteres, punteros, operaciones sobre bits
struct t_dummy {
char cx;
char cy;
int lat;
int longitud;
};
struct t_dummy st;
unsigned int tabla[8]= { 0x1, 0x3, 0x5, 0x7, 0x9, 0xB, 0xD, 0xF };
// Operaciones sobre bits
#define LED1 0x01
#define LED2 0x02
static unsigned int status = 0... |
C | /*=================================================================
*
* xch2_c.C
*
* Description: calculate the Cramer von mises criterion between two
* sample using exchangeability.
*
* The calling syntax is:
*
* v = xch2_c(x1,x2,y1,y2)
*
* This is a MEX-file for MATLAB.
* Author Martin du Rocher <mar... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.