language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /*
* D-Bus Peer Addresses
*
* The D-Bus message broker requires peers to always address the destination of
* their messages. Those addresses can come in different styles. The 'Address'
* type implemented here parses or writes such addresses, hiding the details
* behind a simple API.
*
* The 'Address' type is su... |
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
int minimum(int a, int b)
{
if (a > b)
return b;
else
return a;
}
int maximum(int a, int b)
{
if (a > b)
return a;
else
return b;
}
typedef struct t {
int x;
int y;
} towns;
struct heapite... |
C | #include <stdio.h>
#include <stdlib.h>
int myAtoi(char * str){
if (str == NULL) {
return 0;
}
else {
long result = 0;
int i = 0;
int flag = 1;
while (str[i] == ' ') {
i++;
}
if (str[i] == '-') {
flag = -1;
i++;
}
else if (str[i] == '+') {
flag = 1;
i++;
}
for (; str[i]; i++) {
... |
C | #include <stdio.h>
#include <stdlib.h>
#define N 100
int main()
{
int *A = (int *)malloc(N * sizeof(int));
int *B = (int *)malloc(N * sizeof(int));
int i;
for (i = 0; i < N; i++)
{
A[i] = 0;
B[i] = i;
A[i] += B[i];
}
A[N+4] = 0;
B[N+4] = 0;
return 0;
} |
C | /** Volume measurement.
* Proceeds by integration of the flow sensor.
*/
#ifndef VOLUME_H_
#define VOLUME_H_
#include <stdint.h>
/* @SENSOR_DIR Configures the flow sensor direction.
* -1: flow sensor measures inspiration as a negative flow
* 1: flow sensor measures inspiration as a positive flow
*/
#define SENS... |
C | #include "bootpack.h"
int readcmos(unsigned char addr)
{
io_out8(0x70, addr);
return io_in8(0x71);
}
struct localtime readrtc()
{
int i = 0, k;
struct localtime lt;
lt.sec = 0xff;
/* ɂ͍XVȂ */
if((readcmos(0x0a) & 0x80) == 0){
/* b擾 */
i = readcmos(0x00);
k = (i >> 4) * 10 + (i & 0x0f);
lt.sec = k;
i... |
C | //prog to set and get bit at given position
#include<stdio.h>
#define bitset(byte, nbit) (byte|(1<<(nbit)))
//if bit is 0 sets to 1 else no changes
#define bitget(byte, nbit) (byte=(byte>>nbit)&1)
//gives bit at given location
void main()
{
int num,bit_pos_get,bit_pos_set;
printf("Enter Number: ");
scanf("%d",&num);... |
C | /* { dg-options "-O2" } */
/* { dg-do run } */
extern void abort (void);
typedef unsigned int __u32;
__u32
__rev16_32_alt (__u32 x)
{
return (((__u32)(x) & (__u32)0xff00ff00UL) >> 8)
| (((__u32)(x) & (__u32)0x00ff00ffUL) << 8);
}
__u32
__rev16_32 (__u32 x)
{
return (((__u32)(x) & (__u32)0x00ff00ffUL) <... |
C | int fibcalc(int n) {
int fib_previous = 1;
int fib_prenultimate = 0;
for (int i = 1; i < n; i++) {
int temp = fib_previous;
fib_previous = fib_previous + 2 * fib_prenultimate;
fib_prenultimate = temp;
}
if (n == 0) {
return fib_prenultimate;
}
return fib_previous;
}
|
C | #ifndef __Uart_H_
#define __Uart_H_
#include<Config.h>
#include<stdio.h>
#define NONE_PARITY 0 //У
#define ODD_PARITY 1 //У
#define EVEN_PARITY 2 //żУ
#define MARK_PARITY 3 //У
#define SPACE_PARITY 4 //հУ
#define PARITYBIT NONE_PARITY //Уλ
#define S2RI 0x01 ... |
C | /*
bluepp
2014-12-12
2014-12-20
May the force be with me!
https://oj.leetcode.com/problems/missing-ranges/
Given a sorted integer array where the range of elements are [lower, upper] inclusive, return its missing ranges.
For example, given [0, 1, 3, 50, 75], lower = 0 and upper = 99, return ["2"... |
C | /****************************************Copyright (c)*************************
** 版权所有 (C), 2015-2020, 涂鸦科技
**
** http://www.tuya.com
**
**--------------文件信息-------------------------------------------------------*/
#include "zigbee.h"
/*******************... |
C | #include <stdio.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/select.h>
#include <sys/un.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <error.h>
static int count;
size_t readn(int fd, void... |
C | #include <stdlib.h>
#include <unistd.h>
int main()
{
printf("pid: %d \n", getpid());
printf("ppid: %d \n", getppid());
printf("uid: %d \n", getuid());
printf("euid: %d \n", geteuid());
printf("gid: %d \n", getgid());
printf("egid: %d \n", getegid());
} |
C | #include <stdio.h>
#include <stdlib.h>
#include <limits.h>
int main() {
int x = 4;
int y = -5;
int min = y + ((x - y) & ((x - y) >> (sizeof(int) * CHAR_BIT - 1)));
printf("min(%d, %d) = %d\n", x, y, min);
}
|
C | /*************************************************************************
> File Name: pthread1.c
> Author: yuhaitao
> Mail:acer_yuhaitao@163.com
> Created Time: Mon 04 Jul 2016 07:14:09 PM CST
************************************************************************/
#include <stdio.h>
#include <pthread.h>
... |
C | #define _CRT_SECURE_NO_WARNINGS 1
// char* my_strcpy(char *dest, const char*src)
//{
// //..
//}
//
//int main()
//{
// int arr[6] = {0};
// int (*parr)[6] = &arr;//parrָ
// char* (*pfun)(char*, const char*) = my_strcpy;
//
// return 0;
//}
//#include <stdio.h>
//
//int Add(int x, int y)
//{
// return x+y;
//}
//
//... |
C | #include "typedefs.h"
#include "digitDisplay.h"
#include "board.h"
// Common Anode 7 segment
UINT8 Seven_seg_map[] = {0X03, 0X9F, 0X25, 0X0D, 0X99, 0X49, 0X41, 0X1F, 0X01, 0X09};
typedef struct _Display
{
UINT8 display_Buf[3];
UINT8 Buf_index;
}DISPLAY;
DISPLAY dis = {0};
// Initialization of Digit_Display
void D... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
FILE* war;
char i = 0;
war = fopen("WarPeace", "r+");
do
{
i = fgetc(war);
if(i == 32)
{
fseek(war, -1, SEEK_CUR);
fputc(10, war);
}
}while(i != EOF);
}
|
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int idade;
float salario, valor;
idade = 25;
valor = 4500.50;
salario = valor;
printf("Idade: %d\n", idade);
printf("Eo salario: %f\n", salario);
return 0;
}
|
C | #ifndef INCLUDE_GUARD__Znk_rand_h__
#define INCLUDE_GUARD__Znk_rand_h__
/* Generating rand by Mersenne twister method. */
#include <Znk_base.h>
Znk_EXTERN_C_BEGIN
/**
* @brief
* seedݒ肵Vbts.
* seed_delta 0 ȊOw肵ꍇ͓ŐꂽԂɂseedl
* ɃoCAXlZ邱Ƃł.
*/
void ZnkRand_shuffle( unsigned long seed_delta );
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define xn 2
#define tamanhoAmostras 48
#define n 0.5
int entradas[xn];
float pesosSinapticos[xn + 1];
int amostras[xn][tamanhoAmostras];
int saidaDesejada[tamanhoAmostras];
const char separadorEntradas[2] = ";";
const char separadorSaida[2] = "-";
int func... |
C | #include <stdio.h>
int main()
{
//blank tab newline
int c, nb, nt, nl;
nb = nt = nl = 0;
while ((c = getchar()) != EOF)
{
if (c == ' ') ++nb;
if (c == '\t') ++nt;
if (c == '\n') ++nl;
}
printf("blank : %d\n", nb);
printf("tab : %d\n", nt);
printf("new line : %d\n", nl);
return 0;
} |
C | #ifndef FVECTOR2_H
#define FVECTOR2_H
#include <cmath>
struct fVector2
{
float x;
float y;
fVector2()
{
x = y = 0;
}
fVector2(float p_x, float p_y)
{
x = p_x;
y = p_y;
}
fVector2 operator+(const fVector2& p_other)
{
float nx = x + p_other.x;
float ny = y + p_other.y;
return fVector2(nx, ny);
}... |
C | #include<stdio.h>
#include<math.h>
int main() {
double a,b,c;
scanf("%lf%lf%lf",&a,&b,&c);
double s=(a+b+c)/2,area;
area=sqrt(s*(s-a)*(s-b)*(s-c));
printf("a=%lf\tb=%lf\t%f\narea=%lf\n",a,b,c,area);
return 0;
} |
C | #include "cub3d.h"
float deg(float x)
{
return ((180 / M_PI) * x);
}
void draw_sprite(int id)
{
int i;
int j;
int c;
int *l9alwa;
float size;
i = -1;
size = g_sprite[id].size;
l9alwa = (int*)g_txts.addr;
while (++i < size - 1 && (j = -1))
{
if (g_sprite[id].xof + i <= 0 || g_sprite[id].xof + i > ... |
C | #ifndef ITEM
#define ITEM
#include <stdlib.h>
typedef struct _item {
int rbytes;
int nbytes; /* size of data */
unsigned char nsuffix; /* length of flags-and-length string */
unsigned char nkey; /* key length, w/terminating null and padding */
void *end[];
} item;
... |
C | #ifndef NETPLEX_POLL_H
#define NETPLEX_POLL_H
#include <poll.h>
#include <errno.h>
#include <stdint.h>
typedef struct nplx_poll_set {
nfds_t count;
nfds_t capacity;
struct pollfd *fds;
} nplx_poll_set_t;
typedef struct pollfd *nplx_poll_fillptr_t;
typedef struct nplx_poll_getptr {
const nplx_poll_set_t *set;
n... |
C |
#include <string.h>
#include <stdlib.h>
#include "utils.h"
#include "nav_math.h"
#include "main.h"
extern void ecef2enu(const double *pos, const double *r, double *e);
extern double norm(const double* a, int n);
extern int print_rmc(gtime_t time, double *ecef,int fixID,char *buff);
extern int print_gsv(unsigned char... |
C | /***************************************
* ļ usart2.c
* USART2
* ʵƽ̨STM32F103C8T6
* Ӳӣ------------------------
* | PA2 - USART2(Tx) |
* | PA3 - USART2(Rx) |
* ------------------------
* 汾 ST3.0.0
************************************************... |
C | #ifndef HASH_H
#define HASH_H
#include <stdbool.h>
#include <stddef.h>
/* ******************************************************************
* DEFINICION DE LOS TIPOS DE DATOS
* *****************************************************************/
typedef struct hash hash_t;
typedef struct hash_... |
C | #include "Functions.h"
typedef struct cell{
char name[20];
int x;
int y;
bool moved;
char team;
int energy;
struct cell * next;
}cell;
typedef struct cells{
struct cell * head;
}Cells;
typedef struct block{
int type;
int energy;
int x;
int y;
}block;
bool mp;
int X = 0;
int Y =... |
C | //-------+---------+---------+---------+---------+---------+---------+--------=
//
// File: diag_hash.c
//
//----------
//
// diag_hash--
// Support for managing a hash table of values associated with alignment
// diagonals.
//
// Our search algorithms need to track hits on each diagonal to detect
// overlapping hits a... |
C | /* declare.c */
/* Before we declare our header files, let me say that when you use a lot of pointers in your programs you may want to get into the habit of always including the following four header files. */
#include <stdio.h> /* common input-output routines */
#include <stdlib.h> /* the dynamic memory management... |
C | #include <stdio.h>
int mdc(int n1, int n2){
int resto;
resto=n1%n2;
while(resto!=0){
n1 = n2;
n2 = resto;
resto = n1%n2;
}
return n2;
}
int inv(int n2, int n1){
int i;
for(i=0; i<n1;i++){
if((n2 * i) % n1 == 1) return i;
}
}
int main(){
int k1, k2, a,... |
C | // Read and print n marks
#include<stdio.h>
#define MARKS_LIMIT 100
void main()
{
char marksWord[] = "marks", subject[] = "subject";
int noOfMarks;
printf("How many %s %s do you want to print: ", subject, marksWord);
scanf("%d", &noOfMarks);
int marks[noOfMarks];
for(int scanMarks = 0; scanMarks < noOfMarks; scan... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int main(int argc, char *argv[]) {
int filedesc = open("text.txt", O_WRONLY | O_APPEND);
if (filedesc < 0) {
return 1;
}
int rc = fork();
if (rc < 0... |
C | #ifndef MORSE_CODE_H
#define MORSE_CODE_H
#ifdef _USING_GPP
#include <cstring>
#else
#include <string.h>
#endif
#include <stdint.h>
#define MORSE_BUFFER_LEN 5
typedef struct {
char c;
bool code[MORSE_BUFFER_LEN]; // sequence of DOTS and DASHES
uint8_t n; // how many DOTS and DASHES are needed for char c (i.e.... |
C | #include "copyright.h"
#include "yacr.h"
static NETPTR s_net_array; /* array of net data structures */
static int s_num_nets; /* size of net_array */
static NETPTR *top_list; /* list of nets on top edge of channel */
static NETPTR *bottom_list; /* list of nets on bottom edge of channel */
/*************************... |
C | #include <lcom/lcf.h>
#include <stdint.h>
int(util_get_LSB)(uint16_t val, uint8_t *lsb) {
/*
1º conversão de um valor de 16 bits para 8 ficando com os 8 menos significativos /downcasting
*/
if(lsb == NULL){
return 1;
}
else{
*lsb = (uint8_t) val;
return 0;
}
}
int(util_get_MSB)(uint16... |
C | #include "type_piece.h"
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
int type_etre_integre(type_piece type)
{
// L'enumeration designe un type integre si elle est comprise
// entre 0 et 4.
// Une enumeration etant un type non signee, il est forcement positif.
// Il suffit donc que type... |
C | // Stranded Engine
// ѧ ͨýӿ
// ˵
// ṩѧṹĻͨýṹ
// Ʒʽ
// ǿΪ̬ӿڡ
#pragma once
#include "EngineBase.h"
#include "Vector.h"
#include "Matrix.h"
STE_EXPORT_BEGIN
// Vector3
//
STE_DECLARE_INTERFACE(STEVector3Cross, void)(Vector3* out, const Vector3* v1, const Vector3* v2);
//
STE_DECLARE_INTERFACE(STEVector3Dot, float... |
C | /* Rewrite the function lower, which converts upper case letters to lower case,
* with a conditional expression instead of if-else.
*/
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
int c;
if (argc > 1) {
c = argv[1][0];
(c > 64 && c < 91) ? printf("%c\n", c + 32) :... |
C | #include "../modules/Tree/kdtree.h"
#include "../modules/Rect/rect.h"
int compare(Rect a, Rect b){
StRect *ra = (StRect *) a;
StRect *rb = (StRect *) b;
if(ra->x > rb->x){
return 1;
}
else
return -1;
}
int compareY(Rect a, Rect b){
StRect *ra = (StRect *) a;
StRect *rb = (StRect *) b;
if(ra->y > rb->y... |
C | //
// Created by black.dragon74 on 4/19/18.
// Code is poetry.
//
#include <stdio.h>
// Prime numbers are the numbers that are divisible by 1 and the number itself.
int input, count=0;
int main(){
printf("Enter the max number of the range: ");
scanf("%d", &input);
// Create a for loop that will print... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* pipex.c :+: :+: :+: ... |
C | #include <stdio.h>
// Token type
typedef enum {
TOK_IDENTIFIER = 1,
// keywords
TOK_INT = 2,
TOK_VOID = 11,
TOK_RETURN = 3,
// symbols
TOK_SEMI_COLON = 4,
TOK_OPEN_PARENT = 5,
TOK_CLOSE_PARENT = 6,
TOK_OPEN_BRACKET = 7,
TOK_CLOSE_BRACKET = 8,
// numbers
TOK_NUM = ... |
C | #include "sort.h"
/**
* heap_sort - sort array
* @array: the int array
* @size: the size of array
*
*
*/
void heap_sort(int *array, size_t size)
{
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* parser.c :+: :+: :+: ... |
C | /*
* use gcc -c nullify_ws.c
*
* set the F90 array pointer to null
*
* V702 1/17 *sh* for trac enhancement #2369 -- dynamic memory management
*
*/
#include <Python.h> /* make sure Python.h is first */
#include <stdlib.h>
#include "ferret.h"
void FORTRAN(nullify_ws)(int *ws)
/*
input - ws: Ferret ws index a... |
C | #include <stdio.h>
int main(int argc, char const *argv[])
{
char arr[6];
int i;
for(i=0; i<6; i++){
scanf(" %c", &arr[i]);
}
int cek1=0,cek2=0;
for(i=0; i<6; i++){
if(i % 2 == 0){
if(arr[i] == 'a' || arr[i] == 'i' || arr[i] == 'u' || arr[i] == 'e' || arr[i] == 'o'){
cek1++;
}else{
cek2++;
... |
C | #include <stdint.h>
#include "stm32f1xx.h"
uint32_t SystemCoreClock = 8000000;
// delay loop for 8 MHz CPU clock with optimizer enabled
void delay(uint32_t msec)
{
for (uint32_t j = 0; j < 2000UL * msec; j++)
{
__NOP();
}
}
int main(void)
{
// Enable Port C and alternate functions
SET_BIT... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int legajos[5];
int nota1[5];
int nota2[5];
float promedios[5];
char sexos[5];
int suma = 0;
for (int i = 0; i < 5;i++){
printf("Ingrese el legajo del alumno %d: ",i+1);
scanf("%d",&legajos[i]);
printf("\nIngrese l... |
C | #include <stdio.h>
int *sum(int a,int b){
static int sum;
sum=a+b;
return ∑
}
int main()
{
int n1,n2,*n3;
printf("\nEnter a number:");
scanf("%d",&n1);
printf("\nEnter a number:");
scanf("%d",&n2);
n3=sum(n1,n2);
printf("%d",*n3);
}
|
C | typedef struct flor {
char nome[11];
char id;
int qtd;
} flor;
flor estoque[5] = {
{ .nome="Rosa" , .id='R' , .qtd=0 },
{ .nome="Margarida" , .id='M' , .qtd=0 },
{ .nome="Cravo" , .id='C' , .qtd=0 },
{ .nome="Girassol" , .id='G' , .qtd=0 },
{ .nome="Hortência" , .id='H' , .qtd=0 }
};
flor es... |
C | #include<stdio.h>
#include<conio.h>
main()
{
int num1,num2;
char o;
printf("enter 2 numbers and an operator \n");
scanf("%d%d%c",&num1,&num2,&o);
fflush(stdin);
calc(num1,num2,o);
return 0;
}
calc(val1,val2,oper)
int val1,val2;
char oper;
{
switch(oper)
{
case'+':printf("%d",val1+val2);
break;
case'-':printf("%d",val1-... |
C | #include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <pthread.h>
#include <unistd.h>
#include <assert.h>
void *thread_write(void *arg) {
pthread_setcancelstate(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
int *i = (int *) arg;
char mas[1] = {'a'};
int d[2];
assert(!pipe(d));
for (*i = 0; write(d[1], mas, 1... |
C | /*Ethan Smith Nick Blasey
* pageio.c - ability to save a webpage to a file, and
* load a webpage from a file to a webpage_t
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <unistd.h>
#include <webpage.h>
#include <pageio.h>
#define NCHAR 1024
/**************** pagesave ... |
C | #include <stdio.h>
int main()
{
int set1[3], set2[3],t, c =0;
for(t= 0; t<3; t++)
scanf("%d",&set1[t]);
for(t=0; t<3; t++)
scanf("%d",&set2[t]);
int i,j;
for(j=0; j<3; j++){
for(i=0; i<3; i++){
if(set2[j] == set1[i]){
printf("%d",se... |
C | #include <stdio.h>
struct ListNode
{
int val;
struct ListNode *next;
};
struct ListNode *mergeTwoLists(struct ListNode *l1, struct ListNode *l2)
{
if (l1 == NULL)
{
return l2;
}
if (l2 == NULL)
{
return l1;
}
struct ListNode head;
head.next = NULL;
struct Li... |
C | #include<stdio.h>
#include<stdlib.h>
int main()
{
int a,b;
scanf("%d %d",&a,&b);
printf("Before swap a=%d b=%d",a,b);
a=a*b;
b=a/b;
a=a/b;
printf("\nAfter swap without a third variable a=%d b=%d",a,b);
return 0;
} |
C | #include<stdio.h>
#include<stdlib.h>
#include<malloc.h>
typedef struct
{
int min;
int max;
}*result;
int main()
{
int n,*a,i;
result b;
scanf("%d",&n);
a=(int*)malloc(n*sizeof(int));
b=(result)malloc(n*sizeof(result));
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
if(... |
C | #include<stdio.h>
#include<malloc.h>
int main()
{
int r,a[51],i,j;
printf("Enter number of elements you want(n<50):");
scanf("%d",&r);
for(i=0;i<r;i++)scanf("%d",&a[i]);
printf("Enter index of element you want to remove:");
scanf("%d",&i);
if(i<0) return 0;
if(i>r) return 0;
for(j=i-1;j<r;j++)
{
a[j]=a[j+1];
}
for(j=0;... |
C | #include <stdio.h>
#include <stdlib.h>
int main () {
/*
Inicialmente, vamos rever os 5 tipos primitivos da linguagem C:
1) char
2) int
3) float
4) double
5) void
A seguir, nós temos os 4 modificadores de tipo disponíveis:
signed - números com sinal (positivos e negativos)
unsi... |
C | #include<stdio.h>
int he(int q);
int main(){
int d,l;
int i,j,x,y,index;
int word[10][10]={0};
for(i=0;i<10;i++){
for(j=0;j<10;j++){
word[i][j]=he(j);
printf("% d ",word[i][j]);
}
printf("\n");
}
for(;;){
for(i=0;i<10;i++){
for(j=0;j<10;j++){
word[i][j]=he(j);
printf("% d ",word[i][j]);
}
printf("\n");... |
C | /*
* (c) copyright 1995 by the Vrije Universiteit, Amsterdam, The Netherlands.
* For full copyright and restrictions on use see the file COPYRIGHT in the
* top level of the Orca distribution.
*/
/* $Id: arglist.c,v 1.7 1997/04/02 09:10:23 ceriel Exp $ */
/* A R G U M E N T L I S T H A N D L I N G */
#inc... |
C | #include <stdio.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
int
main()
{
fd_set rfds;
struct timeval tv;
int retval;
//stdin (fd 0) を監視し,入力があった場合に表示する
//FD_ZERO(&rfds);
FD_SET(0, &rfds);
//5秒間監視する
tv.tv_sec = 5;
tv.tv_usec = 0;
retval = select(1, &rfd... |
C | // image_util.c : image utility functions
#include "image_util.h"
#include "stb_image.h"
#include <GL/gl.h>
#include <stdlib.h>
#include <string.h>
int image_load(const char* fname, struct image* img) {
// load
img->pixels = stbi_load(fname, &img->width, &img->height, &img->num_components, 0);
if(img->num_compone... |
C | /*******************************************************************************
Sample file: EGLIGHTPOINT.C
Objective: Shows how to create light point node records using
light point palettes (which are new in OpenFlight v15.8,
Creator/OpenFlight API v2.6).
Shows how to create light point systems contain... |
C | #include <stdio.h>
#include <stdlib.h>
#define SIZE 8
void ReadArray(int a[], int size);
void PrintArray(const int *a, int size);
void InsertionSort(int arr[], int size);
int main(void)
{
int arr[SIZE];
printf("\n enter elements of array :: ");
ReadArray(arr, SIZE);
printf("\n Elements of array before sort asc :... |
C | #include <math.h>
#include <stdio.h>
#define V_vert 35 // distance between the vertically-arranged stars [cm]
#define x_center 512 // x-direction center offset of the Wii sensor [pixels]
#define y_center 384 // y-direction center offset of the Wii sensor [pixels]
void track(unsigned int *blob){
// use... |
C | #include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#include<limits.h>
// CodeCamp.c -- EE 312 Project 1
/* Student information for project:
*
* Replace <NAME> with your name.
*
* On my honor, Osama Iqbal, this programming project is my own work
* and I have not provided this code to any other student.
*
... |
C | #include "public.h"
#include "client_proc.h"
/* 处理分析添加好友的用户请求报文 */
void doProcAddFriendRequest(MSG_DATA_S *pstClientMsg, char *pcName, int iSocket)
{
assert(pstClientMsg != NULL);
char sendName[MAX_NAME_LEN + 1];
int choice;
MSG_HEAD_S *pstHead = (MSG_HEAD_S *)pstClientMsg;
strcpy(sendName, pstHead->srcName);
... |
C | #include <pthread.h>
#include "common.h"
int g_start_thr_flag = 0;
void* process_data(void* linkinfo)
{
int ret = 0;
fd_set fds;
int maxfd = 0;
int fdcli = ((channel_t*)linkinfo)->cli.fd;
int fdsvr = ((channel_t*)linkinfo)->srv.fd;
int set_flag = 0;
channel_t conn;
memset(&conn, 0, sizeof(conn));
conn.cli.... |
C | #include "stdio.h"
#include "SDL.h"
#include "dungeon_audio.h"
int main(__attribute__((__unused__)) int argc,
__attribute__((__unused__)) char * argv[]) {
int freq;
if (SDL_Init(SDL_INIT_AUDIO) != 0) {
SDL_LogCritical(
SDL_LOG_CATEGORY_AUDIO, "SDL Init Failure!: %s", SDL_GetError()... |
C | #include <stdio.h>
int main()
{
int n=0;
size_t intsize;
intsize=sizeof(int);
printf("n=%d,n has %zd bytes:all ints have %zd bytes\n",n,sizeof n,intsize );
return 0;
} |
C | #include "holberton.h"
#include <stdio.h>
/**
*rev_string - function that prints a string, in reverse,
*followed by a new line.
*
*@s : pointer to a string.
* Return: string lenght.
*/
void rev_string(char *s)
{
int len = _strlen(s), i;
char *rev = s;
char tmp;
while (*(rev++) != '\0')
continue;
rev = rev - 2;... |
C | //
// data.c
// gbMon2
//
// Created by michael on 30.01.14.
// Copyright (c) 2014 michael. All rights reserved.
//
#include "data.h"
Temperature getTemperature(Data *this, int i){
return this->temperature[i];
}
void setTemperature(Data *this, Temperature temperature, int i){
this->temperature[i]=temper... |
C | /* ************************************************************************** */
/* */
/* :::::::: */
/* ft_clear_all.c :+: :+: ... |
C | /* does the scanner understand preprocessor directives? */
/* This file tries to fool the scanner by making "strcpy" look like a variable
instead of a function.
*/
#define STRINGCOPY strcpy
int main(int argc, char **argv)
{
char *buffer = (char *)malloc(1024);
STRINGCOPY(buffer, argv[3]);
}
voi... |
C |
/*************************************************************************
> File Name: linkqueue.c
> Author: Wenfei6316
> Mail: Wenfei6316@163.com
> Created Time: 2018年06月19日 星期二 08时01分25秒
************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#inc... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* stack.c :+: :+: :+: ... |
C | #include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
#include <signal.h>
#define MAX_SIZE 4096
typedef struct pNode
{
pid_t pid;
int prior;
char *cmd;
time_t time;
int state;
int signal;
} pNode;
typedef struct pList
{
struct pNode procList[MAX_SIZE];
int size;
} pList;
typedef pList ... |
C | #include<stdio.h>
#include<math.h>
int main(void)
{
int x,y,i,b;
scanf("%d%d",&x,&y);
if(x!=0&&y>=0){
i = 0;
do{
b=pow(x,i);
i=i+1;
}
while(i<=y);
printf("%d",b);
}
return 0;
}
|
C | /*
* atoi.c
*
* Created on: 2015. 7. 24.
* Author: Hong
*/
/*
* ڿ ٲִ Լ
*
*/
int atoi(const char *p) {
int sign = 0;
int res = 0;
while (*p == ' ' || *p == '\t' || *p == '\n' || *p == '\f' || *p == '\r'
|| *p == '\v')
p++;
if (*p == '-') {
sign = 1;
p++;
} else if (*p... |
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 | //TvvOiOۑPj file:prog1.c
#include <xc.h>
#include <pic16f1938.h>
#include "mono2020.h"
/* Ciɂ킹ĕύXj */
void main(void)
{
//NbNi16MHzj
OSCCON=0x7A;
//|[gCjVCY
portinit();
//VZOgAkdcAXebsO[^~
zenoff();
//[Jϐ`
int i=0,j=0,k=0,m=0,n=0;
//ԁiX^[gj
... |
C |
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
int main() {
pid_t pid_hijo;
printf("El pid del programa principal es %d\n", (int) getpid());
pid_hijo = fork();
if(pid_hijo!=0)
{
printf("Este es el proceso padre con ID %d\n", (int) getpid());
printf("El ID del hijo es %d\n", (int) pid_hijo);
}
... |
C | #include <stdio.h>
#include <stdlib.h>
// 4294967295
int
main(int argc,char** argv)
{
unsigned int u;
u = strtoul(argv[1],NULL,10);
printf("You unsigned int number is:%u\n",u);
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
main()
{
int n1, n2, sub;
printf("Inteiros e Subtracao\n");
printf("Digite o primeiro numero: ");
scanf("%d", &n1);
printf("\nDigite o segundo numero: ");
scanf("%d", &n2);
sub=n1-n2;
printf("\nA subtracao de %d por %d eh igual a: %d.... |
C | /*********************************************************************
*
* ANSI C Example program:
* ContWriteDigChan-PipeSampClkwHshk.c
*
* Example Category:
* DO
*
* Description:
* This examples demostrates how to interface the NI 6536/7 to a
* synchonous FIFO.
*
* Instructions for Running:
* 1. Select... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "Gen.h"
#include "Sort.h"
long quicksort(char* array,int l,int r, int t)
{
int sizeOf = 0;
for(int a = 0; *(array + a) != NULL; a++)sizeOf++;
clock_t theStart0 = clock();
int i=l, j=r;
int d;
int m=array[(l+r)/2];
... |
C | /*
** EPITECH PROJECT, 2018
** Kaminari | MyLibC - Tests | My String Length
** File description:
** Unit tests for my_strlen()
*/
#include <criterion/criterion.h>
#include "mylibc.h"
Test(__1_basic, empty_string)
{
char *str = NULL;
cr_assert(my_strlen(str) == 0);
}
Test(__1_basic, string_hello_world)
{
... |
C | //十二支を答える
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main( )
{
char buf[128],eto[32]; // 文字型配列
int yy; // 年
printf("\nあなたは西暦何生まれですか? ");
fflush(stdin);
gets(buf); // 文字列を入力し配列bufに格納
yy=atoi(buf); // 整数値に変換
switch (... |
C | #include<stdio.h>
float func(int a, int b)
{
int i,p=1,fact=1;
float temp=1,sum=0;
for(i=1;i<=a;i++)
{
fact=fact*b;
p=p*i;
temp=(float)fact/p;
sum=sum+temp;
}
return sum;
}
int main()
{
int n=0,x=0;
scanf("%d",&n);
scanf("%d",&x);
printf(... |
C | // Sourece file implementing functions for the Kalman filter
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gsl/gsl_linalg.h>
#include "kalman.h"
#include "../math/matrix_util.h"
void predict(double *x, double *P, double *F, double *Q, double *x_f, double *P_f, int x_dim)
{
/... |
C | #include <stdio.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
typedef struct{
int avance;
int veces;
char nombre[11];
}JugadorT;
typedef struct{
int comodines[5][10];
char matriz[5][10];
}TableroT;
void colocarFicha(JugadorT gam[], int turno, TableroT *tab, int *fil, int *col);
void analizarCasil... |
C | /************************************
*
*@Proposit: Implementacio d'una llista
*bidirrecional ordenada.
* Interficie modul LLISTABIORD
*@Autor: Neil Torrero Salas
*
* ***********************************/
#include "llista.h"
/**********************************************************
*
* @Finalitat: Crear informaci... |
C | // Question 6 : Write a C Program to concatenate arrays.
#include<stdio.h>
int main()
{
int arr[100];
int n;
printf("Enter Number of Elements in Array(<100) :\n");
scanf("%d", &n);
printf("Enter Elements in Array :\n");
for (int i=0;i<n;i++)
{
scanf("%d", &arr[i]);
}
i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.