language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <sys/mman.h>
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include <time.h>
#define NS_IN_SEC 1000000000L
#define PAGE_SIZE (4*1024)
#define START_ADDRESS 0x8000000
#define N_ITERATIONS 10000
void *addr;
static void handler(int sig, siginfo_t *si, void *unused)
{
// printf("Got SIGSEGV at a... |
C | #include<stdio.h>
#include<stdlib.h>
struct node{
int val;
struct node* next;
};
typedef struct node* Node;
Node Insert(Node l,int x){
Node temp = l;
Node newNode = (Node)malloc(sizeof(struct node));
newNode->val = x;
newNode->next = NULL;
if(l == NULL){
l = newNode;
//l->val = x;
//l->next = NULL;
re... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <pthread.h>
#include <semaphore.h>
#include <time.h>
void *thread()
{
// Initialize thread, load data, prepare computation
// Do some cool stuff here
pthread_exit(0);
}
int main(int argc, char *argv[])
{
int i, j, n_threads = 4;
pth... |
C | /*
* pwm.c
*/
#include "pwm.h"
// variables
static int dutyA_fd[3]; // pointers to duty cycle file descriptor
static int dutyB_fd[3]; // pointers to duty cycle file descriptor
static unsigned int period_ns[3];// one period per subsystem
static int init_flag[3] = {0,0,0};
static int mode;
// 0 for "pwmx", 1 for "p... |
C | #include<stdio.h>
void main()
{
int first=0, i,n,second=1,a;
printf("enter the number of numbers you want to see :");
scanf("%d",&n);
printf("%d\t%d ",first,second);
for( i=0;i<n-2;i++)
{
a=first+second;
printf("\t%d",a);
first= second;
second=a;
}
printf("\n\n");
} |
C | /*
* main.c
*
* Created on: ??/??/????
* Author: Sara
*/
#include"keypad.h"
#include"lcd.h"
#include"uart.h"
#include "door.h"
uint8 correct;
int main()
{
Timer_int();
uint8 key;
uint8 check_word='F';
Init_Lcd();/*initialize lcd*/
init_uart();
SET_BIT(SREG,7);/*enable global interrupt*/
send_byte(0x1... |
C | #include<stdio.h>
#include<conio.h>
int main()
{
FILE *fp1,*fp2;
fp1=fopen("C:\\Users\\Charan\\Documents\\Q.B Solution\\Source file.txt","r");
fp2=fopen("C:\\Users\\Charan\\Documents\\Q.B Solution\\Target file.txt","w");
if(fp1==NULL||fp2==NULL)
{
printf("Error in opening files.\nExiting.... |
C | /*
Write a C program to find LCM of two numbers.
source by com.adygreg
[25:11:2020]
*/
#include <stdio.h>
int lcm_finder (int n, int m) {
int lcm, max;
for (max = (m>n) ? m:n; 1; max++) {
if(max%m == 0 && max%n == 0) {
lcm = max;
break... |
C | //
// idf_map.c
// Heck
//
// Created by Mashpoe on 9/15/19.
//
#include "idf_map.h"
#include "table.h"
#include <string.h>
// calloc will set these to null
typedef struct idf_entry {
str_entry key;
void* value;
} idf_entry;
struct idf_map {
idf_entry* buckets;
int capacity;
int count;
};
idf_map* idf_map_c... |
C | // This is the struct for enemy, x and y are its screen coordinates. Pawn has 1 life, Knight has 1 life, and Queen has 3 life.
// Type = 1 is Pawn, Type = 2 is Knight, Type = 3 is Queen.
typedef struct {
int x;
int y;
int life;
int type;
}enemy;
// struct for beam, x and y are screen coordinates. Beam status - is... |
C | //Pharmicros
//Julio Milani 243876, Lucas Lameira 243875
//função de escrever no display
#include <reg51.h>
sbit RS = P3^6;
sbit E = P3^7;
void atraso_timer0_40us()
{
TMOD = 0x1; // timer 16 bits
TF0 = 0; // flag = 0
TH0 = 0xFF; // timer 74 periodos = 0x4A; FFFF-4A = FFB5
TL0 = 0xB5;
TR0 = 1; // start
while( T... |
C | /* displays the speed in feet per second ( fps ) and
in meters per second ( mps ).*/
#include <stdio.h>
double fps(int m,double s); //feet per second function
double mps(int m1,double s1); // meters per second function
int
main(void)
{
double sec1,sec2,sec3,sec4; // time input in seconds
int min1,min2,min3,min4;... |
C | #define MRAND_MAX 0x7fff
#define MULTIPLIER 0x015a4e35
#define INCREMENT 1
int ramd(int *status) {
*status=(*status)*MULTIPLIER+INCREMENT;
return ((*status) >> 16 ) & MRAND_MAX;
}
void sramd(int *status, int semilla) {
*status=semilla;
ramd(status);
} |
C | #include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <semaphore.h>
char buf[10]={0};
sem_t test1;
sem_t test2;
void *worker1() {
for ( int i = 0; i < 10; ) {
sem_wait(&test1);
scanf("%c",&buf[i]);
getchar();
i++;
i = i%10;
sem_post(&test2);
}
return NULL;
}
void *worker2() {
for (int i = ... |
C | #include <stdio.h>
#include <stdlib.h>
#define MAX 1000
typedef enum {false, true} bool;
typedef int btData;
typedef struct _btNode {
btData item;
struct _btNode *lc;
struct _btNode *rc;
} btNode;
btNode* CreateNode(btData item) {
btNode *node = (btNode *)malloc(sizeof(btNode));
node->item = ite... |
C | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <windows.h>
#include <conio.h>
#include <stdio.h>
using namespace std;
int main()
{
char str1[] = {'H', 'e', 'l', 'l', 'o', 'W', 'o', 'r', 'l', 'd'};
char str2[] = {'H', 'e', 'l', 'l', 'o', 'W', 'o', 'r', 'l', 'd'};
char symbol;
... |
C | main()
{ int arr[5],sum=0,i;
printf("enter 5 elements:");
for(i=0;i<5;i++)
scanf("%d",&arr[i]);
for(i=0;i<5;i++)
sum=sum+arr[i];
printf("sum=%d",sum);
}
|
C | #include <stdlib.h>
#include <stdio.h>
#include "sandpiles.h"
/**
* sandpiles_sum - S
* @grid1: Left 3x3 grid
* @grid2: Right 3x3 grid
*
*/
void sandpiles_sum(int grid1[3][3], int grid2[3][3])
{
int x, y;
/* First add two grids together */
for (x = 0; x < 3; x++)
{
for (y = 0; y < 3; y++)
{
grid1[x][... |
C | //
// main.c
// OS_vize1
//
// Created by Tuğba Özkal on 8.03.2017.
// Copyright © 2017 Tuğba Özkal. All rights reserved.
//
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/wait.h>
int t1;
int main (void) {
int i, f;
int t2, *t3;
t1 = 1;
for (i = 0; i < 2; i++) {
... |
C | #include <stdlib.h>
#include <printf.h>
#include "ThreadBarrier.h"
void ThreadBarrier_Init(ThreadBarrier* const me)
{
me->currentCount = 0;
me->expectedCount = 3;
me->mutex = OSSemaphore_Create();
me->barrier = OSSemaphore_Create();
if (me->barrier) {
OSSemaphore_lock(me->barrier);
... |
C | /* VFD control program. (c) 2013 David Wegmuller
*
* This is part of Pandora Pi-box: a minimalist hardware Pandora client.
*
* Reads text from a file and displays it on the upper line
* of the VFD. If the resulting text is longer than 20 characters,
* it is scrolled.
* The bottom line displays static text that ... |
C | #include<stdlib.h>
#include<stdio.h>
#include<omp.h>
int main (int argc, const char * argv[]) {
const int intervalo = 5000;
double starttime, stoptime;
int i,j,k;
int prime;
int total;
starttime = omp_get_wtime();
omp_set_num_threads(8);
#pragma omp parallel... |
C | #include<stdio.h>
#define INF 9999
#define MAX 25
void dijkstra(int G[MAX][MAX],int n,int start);
int main()
{
int i,j,n,k,u,G[MAX][MAX],c=0;
printf("Enter no. of vertices:");
scanf("%d",&n);
FILE *f;
printf("\nEnter the adj matrix:\n");
f=fopen("sfafaw.txt","r");
for(i=0;i... |
C | #include"stdio.h"
int main()
{
int i,j;
while(scanf("%d%d",&i,&j)!=EOF)
{
if((i+j)%86==0)
printf("yes\n");
else
printf("no\n");
}}
|
C | //
// Created by Akigaze on 10/11/2020.
//
#include <stdio.h>
int main() {
char ex[] = "how are you";
printf("ex = %s \n", ex);
// 使用指针来保存字符串
char *arr[] = {"good", "nice", "beautiful", "outstanding"};
// 等价与
// char arr[4][20] = {"good", "nice", "beautiful", "outstanding"};
for (int i = 0... |
C | #include <omp.h>
#include <stdio.h>
#include <stdlib.h>
/*
The exercise was about taking written serial code for
numerical integral computing and making it parallel
with a 'parallel for' construct. The main purpose of the
task itself was to use instructions covered in two previous
lessons of... |
C | #include <stdio.h>
#include <stdlib.h>
// assume pointer is 4 bytes in size
//
int a[5] = {3, 1, 4, 1, 5}; // assume &a = 0x1000
int *b[3] = { &a[0], &a[2], &a[4]}; // assume &b = 0x2000
int** c = &b[1]; // assume &c = 0x3000
int d = 0; // assume &d = 0x4000
/*
* a 0x100... |
C | #include <stdio.h>
#include <stdlib.h>
int funcao_maior_ponteiro(int a,int b,int c)
{
int *p,*p2,*p3;
p=a;
p2=b;
p3=c;
printf("%p %p %p",a,b,c);
}
int main()
{
int *p , i;//*(asterisco)p declara a variavel
printf("Digite um valor \n");
scanf("%d", &i);
p = &i; // aponta o ponteiro do valor de i=4 ... |
C | #ifndef STRUCT
#define STRUCT
/**
*\struct t_direction
*\brief Enumeration contenant les quatres directions possibles lors d'un placement d'une porte
*\struct t_case
*\brief Enumeration contenant tous les items possibles dans une case de la matrice(items et decors)
*\struct t_coord
*\brief Structure ... |
C | #include<stdio.h>
#include<conio.h>
#include<stdlib.h>
struct Node {
char data;
struct Node *next;
};
struct Node *start=NULL,*last=NULL,*fresh=NULL;
void writetoFile(){
FILE *fptr;
fptr = fopen("text.txt","w");
for(fresh=start;fresh!=NULL;fresh=fresh->next){
fprintf(fptr,"%c",fresh->data);
}
fclose... |
C | #include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/slab.h>
#define tamanyo_bloque 5000
#define max_bloques 10
#define DEVICE_NAME "servidor"
#define SUCCESS 0
MODULE_LICENSE("GPL");
static char* puntero; // Puntero a la zona de memoria reservada
static int num_bl... |
C | #include<iostream>
using namespace std;
class A
{
public:
int add(int x, int y)
{
return x+y;
}
int add(int x, int y)
{
return x+y+10;
}
int add(int x, int y, int z)
{
return x+y+z;
}
};
int main()
{
A a;
cout<<a.add(10,20)<<endl;
cout<<a.add(10,20,30)<<endl;
return 0;
}
|
C | int printf(const char*,...);
void main(){
int arr[4][4]={1, 2 ,3 ,4 ,5 ,6 ,7 ,8 ,9 ,10 ,11 ,12 ,13 ,14 ,15 ,16};
for(int i=0; i<4 ; i++){
for(int j=0; j<4 ;j++)
printf("%d ",arr[i][j]);
printf("\n");
}
}
|
C | #pragma once
#include "List.h"
List* CreateList()
{
List* list = (List*)malloc(sizeof(List));
list->front = NULL;
list->back = NULL;
list->elements = 0;
return list;
}
ListNode* CreateListNode()
{
ListNode* node = (ListNode*)malloc(sizeof(ListNode));
node->data = NULL;
node->prev = NULL;
node->next = NULL;... |
C | #include <stdio.h>
char *fun(char *dest,const char *src,int n)
{
int i = 0;
for(i = 0;i < n && src[i] != '\0';i++)
dest[i] = src[i];
for(;i < n;i++)
dest[i] = '\0';
return dest;
}
int main(int argc,char *argv[])
{
char *s = "hello world";
char buf[64];
fun(buf,s,12);
p... |
C | //
// stulist.c
// JStudentManager
//
// Created by James Swineson on 1/5/16.
// Copyright © 2016 James Swineson. All rights reserved.
//
#include "stulist.h"
#include "common.h"
#include "studentdb.h"
#include "list.h"
#include "model.h"
/*
> tree -F --comments
...
|-- kernels/ Precompiled Linux... |
C | // temp refers to temperature not temporary as usually the case in code
const int tempFlashInterval = 500; // Flash interval in milliseconds
const int tempWidth = 6; // Width of flashing area in pixels
int tempLastFlash = 0; // Store last time flash was on
int tempFlash = false; // Ini... |
C | //
// Code to print all possible board configurations resulted when both player plays optimally
// Project : tit-tac-toe LCS
//
// Created by PUSHPENDU GHOSH on 18/11/2017.
// Duration : 10 days
// Copyright © 2017 PUSHPENDU. All rights reserved.
//
#include <stdio.h>
//returns exp to remove dependency on math.h... |
C | // write a function 'expand(s1,s2) that exands shorthand notations
// like a-z in the string s1 into the equivalent complete list abc...xyz
// in s2. allow for letters of either case and digits, and be prepared to handle
// cases like a-b-c and a-z0-9 and -a-z. Arrange that a leading or trailing
// - is taken literal... |
C | #include<stdio.h>
#define IN 1 //inside a word
#define OUT 0 //outside a word
//count lines ,words,and characters in input
int main()
{
int c,nl,nw,nc,state;
state=OUT;
nl=nw=nc=0;
while((c=getchar())!=EOF)
{
++nc;
if(c=='\n')
++nl;
if(c==' '||c=='\n'||c=='\t')
state=OUT;
else if(state==OUT)
{
state=... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <sys/sendfile.h>
#include <math.h>
void error(const char *msg)
{
perror(msg);
exit(1);
}
int main(int argc, char *argv[])
{
soc... |
C | #define RAM_GB 16ULL
#define SIZE ((RAM_GB+4ULL) * 1024ULL * 1024ULL * 1024ULL)
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <libkern/OSAtomic.h>
#include <mach/mach.h>
#in... |
C | #include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
int main()
{char c;
int in,out;
in = open("file.in",O_RDONLY);
out = open("file.out",O_WRONLY|O_CREAT,S_IRUSR|S_IWUSR);
while (read(in,&c,1) == 1)
write (out,&c,1);
exit(0);}
|
C | #include <stdio.h>
int flag_invalid_input = 0;
int equal(double num1,double num2)
{
if((num1 - num2 < 0.0000001) && (num1 - num2 > -0.0000001))
return 1;
else
return 0;
}
double power_rec(double base,unsigned int exponent_value)
{
double result;
if(exponent_value == 0)
return 1... |
C | /* Area: ffi_call
Purpose: Check structures.
Limitations: none.
PR: none.
Originator: From the original ffitest.c */
/* { dg-do run } */
#include "ffitest.h"
typedef struct
{
unsigned char uc;
double d;
unsigned int ui;
} test_structure_1;
static test_structure_1 ABI_ATTR struct1(test_structure_1... |
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int s = 0;
int point = 0;
int poppoint = 1;
int arr[10000000] = { 0 };
void push(int x) {
point++;
s++;
arr[point] = x;
return printf("%d\n", x);
}
void pop() {
if (arr[poppoint] == NULL){
return printf("-1\n");
}
printf("%d\n", arr[poppoint]);
return poppo... |
C | #include "../headers/serv_recept.h"
/** Read continuously reception pipe, verify the member authorisation.
* Display it to the chanel he is registered.
*/
static struct sigaction newClient;
extern struct sigaction endProg;
/**
* En cas d'erreur ou fin de programme serv_recep
*/
void exitRecep(int status) {
if... |
C | /*!
* KeyOut除自己低电平,其他Out是高电平。
* 读取KeyIn,若是低电平代表按下,高电平代表弹起。
*/
#include <reg52.h>
sbit ADDR0 = P1^0;
sbit ADDR1 = P1^1;
sbit ADDR2 = P1^2;
sbit ADDR3 = P1^3;
sbit ENLED = P1^4;
//键盘按下是低电平
sbit KEY4 = P2^7;
void main()
{
ENLED = 0;
ADDR3 = 1;
ADDR2 = 1;
ADDR1 = 1;
ADDR0 = 0;
P2 = 0xF7; //1111 0111 Ke... |
C | /* INFO **
** INFO */
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* Include standard headers */
#include <stdlib.h>
/* func : malloc
free
exit
const : EXIT_SUCCESS */
#include <stdbool.h>
/* type : bool
const : true
false */
/*- - -... |
C | #include <stdio.h>
#include <string.h>
#define max_char 5
#define max_struct 200
typedef struct
{
char andata[max_char];
char ritorno[max_char];
} voli;
int load_data(voli[], FILE *, int *);
void tratte_andata_ritorno(voli[], int, voli[], int *);
void visualizza_tratte(voli[], int);
int main()
{
FILE *... |
C | #include <stdlib.h>
#include <sys/time.h>
#include <stdio.h>
#include <math.h>
#include <cuda_runtime.h>
#include "cublas_v2.h"
// compile as:
// export PATH=$PATH:/usr/local/cuda/bin
// nvcc cudaBlasExample.c -I/usr/local/cuda/include -lcublas -o cudaBlasExample
double read_timer() {
struct timeval end;
gettim... |
C | #include <stdio.h>
int main(int argc, char *argv[])
{
int num;
printf("请输入num:");
scanf("%d",&num);
//1.switch是关键字,switch()后没有冒号;
//2.switch()中的()中只能放整型变量或字符型变量;
//3.switch用法类似于电梯模型
switch (num) {
case 1:
printf("我按下了一楼\n");
break;
case 2:
printf("我按下了二楼\n");
break;
case 3:
printf("我按下了三楼... |
C | #include <stdio.h>
int main(void)
{
int a = 1;
while (1) {
if (a--) {
printf("In if statement\n");
} else {
printf("In else statement\n");
break;
}
}
return 0;
}
|
C | #include <stdio.h>
int main(){
int i, grades[3];
float average = 0.0;
for(i=0; i<3; i++){
printf("Enter grade %d: ", i+1);
scanf("%d", &grades[i]);
}
printf("The grades are: \n");
for(i=0, i<3, i++){
sum += grades[i];
}
average = sum/3;
printf("The average is: %.2f");
if ()
}
|
C | #include<stdio.h>
#include<conio.h>
int main()
{
int fahr;
for (fahr = 0; fahr <= 300; fahr+=20)
printf("%3d %6.1f\n", fahr, (5.0 / 9.0) * (fahr - 32));
getch();
return 0;
} |
C | /*-------------------------------------------------------------------
**
** Fichero:
** lab2.c 24/2/2015
**
** (c) J.M. Mendias
** Programacin de Sistemas y Dispositivos
** Facultad de Informtica. Universidad Complutense de Madrid
**
** Propsito:
** Test del laboratorio 2
**
** Notas de d... |
C | #include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <sys/time.h>
#include <unistd.h>
extern unsigned int n_objets;
extern unsigned int capacite;
extern int* tableau_poids;
void next_fit(int* tab_objets) {
/*
Structure de temps - nécessaire au calcul du temps de l'algorithme
*/
struct timeval ti... |
C | #include <stdio.h>
int main()
{
int arr[4] = {1,2,3,4};
int* ptr1 = (int*)(&arr + 1);
int* ptr2 = (arr + 1);
printf("%x %x\n",ptr1[-1], *ptr2);
return 0;
}
|
C | #include <stdint.h>
#include "adc.h"
#include "gpio.h"
#include "joystick.h"
#include "lpc40xx.h"
#include "lpc_peripherals.h"
#include "stdio.h"
// Public
void joystick__initialize(gpio_s joystick__x_axis, gpio_s joystick__y_axis, gpio_s joystick__switch) {
adc__initialize();
gpio__construct_with_function(joys... |
C | #include <stdio.h>
#include "queue.h"
struct test {
int a;
char b;
};
int main(){
struct test testData1 = {1, 'a'};
Queue q;
Queue * pq = &q;
QueueInit(pq);
QueueAdd(pq, &testData1);
printf("Queue size is %d\n", QueueCount(pq));
struct test * testPopData = QueuePop(pq);
printf("Q... |
C | // http://rosettacode.org/wiki/K-means%2B%2B_clustering#C
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
typedef struct { double x, y; int group; } point_t, *point;
double randf(double m)
{
return m * rand() / (RAND_MAX - 1.);
}
point gen_xy(int count, double radius)
{
double ang, r;
point p, pt = ma... |
C | #include <stdlib.h>
#include "cmsis_os2.h"
#include "hal_system.h"
#include "delay.h"
#include "random.h"
// Configures random number generator.
// WARNING: This function called prior to RTOS initialization.
void random_init(void)
{
uint32_t seed;
// Enable random number generator clock source.
LL_... |
C |
//8ʺ(һ)
#include <stdio.h>
#include <stdlib.h>
int col[8]={0};//¼е
int left[15]={0};//б
int right[15]={0};//б
int Q[8]={0};
void Queen()
{
int i=0;
int top=-1;
int j=0;
while(top!=7)
{
for(;j<8;j++)
{
if(!col[j] && !left[i+j] && !right[7+i-j])//ԷŻʺ
{
Q[++top]=j;
col[j]=left[i+j]=right[7+i-... |
C | /******************************************************************************
** COPYRIGHT NOTICE
** (c) 2012 The Johns Hopkins University Applied Physics Laboratory
** All rights reserved.
*********************************************************************... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
/**
Implement Queue using Linked List.
*/
struct QueueNode {
int val;
struct QueueNode *next;
};
struct Queue{
int size;
struct QueueNode *front;
struct QueueNode *tail;
};
void push(struct Queue *queue, int new_... |
C | #include "holberton.h"
/**
* print_number - print a number
* @n: The number
*
* Return: 0 or 1
* On error, -1 is returned, and errno is set appropriately.
*/
void print_number(int n)
{
int count, n2, num2;
int div;
int num3;
n2 = n;
count = 0;
while (n2 != 0)
{
n2 = n2 / 10;
count++;
}
div = 1;
for (n... |
C | /* Program 1.15 Prgram 1.12 with count statements added */
float rsum(float list[], int n)
{
count++; /* for if conditional */
if (n) {
count++; /* for return and rsum invcation */
return rsum(list, n - 1) + list[n - 1];
}
count++;
return list[0];
} |
C | /** ADAMEm: Coleco ADAM emulator ********************************************/
/** **/
/** Unix.c **/
/** **/
/** ... |
C | #ifndef _SEPOL_PORTS_H_
#define _SEPOL_PORTS_H_
#include <sepol/handle.h>
#include <sepol/policydb.h>
#include <sepol/port_record.h>
/* Return the number of ports */
extern int sepol_port_count(sepol_handle_t * handle,
const sepol_policydb_t * p, unsigned int *response);
/* Check if a port exists */
extern in... |
C | /*
* ehz.c
*
* Created on: Aug 2, 2012
* Author: huy
*/
#include "LPC17xx.h"
#include "sensors.h"
SENSOR_DATA sensor_data[MAX_SENSORS];
void init_sensors() {
uint8_t i=0;
for (; i < MAX_SENSORS; i++) {
sensor_data[i].id = i;
sensor_data[i].address = 0;
sensor_data[i].enabled = 0;
sensor_data[i].... |
C | /*
* LCD_Draw.h
*
* Created: 3/26/2013 5:51:24 PM
* Author: mfolz
This Library currently work with the SSD1289, ST7735 and ST7735R -- Will be adding more libraries soon
-----------------------------------------------------------------
color:
- Before you use any of the functions from this library use the... |
C | /*
_chosen_animal.c
Lets the Beast Master choose an animal type to focus on.
-- Tlaloc --
*/
#include <std.h>
#include <daemons.h>
#include <dirs.h>
inherit FEAT;
string *valid_types = ({ "ape", "badger", "bear", "bird", "boar", "camel", "cheetah", "crocodile", "dinosaur", "dog", "horse", "lion", "snake"... |
C |
#include "OLED.h"
#include "OLEDfont.h"
#include "bsp_i2c.h"
#include "stdlib.h"
#include "bsp_SysTick.h"
#define I2C1_OWN_ADDRESS7 0x0A
#define OLED_Address 0x78
//I2Cд
void Write_OLED_Command(uint8_t Command)
{
I2C_Start();
I2C_SendByte(OLED_Address);
I2C_WaitAck();
I2C_SendByte(0x00);
... |
C | #include<stdio.h>
int main()
{
int a=(-1<1)?1:0;
int b=(-1<1u)?1:0;
printf("the result of -1<1 is %d\n",a);
printf("the result of -1<1u is %d\n",b);
return 0;
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strnstr.c :+: :+: :+: ... |
C | #include <unistd.h>
#include <stdio.h>
#include <pthread.h>
#include <assert.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glu.h>
#include "object_list.h"
#include "spaceship.h"
#include <stdlib.h>
#include <time.h>
#include "constants.h"
#include "asteroid.h"
#include "bullet.h"
#include "main.h"
pthread_m... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define STACK_SIZE 10
struct stack {
int top;
char *p;
int size;//p所指向的内存大小
};
int init_element(struct stack *x)
{
x->p = malloc(x->size * sizeof(char));
if(x->p == NULL)
{
return 0;
}
else
{
return 1;
}
}
int stack_empty(struct stack *s)
{
... |
C | #include "estk.h"
#include <math.h>
//=============================================================================
// Matrices
//=============================================================================
esVec3f esMat3f_MulVec3f(const esMat3f *m, esVec3f v) {
return (esVec3f) {
v.x*m->mat[0] + v.y*m->mat[3] + ... |
C | #include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include <string.h>
/*Set BAUD for your communication port*/
#define BAUD 9600
/*Set current ambient temperature value
for calibration. If calibration is not necessary,
you can ignore this value and leave unchanged*/
#define ... |
C | #include <stdio.h>
#include "divisors.h"
int generateDivisors(unsigned long int num, FILE * file)
{
unsigned long int i = 1;
for (i; i<=num; i++) {
if (num % i == 0) {
fprintf(file, "%ld\n", i);
}
}
return 0;
}
|
C | /**
* dynamic_allocation_memory.c
* @author bulbasaur
* @description
* @created 2020-04-28T11:35:16.586Z+08:00
* @copyright None
* None
* @last-modified 2020-04-28T11:46:05.417Z+08:00
*/
#include <stdio.h>
// Use malloc to import the library
#include <stdlib.h>
int main() {
int number;
int *a;
int i;
... |
C | #include "L3_TCP.h"
const void * L3_TCP(const void * vpdata , unsigned int * UI_NEXT , unsigned int * TCP_HD)
{
const struct tcphdr *stp_TCP = vpdata;
printf("-------------------------------------------\n");
printf(" -------- TCP Header --------\n");
printf("-------------------------------------------\n");
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* multiline_mng.c :+: :+: :+: ... |
C | #include "Usart.h"
UART_HandleTypeDef UART_Initure;
UART_HandleTypeDef UART_TwoIniture;
/********************************************************
* :һPrintض
* :
* ֵ:
* ˵ :
*****************************************************... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_validation.c :+: :+: :+: ... |
C | /* mpfr_grandom (rop1, rop2, state, rnd_mode) -- Generate up to two
pseudorandom real numbers according to a standard normal Gaussian
distribution and round it to the precision of rop1, rop2 according
to the given rounding mode.
Copyright 2011-2019 Free Software Foundation, Inc.
Contributed by the AriC and Ca... |
C | #include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "lists.h"
/**
* delete_nodeint_at_index - Write a function that deletes
* the node at the index index of a listint_t linked list
* @head: head of list
* @index: index is the index of the node that should
* be deleted. Index starts at 0.
* Return... |
C | /*
This file contains the following Physics
distBall(Ball*, Ball*)
normBall(Ball*, Ball*)
magForce(Ball*)
ForceSprings()
SurfaceForce()
updateBrownian(Ball &)
updatePosition(all &)
LJforce(r, sig)
zSurface(x, y)
ParticleInteraction()
*/
float distBall(Ball *b1, Ball *b2) {
... |
C | //
// main.c
// gcd
//
// Created by Alvin Tan De Jun on 25/1/20.
// Copyright © 2020 Alvin Tan De Jun. All rights reserved.
//
#include <stdio.h>
int gcd1(int num1, int num2);
void gcd2(int num1, int num2, int *result);
int main() {
int x,y,result=-1;
printf("Enter 2 numbers: \n");
scanf("%d %d... |
C | #include "main.h"
#include "hid.h"
#include "descriptors.h"
#include "mapping.h"
void registers_to_report(uint8_t *report) {
const uint8_t num_registers = 7;
uint8_t *mapping;
if (kb_Data[2] & kb_Alpha) {
mapping = SCAN_CODES_ALPHA;
} else if (kb_Data[1] & kb_2nd) {
mapping = SCAN_CO... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
**/
int main()
{
int N; // the number of temperatures to analyse
scanf("%d", &N); fgetc(stdin);
char TEMPS[256];... |
C | /**
* First, we'll have the parent make a pipe. Secondly, we'll fork().
* Now, the fork() man page tells us that the child will receive a
* copy of all the parent's file descriptors, and this includes a
* copy of the pipe's file descriptors.
* the child will be able to send stuff to the write-end of the pipe, and the... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "graph.h"
#include "../welsh_powell/welsh_powell.h"
#include "../greedy/greedy.h"
void free_graph(T_Graph *graph) {
for (int i = 0; i < graph->nb_vertex; i++) {
free(graph->matrix[i]);
}
free(graph-... |
C | //
// getchTest.c
// output
//
// Created by Kyle Ngo on 5/20/18.
// Copyright © 2018 Kyle Ngo. All rights reserved.
//
#include <stdio.h>
#include "../header.h"
int main() {
int input;
while ((input = getch()) != EOF) {
putchar(input);
if (input == 'e') {
for (int i = 0; ... |
C | #include "shared_Memory.h"
#include "shared_Memory.c"
int main(int argc, char const *argv[])
{
char *bloque = atar_bloque_Memoria();
if (bloque == NULL)
{
printf("Error al crear el bloque");
return 1;
}
printf("Escribiendo: \"%s\"\n",argv[1]);
strncpy(bloque,argv[1], B_SIZE);
... |
C | #include<stdio.h>
void swap(int *a, int *b)
{
int t;
t=*a;
*a=*b;
*b=t;
}
int partition(int a[],int low,int high)
{
int pivot=a[high];
int j, i=low-1;
for(j=low;j<high;j++)
if(a[j]>=pivot)
{
i++;
swap(&a[i],&a[j]);
}
swap(&a[i+1],&a[high]);
return(i+1);
}
void quicksort(int a[],int low,int high)
{... |
C | #include "keypad.h"
void kpInit(Keypad* obj)
{
int nr = sizeof(obj->rows) / sizeof(ioline_t),
nc = sizeof(obj->cols) / sizeof(ioline_t);
for(int i = 0; i < nr; i++)
palSetLineMode(obj->rows[i], PAL_MODE_OUTPUT_PUSHPULL);
for(int j = 0; j < nc; j++)
palSetLineMode(obj->cols[j], PAL_MODE_INPUT_PU... |
C | #include<stdio.h>
void find__smallest(int a[], int n, int *smallest);
int main(){
int a[100];
int s,element,i;
printf("How many elements you want to store (n)? ");
scanf("%d",&element);
for(i=0; i<element; i++)
{
printf("Enter a value to be stored: ");
scanf("%d",&a[i]);
}
find__smallest(a,element,... |
C | /*
Library for talking to BT Caller ID device over serial port
Copyright (C) 2013 Nicholas J Humfrey <njh@aelius.com>
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 versio... |
C | #include <ncurses.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
#include "headers/screen.h"
#include "headers/employee.h"
#include "headers/window.h"
#include "headers/menu.h"
#include "headers/utils.h"
const char SEARCH_LABEL[] = "Search by ID, First and/or Last name:";
const char* CREATE_LABELS[] ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.