language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include "button.h"
void ingest_button_value(Button* b, uint8_t value) {
b->state = (b->state << 1) | (value & 1);
}
uint8_t is_button_pushed(Button* b) {
return b->state == 0x7F;
}
uint8_t is_button_lifted(Button* b) {
return b->state == 0xFE;
}
|
C | #include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
//including the source code
#include </afs/pitt.edu/home/f/o/foa5/Echo/passiveTCP.c>
#define QLEN 32
#define BUFSIZE 4096
extern int errno;
//defining the prototyp... |
C | #include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main()
{ int r,num,i;
srand(time(NULL));
r= rand()%30+1;
printf("\n\n\t\tGUESS THE NUMBER");
printf("\nenter the number dude(1-30):");
scanf("\n%d",&num);
i=1;
while(num!=r)
{ i++;
if(num>r)
{ printf("\n\t\tH_I_G_H N_U_M_B_E_R... |
C | #include <stdio.h>
#include "search_algos.h"
/**
* binary_search - search algo via binary
* @array: int
* @size: size_t
* @value: int
* Return: int
*/
int binary_search(int *array, size_t size, int value)
{
if (!array)
return (-1);
return (binary_help(array, 0, size - 1, value));
}
/**
* binary_help -... |
C | /*
* File: Main.c
* Author: Armstrong Subero
* Processor: PIC32MX270F256D w/Ext OSC @ 4MHz, PLL to 48 MHz, 3.3v
* Program: 14_WDT
* Compiler: XC32 (v1.44, MPLAX X v4.00)
* Program Version: 1.0
*
* Program Description: This Program Allows PIC32MX270F256D to demonstrate the
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstnew.c :+: :+: :+: ... |
C | /*
Modulo 2
Algoritmos de encriptado
*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include "funciones.h"
int main(){
int codigo;
char * alf;
char letra;
int * codigoCadena;
char * decod;
int n;
char * cadenaDin;
int len;
char * cesar;
char * desenCesar;
alf= generarAlf();
printf("\n%... |
C | #ifndef STRUCT_H
#define STRUCT_H
typedef struct IntMatrix { // Note, square matrix.
int** matrix;
size_t size;
} IntMatrix;
typedef struct Vertex {
int d; // Distance.
struct Vertex* pred; // Preceding Vertex.
size_t index; // From 0 to size-q of the graph, labels Vertices, necessary
// becau... |
C | /* klc_output.h
* Helpers for data output.
* This provides additional abstraction that allows to output data from
* the payload module without directly using printk, trace-related stuff
* or whatever. The way the data is output is subject to change, this
* abstraction helps make these changes local.
*/
/* ====... |
C | #include "lists.h"
#include <stdlib.h>
#include <stdio.h>
/**
* dlistint_len - returns elements from list
* @h: list head
* Return: nodes
*/
size_t dlistint_len(const dlistint_t *h)
{
const dlistint_t *new;
size_t nodes;
if (h == NULL)
return (0);
new = h;
for (nodes = 0; new != NULL; nodes++)
new = new->... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* asm_token_parse.c :+: :+: :+: ... |
C | #include "fdf.h"
int verify(char *file, t_map *map)
{
int fd;
char *line;
fd = open(file, O_RDONLY);
while (get_next_line(fd, &line) > 0)
{
if (map->height == 0)
map->width = ft_strlen(line) - (ft_strlen(line) - 1);
if (ft_strlen(line) - (ft_strlen(line) - 1) != map->width)
perror("different widths in... |
C | /*Program that uses a function to retain data */
#include <stdio.h>
//Function signature
int sum(int,int);
int main()
{
int num1,num2;
int total;
printf("Enter two numbers\n");
scanf(" %d", &num1);
scanf(" %d", &num2);
//Calculate the sum of the numbers using function (cal... |
C | #ifndef _T_MATRIXSTRUCT_H_
#define _T_MATRIXSTRUCT_H_
#define MAX 100
typedef struct {
int row;
int col;
int value;
} sparse;
typedef struct {
int rows;
int cols;
int terms;
} s_header;
void createSparseA(sparse a[]); /* defineXA}x} */
void printSparseMatrix(sparse matrix[]); /* LX}x} */
void makeSpa... |
C |
#include <stdio.h>
#include<math.h>
int main()
{long int bin,flag=0,r,val=1,dec=0,i=0,n=0;
scanf("%ld",&bin);
while(bin>0)
{
r=bin%10;
dec=dec+r*pow(2,i);
i++;
bin=bin/10;
}
printf("%ld",dec);
return 0;
}
|
C | #include<stdio.h>
#define NEWNODE (struct dfile *) malloc (sizeof(struct dfile))
int fdata=0;
int ffree=0;
struct dfile
{
int fdata,ffree;
int status;
struct dfile *u_prev,*u_next,*f_prev,*f_next;
}*head= NULL,*uf=NULL;
struct dfile *ff=NULL;
int init(int dsize)
{
struct dfile *temp=NULL,*te... |
C | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: main.c
* Author: Hp
*
* Created on Ngày 02 tháng 3 năm 2020, 19:57
*/
#include <stdio.h>
#include <stdlib.h>
/*
... |
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
struct image
{
char ca_standard[3];
int i_width;
int i_height;
int i_maxGrey;
int ia_pixArray[7][17];
};
void loadImage(struct image *img);
int main()
{
int i_choice;
struct image st_image1;
do
{
... |
C | #ifndef TEST_H
#define TEST_H
#include <stdio.h>
#include <stdlib.h>
typedef void (*testcase)(void);
static int _failures_, _failures_t_, _failure_printed_;
static int _assert_strcmp(char*, char*);
#define fail_test(M) \
do { \
if (!_failure_printed_) { \
_failure_printed_ = 1; \
printf("\n %s:\n", __fun... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* print_argument_c.c :+: :+: :+: ... |
C | //// CODE: DATA STRUCTURES > Problem-2
/* Using array of pointer concept : (a) Find the Product of two-matrices.
(b) Sort 'n' names in alphabetical order.
*/
//. NOTE: Array name is itself the constant pointer to its first element.
// CODE: Problem-2 (a)
#include <stdio.... |
C | #include <stdio.h>
int main()
{
unsigned int num = 0xFACA8421;
unsigned char *p;
int i;
printf("\nO endereco na memoria e: %u", &num);
printf("\nO numero na base decimal e: %d", num);
p = (unsigned char*) #
for(i = 0; i < 4; i++)
{
printf("\nO conteudo e: %u", *(p+i));
}
return 0;
} |
C | #include "parse.h"
#define BUFFERSIZE 2000
int parse(char *line, char **argv)
{
int count=0;
while (*line != '\0') { // if not the end of line .......
// printf("*line:%c\n",*line);
while (*line == ' ' || *line == '\t' || *line == '\n')
*line++ = '\0'; // replace white spaces with 0
// printf("line... |
C | #include "abb.h"
#include "assert.h"
#include <stdlib.h>
#include <stdio.h>
#include "Stack.h"
#include <math.h>
#include <stdbool.h>
#define Leaf ((pandorasBox) NULL)
static void impr(pandoraBox t, char *k);
static void balance(Abb tree, Stack s);
static int factor_equil(pandoraBox pBox);
static void high_update(pan... |
C | #include<stdio.h>
#include<string.h>
#include<ctype.h>
enum { NAME,PARENS,BRACKETS };
enum { NO, YES };
void dcl(void);
void dirdcl(void);
void errmsg(char *);
int gettoken(void);
extern int tokentype; /* type of last token */
extern char token[]; /* last token string */
extern char name[]; /* identifier name *... |
C | #include<stdio.h>
#include<stdlib.h>
struct bst{
int data;
struct bst *rchild;
struct bst *lchild;
};
struct bst* insert(struct bst *,int);
void main()
{
int ch,data;
struct bst *root=NULL,*pos;
printf("Enter\n1 to Insert\n2 to find\n0 to exit\n");
while(1)
{
printf("enter choice: ");
scanf("%d",&ch);
... |
C | #include "fx_api/fx_api.h"
#include "fx/fx_pwm_pulsing_light.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
uint8_t data;
uint8_t state; //0= off, 1 = ramp up, 2 = on, 3 = ramp down
static const s_fx_param param1 = {PWM_FX,MODE_CONTINOUS,0,"PPULSE",0,fx_pwm_pulsing_light_run};
static const s_fx_param p... |
C |
#include "uart.h"
extern int printf(const char *format, ...);
int main()
{
char c;
int len, i;
printf("uart t%xst \r\n", 0xe);
printf("type something or hit return to quit:\n\r");
while (1) {
if (uart_getc(&c)) {
uart_putc(c);
if (c == '\r') break;
}
}
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <errno.h>
#include <stdarg.h>
#include <signal.h>
#include <limits.h>
#include <pthread.h>
#include <semaphore.h>
#include <sys/mman.h>
#include ... |
C | /* - STRCHR.C -
The ANSI "strchr" function.
$Revision: 328482 $
Copyright 1986 - 1999 IAR Systems. All rights reserved.
*/
#include "string.h"
char *strchr(const char *s, int c)
{
#ifdef _INTRINSIC
return strchr(s, c);
#else
do
{
if (*s == (char)c)
{
return (char *... |
C | // CSparse/Source/cs_droptol: drop small entries from a sparse matrix
// CSparse, Copyright (c) 2006-2023, Timothy A. Davis. All Rights Reserved.
// SPDX-License-Identifier: LGPL-2.1+
#include "cs.h"
static int cs_tol (int i, int j, double aij, void *tol)
{
return (fabs (aij) > *((double *) tol)) ;
}
int cs_droptol... |
C | #include <stdio.h>
static unsigned char sig[] =
{
0x70, 0xB5, 0x05, 0x4C, 0x05, 0x48, 0x06, 0x49,
0x45, 0x1A, 0x0E, 0x46, 0x2A, 0x46, 0x31, 0x46,
0x20, 0x46, 0xFF
};
// Some sort of compression, was unable to identify the algorithm, LZ4 or something..?
int decompress(unsigned char *src, unsigned char *dest,... |
C | /*(1)Faa um programa que cadastre 2 nmeros,
pesquise nmero se existir exiba,
seno exiba mensagem nmero no cadastrado*/
#include <stdio.h>
#include <stdlib.h>
// declaracao
void cadastraNumero(int x, int y);
void pesquisaNumero(int n1, int n2);
void menu();
main(){
int n1,n2;
cadastraNumero(n1,n2);
}
// procediment... |
C | /*
Program to find Anagram. An anagram is a word formed by rearranging the letters of a different word, using all the letters exactly once. For example, the word FACE can be rearranged into "CAFE". Hence FACE and CAFE are anagrams.
Get 2 strings as an input from the user. If those 2 strings are anagrams then print "Ana... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <Bits.h>
#pragma warning(disable : 4996)
typedef struct Matrix_N_M {
int i;
int j;
int** arr;
}matrix;
matrix initArray(int N, int M) {
matrix array;
array.i = N;
array.j = M;
array.arr = (int**)malloc(array.i * sizeof(int*));
for (int k = 0; ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_ultimate_range.c :+: :+: :+: ... |
C | #include<stdio.h>
int main(void)
{
int x[100];
int t;
for(t=0; t<100; ++t)
x[t]= t;
for(t=0;t<100;++t)
printf("%d ",x[t]);
return 0;
}
|
C | //
// Created by Ziyang Jiao on 2019-11-20.
//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <poll.h>
#define backlog 10
#define PORT_NO 9999
i... |
C | #include "monty.h"
/**
* _pop - removes top node of stack
* @stack: pointer to top node
* @line_number: line number count for given file
*/
void _pop(stack_t **stack, unsigned int line_number)
{
stack_t *mover;
if (stack == NULL || (*stack) == NULL)
{
fprintf(stderr, "L%u: can't pop an empty stack\n", line_... |
C | #include<stdio.h>
int main()
{
float F,c;
scanf("%f",&F);
c=5*(F-32)/9;
printf("c=%.2f",c);
return 0;
}
|
C | // bowling_game.c
# include "bowling_game.h"
# include <stdio.h>
# include <errno.h>
# include <stdlib.h>
enum { max_rolls = 21 };
static int rolls[max_rolls];
static int current_roll;
void bowling_game_init() {
for (int i=0; i < max_rolls; i++) {
rolls[i] = 0;
}
current_roll = 0;
}
void bow... |
C | #include "melon/core/stack_meta.h"
#include "melon/core/memory_utils.h"
#include <stdlib.h>
melM_defineStackStruct(BaseStack, void)
TRet melCreateStack(void* stack, StackSize minSize, TSize itemSize)
{
BaseStack* bs = ((BaseStack*)stack);
bs->stack = malloc(minSize * itemSize);
assert(bs->stack != NULL)... |
C | #include<stdio.h>
#include<stdlib.h>
void insert(int);
int del();
void display();
int size,f1=0,f2=0,f3=0;
int r1=-1,r2=-1,r3=-1;
int q1[50],q2[50],q3[50],p,v;
int main()
{
int ch;
printf("enter the size\n");
scanf("%d",&size);
while(1)
{
printf("1-->for insertion\n2-->for deletion\n3-->display\n4-->exit\n");
... |
C |
int SUSHU (int x)
{
int d = 2, none = 1, result = 0;
while (d * d <= x)
{
if (x % d == 0)
{
none = 0;
break;
}
else
d += 1;
}
if (none == 1)
result = 1;
return result;
}
int main()
{
int m, a = 3, b;
cin >> m;
while (2 * a <= m)
{
b = m - a;
if ((b % 2 != 0) ... |
C | /*
* 17.3.c -- suppose list.h (Listing 17.3) uses the following definition of a
* list:
*
* #define MAXSIZE 100
* typedef struct list
* {
* Item entries[MAXSIZE];
* int items;
* } List;
*
* Rewrite the list.c (Listing 17.5) functions to fit this definition and test
* the resulting code with the films3.c ... |
C | #pragma hdrstop
#pragma argsused
#include <stdio.h>
#ifdef _WIN32
#include <tchar.h>
#else
typedef char _TCHAR;
#define _tmain main
#endif
int _tmain(int argc, _TCHAR* argv[])
{ float nom[3][4],som=0,moy= 0;
int i,j;
for(i=0;i<3;i++)
{
for(j=0;j<4;j++)
{
printf("Entrez la valeur ");
scanf("%f... |
C | /* ================== queueCount =================
Returns the number of elements in the queue.
Pre queue is pointer to the queue head node
Return queue count
*/
int queueCount(QUEUE* queue)
{
// Statements
return queue->count;
} // queueCount
|
C | // Author:Zheng Jun
// Date:2018/1/15
// E-mail:zhengjun1987@outlook.com
#include <printf.h>
#define SIZE 4
int bds() {
int value1 = 44, arr[SIZE], value2 = 88, i;
printf("value1 = %d, value2 = %d\n", value1, value2);
for (int j = -1; j <= SIZE; ++j) {
arr[j] = 2 * j + 1;
}
for (int k ... |
C | /*
Author :SGT
Code For : Finding the merging Point of two LL
First find the length of both the LL , then find the Diff of length , move the Bigger LL 'Diff' places , start comparing with both LL
*/
#include<stdio.h>
#include<malloc.h>
struct Node {
int data;
struct Node * next;
};
int lencalculator(struc... |
C | // HW 08 part 1.b
int function(int x,int y);
#include <stdio.h>
#include <stdlib.h>
/*
*
*/
int main(int argc, char** argv)
{
printf("%d",function(4,3));
return 0;
}
int function(int x,int y)
{
if (x==0 | y==0)
return 0;
else
return (function(x-1,y)+function(x,y-1)+x... |
C | #include "operations.h"
ret_code_t create_bank_account (bank_account_t *acc, uint32_t id, uint32_t balance, char password[], pthread_mutex_t *acc_mut) {
char saltedPass[SALT_LEN + MAX_PASSWORD_LEN + 1];
acc->account_id = id;
acc->balance = balance;
char salt[SALT_LEN + 1];
gen_salt (salt);
sprintf (acc->... |
C | /* sum.c */
// sum関数
// Int型の引数を2つとり、それらを足す
int sum(int min,int max)
{
// Int型変数numを定義
int num;
// numに引数の値2つを足した値を代入
num = min + max;
// numの値を戻り値として返す!
return num;
}
|
C | /* compile with and without to see the difference -D_FR_ */
#include <stdio.h>
int main()
{
#ifndef _FR_
printf("Hello World");
#else
printf("Bonjour");
#endif
return !printf("\n");
} |
C | // By Dan Buckstein
// Modified by: _______________________________________________________________
#include "egpfw/egpfw/egpfwInterpolation.h"
#include <math.h>
#define lerp egpfwLerp
// ****
// lerp and lerp inverse
float egpfwLerp(const float v0, const float v1, const float param)
{
//...
return v0 + (v1 - v0) ... |
C | #include <stdio.h>
#include <inttypes.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 "networks.h"
int open_client(uint16_t udpPort){
struct sockaddr_in myaddr;
int sockfd;
if((sockfd = socket... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define N 10
typedef int Vector[N];
void printVector(Vector v, int n);
void fillVector(Vector v, int n);
void fill0Vector(Vector v, int n);
void countDigits(Vector v, int d);
int main(int argc, char * argv[])
{
Vector v;
int num;
printf("Ingresa u... |
C | #include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <math.h>
#include <string.h>
#include "grid.h"
#include "features.h"
#include "math/stats.h"
void startgrid(grid* g, features* f, int level, int depth, int land) {
g->level = level;
g->depth = depth;
float block = (float)90 / pow(2, (float)g->le... |
C | #include <stdio.h>
#include <stdlib.h>
#include <mpi.h>
#include <float.h>
#include <math.h>
#define ROWS 16
#define COLS 16
#define TEMP 50
#define I_FIX 7
#define J_FIX 7
#define EPS 1e-3
void computeFreshValues(double **oldMat, double ** newMat, double nBot[], double nTop[], int rows, int cols, int rank, int mast... |
C | #include <libft/libft.h>
int brainfuck(char *array, int *ptr, size_t n)
{
int i = -1;
unsigned int size = 0;
while (++i, array[i] && size < n)
{
if (array[i] == '+')
++(*ptr);
else if (array[i] == '-')
--(*ptr);
else if (array[i] == '>')
{ ++ptr; ++size; }
else if (array[i] == '<')
{ --ptr; --si... |
C | //
// Copyright © 2017 by Yuri Victorovich. All rights reserved.
//
#include "common.h"
#include "marker.h"
#include <stdio.h>
#include <ctype.h>
#include <sys/types.h>
#include <stdlib.h>
#include <limits.h>
#include <inttypes.h>
static const uint8_t markerChar[3] = {0xe2, 0x80, 0x8b}; // ZERO WIDTH SPACE' (U+200B),... |
C | #include "circular-singly-list.h"
CList CreateCList(void)
{
CList clist = (CList)malloc(2 * sizeof(CNode *));
if (clist == NULL)
FatalError("Out of space!");
CMakeEmpty(clist);
return clist;
}
CList CAdd(CList clist, ElementType number)
{
CNode *p = (CNode *)malloc(sizeof(CNode));
if (p ... |
C | #include "dodbs.h"
#include "dodtest.h"
#include <assert.h>
#include <stdio.h>
#define ULL_BIN_STR "11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"
#define BS_ASSERT_SIZE(sz) do {\
dodbs_t_decl(bs##sz, sz);\
assert(sizeof(bs##sz.arr... |
C | // Test program for demonstrating NESNet.
#include "lib/neslib.h"
#include "echo.h"
#include "../../src/nesnet.h"
#define REQUEST_TYPE_NONE 0
#define REQUEST_TYPE_GET 1
#define REQUEST_TYPE_POST 2
#define REQUEST_TYPE_PUT 3
#define REQUEST_TYPE_DELETE 4
#define ECHO_SERVER_URL "http://cpprograms.net/devnull/echo.php"... |
C | #include <math.h>
#ifndef HAS_ISNAN
inline bool isnan(double v)
{
return _isnan(v);
}
#endif
inline double safeDivide(double a, double b)
{
double tol = 1E-10;
double denom = b;
if (b >= 0 && b < tol){
denom = tol;
}else if (b < 0 && b > -tol){
denom = -tol;
}
double result = a / denom;
retu... |
C | #include "vector.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <search.h>
void VectorNew(vector *v, int elemSize, VectorFreeFunction freeFn, int initialAllocation){
assert(initialAllocation >= 0 && elemSize > 0);
v->elemSize = elemSize;
v->allocLen = initialAllocation;
... |
C | /*
Write a function which takes an array and prints the majority element (if it
exists), otherwise prints “No Majority Element”. A majority element in an array
A[] of size n is an element that appears more than n/2 times (and hence there
is at most one such element).
Sample input-1:
{3, 3, 4, 2, 4, 4, 2, 4, 4}
... |
C | #ifndef __HELPER_PRINT_H__
#define __HELPER_PRINT_H__
#if defined(ARDUINO) && ARDUINO >= 100
#include "arduino.h"
#else
#include "WProgram.h"
#endif
// extern int test1;
extern void serial_print_P(const char* s)
{
char c;
while ((c = pgm_read_byte_near(s++))) Serial.print(c);
}
extern void serial_print_P_arr(con... |
C | #include <string.h>
#include <stdio.h>
#include "preprocessor.h"
#include "preprocessor.tab.h"
#include <getopt.h>
#include <linux/limits.h>
#include <unistd.h>
#include "textlist.h"
#include <stdlib.h>
#include <libgen.h>
extern char* yytext;
int yyerror(const char* s)
{
printf("\nSyntax Error on line %d %s\n", ... |
C | #include "stdio.h"
#include "string.h"
char dicname[5100][51];
int dicsize = 0;
int h[100][51];
char pno[101] = "";
int lenpno = 0;
int rslt[100] = {0}, mincnt[100] = {0};
int to_num(char *in, char *out);
void calcword(char *word);
void judge();
int main(int argc, char* argv[])
{
int n = 0, i =... |
C | /*
* coded by Raskolnikov to remove the inertia that might keep
* Thanes from using the iou_shop...Oct 96
*
*/
inherit "/std/item.c";
string old_path, new_path;
void setup() {
set_name("switcher");
add_alias("switch");
set_main_plural("Switchers");
set_short("Thane Directory Switch Indicator");
... |
C | #include<stdio.h>
#define true 1
#define false 0
void ReplaceBlank(char string[], int length)
{
if(string == NULL || length <= 0)
return;
int orignalLength = 0;
int numberOfBlank = 0;
int i = 0;
while(string[i] != '\0')
{
orignalLength++;
if(string[i] == ' ')
... |
C | /** @file
* Implementacje funkcji pomocniczych.
*
* @author Sebastian Miller
* @date 28.04.2019
*/
#include "utils.h"
#include "structures.h"
#include <stdlib.h>
#include <string.h>
City* findCity(Map* map, const char *city) {
City *current;
bool found;
current = map->firstCity;
... |
C | #include<stdio.h>
int main(){
int I,row,J,K,col,sum,tmp_sum,ar[6][6];
for(I=0;I<6;I++){
for(J=0;J<6;J++) scanf("%d",&ar[I][J]);
}
row=col=sum=-100;
while(row!=4){
tmp_sum=0;
for(I=row;I<row+3;I++){
for(J=col;J<col+3;J++){
if((I==row+1 && J==col) || (I==row+1 && J==col+2)) continue; // corre... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "ir.h"
#include "data.h"
#include "data_support.h"
#include "charsets.h"
#include "common.h"
#define SETUPGENSPEC(size) \
struct ir_generic *gen = malloc(sizeof(struct ir_generic)); \
gen->type = pre->type; \
gen->line = pre->l... |
C | /*
* Tutorial 4 Jeopardy Project for SOFE 3950U / CSCI 3020U: Operating Systems
*
* Copyright (C) 2015, <GROUP MEMBERS>
* All rights reserved.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include "questions.h"
#include "players.h"
#include "jeopardy.h"
#include "questions.... |
C | #include "lists.h"
/**
* print_dlistint - function that prints all elements of a dlistint_t
* @h: pointer head
* Return: number of nodes
**/
size_t print_dlistint(const dlistint_t *h)
{
const struct dlistint_s *temp;
unsigned int num_nodes;
temp = h;
for (num_nodes = 0; temp != NULL; num_nodes++)
{
printf... |
C | #include <stdio.h>
#include <string.h>
void main(){
char s[10];
int len;
// 文字列のコピー strcpy() strcpy(char* s1,char* s2); 右辺の文字列を左辺の文字列変数にコピーする。
strcpy(s,"ABC");
printf("s=%s\n",s);
// 文字列の結合 strcat() strcat(char* s1,char* s2); 右辺の文字列を左辺の文字列変数に追加する。
strcat(s,"DEF");
printf("s=%s\n",s);
//... |
C | /*
* Project: Implementace překladače imperativního jazyka IFJ18
*
* File: sym_stack.h
*
* xglosk00 Kristian Glos
* xvagal00 Dominik Vagala
* xvinsj00 Jakub Vins
* xabike00 Zhamilya Abikenova
*
*/
#ifndef IFJ_PROJECT_SYM_STACK_H
#define IFJ_PROJECT_SYM_STACK_H
#include "symtable.h"
typedef stru... |
C | /*
** EPITECH PROJECT, 2021
** make_opponent_turn.c
** File description:
** make opponent turn
*/
#include "rpg.h"
void make_opponent_turn(game_t *game)
{
int nb = 0;
if (game->fight->opponent->clock == NULL)
game->fight->opponent->clock = sfClock_create();
game->fight->opponent->time = \
sfClock... |
C | #include "page_table.h"
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "../optimum/list.h"
page_entry* page_entry_init(){
page_entry* entry = malloc(sizeof(page_entry));
entry->validity = 0;
return entry;
}
page_table* page_table_init(list* levels_bits){
page_table* pg = malloc(sizeof(pa... |
C | #include <stdio.h>
#define max 100000
int main()
{
int n,i,j,sum,t;
printf("Enter the array Size - ");
scanf("%d",&n);
printf("Enter the elements - ");
int a[n];
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
printf("Enter the Sum to be find - ");
scanf("%d",&sum);
int s[max... |
C | /* ccdsInfo.h was originally generated by the autoSql program, which also
* generated ccdsInfo.c and ccdsInfo.sql. This header links the database and
* the RAM representation of objects. */
/* Copyright (C) 2006 The Regents of the University of California
* See README in this or parent directory for licensing in... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "fichier_h.h"
void fusion(char* nom1, char* nom2 , char*dest, int x, int y) // superposer 2 images nom1 et nom2 de meme type
// l'image nom1 est le backgroung ( grandes dimensions )
... |
C |
#include <TCanvas.h>
#include <TString.h>
#include <TFile.h>
#include <TH1.h>
#include <TArrayD.h>
#include <TGraphErrors.h>
#include <TLegend.h>
#include <TMath.h>
#include <TStyle.h>
#include <iostream>
#include <iomanip>
double getMedian(const TH1* histogram, bool includeUnderAndOverflowBins = false)
{
unsigned... |
C |
/*
* Copyright (C) Igor Sysoev
* Copyright (C) Nginx, Inc.
*/
#include <ngx_config.h>
#include <ngx_core.h>
/*
To quickly process static sets of data such as server names, map directive’s values, MIME types, names of request header strings, nginx
uses hash tables. During the start and each re-configuration ngi... |
C | #pragma once
#include <commctrl.h>
inline HWND FindWindowWithTitle(LPCTSTR lpszTitle, DWORD timeOut = 20000)
{
HWND hWnd = 0;
while(0 < timeOut)
{
hWnd = ::FindWindow(0, lpszTitle);
if(0 != hWnd)
break;
timeOut -= 10;
::Sleep(10);
}
if(!IsWindow(hWnd))
return NULL;
return hWnd;
}
typedef struct... |
C | #include <stdio.h>
#include <stdlib.h>
#define LOOPS 2
int main(){
int n, k; /*qui è la dimensione del mio array*/
int *a; /*puntatore all'array nella heap*/
int i;
for(k = 0; k < LOOPS; k++){
scanf("%d", &n);
/*alloco dinamicamente il mio array*/
a = mall... |
C | // Tariq Alturkestani
// Sept-8-2015
// A simple hello wold MPI application
#include <mpi.h>
#include <stdio.h>
#include <string.h>
#define BUFFER_SIZE 512
int main(int argc, char ** argv)
{
int commWorldSize; // number of processor in MPI Comm World
int commWorldRank; // ... |
C | #include "HuffmanTable.h"
/** Constructs a HuffmanTable from a file.
* - Returns NULL if invalid file.
* - Returns the HuffmanTable otherwise.
* - Not required to return a non-zero size; it's all according to the file.
*/
struct HuffmanTable* HuffmanTable_ctor_filename(char* filename) {
/* Check if f... |
C | #include "surface.h"
#include "parameter.h"
#include <curses.h>
#include <unistd.h>
extern int point[WIN_COLS][WIN_LINES];
extern int elfpoint_x;
extern int elfpoint_x;
extern int elftemp;
extern int direct;
extern int x_1;
extern int y_1;
extern int x_2;
extern int y_2;
extern int d_1;
extern int d_2;
extern int life... |
C | #include <stdio.h>
#include <stdlib.h>
//yildizlarla diamond sekli bastirma
int main() {
int row;
printf("Input : ");
scanf_s("%d", &row);
//ust kisim
for (int i = 0; i <row; i++) {
for (int j = i; j < row; j++)
printf(" ");
for (int k = i; k > 0; k--)
printf("*");
for (int l = 1; l < i; l++)
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include "binheap.h"
struct Heap {
int capacity;
int size;
ElemType *elements;
};
/* Indices start from 0 */
/*
int getParent(int i) {
return (i - 1) / 2;
}
int getLeft(int i) {
return 2 * i + 1;
}
int getRight(int i) {
return 2 * i + 2;
}
*... |
C | #include <iostream>
#include <stdio.h>
int main(){
int a;
printf("Write down a number of month ");
scanf("%d", &a);
if(a == 1 || a == 2 || a == 12)
printf("Winter");
else if(a>2 && a<=5)
printf("Spring");
else if(a>5 && a<=8)
printf("Summer");
else if( a == 0)
printf("Wrong number");
else... |
C | #include<stdio.h>
int main()
{
int array[2000],i,n;
int sorted=1,t;
scanf("%d",&t);
while(t--){
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&array[i]);
}
for(i=0;i<n-1;i++){
if(array[i]<array[i+1]){
printf("YES\n");
... |
C | /**
* @brief Function returns task_node_info
* sql query:SELECT status
* FROM esb_request
* WHERE message_id = ?
*
* returns status if message_id exists else NULL if does not exist.
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <mysql/mysq... |
C | /*
* warning_logic.c
*
* Created on: May 28, 2019
* Author: tony
*/
#include "warning_logic.h"
unsigned char DFMS_health_state = 0;
extern_signal_flags CAN_signal_flags = {0x3f};
DFMS_state DFMS_State = CLOSE;
void warning_logic_state_machine(unsigned char fault_or_normal, extern_signal_flags signal_flag... |
C | #include <stdio.h>
#include <stdlib.h>
#include "error.h"
/*
* Show error message and exit the program
* @params:
* code: the error code
*/
void error_exit(int code)
{
switch (code) {
case ERROR_MEM_ALLOC:
printf("Memory allocation error\n");
exit(0);
... |
C | #include <stdio.h>
#include <unistd.h>
int tab[10] = {0, 23, 150, 255, 12, 16, 21, 42};
void print_number(int numb)
{
char frist_num;
char second_num;
int fn;
int sn;
int i = 0;
fn= numb / 16;
sn = numb % 16;
if(fn < 10)
frist_num = fn + '0';
else
frist_num = fn -... |
C | /*
** Copyright (c) 2012 D. Richard Hipp
**
** This program is free software; you can redistribute it and/or
** modify it under the terms of the Simplified BSD License (also
** known as the "2-Clause License" or "FreeBSD License".)
** This program is distributed in the hope that it will be useful,
** but without any w... |
C | #include "c1.h"
#ifdef ALLOC_PRAGMA
#pragma alloc_text (INIT, DriverEntry)
#pragma alloc_text (PAGE, MKL_EvtDeviceAdd)
#pragma alloc_text (PAGE, MKL_EvtIoInternalDeviceControl)
#endif
HANDLE fileHandle; // Handle for the log file. Remains open throughout the driver's lifetime.
KEYBOARD_DATA_ARRAY keyboardDataAr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.