language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /*
* Sample program to test runtime of simple matrix multiply
* with and without OpenMP on gcc-4.3.3-tdm1 (mingw)
*
* (c) 2009, Rajorshi Biswas
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <assert.h>
#include <omp.h>
int main(int argc, char **argv)
{
int i,j,k;
int n;
double ... |
C | #include<stdio.h>
#define strcase(a,b) strncmp(a,b,sizeof(a)-1)
int main(int argc, const char *argv[])
{
char *path="start_build:xxxxx";
char str2[] = "start_build:123;abcdefghidk";
printf("size:%d\n",(int)sizeof("start_build:"));
//if(strncmp("start_build:",path,sizeof("start_build:")-1) == 0){
if(strcase("sta... |
C | #include <assert.h>
#include <stdlib.h>
static int adder(const int *a, const int *b)
{
return (*a + *b);
}
int main()
{
int x = 1024;
int (*local_adder)(const int *, const int *) = adder;
while(x > 0)
__CPROVER_loop_invariant(1 == 1)
{
x += local_adder(&x, &x); // loop detection fails
//... |
C | /*Write a program to add two numbers.*/
#include <stdio.h>
void main()
{
int a, b;
printf("Enter two numbers: ");
scanf("%d", &a);
scanf("%d", &b);
printf("Sum of %d and %d is: %d", a, b, (a + b));
} |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <sys/shm.h>
#include <sys/types.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#define SEMKEY 24602
#define SHMKEY 24601
#define SEGSIZE 100
union semun {
int ... |
C | #include<bits/stdc++.h>
#include <iostream>
#include <vector>
using namespace std;
bool sortcol( const vector<int>& v1,const vector<int>& v2 )
{
return v1[1] < v2[1];
}
int main()
{
vector<vector<int>> process
{
{1,1,2},
{2,0,2},
{3,6,4},
{4,5,3}
};
sort(process.begi... |
C | #ifndef LEXTREE_SPELLCHECK_H
#define LEXTREE_SPELLCHECK_H
#include <stdbool.h>
#include "lextree.h"
/* This spellcheck uses a relative beam pruning. This constant defines the
* pruning threshold used.
*/
#define LEXTREE_CLOSEST_PRUNING_THRESHOLD 3
#define LT_STRING_LENGTH 4096
#define MININT (1<<31)
#define MAXI... |
C | /*-----------------------------------zollen.c-----------------------------------
Este arquivo contem rotinas de Zollenkopf para fazer ordenacao, reducao da
matriz para a forma LDU e resolver o sistema na forma fatorada, LDUx = b
Faz a ordenacao de como a matriz deve ser fatorada para minimizar o
aparecimento de... |
C | #include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "arma.h"
typedef struct
{
char* nombre;
struct ar15* arma;
} jugador;
jugador* jugadorNuevo(){
return malloc(sizeof(jugador*));
}
void createJ(jugador* j, const char* nombre){
j->nombre = malloc((strlen(nombre)+1)*sizeof(char));
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "a4.h"
#include <time.h>
#include <assert.h>
/*This comnpare function is fount through the website address
https://www.tutorialspoint.com/c_standard_library/c_function_qsort.htm*/
int cmpfunc (const void * a, const void * b) {
return ( *(int*)a - *(int... |
C | //Non-Volatile Memory Library Function Definitions Version 4
//As described in the paper "Hardware Supported Persistent Object Address Translation" by Dr. James Tuck (NCSU)
//Written by Avery Acierno (Undergraduate Research)
//Version 4 Improvements from Version 3:
//1. Pools and files operate seperately not in pairs:... |
C | /*
** EPITECH PROJECT, 2020
** check_file.c
** File description:
** check_file
*/
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
void my_putstr(char *str);
int my_getnbr(char const *str);
int check_boat_size(char *file)
{
int boat_size = 2;
int i = 0;
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fdf.c :+: :+: :+: ... |
C | #include <stdlib.h>
#include <stdio.h>
#include "perfectnumber.h"
#include <stdio.h>
int main() {
int input,result=1;
printf("dame el numero que quieras provar que sea perfecto:\n");
scanf("%d",&input);
result=isPerfecNumber(input);
return 0;
}
|
C | #include <stdio.h>
int main()
{
int N;
scanf("%d", &N);
for (int _i = 0; _i < N; _i++)
{
char c = 0, p;
int r, cnt = 0;
while (c < '0' || c > '9') c = getchar();
while (c >= '0' && c <= '9')
{
p = c;
cnt++;
c = getchar();
}
p = p - '0';
r = (p & 1) || ((cnt == 1... |
C | #include<stdio.h>
#include<string.h>
int main()
{
long long int T,k,i;
scanf("%lld", &T);
getchar();
for(i=1; i<=T; i++)
{
scanf("%[^\n]", s);
getchar();
scanf("%[^\n]", t);
getchar();
k = strcmp(t,s);
//k= abs(k)-1;
printf("Case %lld: %... |
C | #include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "tree.h"
struct tree{
int data;
struct tree *left;
struct tree *right;
struct tree *parent;
};
/*
* Function: createTree
*
* Description: allocates memory for a new binary tree with specific data, left subtree and right
* subtree
* Run... |
C | /*
** EPITECH PROJECT, 2020
** PSU_42sh_2019
** File description:
** function
*/
#include "shell.h"
int check_access_right_file(const char *bin_path)
{
int ret;
if (!bin_path) {
return EXIT_ERROR;
}
ret = access(bin_path, F_OK | X_OK);
if (ret == 0) {
return EXIT_SUCCESS;
} el... |
C | #ifndef MPU_6050
#define MPU_6050
#include <stdint.h>
/**
* @details initialize the mpu6050 unit to begin reading values
* @param void
* @return 1 if successfully initialized, 0 if not
* @brief init mpu6050, I2C uses PB2, PB3
*/
int mpu6050Init(void);
/**
* @details read x-axis, y-axis, and z-axis accelerat... |
C | #include<stdio.h>
int main()
{
// for loop execution
for (int a=10; a < 20 ; a++)
{
printf("Value of a: %d\n",a);
}
return 0;
} |
C | #include <stdio.h>
#include <string.h>
typedef signed char sint8;
typedef unsigned char uint8;
typedef signed short sint16;
typedef unsigned short uint16;
typedef unsigned long uint32;
typedef unsigned long long uint64;
#define IS_ODD(X) ((X)%2)
uint32 GetInclusionExclusion(uint32 number , uint32 firstNumber , uint3... |
C | /*
* File: reverse.c
* ---------------
* This program reads in an array of integers, reverses the
* elements of the array, and then display the elements in
* their reversed order.
*/
#include <stdio.h>
#include "genlib.h"
#include "simpio.h"
/*
* Constants
* ---------
* MaxElements -- Maximum number of eleme... |
C | #include<stdio.h>
#include "linkedlist.h"
Element increment(Element number) {
char *incremented_number = malloc(sizeof(char));
*incremented_number = *(int *)number + 1;
return incremented_number;
}
Status is_even(Element number) {
return *(int *)number % 2 == 0 ? Success : Failure;
}
Status is_int_equal(Elem... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
void main()
{
int i,s=0,v=0,l=0,sent=0;
char a[20];
printf("Enter a string");
gets(a);
strlwr(a);
l=strlen(a);
for(i=0;i<l;i++)
{
if(a[i]==' ')
s++;
if(a[i]=='a' || a[i]=='e' || a[i]=='i' || a[i]=='o' || a[i]=='u')
v++;
if(a[i]=='.')
sent++;
}
printf("No of conson... |
C | // This program determines whether a provided credit card number (user-input) is valid according to Luhn's algorithm.
#include <stdio.h>
#include <cs50.h>
int main(void)
{
// user-input for number greater than 0
long long ccNumber;
do
{
ccNumber = get_long_long("Number: ");
}
while (ccN... |
C | #include <stdlib.h>
#include <string.h>
#include "bitree.h"
void bitree_init(BiTree *tree,void (*destroy)(void *data))
{
tree->size=0;
tree->destroy=destroy;
tree->root = NULL;
return;
}
void bitree_destroy(BiTree *tree)
{
bitree_rem_left(tree,NULL);
memset(tree,0,sizeof(BiTree));... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
int fab[40] = {1, 1};
int n;
int i;
int k = 2;
scanf("%d", &n);
for(i = 0; i < n; ++i) {
printf("%12d", fab[i]);
if((i + 1) % 5 == 0)
printf("\n");
if(k < n)
fab[k] = fab[k - 1] + fab[k - 2], ++k;
}
printf("\n");
return 0;
... |
C | #pragma once
#include <stdio.h>
#include "SinglyLinkedList.h"
Node* reverseList(List* list, Node* head)
{
Node* reverseHead = head;
if (head->next != NULL)
{
reverseHead = reverseList(list, head->next);
head->next->next = head;
}
if (head == list->head)
{
head->next = NULL;
list->head = reverseHead;
}
... |
C | #include<stdio.h>
int main(){
int year,time;
double money;
scanf("%d%d",&year,&time);
if (year<5){
if (time<=40){
money=30*time;
}
else{
money=30*40+45*(time-40);
}
}
else{
if (time<=40){
money=50*time;
}
else{
money=50*40+75*(time-40);
}
}
printf("%.2lf",m... |
C | #include<stdio.h>
int main(){
int n, i;
float x, y;
double div;
div = 0.0;
scanf("%d", &n);
for (i = 1; i <= n; i++){
scanf("%f", &x);
scanf("%f", &y);
if (y == 0){
printf("divisao impossivel\n");
}
else{
... |
C | #include<stdio.h>
#include<fcntl.h>
#include<unistd.h>
#include<termios.h>
#include<stdlib.h>
#include<sys/ioctl.h>
int main()
{
struct termios toptions ;
int fd , fd2 ;
printf("wwwwww\n");
fd2 = open("/dev/ttyS4" , O_RDWR | O_NOCTTY);
fd = open("/dev/ttyACM0" , O_RDWR | O_NOCTTY);
if(fd < 0 || fd2 < 0)
{
p... |
C | /**
* @file snet_ia.c
* @author mathslinux <riegamaths@gmail.com>
* @date Sun May 13 19:26:55 2012
*
* @brief Internet Address Wrapper
*
*
*/
#include <arpa/inet.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <err... |
C | #include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <string.h>
#include <math.h>
int main()
{
setlocale(LC_ALL, "portuguese");
/* 11) Depois da liberação do governo para as mensalidade dos planos de saúde, as pessoas começaram a fazer pesquisas para
descobrir um bom plano, não muito caro. Um v... |
C | #ifndef _INCLUDED_MUSICENCRYPT_H_
#define _INCLUDED_MUSICENCRYPT_H_
#include <stdio.h>
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief decrypt song id
* @param {INPUT} chId: encrypted string buffer
* @return decrypted digital string
*/
unsigned long MusicDecryptSongId(char const * chId);
... |
C | //
// POV (Persistence of Vision)
//
// (C) 2015, Daniel Quadros
//
// ----------------------------------------------------------------------------
// "THE BEER-WARE LICENSE" (Revision 42):
// <dqsoft.blogspot@gmail.com> wrote this file. As long as you retain this
// notice you can do whatever you want with th... |
C | /*
* Producto.c
*
* Created on: 28 abr. 2020
* Author: Nicolas
*/
#include <stdio.h>
#include <stdlib.h>
#include "Producto.h"
#include "utn.h"
void producto_imprimirProducto(Producto* pProducto)
{
printf("\n%d\t\t%s\t\t%s\t\t%.2f",pProducto->isEmpty,pProducto->nombreProducto,pProducto->descripcion,pProdu... |
C | #include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
void hijo (const char *num_hermanos);
int main (int argc, char *argv[]) {
hijo(argv[1]);
return 0;
}
void hijo (const char *num_hermanos) {
printf("Soy %ld y tengo %d hermanos!\n",
(long)getpid(), atoi(num_hermanos) - 1);
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* true_u_tests.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<stdlib.h>
#include "header/function.h"
void convert_data(header *h,info_header *ih)
{
unsigned int size = sizeof(header) + sizeof(info_header) + 256 * sizeof(color_table) + ih->width * ih->height * sizeof(greyscale);
unsigned int data_offset = size - (ih->width * ih->height * sizeof(gre... |
C | /***************************************************
> Copyright (C) 2017 ==KINGYI== All rights reserved.
> File Name: seqlist.c
> Author: Kingyi
> Mail:joseph2009@163.com
> Created Time: 2017年06月19日 星期一 13时49分18秒
***************************************************/
#include "seqlist.h"
seqlist *create_seqlist()
{
... |
C | #include<stdio.h>
#include<math.h>
#include<conio.h>
int r,v,i,p,n,drp,d[100];
void main()
{
do
{printf("donner le nombre");
scanf("%d",&n);
v=0;
r=n;
p=2;
}
while(n>100);
do
{
drp=0;
for(i=2;i<p-1;i++)
{
if((p%i)==0)
drp=1;... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<pthread.h>
#define block_first(i,T,N) (((i) * (N)) / (T))
#define block_last(i,T,N) (block_first(i+1,T,N) - 1)
#define block_size(i,T,N) (block_first(i+1,T,N) - block_first(i,T,N))
typedef struct {
int start;
int len;
char* a;
int n;
... |
C | #include <stdio.h>
int main()
{
int t,L,S,i,carriage[55],j;
while(scanf("%d",&t) == 1){
while(t >= 1){
scanf("%d",&L);
for(i = 0;i < L;i++)
scanf("%d",&carriage[i]);
S = 0;
for(i = 0;i < L;i++){
for(j = i + 1;j < L;j++... |
C | #include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <signal.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <stdlib.h>
typedef struct sockaddr_in SOCK_ADDRESS;
#define true 1
#define false 0
int main()
{
int server_sockfd;
int client_soc... |
C | #include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "mathext.h"
#include "linxaudio.h"
#if defined(_MSC_VER) && _MSC_VER < 1200
float fminf(float a, float b) {
return (((a)<(b))?(a):(b));
}
float fmaxf(float a, float b) {
return (((a)>(b))?(a):(b));
}
#endif
void dsp_mix(float* dest, float* src,... |
C | //
// path.h
// NeilOS
//
// Created by Neil Singh on 1/3/17.
// Copyright © 2017 Neil Singh. All rights reserved.
//
#ifndef PATH_H
#define PATH_H
#include <common/types.h>
// Get the specified component of the input path. The pointer returned is
// an indexed pointer of the input path. NULL is returned if no s... |
C | #include <stdio.h>
#include <stdlib.h>
#include "player.h"
/* funcoes para o jogador */
player_t *player_Create(bag_t *bag){
player_t *player = (player_t *) malloc(sizeof(player_t));
player->score = 0;
player->num_tiles = 7;
player->playing = 1;
int i;
for(i = 0; i < HAND_SIZE; i++){
player->hand[i] = BLANK_HA... |
C | //Greg Ryterski
//gjr7dz, 18186949
//Lab 9 main, Group E
#include "lab9.h"
void errorCheck(int value);
int main(void){
Student* head = initListWithDummyNode();
int errorChecker = 0;
int headVal, tailVal, x;
do{
printf("Menu:\n");
printf("1) Add age to the head of the list\n");
printf("2) Add age t... |
C | #include "../../include/player.h"
#include "../../include/utils.h"
/* ----- | Prototypes | ------ */
static int Player_get_player_id(struct Player *player);
static Color_Pair Player_get_colors(struct Player *player);
static boolean Player_is_real_player(struct Player *player);
/* ----- | Static Variables | -----... |
C | #include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
/**
* read_textfile - reads a text file and prints it to the standard output
* @filename: file name
* @letters: size
* Return: ssize_t
*/
ssize_t read_textfile(const char *filename, size_t letters)
{
char *bu... |
C | /* mmloader.c
* Example on how to implement a MREADER that reads from memory
* for libmikmod.
* (C) 2004, Raphael Assenat (raph@raphnet.net)
*
* This example is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRENTY; without event the implied warrenty of
* MERCHANTABILITY or FITNESS FOR A PAR... |
C | /* $Id$ */
#include <sys/param.h>
#include <sys/stat.h>
#include <ctype.h>
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sysexits.h>
#include <unistd.h>
#ifndef MIN
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif
#ifndef __dead
#define __dead
#endif
#define _PATH_USR_INCLUD... |
C | #include <stdio.h>
int main(void) {
float money;
int value, qua, dim, nic, pen;
char line[100];
printf("Write the amount of money in dollars (less than $1.00)\n");
fgets(line, sizeof(line), stdin);
sscanf(line,"%f", &money);
value= money*100;
qua= (value/25);
dim= (value%25)/10;
nic= ((value%25)%... |
C | #include "clock.h"
#include <stdio.h>
static uint32_t seconds = 0;
static uint32_t minutes = 0;
static uint32_t hours = 0;
void incrementClock() {
if (!incrementSeconds()) {
if (!incrementMinutes()) {
incrementHours();
}
}
}
// ----------------------------------------------------------------------------
vo... |
C | //template for testing code
//download with: wget troll.cs.ua.edu/ACP-C/tester.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(int argc,char **argv)
{
int cols, rows, x=1;
while (x<=10)
{
printf("%d\t",x);
if (x==10)
... |
C | #include "arvore.h"
Arvore *cria_arv_vazia()
{
return NULL;
}
void destroi_arv(Arvore *arv)
{
if (arv != NULL)
{
destroi_arv(arv->esq);
destroi_arv(arv->dir);
free(arv);
}
}
Arvore *constroi_arv(char elem, Arvore *esq, Arvore *dir)
{
Arvore *arv = (Arvore *)malloc(sizeof(Arvore));
arv->info =... |
C | // 基数排序:一种多关键字的排序算法,可用桶排序实现。
int maxbit(int data[], int n) //辅助函数,求数据的最大位数
{
int maxData = data[0]; ///< 最大数
/// 先求出最大数,再求其位数,这样有原先依次每个数判断其位数,稍微优化点。
for (int i = 1; i < n; ++i)
{
if (maxData < data[i])
maxData = data[i];
}
int d = 1;
int p = 10;
while (maxData >= p)... |
C | // 8 - Desenha bordas
#include <stdio.h>
int main(){
int largura, altura, larguraBorda, valorBorda;
scanf("%d", &largura);
scanf("%d", &altura);
scanf("%d", &larguraBorda);
scanf("%d", &valorBorda);
puts("P2");
printf("%d %d\n", altura, largura);
puts("255");
int i, j;
for (i = 0; i < largura; i... |
C | #include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <stdbool.h>
#include <signal.h>
#include <stddef.h>
#include "config.h"
#include "builtins.h"
#include "buffers.h"
#include "pipes.h"
#include "background.h... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include <time.h> /* time_t */
#include <sys/time.h> /* timeval, gettimeofday() */
#define EMPTY 0
typedef struct data
{
int number;
}Data;
typedef struct vector{
Data *arr;
unsigned int current_size;
unsigned int max_size;
}Vector;
Vector *createVector();
... |
C | //
// Created by Hakan Halil on 21.08.20.
//
#include <unistd.h>
#include <string.h>
int main(void){
char* buff = "Hello, world!\n";
int p;
if (fork() == 0)
write(1, buff, strlen(buff)); // -> Hello, world! from child proc
p = fork();
write(1, buff, strlen(buff));
}
// My guess on hello w... |
C | #include <stdio.h>
#include <stdlib.h>
#include <hand.h>
#include <string.h>
void print_hand(struct card hand[HANDSIZE])
{
for (int i = 0; i < HANDSIZE; i++)
{
printf("%s of %s\n", rankName(hand[i].rank), suitName(hand[i].suit));
}
}
int compare( const void* a, const void* b)
{
int int_a = * ( (int*) a... |
C | #pragma once
#ifndef _COMMONS_H
struct Vector2D
{
float x;
float y;
Vector2D()
{
x = 0.0f;
y = 0.0f;
}
Vector2D(float xTemp, float yTemp)
{
x = xTemp;
y = yTemp;
}
};
struct Rect2D
{
float Width;
float Height;
float x;
float y;
//Rect2D()
//{
// x = 0.0f;
// y = 0.0f;
// Width = 1.0f;
// ... |
C | #include<stdio.h>
#include<math.h>
#define PI 3.14159
int main()
{
double circumference;
int radius;
int i;
printf("please enter the radius of a circle to calculate the circumference\n");
scanf("%d", &radius);
circumference = PI*2*radius;
printf("circumference of circle = %lf", circumference);
printf("this i... |
C | #include<stdlib.h>
#include<stdio.h>
#include<math.h>
int main(void)
{
int n,i,j;
double sig,tol;//Tolerance value
//Open file for input
FILE *fp;
fp=fopen("input.dat","r");
/*
Format of input file
n
tol
A[0][0] A[0][1] ....
A[1][0]
A[2][0]
.
.
.
A[n-1][0].....A[n-1][n-1]
b[0]....b[n-1]
*/
//take inputs
fsc... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "common.h"
#include "array.h"
#define DEFAULT_LEN 12
#define MAX_ELEMENTS_LENGTH ((size_t) - 2)
static enum STATE expendArray(Array *array);
static size_t indexAbs(Array *array, size_t index);
static void qSort(Array *array, int begin, int end, int (... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_link_material_object.c :+: :+: :+: ... |
C | #include<stdio.h>
void main()
{
FILE *f1,*f2;
char a;
f1=fopen("data.txt","r");
f2=fopen("copy.txt","w");
while(!feof(f1))
{
a=fgetc(f1);
fputc(a,f2);
}
fclose(f1);
fclose(f2);
f2=fopen("copy.txt","r");
while(!feof(f2))
{
a=fgetc(f2);
printf("%c",a);
}
}
|
C | #include "SMG.h"
#include "stm32f10x.h" // Device header
#include "delay.h"
/*
const unsigned char LED_table[24]={
//01234567
0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,
//89ABCDEF
0x80,0x90,0x88,0x83,0xC6,0xA1,0x86,0x8E,
//ʱЧ
0xF9,0xBF,0x99,0xBF,0x82,0xF9,0xC0,0xA4
};
//ܶ롰0123456789AbCdEFϨ-
const unsig... |
C | #include <stdio.h>
int main(){
int numero;
int morto=0;
int counter=0, pari=0;
int aspettadispari=0;
int posizione_primo_dispari=-1, posizione_cinque=-1;
printf("Dammi dei numeri, dopo ogni pari devono seguire almeno due dispari.\n");
do{
scanf("%d", &numero);
... |
C | /* ----------------------- Compiler Libraries ------------------------------- */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
/* -------------------------------------------------------------------------- */
// header
#include "read_matrix.h"
/**************************** count_rows *... |
C | #include "hash.h"
#include "merge.h"
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
Htab* init_tab() {
Htab *tab;
tab = malloc(sizeof(Htab));
tab->t = malloc(16 * sizeof(login));
for (int i = 0; i < 16; i++)
strcpy(tab->t[i].name, FREE);
tab->m = 16;
tab->n = 0;
return ta... |
C | #include <stdio.h>
#include <string.h>
#include "shellcode.h"
int main(int argc, char *argv[]) {
char buff[265], *ptr, *sc;
long *addr_ptr, addr;
int i;
sc = alt_shellcode; // Shellcode to execute
addr = 0x0804c040; // Address to jump to (in .bss)
for (i = 0; i < 265; i++) {
// Fill... |
C | #include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/types.h>
#include <dirent.h>
#include <stdio.h>
int rmdirs(const char *path, int force) {
DIR * dir_ptr = NULL;
struct dirent *file = NULL;
struct stat buf;
char filename[1024];
/* 목록을 읽을 디렉토리명으로 DIR *를 return ... |
C | #include<stdio.h>
int main()
{
float sal;
printf("Enter the basic salary of Ramesh\n");
scanf("%f",&sal);
printf("Gross salary of Ramesh is = %0.2f",sal-((0.4*sal)+(0.2*sal)));
return 0;
}
|
C | /*
* api.c
*
* Created on: 5 abr. 2019
* Author: utnso
*/
#include "api.h"
int lanzarConsola(){
sleep(1);
log_info(LOGGERFS,"Iniciando hilo de consola");
int resultadoDeCrearHilo = pthread_create( &threadConsola, NULL,
funcionHiloConsola, "Hilo consola");
if(resultadoDeCrearHilo){
log_error(LOGGER... |
C |
#ifndef HISTOGRAM_H
#include <stdlib.h>
typedef struct {
int nbuckets;
int overflow;
int shift;
int nvals;
long long sum;
int buckets[0]; // always at the end
} histogram_t;
void hist_init( histogram_t *h, int nbuckets, int shift );
histogram_t* hist_new( int nbuckets, int shift );
static inline v... |
C | #include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <libintl.h>
#include <locale.h>
#include "ai.h"
#include "engine.h"
#include "gfx.h"
#define _(STRING) gettext(STRING)
void draw_then_sleep(struct gfx_state *s, struct gamestate *g)
{
gfx_draw(s, g);
/* Have a fixed time for each turn to ani... |
C | /*************************************************************
m a i n . c
Practica 3
*************************************************************/
// Basic definitions
#include "Base.h"
#include "lcd.h"
#include "accel.h"
//// Llegeix XYZ
//int main(void){
// char cx[10], cy[10], cz[10], who[10... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <conio.h>
int numEspacos(char *str){
if(str[0] == '\0'){
return 0;
}
if(str[0] == ' '){
return 1 + numEspacos(str + 1);
}
return 0 + numEspacos(str + 1);
}
void imp2Cont(int i, int n){
if(i =... |
C | #include <stdio.h>
#include <malloc.h>
#include <math.h>
void main()
{
float salary;
printf("\atest salary:");
printf("$_____\b\b\b\b\b");
scanf("%f",&salary);
printf("\n$%.2f month is $%,2f a year",salary,salary * 12.0);
printf("\rGee!\n");
}
void ecnu17()
{
int count;
double point[1001];
int i,j;
int casec... |
C | #include<stdio.h>
#include<stdlib.h>
struct MinHeap
{
unsigned size;
unsigned capacity;
int *harr;
};
void swap(int *a,int *b)
{
int temp;
temp=*a;
*a=*b;
*b=temp;
}
struct MinHeap* createMinHeap(unsigned capacity)
{
struct MinHeap* minHeap=(struct MinHeap*)malloc(sizeof(struct MinHeap));
minHeap->size=0;
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
char *readFile(char *filename, int *readSize) { //read file
FILE *fp = fopen(filename, "r+");
if (fp == NULL) {
return NULL;
}
int size;
//size of file
fseek(fp, 0, SEEK_END);
size = ftell(fp);
... |
C | #include <stdio.h>
int main(){
FILE *f1, *f2;
char c;
int i;
f1 = fopen("XMinusOne57-03-06091TheSeventhVictim.mp3", "rb");
f2 = fopen("file.mp3", "wb");
fseek(f1, 84172, SEEK_SET);
i = 0;
c = fgetc(f1);
while (i < 140000){
fputc(c, f2);
c = fgetc(f1);
i++;
}
fseek(f1, ... |
C | #include<stdio.h>
int status[10001]={0};
int main()
{
int m,n,i,j,k,x;
status[0]=status[1]=1;
for(i=2;i<=100;i++)
{
if(status[i]==0)
for(j=i+i;j<=10000;j+=i)
status[j]=1;
}
scanf("%d",&m);
for(i=0;i<m;i++)
{
scanf("%d",&n);
for(j=n/2+1;... |
C | #include <stdio.h>
main() {
int m, a;
printf("digita mese e anno\n");
scanf("%d%d", &m, &a);
if (m == 2)
// febbraio
if ((a % 4 == 0 && a % 100 != 0) || a % 400 == 0)
// anno bisestile
printf("29\n");
else
// anno non bisestile
printf("28\n");
else if (m == 4 || m == 6 ||... |
C | /***********************************************************************
*
* 开发守护进程
*
**********************************************************************/
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <time.h>
#include <sysl... |
C | #include<stdio.h>
#include <sys/resource.h>
int appgetrusage(struct rusage *);
int appgetdiffrusage(struct rusage *, struct rusage *);
int main() {
struct rusage begin, end;
appgetrusage(&begin);
/*
* core of the program goes here
* where lot of system threads are spawned and joined
*
*/
appgetrusage(... |
C | /* (h) Write a program to find the absolute value of a number entered through the keyboard. */
#include<stdio.h>
void main()
{
int n, number;
printf("Enter the number\n");
scanf("%d", &n);
if(n > 0)
{
number = n;
printf("The absolute value of %d is %d\n", n, number);
}
if(n < 0)
{
number = -1 * n;
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
extern int yylinenumber;
//Structure for Entry Specifications
typedef struct AndEntry{
int operation;
int firstVal;
int secondVal;
int findInteger1, findInteger2;
bool isCondition;
bool isNegation;
char *tableE... |
C | // program to get list of number and sort them
#include<stdio.h>
#include <stdlib.h>
#include <string.h> //for gets() but gets is depreciated and no longer supported
//#include<math.h>
#define block 1 // just change value of letter to select corrosponding block while comparing
#if (block==1)
/// string f... |
C | /*
* This example program runs a full instance of chiventure with an in-memory game,
* and where the CLI is monkeypatched to accept functions that model player stats and effects
* We we unable to completely integrate stats and effect completely into the game, but they
* are still functional.
*
* Commands created... |
C | /**
* @file main.c
* @brief Questo è un esempio di utilizzo della libreria @ref mygpio.h sul S.O GNU/Linux in esecuzione sulla board Zybo .
* Per utilizzare la libreria vi è bisogno dell'indirizzo a cui è mappata la periferica.
* Tramite un meccanismo di mapping sarà possibile ottenere un indirizzo virtuale, appartene... |
C | /* buffer.c, femto, Hugh Barney, Public Domain, 2017 */
#include <assert.h>
#include <string.h>
#include "header.h"
void buffer_init(buffer_t *bp)
{
bp->b_mark = NOMARK;
bp->b_point = 0;
bp->b_paren = NOPAREN;
bp->b_cpoint = 0;
bp->b_page = 0;
bp->b_epage = 0;
bp->b_size = 0;
bp->b_psize = 0;
bp->b_flags = 0... |
C | #include<stdio.h>
// program to print fst N natural no. taken by user
/*
int main()
{
int n,i;
printf("Enter the number:");
scanf("%d",&n);
i=1;
do{
printf("\n%d",i);
i++;
}while(i<=n);
return 0;
}*/
// program to print fst N natural no. in reverse order taken by user
/*int main... |
C | #include"hashlib.h"
#include <stdlib.h>
#include <string.h>
void cover_test(TABLE* t) {
HTERR err;
Data d;
// inv ptr
htable_insert(NULL, d, &err);
if(err != HTERR_INVPTR) {
printf("cover_test_inv_ptr: test1 failed!");
exit(1);
}
htable_print(NULL, &err);
if(err != HTER... |
C | /*
* Project: colors.h
* Description: Header file for color mapping
* Brian Rashap
* 10-Feb-2020
*/
#ifndef _COLORS_H_
#define _COLORS_H_
const int black = 0x000000;
const int white = 0xFFFFFF;
const int red = 0xFF0000;
const int lime = 0x00FF00;
const int blue = 0x0000FF;
const int yellow = 0xFFFF00;
const int... |
C | /*----------------------------------------------------------------------
Demo of IPC using Message Queues: The Calculator process
Written By: Team-00
1- Dr. Mohamed Aboutabl
2- Dr. Mohamed Aboutabl
Submitted on: 10/06/2015
----------------------------------------------------------------------*/
#include... |
C | /*
* aufgabe3.h
*
* Created on: 07.12.2012
* Author: roland
*/
#ifndef AUFGABE3_H_
#define AUFGABE3_H_
__BEGIN_DECLS
/**
* @brief Stop waste time
*
* Function will be called through signal handler
*/
void stop_looping_aufgabe3(void);
/**
* @brief Set calculated loop counter thread safe
* @param a_... |
C | #include "list.h"
// variables globales declaradas exclusivamente para -show-vars
int global1 = 10, global2 = 420, global3 = 69;
void createMemoryList( memoryList *feed ) {
feed -> lastPos = NULLH;
}
void insertMemoryList ( memoryList *feed, internalList *example ) {
internalList *tmp = example;
if (... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.