language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #ifndef __UTILS_BTABLE_H_
#define __UTILS_BTABLE_H_
#include <stdint.h>
/* 32bit table utility */
#define BTABLE_SET(a,i) ((a)[(i)/32] |= (1 << ((i) % 32)))
#define BTABLE_GET(a,i) ((a)[(i)/32] & (1 << ((i) % 32)))
#define BTABLE_CLR(a,i) ((a)[(i)/32] &= ~(1 << ((i) % 32)))
static inline void btable_set(uint32_t *a,... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "BasicBio.h"
// FUNCTION LIST
// -------------
// + BarfNodeInfo
// + IncreaseInEdgeCapacity
// + IncreaseOutEdgeCapacity
// + DestroyGraph
// + SpliceProbToScore
// + ReadNodesFromFile
// + UpdateHitExtScore
// + AttemptCon... |
C | #include <stdlib.h>
#include <stdio.h>
# include <avr/io.h>
#include <util/delay.h>
# include <avr/interrupt.h>
#include <string.h>
#include "usart.h"
#include "aes.h"
#include "lcd.h"
# define F_CPU 8000000
# define USART_BAUDRATE 9600
# define BAUD_PRESCALE (((( F_CPU / 16) + ( USART_BAUDRATE / 2) ) / ( USART_BAU... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#define maxbrPokusaja 6
FILE* openFile (char* filename, char* mode, int exitCode);
int pogrBrKar (char* kombinacija, int brKar);
int pogresanKarakter (char* kombinacija, char* dozvoljeniKarakteri, int brKar);
int staraKomb(char* postojeceKom... |
C | /**
* @file file_transfer.c
* @author Aleksandr Vinogradov (vinogradov.alek@gmail.com)
* @brief File transfer between parent and child in one OS using SIGUSR1 and SIGUSR2 bit by bit sending
* @version 0.1
* @date 2019-12-6
*
* @copyright Copyright (c) 2019
*
*/
#define _GNU_SOURCE // for semtimedop();
#inc... |
C | #include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<string.h>
void quicksort(char a[],int low,int high)
{
if(low<=high)
{
int pos=partition(a,low,high);
quicksort(a,low,pos-1);
quicksort(a,pos+1,high);
}
}
int partition(char a[],int low,int high)
{
... |
C | /**
e820.c
======
E820 Memory Map management
**/
/**
Includes
--------
- define.h
- types.h
- x86_const.h
- setup.h : multiboot information
- e820.h : self header
**/
#include <define.h>
#include <types.h>
#include "x86_const.h"
#include "setup.h"
#include "e820.h"
... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct Node Node;
struct Node
{
int value;
Node* right;
Node* left;
};
void Add(Node** currentNode, int value);
Node* Search(Node* currentNode, int key);
void PrintPreOrder(Node* currentNode);
void PrintInOrder(Node* currentNode);
void PrintPostOrder(Node* currentNod... |
C | /*
** EPITECH PROJECT, 2018
** lemin
** File description:
** Recuperates the paths from the end to the start.
*/
#include <stdlib.h>
#include <stdbool.h>
#include "lemin.h"
static void add_path(path_t **paths, path_t *to_add)
{
path_t *current = *paths;
if (*paths == NULL) {
*paths = to_add;
return;
}
while ... |
C | /* 6) O que faz o algoritmo a seguir?
declare i como inteiro
repetir i = 0 até i < 10 passo 2
escreva o valor i
fim-repetir
Implemente esse algoritmo utilizando a linguagem C. */
#include <stdio.h>
int main(void)
{
int i;
for (i = 0; i < 10; i = i + 2)
{
printf("Valor i = %d\n", i);
}
... |
C | #ifndef _SL_MATRIX_H_
#define _SL_MATRIX_H_
#include "slice.h"
/**
* @file
*
* Macierz liczb zmiennoprzecinkowych
*
* Detailed desc
*/
/** Macierz liczb typu @ref SlFloat */
typedef struct _SlMatrix *SlMatrix;
/** Wewnętrzny identyfikator typu macierzy */
#define SL_MATRIX_TYPE (sl_matrix_type ())... |
C | #include <stdlib.h>
#include <stdio.h>
struct page_t {
int id;
int count;
};
struct page_t *find(struct page_t *pages, int id, int n) {
for (int i = 0; i < n; i++)
if (pages[i].id == id)
return pages + i;
return NULL;
}
struct page_t *place(struct page_t *pages, int n) {
int c... |
C | /**
Viết chương trình nhập vào 3 số thực. Hãy in 3 số thực ấy ra màn hình
theo thứ tự tăng dần mà chỉ dùng tối đa hai biến phụ.
7 3 6
**/
#include<stdio.h>
void hoanDoi(int &a, int &b){
int temp;
temp = a;
a = b;
b = temp;
}
main(){
int a, b, c, temp;
printf("\nNhap a: ");
scanf("%d", &a);
prin... |
C | #include <stdio.h>
#include <unistd.h>
#include <s2earm.h>
int main() {
int i = 0;
s2e_make_concolic(&i,4,"i");
if(i < 100) {
if(i < 50)
{
if(i < 25)
printf("test [0]\n");
else
printf("test [1]\n");
}
else {
if(i ... |
C | # include<stdio.h>
# define max 100
void escape(char s[],char t[]);
main()
{
char s[max],t[max];
printf("Enter string");
scanf("%s",t);
escape(s,t);
return 0;
}
void escape(char s[],char t[])
{
int i,j;
for(i=j=0;t[i]!='\0';i++)
{
switch(t[i])
{
case '\n':
s[j++]='\\';
s[j++]='n';
break;
c... |
C | #include<stdio.h>
#include<math.h>
int is_z(int a)
{
int i,mod,m;
if(a==1||a==2||a==3)
{m=1;}
else
{mod=sqrt(a);
m=1;
for(i=2;i<=mod;i++)
{if(a%i==0)
{m=0;
break;
}
}
}
return m;
}
int main()
{int x ,i;
scanf("%d",&x);
for(i=x+1;;i++)
{if(is_z(i))
{printf("%d",i);
break;
}
}
} |
C | #include <stdio.h>
#include <stdlib.h>
int main () {
int x;
printf ("\nDigite o numero de habitantes de sua cidade\n");
scanf ("%d", &x);
printf ("\nA quantidade kwh\n");
scanf ("%f", &y);
printf ("\n\n")
printf ("\n O consumo do mes eh de:\n");
printf ("\nO codigo do consumidor eh:\n")
return 0;
//questao ma... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* push_swap.h :+: :+: :+: ... |
C | #include<stdio.h>
void MoveDisks(int , char , char , char );
int main()
{
MoveDisks(4, '1', '3', '2');
return 0;
}
void MoveDisks(int nDiskNum, char chSourcePole, char chTargetPole, char chMidPole)
{
if (nDiskNum == 1)
printf("%c -> %c\n", chSourcePole, chTargetPole);
else
{
MoveDisks(n... |
C |
#include "tree.h"
#include "helper.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct hash_entry {
RB_ENTRY(hash_entry) entries;
const char *key;
void *value;
};
int hash_cmp(struct hash_entry *h1, struct hash_entry *h2) {
return strcmp(h1->key, h2->key);
}
struct hash_root {
... |
C | #include <stdio.h>
#include "mpi.h"
int main(int argc, char *argv[]){
int myRank;
int p;
int i, j;
int no1, no2, range;
int lower, upper;
int localCount = 0, count = 0;
int flag = 0;
// double local_fact = 1.0;
// double result;
double startTime, endTime;
/* initialize MPI *... |
C | #ifndef _BITNODEQUEUE_H_
#define _BITNODEQUEUE_H_
/// Ԫ
#define MaxSize 50
typedef struct {
// Ԫظ
BiTNode* BT[MaxSize];
// ǰָ
int front, rear;
}BiTNodeQueue;
// 1.ʼ
inline void InitBiTNodeQueue(BiTNodeQueue& Q) {
Q.front = Q.rear = 0;
}
// 2.
inline bool EnBiTNodeQueue(BiTNodeQueue& Q, BiTNode* x) {
if (Q.rear... |
C | #include <stdio.h>
#include "declarations.h"
void printDec2Bin(long dec)
{
char bin[MAX_BYTES + 1] = { 0 };
int i;
for (i = 0; i < MAX_BYTES; i++)
bin[i] = '0';
while (dec && i > 0)
{
bin[--i] = (dec & 1) + '0';
dec >>= 1;
}
printf("%s\n", bin);
} |
C | /*****TODO*****
* Compare simulated data to real data
* Implement fluctuations
* Implement serial communication
* LONG TERM:
** Implement beam
** Implement all the other functions (anneals, beam trips, etc.)
**************/
/********POLARIZED TARGET SIMULATION********
* File: sim.c
* Version: 2.0
... |
C | // Queue is like a the thing we humans stand in line in public to get things done in a sequnetial manner. First come first serve.
// New members join from the last of the queue and will go out from the front.
// FIFO model.
#include <stdio.h>
#include <stdlib.h>
typedef struct node
{
int data;
struct node* n... |
C |
// int main()
// {
// FILE *fileptr1, *fileptr2;
// char filename[40]="test.csv";
// char ch;
// int delete_line, temp = 1;
// //open file in read mode
// fileptr1 = fopen(filename, "r");
// ch = getc(fileptr1);
// while (ch != EOF)
// {
// printf("%c", ch);
// ... |
C | /*
* author: Aleksei Kozadaev (2018)
*/
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "log.h"
#include "cmd.h"
static long current_time_ms();
static int exec_command(const struct command *cmd);
static int fork_wait(pid_t pid... |
C | #include <stdio.h>
#include <math.h>
int main(int argc, char *argv[]) {
long int j, i, suma = 0;
scanf("%ld", &j);
long int array[j];
for(i =0; i < j; i++) {
scanf("%ld",&array[i]);
suma+=array[i];
}
printf("%ld\n",suma);
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#define TRUE 1
#define FALSE 0
struct nodeStruct
{
int xValue; // x co-ordinate.
int yValue; // y co-ordinate.
char identity; // Identity as either visited or unvisited.
struct nodeStruct* next; // Pointer structure that points to next structur... |
C | // pgcc -acc vector_addition.c
#include <stdio.h>
#include <stdlib.h>
void vecaddgpu(float *restrict r, float *a, float *b, int n)
{
#pragma acc kernels loop copyin(a [0:n], b [0:n]) copyout(r [0:n])
for (int i = 0; i < n; ++i)
r[i] = a[i] + b[i];
}
int main(int argc, char *argv[])
{
int n; /* vect... |
C | /*Scrivere un programma che permetta di inserire due vettori lunghi N e
stampi un terzo vettore i cui elementi sono la somma degli elementi dei
due vettori in input. Il programma utilizza 3 funzioni:
• Inserisci elementi nel vettore
• Calcola somma
• Stampa vettore*/
#include <stdio.h>
void carica_vettore(int v[], i... |
C | /***************************************************************************************************************************
* Programming in C (3rd edition)
*
*
* Chapter 8 - Working With Functions - 8.4 - Calculating the nth Triangular Number - Using Arguments in a function
*
*
* 12/18/2014
**************************... |
C | //to find reverse of a number
#include<stdio.h>
int main()
{
int r=0,a;
printf("enter any number");
scanf("%d",&a);
while(a!=0)
{
r=r*10;
r=r+a%10;
a=a/10;
}
printf("the reverse of entered no is %d",r);
}
|
C | /*
** EPITECH PROJECT, 2020
** MY_INTLEN
** File description:
** returns the length of an int
*/
int my_intlen(int nb)
{
int lenght = 0;
while (nb != 0) {
nb = nb / 10;
lenght++;
}
return (lenght);
} |
C | /*
Routines for driving an i2c / iic eeprom.
Only tested on 24c02x series.
*/
#ifndef __EEPROM_IIC_H__
#define __EEPROM_IIC_H__
#include <stdio.h>
#include <string.h>
#include "pico/stdlib.h"
#include "pico/binary_info.h"
#include "hardware/i2c.h"
// I2C defines
// This example will use I2C0 on GPIO8 (SDA) an... |
C | #include "define.h"
// UpperCamelCase
// 超级块 4*15+964 = 1024B
struct SuperBlock
{
unsigned int size; // 磁盘大小
unsigned int start; // 总起始块号
unsigned int fileDirStart; // 文件目录表起始块号
unsigned int fileDirBitmapStart; // 文件目录位图起始块号
unsigned int inodeBitmapStart; // inod... |
C | #define _DEFAULT_SOURCE
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <malloc.h>
#include <stdlib.h>
int rec(const char *pid ){
int count =0;
char procdir[256];
char * ps = calloc(128, sizeof(char));
procdir[0]= '\0';
sprintf(procdir... |
C | #include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <fcntl.h>
int main(){
int fd;
if((fd = open("/usr/bin", O_RDONLY)) < 0){
perror("open error");
return 1;
}
if(fchdir(fd)<0){
perror("fchdir error");
return 1;
}
system("pwd");
return 0;
}
|
C | #include "shell_fct.h"
#define _GNU_SOURCE
#include<stdlib.h>
#include<unistd.h>
#include<stdio.h>
#include<fcntl.h>
#include <sys/wait.h>
#include <arpa/inet.h>
#include<netinet/in.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<string.h>
/**
*Executer une seule commande à distance.
*@param cmd La cmd à exe... |
C | #include <stdio.h>
int ind[10],flag[10];
int main(void)
{
int n,a[10][10],i,j,k,count=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&a[i][j]);
}
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
ind[i] += a[j][i];
}
}
while(count<n)
{
for(k=0... |
C | #include<stdio.h>
int main(void)
{
int f, m, sum;
double per;
printf("л Էּ.");
scanf("%d", &f);
printf("л Էּ.");
scanf("%d", &m);
sum = m + f;
per = (double)m / (double)sum;
printf("л : %d \n", f);
printf("л : %d \n", m);
printf("л : %d \n", sum);
printf("л : %.1lf%% \n", per*10... |
C | /*
* life.c
*
* Created on: Sep 14, 2017
* Author: etarthur
*/
#include <stdio.h>
#include "life.h"
#include <stdlib.h>
//declared all global variables that will be used by program and passed in by user through the command line
int rows;
int columns;
int gens;
/**boundayChecker consumes a board and a s... |
C | /*
* This file is part of the zlog Library.
*
* Copyright (C) 2011 by Hardy Simpson <HardySimpson1984@gmail.com>
*
* Licensed under the LGPL v2.1, see the file COPYING in base directory.
*/
#include "fmacros.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <stdarg.h>
#in... |
C | /*
* This is sample code generated by rpcgen.
* These are only templates and you can use them
* as a guideline for developing your own functions.
*/
#include "IDL.h"
char *
compute_1(char *host, uint8_t act, char login[], char password[], char cmd[])
{
CLIENT *clnt;
char * *result_1;
command execute_1_arg;
... |
C | #include <stdio.h>
void peticion (int * input);
main(){
int casos = {0}, gasto = {0}, total = {0}, i = {0};
printf ("Introduce la cantidad de gastos\n");
peticion (&casos);
while(casos > 0){
total=0;
for (i=1;i<=casos;++i){
printf ("Introduce el gasto %d\n",i);
peticion(&gasto);
total = gasto +... |
C | #ifndef GPIO_H
#define GPIO_H
#include "fpga.h"
#define PORTA (GPIO_BASE+0x00) // GPIO[0:7]
#define PORTB (GPIO_BASE+0x20) // GPIO[8:15]
#define PORTC (GPIO_BASE+0x40) // GPIO[16:23]
#define PORTD (GPIO_BASE+0x60) // GPIO[24:31]
#define PORTE (GPIO_BASE+0x80) // GPIO[32:39]
#define PORTF (GPIO_BASE+0x... |
C | /* Corso di laurea: Ingegneria Informatica
* Esame: Fondamenti di Informatica
* Prova scritta del: 14 luglio 2006
*
* Si scriva un programma che soddisfi le seguenti specifiche:
* - carica da un file di testo un elenco di parole; una parola in
* questo contesto definita co... |
C | #include<stdio.h>
#include<conio.h>
#include<Windows.h>
#include<string.h>
#define LEN_BOOK sizeof(struct Book)
#define LEN_READER sizeof(struct Reader)
#define BOOK_DATA astBook[i].iNum, astBook[i].acName, astBook[i].acAuthor, astBook[i].acPress, astBook[i].iAmount
#define READER_DATA astReader[i].iNum, astRe... |
C | #include <gpio/gpio.h>
#include <uart/uart.h>
#include <util/util.h>
#include <util/printf.h>
/*
* Blink LED (GPIO PIN:24)
*/
void main()
{
const int pin = 24;
gpio_set_pin_mode(pin, OUTPUT);
while (1)
{
gpio_set_pin(pin);
__delay(1000000);
gpio_clear_pin(pin);
__del... |
C | #include <stdio.h>
main()
{
int n1, n2, i, i2, f;
do
{
scanf("%d",&n1);
scanf("%d",&n2);
} while (n2 < n1);
for(i2 = n1; i2 <= n2; i2++)
{
f = -1;
for (i = 1; i <= i2; i++)
{
if (i2%i == 0)
f++;
}
if (f == 1)
printf("%d ",i-1);
}
}
|
C | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "monteCarlo.h"
double debug_function(double *x) //sqrt(x) function for testing monte carlo integration
{
return sqrt(x[0]);
}
double dmitri_function(double *x) //Function supplied in homework description
{
return 1 / (M_PI * M_PI * ... |
C |
// BANK APPLICATION
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define BANK_FILE "bank_data.dat"
struct bank
{
long long acc_number;
char bank_name[30];
char branch_name[20];
char acc_holder_name[30];
char acc_holder_address[80];
char status;
float balance;
};
struct bank customer... |
C | //
// main.c
// MobileDevice
//
// Created by zhengzhilin on 14-1-9.
// Copyright (c) 2014年 zhengzhilin. All rights reserved.
//
#include <stdio.h>
#include "mobiledevice.h"
enum MobileDeviceCommandType
{
GetUDID,
InstallApp,
UninstallApp,
ListInstalledApps,
Tunnel
};
struct
{
struct am_d... |
C | #include <stdio.h>
#include <stdlib.h>
void print_2d_matrix(void** matrix, unsigned short rows, unsigned short columns) {
int **matrix_pointer = (int**)matrix;
for (int x=0; x<rows; ++x) {
for (int y=0; y<columns; ++y) {
printf("%i ", matrix_pointer[x][y]);
}
printf("\n");
... |
C | #include <stdio.h>
int main()
{
int n,mod,aux=0,cont=0;
scanf("%d",&n);
while(n!=0)
{
mod=n%2;
if(mod==1)
{
cont++;
if(cont>aux)
aux=cont;
}
else
cont=0;
n=n/2;
}
printf("%d\n",aux);
system("Pause")... |
C | #include <stdio.h>
#include <stdlib.h>
void no25();
// convert decimal to binary
void myitoa(int i ,char * p )
{
}
void no28()
{
char a =3,b = 6,c,str[100],*p = str;
c = (a ^ b) << 2;
// itoa(c,p,10);
printf("the char is %d,and the number is %s \n",c,p);
}
void no27()
{
printf("12 | 012 = %d \n",12 | 012);
}
voi... |
C | #include <stdio.h>
#include <unistd.h>
/*
* arquivo que será chamada pelo execve
*/
int main(int argc, char const *argv[])
{
printf("Processo novo :O\n");
/*
* apenas verifica o número de argumentos e o exibe se algum valor foi passado.
*/
if (argc != 2)
{
printf("Nenhum valor recebido... |
C | #include <stdio.h>
#include "holberton.h"
/**
* get_bit - get_bit
* @n: unsigned long int n
* @index: unsigned int index
* Return: n or -1
*/
int get_bit(unsigned long int n, unsigned int index)
{
if (index > 128)
/*->128 is a funny random DEC of bit number*/
return (-1);
n = n >> index & 1;
return (n);
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* print_px.c :+: :+: :+: ... |
C | #include "variadic_functions.h"
/**
* print_all - check the code for Holberton School students.
* @format: type
*/
void print_all(const char * const format, ...)
{
unsigned int j = 0;
va_list ap;
char *s;
va_start(ap, format);
while (format[j] != '\0')
{
switch (format[j++])
{
case 's':
s = va_arg(ap... |
C | /*9Kۑ3 11515009 rcs*/
/*͂Ƃ̐̏c̍sAcΊp̘al
vO*/
#include<stdio.h>
void main(void)
{
int mg[16][16],ii=1,jj,nn,kk;
printf("15ȉ̊͂Ă:");
scanf("%d",&nn);
jj=(nn+1)/2;
mg[1][jj]=1;
for(kk=2;kk<=nn*nn;kk++){
if(kk%nn==1)
ii++;
else if(ii==1){
ii=nn;... |
C | #include<stdio.h>
#include<math.h>
int main(){
int n ;
int a,b,c,d;
again:
printf("\n\n1.Tinh dien tich hinh vuong.");
printf("\n2.Tinh dien tich hinh chu nhat.");
printf("\n3.Tinh dien tich tam giac.");
printf("\n4.Tinh dien tich hinh thang.");
printf("\n5.Tinh dien tich hinh tron.");
printf("\nChoose an opti... |
C | #include <stdio.h>
#include <stdlib.h>
#include "cliente.h"
#include "listaEstaticaSequencial.h"
#include "listaSimplesmenteEncadeada.h"
#include "listaDuplamenteEncadeada.h"
int menu(){
Cliente c;
LES* les_cliente;
LES* cpfLes;
LES* cpfEncontradoLES;
LSE* lse_cliente;
LSE* cpfEncontradoLSE;
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* prinf.c :+: :+: :+: ... |
C | #include <stdlib.h>
#include "linkedlist.h"
void freeNode(struct Node_s *node) {
free(node);
}
LinkedList *ll_initList() {
LinkedList *list = malloc(sizeof(LinkedList));
list->size = 0;
list->first = NULL;
list->last = NULL;
return list;
}
void *ll_peek(LinkedList *list) {
if (list-... |
C | //
// main.c
// my_memcpy
//
// Created by Anoja Rajalakshmi on 9/18/17.
// Copyright © 2017 Anoja Rajalakshmi. All rights reserved.
//
#include <stdio.h>
void my_memcpy(char *src,char *dest,unsigned long len){
while(len){
*dest++ = *src++;
len--;
}
dest[len]=0;
}
int main(int argc, con... |
C | /*
* Successive over relaxation
* (red-black SOR)
*
*/
#include "sys/time.h"
#include "unistd.h"
#include "stdio.h"
#include "stdlib.h"
#include "math.h"
#include "mpi.h"
#include "errno.h"
#define TOLERANCE 0.0002
struct table_t
{
double **storage;
int rows;
int cols;
};
void table_init(struct tab... |
C | /*
* uart.c
*
* Created on: 6. okt 2016
* Author: Karl
*/
#include "uart.h"
/** \file uart.c
** \brief Documentation for the UART module.
**
** Basic initialisation of UART peripheral.
**/
#define UART_PRESCALE 0x0682 /**< constant for clockPrescalar variable in USCI_A_UART_initParam construct, see fami... |
C | //
// Created by machiry on 12/8/18.
//
#ifndef PROJECT_FACTSTYPE_H
#define PROJECT_FACTSTYPE_H
#include <cstdio>
#include <time.h>
/**
* Type of facts supported/
*/
typedef enum{
PTRFACT , /* Data ptr fact*/
FUNCPTRFACT, /* Function ptr fact */
MAXFACTTYPE /* INVALID fact type */
} FACTTYPE;
typedef ... |
C | #include <stdio.h>
int main(){
int a[5];
int i=0, par=0,imp=0,neg=0,pos=0;
while (i!=5){
scanf("%d",&a[i]);
if(a[i]%2==0) par++;
if(a[i]%2!=0) imp++;
if(a[i]<0) neg++;
if(a[i]>0) pos++;
i++;
}
printf("%d ... |
C | /**
* @file prob10.c
* @author Stavros Vagionitis
* @date 25 Feb 2015
* @brief [Problem 10 in Project Euler](https://projecteuler.net/problem=10)
* Summation of primes
* ===================
* The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
*
* Find the sum of a... |
C | /**
* \file base64.h
*
* \brief RFC 1521 base64 encoding/decoding
*/
/*
* Copyright The Mbed TLS Contributors
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a cop... |
C | #include<stdio.h>
#include<stdlib.h>
#define MAX 50
void insert_arr();
void delete_arr();
void display();
int queue_a[MAX];
int rear=-1;
int front=-1;
int main()
{
int choice;
while(1)
{
printf("1.Insert \n");
printf("2.Delete \n");
printf("3.Display \n");
printf("4.Exit \n");
printf("\nEnter your choic... |
C | #include "node_list.h"
#include "location.h"
#include "node.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
// Define make_list (node_list.h).
int make_list(struct node_list_t* list, size_t initial_capacity)
{
// Assert that the pointer to the node list variable is valid.
assert(list != NULL)... |
C | #include <unistd.h>
#include <stdlib.h>
#include "mx_strcpy.c"
#include "mx_strcat.c"
char *mx_strdup(const char *str) {
char *dstString = (char *) malloc(mx_strlen(str));
if (dstString == NULL) {
return NULL;
}
mx_strcpy(dstString, str);
return dstString;
}
|
C | /*
* =====================================================================================
*
* Filename: execve.c
*
* Description: 演示exec函数的用法,这里以execve为例。
*
* Version: 1.0
* Created: 2014年07月21日 17时06分50秒
* Revision: none
* Compiler: gcc
*
* Author: Sweethe... |
C | #include <stdio.h>
#include <time.h>
#include <stdlib.h>
#define MAX 1000
void nhapmang(int arr[], int *n);
void xuatmang(int arr[], int n);
void sapxep(int arr[], int n);
void sapxeple(int arr[], int n);
int main()
{
int arr[MAX];
int n;
nhapmang(arr, &n);
printf("\nTruoc khi sap xep!\n");
xuatm... |
C | #include <stdint.h>
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
#include "gamma.h"
#include <stdbool.h>
#include <string.h>
int main() {
/*
scenario: test_random_actions
uuid: 727496543
*/
/*
random actions, total chaos
*/
gamma_t* board = gamma_new(9, 8, 9, 9);
assert( board != NULL );
assert( gamm... |
C | #include <stdio.h>
#include "square.h"
int main(void) {
printf("2^2 = %d\n", square(2));
return 0;
}
|
C | #include <stdio.h>
#define real double
//=======================================================
// Solves the Tridiagonal System of Equations Ax=B
// Using the method of cyclic reduction
// dt:21072009
//=======================================================
int main()
{
/* Matrix Size */
... |
C | #include <stdio.h>
int add(int a, int b) {
return a + b;
}
int sub(int a, int b) {
return a - b;
}
int main(void) {
int(*fp)(int, int) = add;
printf("%d\n", fp(10, 3));
fp = sub;
printf("%d\n", fp(10, 3));
return 0;
} |
C | #ifndef BASICS_H
#define BASICS_H
// typedef for fix point numbers
typedef long FIXPT;
#define PRES 16384
#define PSHIFT 14
#define PROUNDBIT (1 << (PSHIFT-1))
#define FROM_FLOAT(a) (long(a*PRES))
#define FROM_INT(a) (a << PSHIFT)
#define TO_INT(a) ((a + PROUNDBIT)>> PSHIFT)
typedef struc... |
C |
#include <stdlib.h>
#include <ctype.h>
#include <assert.h>
#include <string.h>
#include "python.h" /* get the TK_ values */
#include "scanner.h"
#define SCANNER_EMPTY (SCANNER_EOF - 1) /* -2 */
#define SCANNER_TABSIZE 8
#define SCANNER_MAXINDENT 100
#define SCANNER_MAXIDLEN 200
typedef struct
{
get_char_t ... |
C | /*6. Напиши програма која пресметува сума на внесени броеви од тастатура се додека не се внесе -1.*/
#include <stdio.h>
int main(void){
int suma=0;
int broj;
printf("Vnesi broj:\n");
scanf("%d",&broj);
while (broj != -1)
{
suma=suma+broj;
printf("Vnesi broj,-1 za kraj:");
scanf("... |
C | #include <stdio.h>
#include <math.h>
int main(int argc, char *argv[]) {
int a,b,c;
int x,y,z,m,n;
z=1000;
while(z<10000){
a=z;
x=a/1000;
a=a%1000;
y=a/100;
a=a%100;
m=a/10;
n=a%10;
if(x==y && m==n && sqrt(z)==(int)sqrt(z)){
printf("%d\n",z);
}
z++;
}
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#define STRSIZE 500
struct node
{
int num;
struct node *left;
struct node *right;
};
typedef struct node Node;
Node *CreateNode();
char *PrintTree(Node *t);
void InsertBinTree(Node *t, int i);
int InTree (Node *t, int i);
int m... |
C | #include <stdio.h>
int main()
{
char c;
for(;;)
{
printf( "Press any key, Q to quit: " );
// Convert to character value
scanf("%c", &c);
if (c == 'Q')
break;
}
} // Loop exits only when 'Q' is pressed
|
C | #ifndef TET_QUALITY_H
#define TET_QUALITY_H
#include "tet_mesh.h"
//
// Implementations of different quality metric for tetrahedra.
// All quality metrics should conform to the following:
// - Equilateral tetrahedra should have a quality measure of 1.0, which is
// the maximum (ie: quality measure should be norm... |
C | /** @file */
/*
MIT License
Copyright (c) 2020 Owen Trump
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge... |
C | /* @TODO(thynn): This list
* -BVH. Spheres, possibly also AABBs (octree?). Smart ways of constructing these is what we need..
* -SIMD support, mainly for the pure soup one, but if we have an octree we might be able to move aabb
* intersection pre-recurse (check entire scene before calling recurse first time, go wid... |
C | #include <stdio.h>
/**
* main - find natural multiples of 3 and 5
* Return: Always 0 (success)
*/
int main(void)
{
int i;
int sum = 0;
int max = 1024;
for (i = 0; i < max; i++)
if (i % 3 == 0 || i % 5 == 0)
sum = sum + i;
printf("%i\n", sum);
return (0);
}
|
C | #include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
void wc(char* str, int* pd)
{
int pid;
pid = fork();
if(pid == 0)
{
dup2(pd[0],0);
close(pd[0]);
close(pd[1]);
execlp(str, str, NULL);
perror(str);
exit(-1);
}
}
void ls(char* str, int* pd)
{
int pid;
pid = fork();
if(... |
C | #include<stdio.h>
#include<conio.h>
int main(){
int n,rem,count=0;
printf("Enter the number \n");
scanf("%d",&n);
do
{
rem=n%10;
count++;
n=n/10;
}
while(n>0);
printf("The number of digits are:%d \n",count);
getch();
return 0;
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: ... |
C | /*int bor_timer_add( //calcule date expiratoire
unsigned long delay, //en ms
void * data){
if(bor_timer_nb>=BOR_TIMER_MAX){
fprintf(stderr, "bor_timer_add : erreur , trop de timers\n", );
return -1;
}
struct timeval t;
gettimeofday(&t,NULL);
t.tv_usec+= delay*1000;
if (t.tv_usec >1000000) {
t.tv_sec+=... |
C | #include "../lib/headers/pf_const.h"
#include "../lib/headers/record.h"
#include "../lib/headers/sequential.h"
#include <stdlib.h>
#include <stdio.h>
//codigo de ejemplo de organizacion sequencial
//en general es verbose por motivos didacticos.
//se omite ejemplo de uso de S_DESTROY.
campo schema_students[] = {{"PADR... |
C | #include "lotto.h"
//////////////////////////////////////////////////////////////////////////////////////////
// < ϰ õ ȣ ϴ Լ >
//////////////////////////////////////////////////////////////////////////////////////////
int menu_disp(void)
{
int sel;
// system("cls");
printf("\n\n ===< ζ α >===\n\n");
p... |
C |
#include "lcd_drv.h"
#include <stdint.h> /* For uint8_t definition */
#include <stdbool.h> /* For true/false definition */
#include "system.h"
#include "user.h" /* For global variables*/
#include <xc.h>
// Define the LCD type and details
#define lcd_type 2 // 0=5x7, 1=5x10, 2=2 lines
#... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils.c :+: :+: :+: ... |
C | #include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef uint8_t byte;
typedef double f64;
typedef uint64_t u64;
#define MAX(x, y) ((x) >= (y) ? (x) :... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.