language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
double serialTrap(int n, double a, double b, double h);
double f(double x);
int main(int argc, char* argv[]) {
struct timespec start, end;
clock_gettime(CLOCK_MONOTONIC, &start);
int n = strtol(argv[1], NULL, 10);
double a = 0... |
C | #include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
float Custos;
int nCoelhos;
printf("Digite a quantidade de coelhos\n");
scanf("%d", &nCoelhos);
Custos = (nCoelhos * 0.7) / 18 + 10;
printf("R$: %.2f\n", Custos);
system("pause");
return 0;
}
|
C | #include <stdio.h>
#include <unistd.h>
#include "ud_thread.h"
// If done correctly, each child should print their "before" message
// before either prints their "after" message. Test by adding sleep(1)
// calls in various locations.
sem_t *s1, *s2;
void child_1(int arg) {
printf("child 1: before\n");
// what... |
C | /*
tagreplace - replace tag records which match the criteria
given on the command line from stdin and write them to stdout.
Note that if we cant work out what the which is the primary
tag, and the first record does not meet the criteria then
we may lose the headers.
Note that this is ALPHA software, developed p... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<errno.h>
#include<sys/types.h>
#include<sys/time.h>
#include<unistd.h>
#include<sys/wait.h>
#include<time.h>
#include<pthread.h>
#include<getopt.h>
#define SIZE (int)1e8
#define RANDOM_MAX (int) 1e9
// Structure des resultats des tests
typedef struct r... |
C | #include <stdio.h>
#include <stdbool.h>
int main(){
int qtdJogadas = 0;
int salaAtual = 0;
char opcaoEscolhida = 'E';
while(qtdJogadas < 3 && (opcaoEscolhida == 'E' || opcaoEscolhida == 'D')){
printf("Escolha a sala da [D]ireita ou a sala da [E]squerda - Voce esta na sala %d", salaAtual);
... |
C | /*
MyOpenGl.c
Simple Template of programming using the OpenGL graphics library
Ionildo Jose Sanches - 17/02/03
*/
/* Includes requeridos */
#ifdef _WIN32
#include <windows.h>
#endif
#include <GL/gl.h>
#include <GL/glut.h>
/* Executada sempre que necessario re-exibir a imagem */
void display(void)
{
gl... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(int argc, char** argv) {
int arr[100] = {0}, lastPoint;
srand(time(NULL));
int i, debug = rand() % 100 + 1;
for(i=0; i<debug; i++) {
arr[i] = rand() % 4095 + 1;
if(i == debug - 1) lastPoint = debug;
printf("value : %d, [%d]\n", arr[i], i);
}
... |
C |
#include <errno.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <linux/i2c-dev.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#define FILE_NAME "/dev/eeprom"
int byte_read(int fd, unsigned char addr, unsigned char *data)
{
uns... |
C | /*
中国大学MOOC-翁恺-C语言程序设计习题集
02-1. 厘米换算英尺英寸(15)
如果已知英制长度的英尺foot和英寸inch的值,那么对应的米是(foot+inch/12)*0.3048。
现在,如果用户输入的是厘米数,那么对应英制长度的英尺和英寸是多少呢?别忘了1英尺等于12英寸。
输入格式:
输入在一行中给出1个正整数,单位是厘米。
输出格式:
在一行中输出这个厘米数对应英制长度的英尺和英寸的整数值,中间用空格分开。
输入样例:
170
输出样例:
5 6
*/
#include <stdio.h>
int
main(int argc, char *argv[])
{
int cm;
f... |
C | #include <stdio.h>
int main(){
int x = 10, y=20;
int* p1;
int* p2;
p1 = &x;
p2 = &y;
(*p1)++;
printf("(a) x = %d \n", x );
printf("(b) y = %d \n", y );
printf("(c) &x = %p \n", &x );
printf("(d) &y = %p \n", &y );
printf("(+) *p1 = %d \n", *p1 );
printf("(+) *p2 = %d \n... |
C | /**
* MathUtil.h
* Quick utility functions.
*
* This file is part of Jonathan Fischer's Xcode Game Template:
* https://github.com/mohiji/xcode-templates
*/
#ifndef MathUtil_h
#define MathUtil_h
#include <math.h>
inline float RadiansToDegrees(float radians) {
return radians * (180.0f / M_PI);
}
inline float D... |
C | #include <stdio.h>
#include<signal.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <mysql/mysql.h>
#include <sys/file.h>
#include <time.h>
#include "bcm2835.h"
#include "TX20.h"
/* ------------------------------------------------------------------------------------------------------------------... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* push_swap.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <math.h>
typedef struct cronometro {
int minutos;
int segundos;
int decimos;
} tempo;
void desconverte(double valor)
{
tempo t;
t.minutos = 0;
t.segundos = 0;
int negativo = 0;
if (valor < 0.0) {
negativo = 1;
valor *= -1;
}
... |
C | #include<stdio.h>
/*
struct A{
int i;
char ch[30]; };
*/
int main()
{
char *p = "abc";
printf ("%c", *p++);
// printf ("%c", ++*p);
printf ("%c", (*p)++);
//printf("%d\n",sizeof (struct A));
}
|
C | #include<stdio.h>
typedef unsigned u;
u max(u a,u b){return a>b?a:b;}
u F[1111],O[1111],V[1111],vi;
int main()
{
u t=0,T,n,i,j,k,r;
for(scanf("%u",&T);t++<T;)
{
scanf("%u",&n);
for(i=0;++i<=n;O[i]=0)scanf("%u",F+i);
for(r=i=0;++i<=n;)
{
for(V[j=i]=++vi,k=1;V[j=F[j]]!=vi;++k)V[j]=vi;
if(F[F[j]]==j)O[j]=... |
C | #ifndef CONTEXT_H
#define CONTEXT_H
#include <inttypes.h>
//================| Context Class Declaration |================//
//A structure for holding information about a framebuffer
typedef struct Context_struct {
uint32_t* buffer; //A pointer to our framebuffer
uint16_t width; //The dimensions of the fram... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main()
{
FILE *fp;
// Testing to see if file exist
if (access("test.txt",F_OK) == 0){
printf("File exist");
}
else{
printf("File does not exist");
}
printf("\n\nHello World");
return 0;
}
|
C | /**
* @file DoroboLib32 Trace (DT)
*
* DoroboLib32 software based tracing.
*
* Copyright (c) 2016 Laurent Schröder, Claus Fühner, Michael Hoffmann
*/
#include "trace.h"
#include "stm32f0xx_hal.h"
#include "string.h"
#include "stdio.h"
#include "stdarg.h"
#include "dorobo32.h"
// ****************************... |
C | /* libgpio
*
* Copyright 2012 Manuel Traut <manut@linutronix.de>
*
* LGPL licensed
*/
#include "ubmc_gpio.h"
#include <errno.h>
#include <fcntl.h>
#include <poll.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <syslog.h>
//#define DEBUG
#defin... |
C | /*
Fichiers à rendre : *.c, *.h
Fonctions Autorisées : write, malloc, free
Écrire un programme qui prend en paramètre une chaine de caractères et qui affiche
les mots de cette chaine par ordre de longueur puis dans l’ordre ascii. Les majuscules et
minuscules sont identiques dans l’ordre alphabetique (bien regarde... |
C | #pragma once
#include <stdbool.h>
#include <stdio.h>
struct String;
typedef struct String String;
String* createEmptyString();
void deleteString(String* string);
int stringLength(String* string);
String* getStringFromArray(const char* array);
char* importStringToArray(String* string);
void concatenateStrings(String... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define Maxsize 50
typedef char ElemType;
typedef struct LNode
{
ElemType data;
struct LNode *next;
}LinkNode;
void Init(LinkNode *L)
{
L = (LinkNode *)malloc(sizeof(LinkNode));
L->next = NULL;
}
void CreateF(LinkNode *L,ElemType a[],int n)... |
C | /* Header file */
#ifndef __TREE__
#define __TREE_
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
struct node {
/* data */
void *address;
size_t length;
char *location;
double timestamp;
int free;
/* used for tree */
struct node *left,
*right,
*par... |
C | /* FS : 1024 octets blocks, inode contient 1 numero de champ (chap bloc) qui sert à stocker les numeros des blocs de données
On a les routines bloc_from_disk() et bloc_to disk() et get_free_bloc() */
// Attention c'est contre intuitif. Lorsque l'utilisateur veut read, on doit lui write les données :)
int sifs_read_ino... |
C | #include <stdio.h>
int main(){
float r,m, areatotal,alt, pi = 3.14,prec;
scanf("%f %f &f", &r,&m, &alt);
areatotal = (pi * (r * r * 2) + (2 * pi * r * alt));
prec = areatotal * 100.00;
printf("Area total = %0.2f m2 e R$: %0.2f", areatotal, prec);
return 0;
}
|
C | #include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
extern int backtrace (void **, int);
static void
b (void)
{
void *v[20];
int i, n;
n = backtrace(v, 20);
for (i = 0; i < n; ++i)
printf ("[%d] %p\n", i, v[i]);
}
static void
c (void)
{
b ();
}
static void
a (int d, ...)
... |
C | /****************************************************************************//**
* @file main.c
* @version V0.10
* @brief Implement SPI Master loop back transfer. This sample code needs to
* connect MISO_0 pin and MOSI_0 pin together. It will compare the
* received data with transmitte... |
C | #include "holberton.h"
#include <stdio.h>
/**
* _strcmp - compares 2 strings from src to dest
*
* @s1: 1st string being compared
* @s2: 2nd string to be compared
*
* Return: areEqual
*/
int _strcmp(char *s1, char *s2)
{
int i = 0;
while (s1[i] != '\0')
{
if (s1[i] > s2[i])
return (s1[i] - s2[i]);
if... |
C | #include <stdint.h>
#include "Opcodes.h"
#include "FpExceptions.h"
#include "Ancillary.h"
uint8_t isNaN32(float op)
{
uint32_t NaN_single = 0x7F800000;
uint32_t op_int = _BITCAST_(uint32_t, op);
op_int = op_int & NaN_single;
if(op_int == NaN_single)
return 1;
return 0;
}
uint8_t isNaN64(double op)
{
uint64_... |
C | #include "hash.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#define POINTERSIZE 8
struct Performance *newPerformance() { //Create newPerformance
struct Performance *perf;
if ((perf = malloc(sizeof(struct Performance))) == NULL) { //Null check
fprintf(stderr, "%s\n", "Error, malloc failed");
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* job_misc.c :+: :+: :+: ... |
C | #ifndef _POWERDUE_H_
#define _POWERDUE_H_
#define LED_RGB_RED 6
#define LED_RGB_GREEN 7
#define LED_RGB_BLUE 8
#define PD_RED 1
#define PD_GREEN 2
#define PD_BLUE 3
#define PD_YELLOW 4
#define PD_PURPLE 5
#define PD_TIEL 6
#define PD_WHITE 7
#define PD_OFF 8
#define pd_rgb_led_init() { \
pinMode(LED... |
C | #include <sys/types.h>
#include <linux/kernel.h>
#include <sys/syscall.h>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <errno.h>
#define MAX 256
int main()
{
FILE *fp;
fp=fopen("crontext.txt","a+");
char buffer[40];
struct timeval time;
int32_t i,j,k,size,l1,h1,l2,h2;
int32_t * str... |
C | /*
* halm/platform/lpc/lpc17xx/clocking.h
* Copyright (C) 2013 xent
* Project is distributed under the terms of the MIT License
*/
/**
* @file
* Clock configuration functions for LPC175x and LPC176x series.
*/
#ifndef HALM_PLATFORM_LPC_CLOCKING_H_
#error This header should not be included directly
#endif
#ifn... |
C | #include <stdio.h>
#include <limits.h>
int main()
{
int arr[] = {7,1,5,3,6,4};
int i, profit;
int max_profit = 0;
int min_price = INT_MAX;
for (i=0; i< sizeof(arr)/sizeof(int); i++) {
if (arr[i] < min_price)
min_price = arr[i];
else {
profit = arr[i] - min_price;
if (max_profit < pr... |
C | #include<stdio.h>
#include<math.h>
float main()
{
float a, b, area;
printf("Enter a:\n");
scanf("%f", &a);
printf("Enter b:\n");
scanf("%f", &b);
area=3.142*a*b;
printf("Area of a eclipse:%.2f\n", area);
}
|
C | /*
** EPITECH PROJECT, 2019
** Objdump
** File description:
** main
*/
#include "dump.h"
#include "lib_header.h"
void display_start_adress_little(t_elf *my_elf)
{
Elf32_Ehdr *elf = (Elf32_Ehdr *)my_elf->data;
printf("start address 0x%08x\n\n", elf->e_entry);
}
void display_start_adress_big(t_elf *my_elf)
{
... |
C | //Nhập một số nguyên dương N không quá 9 chữ số. Hãy đếm xem N có bao nhiêu chữ số lẻ và bao nhiêu chữ số chẵn. Nếu không tồn tại số lẻ hoặc số chẵn thì in ra kết quả là 0 cho loại số tương ứng
//INPUT
//12345678
//OUTPUT
//4 4
// main.c
// Đếm chữ số chẵn và chữ số lẻ
//
// Created by PAT on 5/9/20... |
C | /* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#ident "@(#)mbtranslate.c 1.1 93/05/05 SMI"
#include "curses_inc.h"
extern ... |
C | /** ANSI_Escapes.h
* Preprocessor macro definitions for escapes and control sequences
* originally defined by the former ANSI X3.64 standard. They are currently
* defined by ISO/IEC 6429 after the 1994 withdrawl of X3.64, in favour of
* the ISO definition based on ECMA-48 (5th ed, 1991).
*/
#ifdef ANSI_USE_C1_SET... |
C | //
// DictionaryTests.c
// yammer
//
// Created by david on 12/2/15.
// Copyright © 2015 combobulated. All rights reserved.
//
#include "DictionaryTests.h"
#include "YMDictionary.h"
#include "YMThread.h"
#include "YMLock.h"
#include "YMSemaphore.h"
#include "YMString.h"
YM_EXTERN_C_PUSH
#define NumberOfThreads ... |
C | #include <stdio.h>
int remove_duplicate_array(int *a, int n);
int main()
{
int z[]={1,1,1,1,1,2,3,4,4,4,4};
int l=remove_duplicate_array(z,11);
printf("%d\n",l);
for(int i=0; i<l; i++)
printf("%d ",z[i]);
return 0;
}
int remove_duplicate_array(int *a, int n) {
int i = 0, b = 0, counter = 0;
int temp[... |
C | #include <stdio.h>
int main(void){
int i = 1000;
int flag = 0;
for(i; i < 10000; i++){
flag = 1;
for (int j = 1; j <= 1000; j *= 10 ){
if ((i/j - 7) % 10 == 0)
{
flag = 0;
break;
}
}
if ( flag )
printf("%d ", i);
}
getchar();
getchar();
} |
C | // Copyright 2020 jrlc
#pragma once
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief 用户API
* @defgroup user_api
* @{
*/
/**
* @brief 设备绑定驱动
*
* @param device_id
* @param driver_id
* @return int
*/
int dev_bind(int device_id, int driver_id);
/**
* @brief 设备解绑驱动
*
* @param devi... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h>
#define MAX_LEN 256
#define MAX_CHAR_SCAN "%255s"
#define GARBAGE_CAP 100 // має бути рівна CLIENT_NUMBER
#define CLIENT_NUMBER 100
#define BRIGADE_NUMBER 100
#define ORDER_NUMBER 10000
typedef struct TClient
{
int id;
... |
C | #include <prodcons.h>
#include <queue.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
int n;
semaphore consumed, produced;
bool search_dash_f(char *args[]);
int search_count_arg(char *args[], int def);
bool validate_arg(char *arg);
shellcmd xsh_prodcons(int nargs, char *args[])
{
n = 0;
int c... |
C | #include <emscripten.h>
extern float jsSqrt(int);
int EMSCRIPTEN_KEEPALIVE add(int value1, int value2) {
return value1 + value2;
}
int EMSCRIPTEN_KEEPALIVE subtract(int value1, int value2) {
return value1 - value2;
}
int EMSCRIPTEN_KEEPALIVE multiply(int value1, int value2) {
return value1 * value2;
}
int EM... |
C | #include "holberton.h"
/**
* _strncat - concatenate 2 strings stop at n
* Return: concatenated string
*
*@dest: first string
*@src: second string
*@n: where to finish
*/
char *_strncat(char *dest, char *src, int n)
{
int place = 0;
int count = 0;
int x = 0;
while (dest[count] != '\0')
count++;
while (src... |
C | #include <stdio.h>
#include <strings.h>
double A[3][2] = {{1, 2}, {3, 4}, {5, 6}};
double X[2] = {7, 8};
void matprint(int numRows, int numCols, double A[numRows][numCols]){
for(int i = 0; i < numRows; i++){
for(int j = 0; j < numCols; j++){
printf("%g %lu ", A[i][j], (long unsigned)&A[i][j]);... |
C | /* iv.c
*
* Modified Bessel function of noninteger order
*
*
*
* SYNOPSIS:
*
* double v, x, y, iv();
*
* y = iv( v, x );
*
*
*
* DESCRIPTION:
*
* Returns modified Bessel function of order v of the
* argument. If x is negative, v must be integer v... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* core2.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include "../include/reorderedColumn.h"
void ReorderedColumn(relation * rel_old, relation * rel_new, psum * ps)
{
uint64_t i = 0;
// = 7 because we need the 8th byte(0 = 1st byte from the right, 1 = 2nd byte from the right)
uint64_t selected_byte = 7;
uint64_t re... |
C | #include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include "dht.h"
#include "connection.h"
pthread_t server_thread;
CONNECTION connections[MAX_CONNECTIONS];
WSADATA WSAData;
void * client_socket_thread(void* data)
{
CONNECTION * connection = (CONNECTION*)data;
sem_post( &connection->mutex );
for(;;)... |
C | /*2018.5.11
PATҼA+BC (15)
Ŀ
[-231η, 231η]ڵ3ABCжA+BǷC
:
1иT(<=10)DzĸTÿռһУ˳ABCԿոָ
:
ÿһCase #X: trueA+B>CCase #X: falseXDzıţ1ʼ
:
4
1 2 3
2 3 4
2147483647 0 2147483646
0 -2147483648 -2147483647
:
Case #1: false
Case #2: true
Case #3: true
Case #4: false*/
#include <stdio.h>
int main(){
int n=0;
int A,B... |
C |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define TEST(EXP, RES) printf(#EXP " (" #RES " vs %d) -> %d\n", (EXP), ((EXP)) == (RES))
#define TEST_STR(EXP, RES) printf(#EXP " (" #RES " vs \"%s\") -> %d\n", (EXP), strcmp(((EXP)), (RES)) == 0)
int nmatch(char *s1, char *s2... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
//1.先把所需要的数据信息结构定义下来
struct DynamicArray {
//输出数据元素的空间首地址
void **addr;
//存储数据的内存中最大能够容纳多少元素
int capacity;
//当前存储数据的内存中有多少个元素
int size;
};
//初始化数组
struct DynamicArray *Init_DynamicArray(int capacity){
if(capacity <= 0){
return NULL;
}
struct Dynamic... |
C | // 6) Faça um programa que leia um valor do tipo double e depois o imprima na forma de notação científica.
// Libs
#include <stdio.h>
#include <stdlib.h>
// Main func
int main(){
double number;
printf("Digite um número:\n");
scanf("%f", &number);
printf("Valor lido: %E", number);
return 0;
} |
C | #include "../includes/ft_solve.h"
char *ft_memcpy(char *dst, char *src, int len)
{
int i;
if (!dst || !src || !len)
return (dst);
i = -1;
while (++i < len)
dst[i] = src[i];
return (dst);
}
t_list *ft_free_list(t_list *list)
{
if (!list)
return (NULL);
if (list->next)
list->next = ft_free_list(list->n... |
C | /*
*
* Leetcode:
* Runtime: ms
* Memory Usage: MB
*
*/
#include <stdio.h>
#include <stdlib.h>
#define ANSWER 1
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* struct ListNode *next;
* };
*/
struct ListNode {
int val;
struct ListNode *next;
};
#if ANSW... |
C | #define _CRT_SECURE_NO_WARNINGS
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "lists.h"
#include "Htable.h"
struct graph_base{
struct Hash_table * ht;
struct intList * list;
};
struct graph_base * read_graph(FILE * f){
struct graph_base * gb = (struct graph_base *)calloc(1, sizeof(struct grap... |
C |
#include "../../include/rf_utils.h"
#include <string.h> //for memcpy
///Declaration of the utils globals
RF_UTILS rfUTILS;
// A function which detects system's endianess
void rfUTILS_DetectEndianess()
{
int32_t anint = (int32_t)0xdeadbeef;
rfUTILS.endianess = (*(char *)&anint == (char)0xef)? RF_LITTLE_ENDI... |
C | #include "median_filter.h"
#include "array_utility.h"
#include "kernel_filter.h"
#include <math.h>
// Helper function to find the pixel array for a particular input image.
float* find_pixel_array (float** input, int M_in, int N_in,
int row, int col, int size, int* array_size)
{
// Declare array size.
*arr... |
C | /*
* Question2.c
* Created on: 06/04/2014
* Author: Shane
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
double distance(double x1, double y1, double x2, double y2);
int main(void){
double X1, X2, Y1, Y2;
printf("Enter a coordinate on the Cartesian plane: \n");
scanf("%lf%lf", &X1, &Y1);
print... |
C | #include <stdlib.h>
#include <string.h>
#include "node.h"
//
// node_t
//
void node_init(node_t *this, const char *name, int nodetype, attributes_t *attributes)
{
this->name = MALLOC_OR_DIE((strlen(name) + 1) * sizeof(*this->name));
strcpy(this->name, name);
this->parent = NULL;
if (attributes) {
... |
C | /*/
#include <stdio.h>
int main() {
char myArray[6] = {'A','B','C', };
printf("%c %c %c \n", myArray[0],myArray[1],myArray[2]);
myArray[3] = 'C';
myArray[4] = 'B';
myArray[5] = 'A';
printf("%c %c %c %c %c %c \n", *&myArray[0], *&myArray[1], *&myArray[2], *&myArray[3], *&myArray[... |
C | #pragma once
struct memory_allocator
{ // Constructor
memory_allocator( void* p_mem, const DWORD size );
// Allocator
void* malloc( const DWORD size );
void free( void* p_ptr );
// Get the locking element
volatile LONG* lock( void );
// This will initialize the object if it is not alr... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_cd.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
//parent process write, the child process read, and vice versa
int main(){
int fd[2];
pid_t pid;
if(pipe(fd) < 0){
printf("pipe create error \n");
exit(1);
}
if((pid = fork()) < 0){
printf("fork error \n");
exit(1);
}
i... |
C | /*
*
* name: Robert Chunn
* date: 08 Jan 2020
* project: Performance Lab 6
*
* URL: https://github.com/CyberTrainingUSAF/08-C-Programming/blob/master/04_IO_part_1/performance_labs/lab6/lab6.md
*
*/
#include <stdio.h>
int main(void)
{
// declare and initialize a variable for getc() to store its result
in... |
C | //
// Heap.h
//
//
// Created by Luiz Henrique Campos Barboza on 15/12/15.
//
//
#ifndef Heap_h
#define Heap_h
#include "macros.h"
// Heap
/// Área de armazenamento de objetos e arrays da JVM
/*!
Heap define a estutura de objetos e arrays;
*/
typedef struct {
// estrutura
struct _object {
ClassFi... |
C | /* tcpserver.c */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <dirent.h>
#include"diffcomm.h"
#include"audioSD.h"
#include <signal.h>
//numero de port
#define PO... |
C | #include <stdio.h>
#define MAXSIZE 100
#define INTMAX 32767
// : ͼĻ
typedef char DataType;
typedef struct
{
DataType vexs[MAXSIZE]; // Ϣ
int edges[MAXSIZE][MAXSIZE];// ڽӾ, ԽΪ0,ΪȨֵ, ڵıΪ-1, ʾ
int numVexs, numEdges; // ͱ
}Graph;
// ͼ
void CreateGraph(Graph *G)
{
int i, j, k, w;
printf(":");
scanf("%d", &G->n... |
C | /*Break the string into substrings based on a delimeter.
input:String which has '_' in between substrings.
output:multiple strings.
*/
#include <stdio.h>
#include <string.h>
int main() {
int num1;
int arr[20];
int i=0;
int j=0;
int k;
char s[30];
char dummy1[30]="";
scanf("%s",s);
int l=str... |
C | /* Write a C programs to check whether an alphabet is vowel or consonant using swith case. */
#include <stdio.h>
int main(){
char ch;
printf("\nEnter the alphabet:\n");
scanf("%c", &ch);
switch(ch){
case 'a':printf("\nThe entered alphabet is a vowel.\n"); break;
case 'e':pr... |
C | #include "holberton.h"
#include <stdlib.h>
/**
* create_array - creates an array of chars, and
* initializes it with a specific char
*
* @size: size of array
* @c: character to init array
* Return: char pointer
*/
char *create_array(unsigned int size, char c)
{
char *char_arr;
unsigned int i;
if (size == 0)... |
C | #include "stupid_delay.h"
uint32_t __IO delay_val;
void delay_init(){
if(SysTick_Config(SystemCoreClock / 100000UL)){
while(1);
}
}
void delay_ms(uint32_t value){ //unit of value = [ms]
delay_val = value*100;
while(delay_val != 0);
}
/*Cannot get less than 10us because of SystemCoreClock?*/
void delay_us(uint3... |
C | // has-tabs.c
// C source code using tabs for indentation.
#include <stdio.h> // printf
int main()
{
int a = 4;
printf("a: %d\n", a);
if (a)
a++;
return 0;
}
// EOF
|
C | #include <stdio.h>
#include <stdlib.h>
#define N 10
void func1(void)
{
int a[N] = {0,56,89,3,65,43,39,13,29,28};
int i,j,t;
for(i = 0 ; i <= 8; i++) //控制排序趟数
{
for(j = 1; j < N-i-1;j++)
{
if(a[j] > a[j+1])
{
t = a[j];
a[j] = a[j+1];
a[j+1] = t;
}
}
}
for(i = 0 ; i < N; i++)
... |
C | #include <math.h>
#include <GL/glut.h>
#include <stdio.h>
#include <stdlib.h>
float tx = 0.0;
float ty = 0.0;
void circulo()
{
int i;
float angulo = 0.0;
glBegin(GL_POLYGON);
for (i = 0; i <= 50; i++)
{
angulo = 2 * M_PI * i / 50.0;
glVertex2f(0.15 * cos(angulo), 0.15 * sin(angulo));
}
glEnd();
... |
C | #include "makespl.h"
#include "piv_ge_solver.h"
#include <stdio.h>
#include <stdlib.h>
#include <float.h>
#include <math.h>
double laguerr(int n, int alfa, double x)
{
if (n==0)
return 1;
if (n==1)
return 1 + (double)alfa - x;
return (((2.0 * n - 1 + alfa - x) * laguerr(n-1, alfa, x) - (n - 1 + alfa) * lagu... |
C | #ifndef log_logging_event_h
#define log_logging_event_h
/**
* @file logging_event.h
*
* @brief the internal representation of logging events.
*
* When a affirmative logging decision is made a log_logging_event
* instance is created. This instance is passed around the different log
* components.
**/
#include... |
C | #ifndef __triangle_H
#define __triangle_H
#include "Vertex.h"
#include "Vector.h"
#include "Texture.h"
#include "Material.h"
#define NUM_TRIANGLE_PER_POOL 10000
//R
typedef struct Triangle
{
int miplevel, fogEnable, lightEnable, depth, uvState, index;
DWORD render_mode;
Texture * texture;
M... |
C | /*************************************************************************
> File Name: strstr.c
> Author: tp
> Mail:
> Created Time: Thu 30 Aug 2018 01:50:49 PM CST
************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
struct Client
{
char *name;
int age;
double balance;
};
_Bool name_comparator(struct Client *, struct Client *);
_Bool balance_comparator(struct Client *, struct Client *);
_Bool age_comparator(struct Client *, struct Client *... |
C | #include <stdio.h>
int main (int argc, char * argv[]){
int table[10]={18,14,13,20,30,32,70,62,14,41};
for (int i = 0; i<10;i++)
{
printf ("%d\n", table[i]);
}
}
|
C | /*
* ADC.c
*
* Created on: 21.02.2021
* Author: Michal
*/
#include <ADC.h>
#include "stm32l4xx.h"
/* ADC */
void ADC_Init()
{
RCC->AHB2ENR |= RCC_AHB2ENR_GPIOCEN | RCC_AHB2ENR_ADCEN; // enable ADC and GPIO C clock
RCC->CCIPR |= RCC_CCIPR_ADCSEL_0 | RCC_CCIPR_ADCSEL_1; // select clock ADC
ADC1->CFGR |= ... |
C | /*
gen_cpp.c - Generates c++ source code files.
Copyright (C) 2019 Stephen Rhen
This file is part of asmc, A State Machine Compiler.
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 Foundati... |
C | 大侦探福尔摩斯接到一张奇怪的字条:我们约会吧! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm。大侦探很快就明白了,字条上奇怪的乱码实际上就是约会的时间星期四 14:04,因为前面两字符串中第 1 对相同的大写英文字母(大小写有区分)是第 4 个字母 D,代表星期四;第 2 对相同的字符是 E ,那是第 5 个英文字母,代表一天里的第 14 个钟头(于是一天的 0 点到 23 点由数字 0 到 9、以及大写字母 A 到 N 表示);后面两字符串第 1 对相同的英文字母 s 出现在第 4 个位置(从 0 开始计数)上,代表第 4 分钟。现给定两对字符串,请帮助福尔摩斯解码得到... |
C | #include <stdio.h>
int func(int n);
int main()
{
int N=0, i=0;
scanf("%d", &N);
for (i = 1; i <= N; i++)
{
if(N == i + func(i)) break;
if(i == N) {
i=-1;
break;
}
}
printf("%d", (i==-1) ? 0 : i);
return 0;
}
int func(int n) {
... |
C | /*
* Keypad.c
*
* Created: 3/14/2015 5:52:58 PM
* Author: Dalia Hossam
*/
#define F_CPU 1000000UL
#include <util/delay.h>
#include "keyPad.h"
#include "KeyPad_Config.h"
u8_t Get_Key()
{
//keypad connected on PORTA
//connect coloumns on PINS from (PD0-PD3),make these PINS as o/p pins
//connect rows on PINS... |
C | #include <ncurses.h>
#include <stdlib.h> // Random
#include <time.h> // Different values random
#include <stdbool.h> // to declare bool
#include <string.h> // strcpy
enum address { RIGHT, DOWN, LEFT, UP };
typedef char byte;
void printBoard( char[] );
char detectDrunk( byte, byte, char[], char[] );
byte findFirst... |
C | void reverse(unsigned int a[], unsigned int n)
{
unsigned int temp;
unsigned int i;
unsigned int j;
for (i = 0; i < n - i - 1; i++) {
j = n - i - 1;
temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
|
C | #include <stdio.h>
#include <stdlib.h>
int comp( const void *b, const void *a ) {
return *(int*)a - *(int *)b;
}
int main(int argc, const char *argv[])
{
int i, n, a[100000];
while (scanf("%d", &n) != EOF) {
for (i = 0; i < n; i++)
scanf("%d", &a[i]);
qsort(a, n, sizeof(int), ... |
C | /* Lua System: Threading */
#ifdef _WIN32
#include <process.h>
#define thread_getid GetCurrentThreadId
#define THREAD_FUNC_API unsigned int WINAPI
typedef unsigned int (WINAPI *thread_func_t) (void *);
typedef unsigned int thread_id_t;
typedef DWORD thread_key_t;
#else
#include <pthread.h>
#define thread... |
C | /*
* conn_tcp.c
*
* Created on: 20Oct 2016
* Author: Jie Deng
*/
#include <errno.h>
#include <stdio.h>
#include <sys/socket.h>
#include <arpa/inet.h> //inet_addr
#include <unistd.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#ifdef __unix__
#include <linux/if.h>
#include <linux/if_tun.h>
#else
#includ... |
C | #include <stdio.h>
#include<unistd.h>
int main()
{
int ret = fork();
if(ret>0)
{
printf("father:%d\n",getpid());
}
else if(ret==0)
{
printf("child:%d\n",getpid());
}
else
{
printf("perror fork()");
}
return 0;
}
|
C | #include <assert.h> /* for PRIu32 */
#include <inttypes.h> /* for PRIu32 */
#include <stdatomic.h> /* for uint8_t, uint32_t */
#include <stdint.h> /* for uint8_t, uint32_t */
#include <stdio.h>
#include <stdlib.h>
#include "nbcompat.h"
static const uint8_t initial_u8 = 0x10;
static const uint16_t initial_u16 = 0x102... |
C | #include<stdio.h>
//x とy の差を求めるマクロを定義
#define diff(x,y) (((x) > (y)) ? ((x) - (y)): ((y) - (x)))
int main(void){
int x = 1,y = 3;
float fx = 1.4,fy = 3.6;
printf("x = %d \ny = %d\n%d\n",x,y,diff(x,y));
printf("fx = %f \nfy = %f\n%f\n",fx,fy,diff(fx,fy));
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.