language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h> // for read, write, close
//#include <linux/ioctl.h> // for _IORD _IOWR
//#define MY_MACIG 'G'
#define MY_MACIG ']'
#define READ_IOCTL _IOR(MY_MACIG, 0, int)
#define WRITE_IOCTL _IOW(MY_MACIG, 1, int)
int main(){
char buf[200];
int fd... |
C | #ifndef COLOR_H_
#define COLOR_H_
struct Color {
float r, g, b;
Color() : r(0), g(0), b(0) {}
Color(float _r, float _g, float _b) : r(_r), g(_g), b(_b) {}
Color operator+(const Color& c) const { return Color(r+c.r, g+c.g, b+c.b); }
Color operator*(float f) const { return Color(r*f, g*f, b*... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{ int a[26]={0};
char s[1001];
fgets(s,1001,stdin);
int i=0,j=0;
while(s[j]!='\0')
{ if(s[j]>='a'&&s[j]<='z')
{i=s[j] - 'a';
a[i]++;}
if(s[j]>='A'&&s[j]<='Z')
{i=s[j] - 'A';
a[i]++;}
j++;
}
for(i=0;i<26;i++)
{ if(a[i]!=0)
{ printf("%c - ", 'a'+i);
printf("%d \n", a[i])... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int i,a,b,hasil;
printf("====Bentuk Iteratif====\n\n");
printf("Masukkan angka : ");
scanf("%d", &a);
printf("Masukkan pangkat : ");
scanf("%d", &b);
for (i=1; i<=b; i++)
hasil =hasil*a;
printf("Hasil dari %d pangkat %d = %d\n", a,b,hasil);
return 0;
}... |
C | #include "colors.h"
#include <stdio.h>
#include <stdlib.h>
#include <omp.h>
int main(int argc, char *argcv[]){
int iam = 0, np = 1;
int p = atoi(argcv[1]);
int datos[100];
int i = 0, j = 0;
#pragma omp parallel num_threads(p) private(iam, np, i) shared(j)
{
#if defined(_OPENMP)
np ... |
C | /*
* UART.c
*
* Created on: Feb 21, 2019
* Author: ryanjl9, Ben Pierre, Anthony Rosenhamer
*
*/
#include <UART.h>
#include <MOVEMENT.h>
#include <lcd.h>
#include <final.h>
#define BIT0 0x01
#define BIT1 0x02
#define BIT2 0x04
#define BIT3 0x08
#define BIT4 0x10
#define B... |
C | #include <stdio.h>
#include <stdlib.h>
unsigned int fibo[51] = { 0, };
void InitFibo(void)
{
fibo[0] = 0;
fibo[1] = 1;
for (int i = 2; i < 51; ++i)
{
fibo[i] = fibo[i - 1] + fibo[i - 2];
}
}
void Print(int num)
{
if (num < 3)
{
printf("Error!");
return;
}
f... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* apply_char_bonus.c :+: :+: :+: ... |
C | #include<stdio.h>
int main()
{
int a,b=0;
scanf("%d",&a);
while(a!=0)
{
a/=10;
b++;
}
printf("%d",b);
return 0;
}
|
C | #include<stdio.h> //printf
#include<string.h> //strlen
#include<stdlib.h>
#include<sys/socket.h> //socket
#include<arpa/inet.h> //inet_addr
#include<unistd.h>
#define SERV "\x1B[35m"
#define CLIENT "\x1B[36m"
#define RESET "\033[0m"
int readline(int, char *, int);
int main(int argc , char *argv[])
{
... |
C | /* chapter 03 exercise */
#include <stdio.h>
int main()
{
/* data type size */
printf("data type size\n");
printf("int size is %d Bytes\n\n", sizeof(int));
printf("short size is %d Bytes\n\n", sizeof(short));
printf("long size is %d Bytes\n\n", sizeof(long));
printf("long long size ... |
C | #ifndef FILE_H
#define FILE_H
#include <stdio.h>
#include <stdlib.h>
typedef struct queue_cell {
void* x;
struct queue_cell* next;
struct queue_cell* prev;
} queue_cell;
typedef struct queue {
queue_cell* head;
queue_cell* tail;
int size;
} queue;
/**
* @brief Create a Queue object FILO
*... |
C | // Dijkstra ADT interface for Ass2 (COMP2521)
#include "Dijkstra.h"
#include "PQ.h"
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
// helper functions
#include <limits.h>
static void deletePreviousPredNodesOfVertex(ShortestPaths* paths, Vertex v) {
for (PredNode* node = paths->pred[v], *nextNode; node !=... |
C | #include <stdio.h>
int y = 5; // in Global space-> outside of main
int main(){
// C is white space insensitive
printf("\tHello World\n \t!!!\n");
/*
This is amulti line comment
*/
printf("\t numbers %d %c %f \n",5,'h',2.5); //these are format specifiers
double x2 = 2.0; // can force data types also-> ... |
C | #include <pthread.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
/* Compile: gcc thread-dekker.c -o thread-dek.out -lpthread */
volatile int s = 0;
volatile int order = 0;
volatile int interest[2] = {0, 0};
void* fthread0(void* v) {
int i;
for (i = 0; i < 4; ++i) {
interest[0] = 1; // Indica int... |
C | #include <stdio.h>
#include <stdlib.h>
void hanio(int,char,char,char);
int main(void){
while(1){
int n;
scanf("%d",&n);
hanoi(n,'A','B','C');
}
system("pause");
return 0;
}
void hanoi(int n, char A, char B, char C){
if(n==1){
printf("move sheet from %c to %c\n",A,C);
}
else{
hanoi(n-1,A,C,B);
hanoi... |
C | #include "../include/mnblas.h"
#include "../include/complexe2.h"
#include <stdlib.h>
#include <stdio.h>
/*
* 2 FLOP
*/
void mnblas_saxpy(const int N, const float alpha, const float *X, const int incX, float *Y, const int incY)
{
unsigned int i = 0;
//on part du postulat que incX = incY
/// register unsigned int ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* move_s.c :+: :+: :+: ... |
C | /* Routines for parsing arguments */
#include <stdlib.h>
#include <ctype.h>
#include "db.h"
#include "config.h"
#include "match.h"
#include "externs.h"
#define DOWNCASE(x) (isupper(x) ? tolower(x) : (x))
static dbref exact_match = NOTHING; /* holds result of exact match */
static int check_keys = 0; /*... |
C | #include <stdio.h>
unsigned int dim_right(unsigned int w){
return w^(w&-w);}
unsigned int dim_left(unsigned int w){
unsigned int pos = 0, c = w;
while (c>0){
c/=2;
pos++;}
return w^(1<<(pos-1));}
unsigned int flip(unsigned int w, unsigned int f){
if ((w|1<<f)!=w)
return (w... |
C | #include<stdio.h>
#include<unistd.h>
#define CHUNK 65536
int main(int argc, char **argv) {
if (argc != 2) {
printf("xor_e2 {filename}\n");
return -1;
}
FILE *fd;
unsigned char d[CHUNK];
fd = fopen(argv[1], "r+");
unsigned int i, xz_read;
while((xz_read = fread(&d, sizeof(char), CHUNK, fd)) == CHUN... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main_ls.c :+: :+: :+: ... |
C | #include <stdio.h>
#include "sqlite3.c"
#include <time.h>
#include <stdlib.h>
static int callback(void *NotUsed, int argc, char **argv, char **azColName) {
int i;
for(i = 0; i<argc; i++) {
printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
}
printf("\n");
return 0;
}
i... |
C | #include <stdio.h>
#include <assert.h>
#include "ArrayList.h"
void ListInit(Array* array)
{
array->length = 0;
array->curPosition = -1;
}
void LInsert(Array* array, LData data)
{
assert(array->length < LIST_LEN);
array->arr[array->length++] = data;
}
int LFirst(Array* array, LData* pdata)
{
if (array->length ... |
C | #include "tree.h"
#include "visualtree.h"
#include <stdio.h>
#include <assert.h>
#include <time.h>
int main(){
/*node *t = scan_tree();
int i;
for( i = 0; i < 100; i++){
if (find_bst(t,i)){
printf("%d ", i);
}
}
printf("\n");
write_tree(t);
t = insert_bst(t, 2);... |
C | #include<stdio.h>
int main()
{
char ch;
printf("enter the character");
scanf("%c",ch);
int lowercasevowel,uppercasevowel;
lowercasevowel=(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')
uppercasevowel=(ch=='A'||ch=='E'||ch==I||ch=='O'||ch=='U')
if(lowercasevowel||uppercasevowel)
{
printf("%c is a vowel",c);
}
e... |
C | /******************************************************
* DSA Lab Test 2: Problem 1 (tree.h)
*
* Do not edit this file.
* ****************************************************/
#include <stdbool.h>
#ifndef TREE_H_INCLUDED
#define TREE_H_INCLUDED
struct _tnode
{
unsigned int d... |
C | /*Задача 2. Дефинирайте и инициализирайте двумерен масив с по 5
елемента (5 x 5). След като сте готови, направете въвеждане на данните в
масива, като четете от потребителя със scanf. */
#include <stdio.h>
int main(void)
{
int matrix[5][5];
int i, j;
for (i = 0; i < 5; i++)
{
for (j = 0... |
C | #include "structs.h"
#include "functions.h"
#include <math.h>
#include <time.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct euc_vec{
float *vector; //array of random coordinates
float t;
};
struct Node{
char name[12];
int visited;
int center; //cluster which belongs to
int cent... |
C | #include <stdio.h>
#include <string.h>
#define MAX 999
#define MIN 100
int itostr(int n, int str[]);
int isPalindrome(int str[], int length);
int main(void) {
int a, b, largest = 0, pdt, length;
int pdt_str[15];
for (a = MAX; a >= MIN; a--) {
for (b = MAX; b >= MIN; b--) {
pdt = a*b;
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "zend_hash.h"
int main(int argc, char **argv) {
HashTable ht;
HashPosition pos;
char *str_key, *str_val;
ulong num_key;
uint str_key_len;
int key_type;
zend_hash_init(&ht, 2, NULL);
zend_hash_add(&ht, "aaa", 3, "1111111111111111", 0, NULL);
... |
C | #include <stdio.h>
#include <string.h>
int main()
{
char text[100], ch;
int type, key, i=0, length;
printf("Enter the text: ");
gets(text);
printf("Chose an option: \n");
printf("0 - Encrypt \n");
printf("1 - Decrypt \n");
scanf("%d", &type);
while((type < 0) || (type > 1))
{... |
C | #include<stdio.h>
#include<LPC17xx.h>
#include <stdlib.h>
#include<string.h>
unsigned char a[] = "7500398BBC7B";
char* itoa(int num, char* str);
void reverse(char str[], int length);
int cal(int l,int k);
void uart_init(void);
int main()
{
char i;
char last[6],first[4];
itoa(cal(9,5),last);
itoa(cal(... |
C | /* EE231002 Lab10. Academic Competition
107061113, 李柏葳
Date: 2018/11/26
*/
#include <stdio.h>
struct STU { // student info
char fName[15]; // first name
char lName[15]; // last name
double math, sci, lit; // score of each subject
double total; // total score
double min; // min score among... |
C | #ifndef __LIMITED_LIST__
#define __LIMITED_LIST__
#include <stddef.h>
#include <stdlib.h>
// type of elements stored
typedef size_t LL_Value;
// definition of a structure that allows to store
// a maximum number of elements as circular array
typedef struct {
// pointer to the stored data
LL_Value *values;
... |
C | #include <stdio.h>
int decTobin(int n);
int main()
{
int decimal = 5;
printf("Enter a decimal number%d\n ", decimal);
printf("Binary number of %d is %d\n ", decimal, decTobin(decimal));
return 0;
}
int decTobin(int n)
{
int remainder;
int binary = 0, i = 1;
while(n != 0)
{
remaind... |
C | /* param.c */
/* vim: set shiftwidth=4 cindent : */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "tdcg.h"
#include "param.h"
Param *create_param()
{
Param *param = (Param *)malloc(sizeof(Param));
return param;
}
void free_param(Param *param)
{
free(param->value);
free(param->na... |
C | #ifndef __UTILS_H__
#define __UTILS_H__
#define DEBUG_FLAG 0
#define BITS_PER_CHAR 8
#define RUNLENGTH_MASK 0x1
#define HUFFMAN_MASK 0x2
#define DIFFERENCE_MASK 0x4
#define huge_t unsigned long long
#define large_t unsigned long
#define BITS_PER_BYTE 8
/* *** References ***
* http://soundfile.sapp.org/doc/WaveFor... |
C | #include<stdio.h>
#include<stdlib.h>
#include "stack.h"
#include "List.h"
int label(char);
int main(){
int T;
scanf("%d",&T);
char a = getchar();
int i;
for(i = 0; i < T; i++){
a = getchar();
stack* st = stack_new();
int n = 0;
while(1){
if(a == '\n'){
if(stack_is_empty(st)) print... |
C | #include <stdio.h>
#include <stdlib.h>
#include "PilhaDupla.h"
#define tam 100
typedef int TipoItem;
// Pilha de numeros inteiros, os pares vão para um lado e os impares para outro
typedef struct{
int Topo,Base;
}IndicePilha;
struct tipopilhadupla{
int Item[tam];
IndicePilha Pilha1,Pilha2;
};
TipoPilha... |
C | #include <stdio.h>
int zheng(int x)
{
if(x<10) return x;
else return 10*zheng(x/10)+x%10;
}
void ni(int x)
{
if(x<10) printf("%d",x);
else
{
printf("%d",x%10);
ni(x/10);
}
}
void main()
{
int a;
printf("һ");
scanf("%d",&a);
printf("Ϊ%d\n",zheng(a));
printf("Ϊ");
ni(a);
}
|
C | /* malloc(size):
size:要凑到最大数据类型所占字节的整数倍
realloc(void *p,size_t size):
size 连续存储空间。
如果p的地址满足size的要求,在原始位置的空间后增加。
如果p的地址不能满足size的要求,则重新分配,将原来的地址的数据复制到现在的空间上
*/
#include <stdio.h>
#include <stdlib.h>
int main1(void)
{
int *p1 = malloc(4*sizeof(int)); // allocates enough for an array of 4 int
int *p2 = ... |
C | /*C programs to demonstrate TCP sockets programming.
C code of client process that connects to server through socket.*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <netdb.h>
#define SERVICE_PORT 8888 /*hard-coded port number.*/
int conn(char *host, int port); /*Connects to host, port... |
C | #include <string.h>
#include "heclib7.h"
/**
* Function: ztsGetStandardInterval
*
* Use: Public
*
* Description: Get a standard DSS time interval in seconds from the E part, or the E part from the interval in seconds.
* Also will return a list of standard intervals.
*
* Declaration: int ztsGetStandardInter... |
C | #include "../include/get_next_line.h"
int make_line(int fd, char **save, char **line)
{
int i = 0;
char *tmp;
while(save[fd][i] != '\0' && save[fd][i] != '\n')
i++;
if(save[fd][i] == '\0')
{
*line = ft_strdup(save[fd]);
free(save[fd]);
return 0;
}
*line = ft_substr(save[fd],0,i);
tmp = ft_strdup(&s... |
C | //
// Shaun Chemplavil U08713628
// shaun.chemplavil@gmail.com
// C / C++ Programming I : Fundamental Programming Concepts
// 146359 Raymond L. Mitchell Jr.
// 04 / 23 / 2020
// C1A6E1_main.c
// Win10
// Visual C++ 19.0
//
// This program prompts the user to enter a string and returns the length
// using strlen and MyS... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int n1,n2,n3;
printf("digite o primeiro valor:");
scanf("%d",&n1);
printf("digite o segundo numero:");
scanf("%d",&n2);
printf("digite o terceiro nunero:");
scanf("%d",&n3);
if(n1<n2 && n2<n3)
{
printf("em ordem crescente... |
C | #include <string.h>
#include <stdio.h>
#include <stdlib.h>
struct student {
char* name ;
struct student* stds[20];
};
void stdsShow(struct student* root, char* prefix) {
if(root->name)
printf(strcat("%s\n", prefix), root->name);
for(int i=0; i<20; i++) {
if(root->stds[i]) {
... |
C |
// Put values in arrays
byte invader1a[] =
{
B00011000, // First frame of invader #1
B00111100,
B01111110,
B11011011,
B11111111,
B00100100,
B01011010,
B10100101
};
byte invader1b[] =
{
B00011000, // Second frame of invader #1
B00111100,
B01111110,
B11011011,
B11111111,
B00100100,
... |
C | /*条件变量的基本操作和认识*/
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
int have_noodle = 0;
//pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
//使用一个条件变量可能会导致唤醒紊乱,所以用两个条件变量
pthread_cond_t chimian; //吃面的人等在这
pthread_cond_t zuomian; //做面的人等在这
pthread_mutex_t mutex;
void *thr_sale(void *arg)
{
... |
C | #pragma once
struct BTree {
char data;
struct BTree *left;
struct BTree *right;
};
typedef struct BTree BTree;
typedef struct BTree Node;
typedef struct BTree* NodePtr;
typedef struct BTree* TreePTr;
/* construct */
struct BTree *btree_create(char root, struct BTree *left, struct BTree *righ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fillit.h :+: :+: :+: ... |
C | /* Interface for hiding processes, files and the rootkit itself */
#ifndef _HIDING_H
#define _HIDING_H
#include "config.h"
#define log(...) if (DEBUG) printk(__VA_ARGS__)
// Returns whether the rootkit module is hidden or not
bool is_module_hidden(void);
// Returns whether a filename is hidden or not
bool is_file_... |
C | //
// parser.c
// loxi - a Lox interpreter
//
// Created by Marco Caldarelli on 16/10/2017.
//
#include "parser.h"
#include "common.h"
#include "error.h"
#include "expr.h"
#include "error.h"
#include "expr.h"
typedef struct Parser
{
Token *tokens;
Token *current;
Token *previous;
const char *s... |
C | //스타수열 최종ver : ver4 반례 [1,1,0] 수정
#include <stdio.h>
#include <stdlib.h>
typedef struct star {
int len, flag, bfIdx;
}Star;
void initStar(Star* star, int a_len);
void updateLen(Star* star, int curIdx);
void lastUpdate(Star* star, int curIdx);
int solution(int a[], int a_len);
int main() {
int* a;
int a_len;
scan... |
C | #ifndef UTILS_H
#define UTILS_H
#include <sys/time.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#if defined(DEBUG)
#define P_DEBUG(...) fprintf(stderr,"[DEBUG] : "__VA_ARGS__)
#else
#define P_DEBUG(...)
#endif
#define ERR(msg) fprintf(stderr, "%s\n", msg)
#define P_ERR(msg... |
C | #include "lists.h"
/**
* free_dlistint - Frees a linked list
* @head: Holds the head
* Return: none
*/
void free_dlistint(dlistint_t *head)
{
dlistint_t *swappity, *tmp;
if (!head)
return;
for (swappity = head->next; swappity; swappity = tmp)
{
tmp = swappity->next;
free(swappity);
}
free(head);
}
|
C | #include "../../includes.h"
HashMapEntry *map_entry_new(char *key, void *value, size_t size)
{
HashMapEntry *entry = (HashMapEntry*)malloc(sizeof(HashMapEntry));
if(entry)
{
entry->key = strdup(key);
entry->value = NULL; // Set value to NULL before calling map_entry_set
map_entry_set(entry, value, ... |
C | #include "pileup.h"
/*
* Fetches the next base => the nth base at unpadded position pos. (Nth can
* be greater than 0 if we have an insertion in this column). Do not call this
* with pos/nth lower than the previous query, although higher is better.
* (This allows it to be initialised at base 0.)
*
* Stores the r... |
C | /*
Editor de la matriz de enemigos para Kraptor
NOTA: si se ejecuta con krapmain.dat presente en el mismo directorio, _MUESTRA_ los enemigos
con sprites, en vez de usar los numeros. [cool!]
Kronoman 2003
En memoria de mi querido padre
Teclas:
DELETE = casilla a 0
BARRA = situar valor selecci... |
C | /**
* @file ub_event_realloc.h
* @brief
* @author John F.X. Galea
*/
#ifndef EVENTS_HEAP_REALLOC_UB_EVENT_REALLOC_H_
#define EVENTS_HEAP_REALLOC_UB_EVENT_REALLOC_H_
#include "dr_api.h"
#include "drmgr.h"
#include "dr_defines.h"
/**
* @struct ub_realloc_data_t
*
* @var ub_realloc_data_t::addr The addr of... |
C | #include <ctype.h>
#include <fcntl.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#define MAX 256
void show_error_msg() {
char error_message[30] = "An error has occurred\n";
write(STDERR_FILENO, error_message,... |
C | #include <stdio.h>
typedef unsigned int u32;
char *ctable = "0123456789ABCDEF";
void prints(char * str) {
int s_index = 0;
while (str[s_index] != '\0') {
putchar(str[s_index]);
s_index++;
}
}
int rpu(u32 x, int base)
{
char c;
if (x){
c = ctable[x % base];
rpu(x / ... |
C | #include <stdio.h>
void test() {
// empty statement
;
}
int main() {
int x = 0;
test();
printf("%d\n", x);
return 0;
}
|
C | /* Author: Andrew Tee
* Partner(s) Name:
* Lab Section:
* Assignment: Lab #6 Exercise #2
* Exercise Description: [optional - include for your own benefit]
*
* I acknowledge all content contained herein, excluding template or example
* code, is my own original work.
*
* Demo Link: https://youtu.be/qz1JVSg-hj... |
C | #include <stdlib.h>
#include <error.h>
#include <SDL2/SDL.h>
#include "eventHandler.h"
#include "player.h"
typedef struct app{
SDL_Renderer *renderer;
SDL_Window *window;
} App;
#define SCREEN_HEIGHT 720
#define SCREEN_WIDTH 1020
int initSDL(App *app);
int main(int argc, char *argv[]){
App app;
if(! init... |
C | #include <stdio.h>
int main() {
int (*ptr)[4];
int i, j;
ptr=(int(*)[4])malloc(3*4*sizeof(int));
for (i=0; i<3; i++) for (j=0;j<4; j++) scanf("%d", *(ptr+i)+j);
for (i=0; i<3; i++) for (j=0;j<4; j++) printf("massive[%d][%d]= %d, adres= %p\n", i, j, *(*(ptr+i)+j), *(ptr+i)+j);
return 0;
} |
C | // eqstring.c: Solution of wave equation using time stepping
// saves output to 3D grid format used by gnuplot
#include <stdio.h>
#include <math.h>
#define rho .01 // density per length
#define ten 40 // tension
#define max 100 // time steps
main() {
int i, k;
double x[101][3];
FILE *out;
out = ... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
int main(void)
{
int first_iteration;
int num;
int N;
int i;
long long j;
long long r;
long long t;
long long p;
long long x;
scanf("%d", &num);
for (i = 1; i <= num; ++i)
{
scanf("%lld %lld", &r... |
C | /**
* hdr_thread.h
* Written by Philip Orwig and released to the public domain,
* as explained at http://creativecommons.org/publicdomain/zero/1.0/
*/
#ifndef HDR_THREAD_H__
#define HDR_THREAD_H__
#include <stdint.h>
#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
#define HDR_ALIGN_PREFIX(alignme... |
C | #include <CUnit/CUnit.h>
#include <stdio.h>
#include "cmat.h"
#include "test_sub.h"
#define N(x) (sizeof(x) / sizeof(*x))
static int
create_matrix(const matrix_info_t* info, cmat_t** dst)
{
return cmat_new(info->val, info->rows, info->cols, dst);
}
static void
check_matrix(cmat_t* ptr, const matrix_info_t... |
C | #include "std.h"
#include "list.h"
List list_new(i32 size){
size = size < 10 ? 10 : size;
List list = malloc(sizeof(struct List));
list->elements_size = size;
list->elements = malloc(sizeof(i32) * size);
list->size = 0;
return list;
};
void list_free(List this){
free(this->elements);
fre... |
C | /* Esercizio 96
In un vettore sono contenuti i prezzi di vendita di un determinato prodotto
relativamente agli N supermercati dove è presente. Il codice del supermercato
corrisponde all'indice del vettore.
Scrivi un programma che dopo aver caricato i dati permetta di:
a. stampare il minimo prezzo re... |
C | #include <reg51.h>
#include <intrins.h>
unsigned char key_s, key_v, tmp;
char code str[] = "I love zhu xiao ying--CUMT \n\r";
void send_int(void);
void send_str();
bit scan_key();
void proc_key();
void delayms(unsigned char ms);
void send_char(unsigned char txd);
sbit K1 = P1^4;
main()
{
send_int();
TR1 = 1; ... |
C | /*
* Naglowki.h
*
* Created: 2016-12-31 18:23:00
* Author: Nathir
*/
// Zastanow sie czy przerwanie osiagniecia pozycji zadanej nie powinno czasem miec priorytetu MID. Jest wazniejsze od np. przyspieszania/hamowania
//
/*
krancowki - drgaja styki
okres drgan 1ms
drgania wystepuja przy zalaczaniu i ... |
C | /*Write a C program to input length in centimeter and convert it to meter and kilometer*/
#include<stdio.h>
int main(){
int cm,m,km;
printf("enter the value in cm:");
scanf("%d",&cm);
m = cm/100;
printf("metres = %d\n",m);
km = cm/1000;
printf("kilometres = %d\n",km);
return 0;
}
|
C | #include <stdio.h>
int main(void)
{
int c = 7;
int d = (c/2);
printf("%i\n", d);
return 0;
} |
C | #include <stdio.h>
int main(void)
{
int n,result = 1;
printf("%-8s%-14s\n","n","Factorial of n");
for (n = 1;n <= 5;n++) {
result = result * n;
printf("%-8d%-14d\n",n,result);
}
return 0;
}
|
C | /**
* un programma, lanciato due volte come trasmittente e ricevente,
* comunica tramite una pipe con nome sul file-system (FIFO);
* da invocare come:
* - trasmittente: fifo T
* - ricevente: fifo R
*
* tentano di scambiarsi messaggi di dimensione variabile
* (dimostrando i limiti delle pipe/fifo)
... |
C | #include <stdio.h>
int main(void){
char *string = "Hello Arrays";
char character_array[7] = "abc123";
printf("the string is %s",string);
printf("the array is %s",character_array);
} |
C | #include "dothat.h"
#include <unistd.h>
#include <stdio.h>
int main() {
DOTHAT* d = dothat_init();
dothat_lcd_clear(d);
dothat_lcd_home(d);
dothat_input_recalibrate(d);
int active = 1;
while( active != 0 )
{
uint8_t inp = dothat_input_poll(d);
char inputtext[] = { '-', '-', '-', '-', '-', '-', 0 };
i... |
C | #include <stdio.h>
#include <stdlib.h>
void basic()
{
long int i = 0;
long int j;
int done = 0;
while (!done)
{
i += 20;
done = 1;
// 20 (2*2*5) 2, 4, 10, 20
// 19
// 18 (2*3*3) 2, 6, 9, 18
// 17
// 16 (2*2*2*2) 2, 4, 8, 16
... |
C | #include "types.h"
#include "stat.h"
#include "user.h"
int numPasses;
int numThreads;
int currPass = 1;
int holder = 0;
lock_t lock;
int sequenceNum = 0;
void passFrisbee(void* arg)
{
int threadnumber = *(int*)arg;
for(;;)
{
//printf(0,"Thread %d from the top\n", threadnumber);
int check, skip, break_;
d... |
C | #include<stdio.h>
#include<math.h>
double gamma_function(double);
int main(){
double a=-2*M_PI, b=2*M_PI, dx=0.013;
for(double x=a;x<b;x+=dx)
printf("%g %g %g\n",x,gamma_function(x),tgamma(x));
return 0;
} |
C | #include<stdio.h>
int N, Num[20][20], Re[21][21][21][41];
void Search(int xa, int xb, int xc, int step) {
if (Re[xa][xb][xc][step] == 0) {
int ya, yb, yc;
ya = step - xa - 1;
yb = step - xb - 1;
yc = step - xc - 1;
if (xa < N && xb < N && xc < N && ya < N && yb < N && yc < ... |
C | /*
* Project Arduino.c
*
* Created: 25-Oct-17 14:27:50
* Author : Arneldvdv
*/
#include <avr/io.h>
#include <avr/delay.h>
//blink every half second
#define BLINK_DELAY 500
// switch every 10 seconds
#define UP_DOWN_DELAY 100000
// stop blinking after 5 seconds
#define Blink_CD 5000
int main(void)
{
//define p... |
C | #include <stdio.h>
#include <stdlib.h>
#include "src/tables.h"
#include "assembler.h"
int grade_pass_two(char* in_name, char* out_name, SymbolTable* symtbl, SymbolTable* reltbl) {
FILE *input = fopen(in_name, "r");
FILE *output = fopen(out_name, "w");
if (!input || !output) {
return -1;
}
... |
C | /*
* Dati due vettori di medesima dimensione crea un terzo vettore popolandolo in maniera alternata
*/
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
int alterna(int v1[], int v2[], int v3[], int n);
void stampa (int n , int v[]);
int main()
{
srand(time(NULL));
int n =0 ,i = 0,s = 0;
pr... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_sort_sprites.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <setjmp.h>
#include <mz/mz_libs.h>
#include <mz/mz_cunit.h>
static jmp_buf buf;
static int first_enter = 0;
static int first_returns = 0;
static int sceond_enter = 0;
static int sceond_returns = 0;
static int static_var = 0;
static void second(void)
{
sceond_enter = 1;
longjmp(b... |
C |
/*
#!/usr/bin/perl
use Data::Dumper;
my $sn = 8;
sub getPowerLevel
{
my $x = shift;
my $y = shift;
my $rackID = $x + 10;
my $pwrlev = $rackID * $y;
$pwrlev += $sn;
$pwrlev *= $rackID;
$pwrlev = substr( $pwrlev, -3, 1 ) - 5;
return $pwrlev;
}
@tests = (
[ 3, 5, 8 ],
[ 122, 79, 57 ],
[ 217, 196, 39 ]... |
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>
#define BUFFERSIZE 100005
int numArr[BUFFERSIZE] = { 0, };
int haveNum[BUFFERSIZE] = { 0, };
int count;
int before;
void tokenizer(char arr[]) {
int i, j, num;
char *tempToken;
char *context = NULL;
char tempArr[BUFFERSIZE] = { NULL, };
char *Word[BUFFERSIZE] ... |
C | #include <stdio.h>
#define INF 999999
int min(int a, int b)
{
return a>b?b:a;
}
int main()
{
int d[3][3]={{0,4,11},{6,0,2},{3,INF,0}};
int p[3][3] = {{-1,1,1}, {2,-1,2},{3,-1,-1}};
int n=3;
for(int k=0; k<n; k++)
{
for(int i=0; i<n; i++)
{
for(int j=0; j<n; j++)
{
int D=d[i][j];
d[i][j] = min(d... |
C | #include <stdlib.h>
#include <string.h>
#include <image.h>
#include <source.h>
Pixel::Pixel(void) {r = 0; g = 0; b = 0;};
Pixel::Pixel(unsigned char red, unsigned char green, unsigned char blue)
{
r = red;
g = green;
b = blue;
};
//setter
void Pixel::ResetRGB(unsigned char red, unsigned char green, unsigned char ... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define N 100
//done
typedef struct {
int num;
char foodname[20];
int money;
} caidan;
//done
typedef struct {
int num;
char name[20];
char sec[20];
char VIP;
} customer;
//done
typedef struct {
char name[20]... |
C | #include "display.h"
//printf override
static FILE display_stdout_override = FDEV_SETUP_STREAM(display_write_char,NULL,_FDEV_SETUP_WRITE);
void display_setup() {
display_mode_instruction();
spi_send_display(FUNCTION_SET);
_delay_ms(2);
spi_send_display(BIAS_SET);
_delay_ms(2);
spi_send_display(POWER_CONTROL);
... |
C | #include <stdio.h>
#include <stdlib.h>
struct my
{
int a;
struct my *next;
};
struct my *p = NULL;
void put(const struct my *my_p)
{
printf("Put element: 0x%x\n", my_p);
if (p == NULL){
printf("Empty list\n");
p = my_p;
return;
}
struct my *cur = p;
while (1){
printf("cur: 0x%x\n"... |
C | #include<stdio.h>
main(){
char str[10][20];
int i;
for(i = 0; i < 10; i++){
str[i][0] = '\0';
}
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include <ctype.h>
#include "input.h"
void menu()
{
printf("1- Agregar Numero\n");
printf("2- Modificar Numero\n");
printf("3- Borrar Numero\n");
printf("4- Calcular campos Par/Impar/Primo\n");
printf("5- Infor... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.