language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /*----------------------------------------------------------------------
* File: 4.1. pattern_missmatch.c
* Project: GeneralNN_GUI_1.0
* Version: V1.0
* Created on: 09.11.2020, 17:16:38
* Author: N. Kornel
* Company: Nensys
*
* Copyright © 2020 by Nensys GbR
* Use of this file and all called functions requires ... |
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 | #define _CRT_NONSTDC_NO_WARNINGS 1
#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <ctype.h>
#include <string.h>
#include <tchar.h>
typedef struct ACCOUNTS {
int account_num;
double initial_balance;
double current_balance;
double total_deposited;
double tota... |
C | // SpriteMethods.h
// Defines implementation for a common interface for dealing with multiple sprite behaviors...
// Author(s): Eagan Rackley
#ifndef SPRITE_METHODS_H
#define SPRITE_METHODS_H
#include "IModel.h"
#include "ISprite.h"
#include "SpriteInfo.h"
///<summary>
/// Initializes some of our default values ...
/... |
C | #include <stdio.h>
#include <stdlib.h>
void push(int a,int* q,int f,int r)
{
if(r<f)
printf("Queue is FUll");
else
r++;
q[r]=a;
}
int pop(int *q, int f,int r)
{
if(r==-1)
{
printf("Queue is Empty");return;}
int i,j;int n=r;int t;
for(i=0;i<n;i++)
for(j=0;j<=n-i-1;j++)
{
... |
C | /*
Given a string s and a non-empty string p, find all the start indices of p's anagrams in s.
Strings consists of lowercase English letters only and the length of both strings s and p will not be larger than 20,100.
The order of output does not matter.
Example 1:
Input:
s: "cbaebabacd" p: "abc"
Output:
[0, 6]
Ex... |
C | #include<stdio.h>
#include<stdlib.h>
struct stu
{
long long id;
int a,b;
double sum;
};
int main()
{
struct stu s[1500];
int n;
scanf("%d",&n);
for (int i = 0; i < n; i++)
{
scanf("%lld %d %d",&s[i].id,&s[i].a,&s[i].b);
s[i].sum = s[i].a * 0.7 + s[i].b * 0.3;
}
fo... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* pool.c :+: :+: :+: ... |
C | #include <stdlib.h> /* malloc, free */
#include "dhcp.h" /* all below */
#include "trie.h" /* binary trie type */
struct dhcp
{
uint32_t net_add;
uint32_t net_mask;
trie_t *trie;
};
static size_t GetHeightFromNetMask(uint32_t net_mask);
uint32_t GenerateIp(uint32_t net_add, uint32_t end);... |
C | #include <stdio.h>
int main()
{
int n, i;
long long int a, s;
scanf("%d", &n);
s = 0;
for (i = 0; i < n; ++i) {
scanf("%lld", &a);
s += a;
}
printf("%lld\n", s);
}
|
C | #include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <sys/prctl.h>
#include "threadbase.h"
LIST_HEAD(threadListHead);
static void *threadInterface(void *pvPara)
{
ThreadCreateParaDef *ptThreadCreatePara = (ThreadCreateParaDef *)pvPara;
void *pvFuncPara = ptThreadCreatePara->... |
C | #include <avr/io.h>
int main1(void)
{
//
PORTB = (1<<PB5); // 5 B 1
DDRB = (1<<DDB5); // 5 B
//
while (1)
{
}
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include "3-calc.h"
/**
* main - Entry point
* @argc: pointer
* @argv: pointer
* Return: Always 0 (Success)
*/
int main(int argc, char *argv[])
{
int a, b, r;
int (*fun)(int, int);
if (argv[2][1] != '\0')
{
printf("Error\n");
exit(99);
}
if (argc != 4)
{
printf... |
C | #include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
#define FILE_LENGHT 400
int main(int argc, char * const argv[]){
FILE *f1;
int i;
char letter = ' ';
clock_t start = clock();
/* Apertura del fichero de destino, para ... |
C | /* Copyright (C) 2011 by Valentin Ochs
*
* 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, publi... |
C | #include <stdio.h>
#include <stdlib.h>
int addNum(int , int);//function declaration or prototype
int main()
{
int num1,num2,sum;//variable declaration
printf("Enter the First number : ");
scanf("%d", &num1);
printf("Enter the Second number : ");
scanf("%d", &num2);//taking two number as input from user
sum=addNum(num1,... |
C | /**************************************************************************//**
* @file leuart.c
* @brief LEUART code for the EFM32 bootloader
* @version x.xx
******************************************************************************
* @section License
* <b>Copyright 2015 Silicon Laboratories, Inc. http://www... |
C | /**
* @file assert.c
*
* @brief Assertion and debugging infrastructure.
*
* @author Kartik Subramanian
*/
#include <assert.h>
#include <stdarg.h>
#include <exports.h>
#include <arm/psr.h>
#include <arm/exception.h>
void panic(const char* fmt, ...)
{
va_list list;
va_start(list, fmt);
// XXX This is not wor... |
C | //
// main.c
// ch8_8_3
//
// Created by Leaf on 2017/5/9.
// Copyright © 2017年 zhuscat. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
void
pr_exit(int status)
{
if (WIFEXITED(status))
printf("normal termination, exit status = %d\n",
... |
C | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
double round(double x);
float roundf(float x);
long double roundl(long double x);
const double esp = 1e-6;
char buf[256];
int main() {
double lg2 = log10(2), a, v;
int b, m;
while (scanf("%s", buf) == 1 && strcmp(buf, "0e0")) ... |
C |
#include<prodcons.h>
/*Assignment 2
void producer(int count)
{
int i;
for(i=1; i<=count; i++)
{
n=i;
printf("Produced value is :%d\n", n);
}
}*/
/*Two Semaphores*/
void producer(int count)
{
int i;
for( i=1 ; i<=count ; i++ )
{
wait(consumed);
n++;
printf("Produced :%d \n",n);
signal(produced);
... |
C | #include <cgraph.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <base/rbtree.h>
#include <base/graphviz.h>
#include <base/ord.h>
#include <base/macros.h>
#include <base/random.h>
#include "btree_dot.h"
static bool red(struct rb_node *node) {
return node && node->red;
}
static int uid = 0;
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <locale.h>
int main()
{
setlocale(LC_ALL, "Portuguese");
char categoria, cat=0;
printf("\n _________________________");
printf("\n |Digite T para Tcnico | ");
printf("\n |Digite P para Programador| ");
printf("\n |Digite A para Analista | ");
printf("\n |Digi... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/wait.h>
#include <unistd.h>
static int ARG_MAX = 4096; // Minimum ARG_MAX by POSIX.1
char** parse_cmd(char* cmd) // Parse command's name and argument list
{
int counter = 0;
char delim[] = " \n";
char** list = (char**) malloc(ARG_MAX... |
C | #include <stdio.h>
#include <conio.h>
#include <string.h>
#include <stdlib.h>
#include <windows.h>
#include "Servers.h"
/* Main Program*/
int main()
{
printf("\n\t\t\t------------------------- WELCOME -----------------------------\n");
Sleep(900); // Delays the Program for 900 milliseconds
... |
C | //
#include <std.h>
#include <security.h>
#include <daemons.h>
void create() { seteuid(getuid()); }
int help(){
write(
@OLI
%^YELLOW%^READ CAREFULLY%^RESET%^
usage permadeath <player name> (works on off line players as well>
permadeath <player name> <time> <unit>
permadeath pardon <pl... |
C | /*--------------------------------------------------------------------*/
/* buzz.c */
/* Author: Andrew Appel, 2016, modified by Iasonas Petras, 2017 */
/* Purpose: This program finds the 25 most common words in the input */
/* file (reads from stdin), ... |
C | /* Program 3.7 - A confused recruiting policy */
#include <stdio.h>
#include <stdbool.h>
int main(void) {
int age = 0; /* Age of the applicant */
int college = 0; /* Code for college attended */
int subject = 0; /* Code for subject studied */
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_itoa.c :+: :+: :+: ... |
C | /*
This program checks the collinearity of points.
It receives an input a vector with points and returns the mathematical functions that pass these points. It have a list to store answers.
This program create a csv file with the time execution results for each function(CPU,GPU) in this format: size of vecto... |
C | #include <stdio.h>
void reverse( int x[ ][2], int y[ ][3] );
main( )
{ int x[ 3 ][ 2 ] = { {1,2}, {3,4}, {5,6} }; int *p, y[ 2 ][ 3 ]; reverse( x, y ); /* ת */
p = &y[0][0]; /* ȡַ */ while( p <= &y[ 1 ][ 2 ] ) printf(%d, , *p++ ); /* ӡ1,3,5,2,4,6,*/
}
void reverse( int x[ ][ 2 ], int y[ ] [ 3 ]... |
C | #include<stdio.h>//ҳСֵԪ֮ 1119 ѩ
int main(){
int i,j;
int c[5][5];
int sum=0;
for(i=0;i<3;i++){
for(j=0;j<3;j++){
scanf("%d",&c[i][j]);
sum+=c[i][j];//ȡ벢
}
}
int min=c[0][0],x,y;
for(i=0;i<3;i++){
for(j=0;j<3;j++){
if(min>c[i][j]){
min=c[i][j];
x=i;y=j;//ҳСֵ
}
}
}
printf("sum=%d x... |
C | /**** Bibliotheque des clients ****/
#ifndef _LIBMISSILE_H_
#define _LIBMISSILE_H_
/** Fichiers d'inclusion des bibliotheques **/
#include "libpos.h"
/** Constantes **/
#define TIR_ACTIF 1
#define TIR_INACTIF 0
/** Types **/
typedef struct missile_s missile_t;
struct missile_s {
int tir;
pos_t position;... |
C | #include <stdio.h>
main(){
int a,b,r,rd,rdd,d;
printf("Euclidean Algorithm\n");
printf("Enter a: ");
scanf("%d",&a);
printf("Enter b: ");
scanf("%d",&b);
r = a;
rd = b;
while(rd != 0){
rdd = r % rd;
r = rd;
rd = rdd;
}
d = r;
printf("Gcd(%d,%d) = %d\n",a,b,d);
} |
C | /*
Consider an array, in which each array element is a data structure. The fields of
such data structure are: number,name and address. The array has a capacity for 5
elements. Implement a function to receive as parameter one
instance of such data structure. The function must print the content of the
received data struc... |
C | /*
* src.c
*
* Created on: Jul. 10, 2020
* Author: christy
* Credits : Takis
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include "stack_lib_function.h"
int main()
{
/* declare and initialize variables */
stack_t stack;
stack.top = 0;
int loadarr[] = { 52, -29, 36, 1154, 72... |
C | #include<stdio.h>
#include<string.h>
int main()
{
long long int n,i=0,j=0,k=0;
while(scanf("%ld",&n)==1)
{
if((n%4==0&&n%100!=0)||n%400==0)
{
printf("This is leap year.\n");
i=1;
}
if(n%15==0)
{
printf("This is huluculu festival... |
C | /*
* Copyright 2017 Ed Kellett
*
* See LICENCE for the full copyright terms.
*/
#include <assert.h>
#include <stdlib.h>
#include <fsm/fsm.h>
#include <adt/stateset.h>
int main(void) {
struct state_set *s = NULL;
fsm_state_t a[3] = {1, 2, 3};
assert(!state_set_contains(s, a[0]));
assert(!state_set_contains(... |
C | #include <stdlib.h>
void foo(int *out)
// clang-format off
__CPROVER_requires(out ==> __CPROVER_is_fresh(out, sizeof(*out)))
__CPROVER_assigns(out: *out)
__CPROVER_ensures(out ==> *out == 1)
// clang-format on
{
if(out)
*out = 1;
}
int nondet_int();
void main()
{
int *out;
foo(out);
}
|
C | #include <stdio.h>
int main()
{
int sum = 0;
int a = 1;
int b = 2;
int tmp;
while(b < 4000000)
{
if(b % 2 == 0)
sum = sum + b;
tmp = b;
b = a + b;
a = tmp;
}
printf("result = %d\n", sum);
}
|
C | /* ----- System Includes ---------------------------------------------------- */
#define _USE_MATH_DEFINES
#include <math.h>
/* ----- Local Includes ----------------------------------------------------- */
#include "configuration.h"
#include "global.h"
#include "kinematics.h"
#include "motion_types.h"
/* ----- Define... |
C | /* Som getint är skriven behandlas ett + eller -, som inte följs av en siffra, som
* en gitlig representation av noll. Korrigera så att ett sådant tecken skickas
* tillbaka till strömmen av indata.
*/
#include <stdio.h>
#include <ctype.h>
#define BUFSIZE 100
char buf[BUFSIZE]; /* buffer for ungetch */
int bufp = ... |
C | #include <stdio.h>
typedef int ElemType;
void Swap(ElemType *x, ElemType *y)
{
ElemType t;
t = *x;
*x = *y;
*y = t;
}
// 当所需排序数在5~20时插入排序更高效,这也可以避免数组小于3时出现的运行错误.
void InsertionSort(ElemType A[], int N)
{
int j, i;
ElemType Tmp;
for (i = 1; i < N; i++)
{
Tmp = A[i];
for ... |
C | #include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
int sum_op(int numdata);
int factorial_op(int N);
static int __init modtest_init(void)
{
printk(KERN_INFO"_ _ _Moduletest init!_ _ _\n");
return 0;
}
static void __exit modtest_exit(void)
{
printk(KERN_INFO"_ _ _Moduletest delete!_... |
C | #include <libtcc.h>
#include <stdio.h>
#include <stdlib.h>
char* up_file(const char* path)
{
FILE* fp = fopen(path, "r");
fseek(fp, 0, SEEK_END);
size_t sz = ftell(fp);
rewind(fp);
char *buf = calloc(sizeof(char), sz);
fread(buf, sz, sizeof(char), fp);
fclose(fp);
return buf... |
C | /*
* @file spi.c
*
* @Created on: 18.02.2018
* @Author: Kamil
* @brief Source code of abstract SPI controller work at stm32F072RB
*/
//*****************************************INCLUDE***********************************
#include "stm32f4xx.h"
#include "../inc/spiDriver.h"
//************************************... |
C | #include <stdio.h>
#include <stdlib.h>
/*
Escribir en C un programa que muestre los nmeros impares entre 0 y 100 y que
imprima cuantos impares hay.
*/
int main()
{
//Defino variables
int contador, cantidadImpares;
//Asigno valores e inicializo variables
cantidadImpares = 0;
for(contador=... |
C | #include <getopt.h>
#include <unistd.h> // For write(2)
#include <string.h> // For strchr(3)
char *optarg;
int optind = 1, opterr, optopt;
#define UNKNOWN 0
#define MISSING 1
static void getopt_error(int err)
{
static char msg_unknown[] = "Unknown option `-x'.\n";
static char msg_missing[] = "Missing argume... |
C | //#include <stdio.h>
//#include <conio.h>
//#include <windows.h>
//#include<stdio.h>
//#include<conio.h>
//#include<windows.h>
//#include <string>
//#include<iomanip>
//#include <iostream>
//#include<fstream>
//
//extern void bubbleSort();
//
//void swap(int *xp, int *yp)
//{
// int temp = *xp;
// *xp = *yp;
// *yp = ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
int rwork(int rank, int secondsValues) {
// If rank is 0, non-threadsafely decide on a number of seconds for a worker: 2, 4, or 8.
if (rank == 0) {
time_t t;
srand((unsigned) time(&t));
int orderValue = 0;
... |
C | #include <stdio.h>
#define MAX_LEN 10
void avg(int *arr)
{
int average = 0;
for (int i = 0; i < MAX_LEN; i++)
average += *arr++;
printf("\nThe average is - %d", average / MAX_LEN);
}
int main()
{
int arr[MAX_LEN];
for (int i = 0; i < MAX_LEN; i++)
scanf("%d", &arr[i]);
avg(arr... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* check_links.c :+: :+: :+: ... |
C | #include<bits/stdc++.h>
using namespace std;
int main() {
int n;cin>>n;
vector<int>v;
while(n--){
int t;
cin>>t;
if(t==1){
int x; cin>>x;
auto it=lower_bound(v.begin(),v.end(),x);
v.insert(it,x);
}
else{
if(v.size()<3){
... |
C | //ʵ27ָP08λLEDˮ
#include<reg51.h>
/*************************************************
ܣʱԼ150ms (3*200*250=150 000s=150ms
*************************************************/
void delay150ms(void)
{
unsigned char m,n;
for(m=0;m<200;m++)
for(n=0;n<250;n++)
;
}
/*************************************************
ܣ
... |
C | /**
* @file vector.h
* @brief 2D and 3D vector structures and functions
*
* Vecotr dot product, cross product and normalization functions.
*
* @copyright Copyright (c) 2020 Khant Kyaw Khaung
*
* @license{This project is released under the MIT License.}
*/
#ifndef __RK_MATH_VECTOR_H__
#define __RK_MATH_VECT... |
C | #ifndef _MGRAPH_H_
#define _MGRAPH_H_
#include <stdio.h>
#include <stdlib.h>
#define maxSize 50
#define maxVertices 30 //ͼжĿֵ
#define maxEdges 900 //
#define maxWeight 32767 //Ȩֵ൱ڡޣ
#define impossibleValue '#'
#define impossibleWeight -1
typedef char Type; //ݵ
typedef int Weight; //... |
C | #include<stdio.h>
#include<stdlib.h>
struct adjListNode{
int data;
struct adjListNode *next;
};
struct adjList{
struct adjListNode *head;
};
struct Graph{
int V;
struct adjList *array;
};
struct adjListNode *newAdjListNode(int data){
struct adjListNode *newNode=(struct adjListNode *)malloc(sizeo... |
C | #include<sys/time.h>
#include<sys/utils.h>
#include<sys/string.h>
#include<sys/asm_utils.h>
#include<sys/kprintf.h>
#define CURRENT_YEAR 2017
char system_uptime[15];
int century_val = 0x00;
int second;
int minute;
int hour;
int day;
int weekday;
int month;
int year;
int updating() {
outb(CMOS_ADD, 0... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_display_file.c :+: :+: :+: ... |
C | /*
* 题目:写一个函数,求两个整数的之和,要求在函数体内不得使用+、-、×、÷。
*
*
* author: louluo
*/
|
C | #include <stdio.h>
#include <stdlib.h>
int main(void){
int *p, i=0;
p = (int*)malloc(5*sizeof(int));
do{
scanf("%d",p[i]);
i++;
}while(i!=5);
for(i=0;i<5;i++){
printf("%d\n",p[i]);
}
free(p);
}
|
C | #include <stdio.h>
int main(){
int N, cont;
double C;
scanf(" %d" , &N);
while(N>0){
cont = 0;
scanf(" %lf" , &C);
while(C>1){
C /= 2;
cont++;
}
printf("%d dias\n", cont);
N--;
}
return 0;
} |
C | #include <math.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdint.h>
#include <errno.h>
#include <assert.h>
#include <string.h>
#define BUFSZ (1024*1024)
struct table {
float byteent[256];
float *result;
};
struct state {
int blocksize;
int n_tables;
size_t nblocks;
size_t nalloc;
s... |
C | #include<stdio.h>
int factorial(int n){
int i = 0, f = 1;
for(i = 1; i <= n; i++)
f *= i;
return f;
}
int main(int argc, char *argv){
int n;
printf("Enter the number of which you want to find the factorial\n");
scanf("%d", &n);
int fact = factorial(n);
printf("The factorial of the given number is %d\n", fact)... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct {
int x;
int y;
} point_t;
// TODO:
// Create a function the constructs a Point (returns a pointer to a new point)
// It should take it's x and y coordinate as parameter
// TODO:
// Create a function that takes 2 Points as a pointer and returns the distan... |
C | #include <stdio.h>
#include <stdlib.h>
struct content {
int key;
};
struct node {
struct content cont;
struct node *left;
struct node *right;
};
struct node *tree;
void initialize_tree(struct node *);
void display(struct node *);
// Basic operations
struct node *INSERT(struct node *);
struct node *DELETE(st... |
C | /// @file spinlock.h
/// @brief
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
#include "klib/stdatomic.h"
/// Determines if the spinlock is free.
#define SPINLOCK_FREE 0
/// Determines if the spinlock is busy.
#define SPINLOCK_BUSY 1
/// @b... |
C | #include <stdio.h>
#include "functions.h"
#include "common.h"
int create_file() {
FILE* new_file;
char file_name[MAX_FILE_NAME];
system("cls");
printf("Unesite naziv nove datoteke: \n");
while(1) {
scanf("%s", file_name);
if(strlen(file_name) != 0) {
break;
}... |
C | #define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<Windows.h>
int main()
{
int single = 0;
int i = 0;
int arr[11] = { 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 111 };
single = arr[0];
for (i = 1; i < sizeof(arr) / sizeof(arr[0]); i++)
{
single = single^arr[i];
}
printf("%d\n", single);
system("pause");
return 0... |
C | #include <stdio.h>
#include <string.h>
#include "menu.h"
#include "truck.h"
#include "material.h"
int getOption(int numOptions) {
int option=0;
while(option<1 || option>numOptions) {
/* Read the input */
printf(">> ");
scanf("%u", &option);
getchar();
/* Check the user input */
if(option<1 || opti... |
C | #include <stdlib.h>
#include <stdio.h>
int
main(int argc, char argv[])
{
int i,imax=500000000;
float x=0.0;
for (i=0;i<imax;i++) {
x += 1.0;
}
}
|
C | #include<stdio.h>
int main()
{
int n,a=0,arr[100],i,avg;
printf("enter the number of elements \n");
scanf("%d",&n);
printf("enter the elements one by one");
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
}
for(i=0;i<n;i++)
{
a=a+arr[i];
}
avg=a/n;
printf("the average is %d",avg);
return 0;
}
|
C | /*
* 栈演示
* */
#ifndef __02STACK_H__
#define __02STACK_H__
typedef struct {
int buf[SIZE]; //记录栈里的数字。前面的数字记录到小下标的存储区里
int qty; //记录栈里的数字个数
} stack_t;
//栈的初始化函数
void stack_init(stack_t *);
//栈的清理函数
void stack_deinit(stack_t *);
//获得栈里数字个数的函数
int stack_size(const stack_t *);
//判断栈是否空的函数
i... |
C | nclude <stdio.h>
#include <string.h>
#include <stdbool.h>
void pop(int deque[], int *top_cursor, int *bottom_cursor, bool front)
{
if (*top_cursor < *bottom_cursor)
printf("-1\n");
else if (front)
{
printf("%d\n", deque[*top_cursor]);
deque[*top_cursor] = 0;
--(*top_cursor);
}
else
... |
C | /*
*/
#include<stdio.h>
int loop(int t);
void show(int t);
int main() {
int N;
scanf("%d",&N);
int sum=0;
while(N>0) {
sum+=N%10;
N/=10;
}
printf("%d",sum);
show(loop(sum));
return 0;
}
int loop(int t) {
int result =0;
while(t>0) {
result *=10;
result+=t%10;
t/=10;
}
return result;
}
void show(in... |
C | #define _CORE_
#include <assert.h>
#include "util/chk_error.h"
#include "socket/chk_socket_helper.h"
#include "socket/chk_stream_socket.h"
#include "event/chk_event_loop.h"
#include "socket/chk_stream_socket_define.h"
#ifndef cast
# define cast(T,P) ((T)(P))
#endif
uint32_t chunkcount = 0;
uint32_t bu... |
C | #include"reg51.h"
#define uint unsigned int
#define uchar unsigned char
sbit led0=P0^0;
sbit led1=P0^1;
sbit led2=P0^2;
sbit led3=P0^3;
sbit led4=P0^4;
sbit led5=P0^5;
sbit led6=P0^6;
sbit led7=P0^7;
sbit button=P3^0;
void delay(uint n)
{
uint i,j;
for(i=0;i<n;i++)
for(j=0;j<930;j++);
}
void initTime()
{
TMOD =... |
C | /**************************Priority Inheritance by using mutex**************************** */
/* Author : Nikhil
Date : 22/05/2012
*/
#include "includes.h"
#include "uart1.h"
#include <util/delay.h>
OS_STK task1_stack[256];
OS_STK task2_stack[128];
OS_STK task3_stack[256];
OS_EVENT *mutex;
volatile INT8U err;
... |
C | #include <stdio.h>
int main()
{
int year,day,month,DayInMonths,weekday =0;
printf("enter the desired year");
scanf("%d",&year);
char *months[] ={"january", "Febuary", "March", "april", "May" , "june", "july", "august", "september", "oct", "Nov", "Dec"};
int monthday[] ={31, 28, 31, 30, 31, 30, 31, 30, 31,30 ,31,... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#define DUMP_DEBUG
// from high-freq to low-freq
char monogram[26] = {'e', 't', 'a', 'o', 'i', 'n', 's', 'h', 'r', 'd', 'l', 'u', 'c', 'm', 'w',
'f', 'g', 'y', 'p', 'b', 'v', 'k', 'j', 'x', 'q', 'z'};
int char_freq[... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <poll.h>
#include <linux/userfaultfd.h>
#include <string.h>
#include <sys/ioctl.h>
#include "shared-header.h"
#define errE... |
C | #include <stdio.h>
#include <string.h>
void __strcpy(char *dst, const char *src)
{
const char *dst_org = dst;
const char *src_org = src;
while ((*dst++ = *src++))
;
printf("%ld %ld\n", dst - dst_org, src - src_org);
}
int main()
{
char src[16], dst[16];
strcpy(src, "");
__strcpy(dst, src);
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mnist-utils.h"
int main()
{
int end=1;
FILE *imageFile, *labelFile;
imageFile = openMNISTImageFile(MNIST_TRAINING_SET_IMAGE_FILE_NAME);
labelFile = openMNISTLabelFile(MNIST_TRAINING_SET_LABEL_FILE_NAME);
while (end)
{
... |
C | #include <stdio.h>
#include <stdlib.h>
#include "string.h"
#include "empleados.h"
#include "LinkedList.h"
/** \brief asigna un puntero a un espacio en la memoria reservado
** \return retorna puntero a empleado
*/
eEmpleado* employee_new()
{
eEmpleado* auxEmpleado = (eEmpleado*) malloc(sizeof(eEmpleado));
if... |
C | #include <stdio.h>
int main( void)
{
int a = 0, b = 0, c = 0, lcm = 0, gcd = 0;
scanf( "%d", &lcm );
while( ~scanf( "%d", &b ) )
{
gcd = lcm;
a = b;
while( b != 0 )
{
c = gcd % b;
gcd = b;
b = c;
}
lcm = lcm * ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "empleados.h"
eEmpleado* nuevoEmpleado()
{
eEmpleado* retornoEmpleado;
retornoEmpleado = (eEmpleado*) calloc(sizeof(eEmpleado),1);
return retornoEmpleado;
}
eEmpleado* nuevoEmpleadoParametros(int legajo , char* nombre, float s... |
C | /*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be us... |
C | //
// Project.h
//
//
//
#include <stdio.h>
#include <pic32mx.h>
#include <stdint.h>
/* Declare display-related functions from mipslabfunc.c */
void display_image(int x, const uint8_t *data);
void display_init(void);
void display_string(int line, char *s);
void display_update(void);
uint8_t spi_send_recv(uint8_t... |
C | /* file: helloworld.c */
void sayhello(MPI_Comm comm)
{
int size, rank;
MPI_Comm_size(comm, &size);
MPI_Comm_rank(comm, &rank);
printf("Hello, World! "
"I am process %d of %d.\n",
rank, size);
}
|
C | #include <stdio.h>
#include <string.h>
int main(void)
{
char result[128] = "";
char input[128] = "";
char *mark = NULL;
while ( scanf("%s", input) != EOF ) {
if ( strlen(result) == 0 ) {
strcat(result, input);
} else {
int i;
int shor... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
// tstr = (vstr*20+i)*i
// return tstr > nstr
int str_val(char *tstr, char *vstr, char i, char *nstr) {
int tn, nn, n;
char *tp, *vp;
if(*vstr == '\0') {
sprintf(tstr, "%d", i*i);
} else if(i == 0) {
strcpy(tstr, "0");
} else {
nn = strlen(vstr);
... |
C | #include "poti.h"
// Method initilaizes the analog digital conversion
void init_poti_adc()
{
// Set the AREF input pin as a reference pin for ADC calculation
ADMUX = (1 << REFS0);
// ADC Enable and prescaler of 128 -> high prescaler -> low accuracy
// F_CPU/128 = 125000
ADCSRA = (1 << ADEN) | (1 <... |
C | /*
* mcp3008_raspi_test.c:
* Copyright (c) 2020 Ricardo Bustos
***********************************************************************
*
* mcp3008 raspberry pi 3+ library is a free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public
* License as ... |
C |
#include "records.h"
#include "memory.h"
#include "symbols.h"
#include <stdlib.h>
#include <limits.h>
enum { BUCKET_SIZE=4 };
typedef struct hb_struct *HashBucket;
struct hb_struct
{
int keys [ BUCKET_SIZE ];
uint8_t indexes [ BUCKET_SIZE ];
};
struct rd_struct
{
int maxIndex;
int hashParameter;
int8... |
C | #include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <linux/kernel.h>
#include <sys/wait.h>
#include <sys/syscall.h>
#include <errno.h> /* errno and error codes */
#include <sys/time.h> /* for gettimeofday() */
#include <unistd.h> /* for gettimeofday(), getpid() */
#inclu... |
C | #include <stdio.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <dirent.h>
#include <pthread.h>
#include <unistd.h>
#include <fcntl.h>
#include "../include/log.h"
#include "../include/comm.h"
#include "../include/list.h"
#include "../include/user.h"
#include "../include/queue.h"
#include "../... |
C | #include <stdio.h>
#include <string.h>
#include "Entidade.h"
#include "CRUD.h"
#include "Validacoes.h"
#include <stdlib.h>
#include <time.h>
#define true 1
#define false 0
#define Max_Detento 200;
void cadastroDetento(Detentos denVec[]){
Detentos den;
time_t agora;
char dataEntrada[50];... |
C | //***********************************************************************************
// handlers.c, Phase 0, Exercise 4 -- Timer Event
//***********************************************************************************
#include "spede.h"
// 2-byte (unsigned short) ptr points to video memory location
// assume scree... |
C | #include <dirent.h>
#include <stdio.h>
#include <string.h>
#include <ncurses.h>
#include "LList.h"
#define MAX_FILE 40
int main(){
DIR *dirp;
struct dirent *dp;
const char PROG_NAME[] = "FileMan";
const char VER_NO[] = "v0.0.0.1";
char files[MAX_FILE][FILENAME_MAX];
if ((dirp = opendir(".")) == NULL){
... |
C | #include "main.h"
/**
* read_textfile - Reads text and prints it out to stdout.
*
* @filename: Name of file.
* @letters: Number of letters to be read and printed.
*
* Return: Number of bytes the function can read and print.
*/
ssize_t read_textfile(const char *filename, size_t letters)
{
ssize_t o, r, w;
char... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.