language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #ifndef LIST_H
#define LIST_H
typedef void* dataElement;
typedef void (*freeListDataElement)(dataElement);
typedef dataElement (*copyListDataElement)(dataElement);
struct list_t {
dataElement data;
freeListDataElement freeDataElement;
copyListDataElement copyDataElement;
struct list_t *next;
};
type... |
C | #include "websockets.h" // includes the "http.h" header
#include <stdio.h>
#include <stdlib.h>
/* ******************************
The Websocket echo implementation
*/
void ws_open(ws_s * ws) {
fprintf(stderr, "Opened a new websocket connection (%p)\n", (void * )ws);
}
void ws_echo(ws_s * ws, char * data, size_t si... |
C | #include <stdio.h> // printf(), fgets()
#include <stdlib.h> // exit()
#include <unistd.h> // alarm()
#include <signal.h> // "SIGALRM", signal()
#define TIMEOUT 5
void sig_handler(int sig)
{
printf("\nTimeout! GoodBye!\n");
exit(0);
}
int main(void)
{
char buf[1024];
signal(SIGALRM, sig_handler);
alarm(TIMEOUT);... |
C | #include "utilitaires_tableaux.h"
void triBulle(int tab[], int n)
{ int i,j;
for(i=n-1; 1<i; i--){
for(j=0; j<i; j++){
if(tab[j] > tab[j+1])
echanger_elem_tab(tab, j, j+1);
}
}
}
void triBulleAmeliore(int tab[], int n)
{ int i,j; _Bool permutee = 0;
for(i=n-1; 1<i; i--){
for(j=0; j<i; j++){
if(tab... |
C | /* process.c */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
int child_count = 0;
int parent_count = 0;
/************************************************************************... |
C | //1.Write a program to take input as a password but should display only x's instead of charaters
#include<stdio.h>
int main()
{
char data;
data = getchar();
printf("x");
printf("%c",data);
}
|
C | /* ************************************************************************** */
/* ************************************************************************** */
/* */
/* Author: Jarret Shook ... |
C | #include <stdio.h>
const char *FILE_NAMES[] = {
"cia-crest-files-cia-crest-archive-metadata/test.csv",
"cia-crest-files-cia-crest-archive-metadata/2_export.csv",
"cia-crest-files-cia-crest-archive-metadata/3_export.csv",
"cia-crest-files-cia-crest-archive-metadata/4_export.csv",
"cia-crest-files-cia-crest-ar... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void){
int lotto[7];
srand( time(NULL));
lotto[0] = rand() % 45 + 1;
for(int i = 0; i < 7 ; ++i){
lotto[i] = rand() % 45 + 1;
for(int j = 0; j < 7 ; ++j){
if(lotto[i]==lotto[j]}
break;
}
printf("%d\n", lotto[i]);
} ... |
C | #include <stdio.h>
#include "insn.h"
#include "nuclei_sdk_soc.h"
int main(void)
{
int ret = 0;
unsigned int array[ROW_LEN][COL_LEN] = {
{10, 30, 90},
{20, 40, 80},
{30, 90, 120}
};
unsigned int col_sum_ref[COL_LEN] = {0};
unsigned int row_sum_ref[ROW_LEN] = {0};
unsigned... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/wait.h>
int main(int arg,char* argv[],char** environ)
{
int fd[2];
pid_t pid;
int stat_val;
if(arg<2)
{
printf("wrong parameters\n");
exit(0);
}
pipe(fd);
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* server.c :+: :+: :+: ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* children.c :+: :+: :+: ... |
C | #include <stdio.h>
int main()
{
int a[3] = { 1, 2, 3 };
printf("%d\n", a[3]);
// no problem!
}
|
C | #include <mikeos.h>
static inline int pow(int base, int power)
{
if (power == 0)
return 1;
for (power--; power > 0; power--)
{
base *= base;
}
return base;
}
void _os_string_to_int(int* ax, int* bx, int* cx, int* dx, int* si, int* di)
{
*ax = os_string_to_int((char*) *si);
}
... |
C | /* This file is part of CCCA,
http://github.com/alexjgriffith/CCCA/,
and is Copyright (C) University of Ottawa, 2015. It is Licensed under
the three-clause BSD License; see LICENSE.txt.
Author : Alexander Griffith
Contact: griffitaj@gmail.com */
#include "height.h"
int getChromosome(char value[10])
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fts.h>
#define ERR_INVALID_USAGE 1
#define ERR_PARAM_NOT_DIR 2
int has_cpp_extension(char* fileName) {
int lastIndex = 0;
while (fileName[lastIndex] != '\0') {
lastIn... |
C | #include <stdio.h>
int main(void) {
int N = 0, number, done = 0, message, sum = 0;
FILE *ifile; /* ifile is a variable name, we call this a file pointer */
ifile = fopen("studentGrades.txt", "r"); /* open file for reading,
r stand for reading */
while ( !done ) {
message = fsc... |
C | /** @file gpio_driver.c
* @brief Function implementation for GPIO driver.
*
* This is the source file for the definition of GPIO driver.
*
* @author Tran Nhat Duat (duattn)
* @version V1.0
*/
/*******************************************************************************
* 1. Included Files
**********... |
C | #include<stdio.h>
int main()
{
float height;
int age;
char section;
printf("\n enter height:\n");
scanf("%f",&height);
printf("\n enter age:\n");
scanf("%d",&age);
printf("\n enter section:\n");
scanf(" %c",§ion);
printf("\n height=%f age=%d section=%c\n",height,age,section);
return (0);
}
|
C | //
// Created by dengyao on 18-3-27.
//
#include <stdio.h>
#include "memwatch.h"
static size_t g_total_malloc = 0;
typedef struct ptr_info{
void* ptr;
size_t size;
const char* file;
int line;
struct ptr_info* prev;
struct ptr_info* next;
}ptr_info;
static ptr_info* g_total_head = NULL; // 头指... |
C | /*
* HC_SR04.c
*
* Created on: 04 окт. 2016 г.
* Author: developer
*/
#include <avr/io.h>
#include <util/delay.h>
#include <stdint.h>
#include "hal/time.h"
#include "hal/config.h"
#include "hal/structs.h"
void HC_SR04_init (){
US_DDR &= ~(1 << US_pin_ECHO);
US_PORT &= ~(1 << US_PIN_TRIG);
US_DDR |= (1 ... |
C | #include "rand8.h" // tutaj trzeba podać ścieżkę do rand8
#include <avr/io.h> // IO
//#include <inttypes.h> // uint
#include <stdlib.h> // srand, rand
void init_adc(){
ADMUX |= (1<<REFS0);
ADCSRA |= (1<<ADPS2)|(1<<ADPS1)|(1<<ADEN); // prescaler = 64, 8MHz/64 = 125kHz
}
uint16_t read_adc(uint8_t adc_channel... |
C | #include <stdio.h>
#include "daq_lib.h"
int main(int argc, char *argv[])
{
daq_card_t daq;
uint16_t sample;
if (argc != 2) {
fprintf(stderr, "Too few arguments\n");
return 1;
}
if (daq_open(argv[1], &daq)) {
perror("Error opening daq device");
return 1;
}
if (daq_config_channel(&daq, ... |
C | #include <stdio.h>
#include <stdlib.h>
int main() {
float h;
int sexo;
printf("Informe sua altura: ");
scanf("%f", &h);
printf("Qual seu sexo:\n");
printf("1-Homem;\n2-Mulher;\n");
scanf("%d", &sexo);
getchar();
if(sexo == 1) {
printf("Peso ideal: %.2fKg\n", (72.7*h)-58.0);
}
if(sexo == 2) {
pri... |
C |
/////////////// CDivisionWarning.proto ///////////////
static int __Pyx_cdivision_warning(const char *, int); /* proto */
/////////////// CDivisionWarning ///////////////
static int __Pyx_cdivision_warning(const char *filename, int lineno) {
#if CYTHON_COMPILING_IN_PYPY
// avoid compiler warnings
filename++... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* print_square.c :+: :+: :+: ... |
C | #include "solver.h"
#include <stdlib.h>
#include <stdio.h>
int backtracking(GameBoard *board, int random, int x, int y);
void setSeed(int seed){
srand(seed);
}
GameBoard* generateSolution(GameBoard *board){
backtracking(board, 1, 0, 0);
return board;
}
GameBoard* generateBoard(GameBoard *solution,GameBoard *b... |
C | #ifndef METROLINK_H
#define METROLINK_H
#include <stdbool.h>
#include <stddef.h>
/**
* Call exactly once on startup before using any other functions.
*/
void metrolink_init(void);
/**
* Specify the journey desired by the user.
*/
void metrolink_set_journey(const char *start, const char *target);
/**
* If a tra... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int bfmatch(char *str, char *sub, int n)
{
// const char *sub = "AAAAB";
int i = 0, j = 0;
int count = 0;
while (i < n)
{
count++;
while (j < strlen(sub) && *(str + i + j) == *(sub + j))
{
count++;
... |
C | /*
IndirectObject.c
Author: Nebojsa Vislavski
Date: 2.7.2008.
Writes indirect objects
*/
#include "IndirectObject.h"
#include "MemoryManager.h"
#include <stdlib.h>
DLLEXPORT_TEST_FUNCTION struct IndirectObject* IndirectObject_Create(struct PdfDocument *document)
{
struct IndirectObject *x;
x = (struct IndirectOb... |
C | #include <string.h>
void itoa(char *buf, unsigned long int n, int base)
{
unsigned long int tmp;
int i, j;
tmp = n;
i = 0;
do {
tmp = n % base;
buf[i++] = (tmp < 10) ? (tmp + '0') : (tmp + 'a' - 10);
} while (n /= base);
buf[i--] = 0;
for (j = 0; j < i; j++, i--) {
... |
C |
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <conio.h>
#include "menu.h"
#include "campo.h"
#define Backspace 8
void niveis()
{
char pausa;
char opcoes;
int tecla = 0;
do
{
system("cls");
gotoxy(58, 12);
printf(" Niveis:\n... |
C | #ifndef LYNX_LWM2M_SCHEDULER_H
#define LYNX_LWM2M_SCHEDULER_H
#include <pthread.h>
#include <sys/time.h>
#include <time.h>
#include <semaphore.h>
#include <stdbool.h>
#include <list.h>
/********* LIST **********/
typedef struct task_element task_element;
typedef struct task_list {
task_element* first;
} task_li... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putstr.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <math.h>
int main() {
/*This program will calculate the distance between two points*/
double x1;
double y1;
double x2;
double y2;
double distance;
printf("Enter x1:\n");
scanf("%lf",&x1);
printf("Enter y1:\n");
scanf("%lf",&y1);
printf("Enter x2... |
C | #include "push_swap.h"
void print_ra(int color, int fd)
{
if (color)
ft_putendl_fd(C_RA, fd);
else
ft_putendl_fd("ra", fd);
}
void print_rb(int color, int fd)
{
if (color)
ft_putendl_fd(C_RB, fd);
else
ft_putendl_fd("rb", fd);
}
void print_rr(int color, int fd)
{
if (color)
ft_putendl_fd(C_RR, fd);
e... |
C | #ifndef _KNAPSACK_H
#define _KNAPSACK_H
#include "item.h"
/**
* @brief Knapsack type definition
*/
typedef struct _s_knap * knapsack;
/**
* @brief Creates an empty knapsack that supports at most [capacity] weight
* @param capacity The max capacity for knapsack
* @return An empty knapsack
*/
knapsack knapsack_empty(u... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* dir_key.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
struct Node {
int data;
struct Node *next;
} *Head;
void Create (int A[], int n);
void Display (struct Node *h);
int Length(struct Node *p);
void Insert (struct Node *p, int index, int x);
int main (){
int A[] = {2,3,4,5,6};
Create(A,5);
Insert(Head, 3,1... |
C | /*
* Copyright 2007-2010, Stepan V.Karpenko. All rights reserved.
* Distributed under the terms of the PhloxOS License.
*/
#include <phlox/processor.h>
#include <phlox/spinlock.h>
void spin_init(spinlock_t *s)
{
atomic_set(s, SPIN_UNLOCKED);
}
void spin_init_locked(spinlock_t *s)
{
atomic_set(s, SPIN_LOCKED)... |
C | /*Program Description*/
/*1.(鱣)*/
/*2.˵(ֱӲѯתΪṹѯתΪѯ˳)*/
#include "stdio.h"
#include "windows.h"
#include "Array.h"
#include "Structural.h"
#include "LinkedList.h"
#define N 10 /*ѧ,ѧݻ,ĺӦͷļĺ궨ҲҪ*/
#define NEXT 10 /*(Name Extent)*/
void InputData(char TempName[N][NEXT], float TempScore[N], int Num) /*ѧϢ*/
{
int i; /... |
C | #include "holberton.h"
/**
* reverse_array - reverse the array
* @a: first input array
* @n: second input length of first input
*
* Return: this function doesn't use return
*/
void reverse_array(int *a, int n)
{
int a2 = 0;
/*int a3 = 0;*/
int izq;
int der;
n = n - 1;
while (n > a2)
{
izq = a[a2];
d... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fractol.c :+: :+: :+: ... |
C | /**
* @brief A program demonstrating logging
*/
#include <solana_sdk.h>
extern void logging(SolParameters *params) {
// Log a string
sol_log("static string");
// Log a slice
sol_log_array(params->data, params->data_len);
// Log a public key
sol_log_pubkey(params->program_id);
// Log all the program'... |
C |
#include <unistd.h>
void putchar(char a)
{
write(1, &a, 1);
}
int main(int argc, char **argv)
{
int a;
a = 0;
if (argc < 2)
putchar('\n');
else
{
argc--;
while (argv[argc][a])
{
putchar(argv[argc][a]);
a++;
}
putchar('\n');
}
return (0);
} |
C | #include<stdio.h>
int main(){
int islem;
int bakiye =100;
int tutar;
printf("Islemler\nPara yatirmak icin 1 \nPara cekmek icin 2\nHesap bakiyenizi gormek icin 3\nCikmak icin 4 girimiz");
do{
printf("\n\nIslem Seciniz:");
scanf("%d",&islem);{
switch(islem){
case 1:
printf("Bakiyeniz %d \... |
C | #include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#define PATH "/tmp"
#define PRJ_ID 0x6666
#define SIZE 4026
int main()
{
key_t k = ftok(PATH,PRJ_ID);
if(k < 0)
{
printf("ftok error!\n");
return 1;
}
int shm_id = shmget(k,SIZE,0... |
C | #include "hash_tables.h"
/**
* shash_table_create - creates a intance of the struct hash_table_t and
* returns it
* @size: size of the array of pointers to linked lists
* Return: the new hash table or NULL
*/
shash_table_t *shash_table_create(unsigned long int size)
{
/* Create the space for the hash table */
s... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct{
int citation;
char author[20];
}Paper;
Paper paper[20005];
int cmp(const void* a , const void* b){
return strcmp(((Paper*)a)->author , ((Paper*)b)->author) != 0 ? strcmp(((Paper*)a)->author , ((Paper*)b)->author) : ((Paper*)b)->citation - ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct Node{
char info;
struct Node *prox, *prev;
}node;
node *makeNode(char info){
node *tmp=(node*)malloc(sizeof(node));
tmp->info=info;
tmp->prox=tmp->prev=NULL;
return tmp;
}
node *push(node *topo, node *input){
input->prox=topo;
if(to... |
C | #include <stdio.h>
typedef struct node {
int data;
struct node *next;
} lnode;
lnode *merge(lnode *one, lnode *two) {
if (one == NULL) {
return two;
}
if (two == NULL) {
return one;
}
lnode *one_head = one;
lnode *two_head = two;
lnode *tmp;
while (one != NULL &... |
C | #include "../ft_list.h"
void ft_list_sort(t_list **head, int (*cmp)())
{
t_list *current;
t_list *next;
char *help;
current = *head;
while (current->next)
{
next = current->next;
if (cmp(current->data, next->data) > 0)
{
help = current->data;
... |
C | #include <stdio.h>
#include "my_functions.h"
/* TASK 3 */
int str_length(char *mystring)
{
int i = 0;
char c = mystring[i];
while (c != '\0')
{
i++;
c = mystring[i];
}
return i;
}
/* TASK 4 */
void str_copy(char *source, char *destination)
{
if (str_length(source) == 0)
{
*destination = '... |
C | /* Student ID : 200882675
* Student Name: Michael Chadwick
* Task 1046 : Sum of Adjacent Numbers
* RunID : 34060
* Result : Accepted
*/
#include<stdio.h>
#include<stdlib.h>
int** insMatrix(int*, int*, int*) ; //create & empty a matrix
void occMatrix(int**, int*, int*, int*); //obtain user ... |
C | #include <lib.h>
#include <daemons.h>
inherit LIB_LEADER;
int JoinGuild(object ob, string verb, string what);
int TeachSpell(object who, string verb, string spell);
string *spells;
mapping AvailableSpells;
int WieldStaff(){
if(!present("staff",this_object())){
new("/domains/town/weap/leostaff")->eventMov... |
C | /*********************
*villageTestFunc
*
*
*
*********************/
#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"
int main(){
int i;
int seed = 1000;
int numPlayer = 2;
int passed = 1;
int k[10] = {adventurer, council_room,... |
C | #include <stdio.h>
int ispal(char a[], int l, int h){
if(l>=h)
return 1;
if(a[l]!=a[h]){
return 0;
ispal(a, ++l, --h);
}
}
int len(char a[]){ //finds length of array recursively and returns position of last element.
static int n=0;
if(a[n]!='\0'){
n++; len(a);
}
return n-1;
}
void main(){
char a[50];
... |
C | #include "util.h"
#include <stdarg.h> // va_start(3)
#include <stdio.h> // fprintf(3)
#include <stdlib.h> // free(3)
#include <string.h> // strcmp(3)
char *ErrorMsg;
Args *new_Args(int argc, char **argv) {
Args *args = malloc(sizeof(Args));
args->argc = argc;
args->argv = argv;
return args;
}
void delete_A... |
C |
#include <stdio.h>
int main()
{
int c, count;
count = 0;
for ( c = 0; ( c = getchar()) != EOF; c++)
{
getword(c, count);
}
printf(" word length equals: \t %d ", count);
return 0; } int getword( int stream, int length )
{
if ( stream != ' ' || stream != '\t' || stream != '\n' )
{
++length;
}
else i... |
C | #include <assert.h>
#include <stdlib.h>
#include "../src/chip8.h"
#include "../src/defs.h"
void testReturn() {
Chip8 *toTest = initChip8();
opcode ocs[] = {0x20fc};
loadInstructions(toTest, ocs, 1);
toTest->memory[0x0fc] = 0x00;
toTest->memory[0x0fd] = 0xee;
emulateCycle(toTest);
assert(toTest->progra... |
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 | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* struct ListNode *next;
* };
*/
struct ListNode *getIntersectionNode(struct ListNode *headA, struct ListNode *headB) {
int size1 = 0, size2 = 0, i;
struct ListNode * node = headA;
while (node != NULL) {size1++; node = nod... |
C | /* "controlFuncs.h"
This is contains all the functions defined in main
the subfunctions these functions call are in "subFuncs.h" */
#include "controlSys.h" // includes "#include <math.h> and subfunction definitions
#ifndef MATH
#define MATH
#include <math.h>
#endif
// distance in meters from cam->wall
#ifndef ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* libft.h :+: :+: :+: ... |
C | #include "main.h"
#include "stm32f4xx_hal.h"
/**
* @brief Rx Transfer completed callback
* @param huart: UART handle
* @retval None
*/
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
/* Increment Index for buffer writing */
UserTxBufPtrIn++;
/* To avoid buffer overflow */
if(UserTxBufPtrIn... |
C | #include <stdio.h>
void Hanoi(int n);
void SubHanoi(int n, char x, char y, char z);
void move(int i, char x, char y);
void Hanoi(int n) {
if (n > 0)
SubHanoi(n, 'A', 'B', 'C');
}
void SubHanoi(int n, char x, char y, char z) {
if (n == 1) {
move(n, x, y);
}
else {
SubHanoi(n - 1, x, z, y);
move(n, x, y);
... |
C | // modelop.schema.0: input_schema.avsc
// modelop.schema.1: output_schema.avsc
#include "fastscore.h"
#include <fstream>
#include <iostream>
#include <jansson.h>
#include <list>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
// function to compute dot product of two 7-... |
C | #include<stdio.h>
#include<stdlib.h>
#define mod 1000000007
int maxheap[1000010],minheap[1000010],median;
void insert_min(int);
void insert_max(int);
void min_heapify();
void max_heapify();
void put_median(int);
int check();
int main()
{
int test;
scanf("%d",&test);
while(test--)
{
long long int fin;
int a,b,c,... |
C | #include<stdio.h>
int main(){
int marks;
printf("Enter the marks you scored => ");
scanf("%d",&marks);
switch(marks/10){
//here what we are doing is we are dividing the marks by 10 so that we get a integer value
//i.e if we divide 95/10 we get 9.5 but since the integer division yeilds ... |
C | /*
Carrasco, Angelica Grace A.
2013-47726
Cmsc128 AB-2L
Assign 001: Number Library
cmsc128-ay2015-16-assign001-c
NumbersToWords Library
*/
// This function generates the word form of a single digit.
void onesNumber(int num){
switch(num){
case 1: printf(" one");
break;
case 2: printf(" two");
break;
case... |
C | #include<stdio.h>
#include<stdlib.h>
int maxMatrixSum(int** mat, int m, int n,int k)
{
int **dp = (int**)malloc(sizeof(int*)*m);
for(int i=0;i<m;i++)
{
dp[i] = (int*)malloc(sizeof(int)*n);
}
dp[0][0] = mat[0][0];
for(int i=1;i<n;i++)
{
dp[0][i] = dp[0][i-1] + mat... |
C | /*user defined function*/
#include<stdio.h>
int main()
{
int choice;
int a,b,r;
printf("\nenter 1 for addition");
printf("\nenter 2 for subtraction");
printf("\nenter 3 for multiplication");
printf("\nenter 4 for remainder");
scanf("%d",&choice);
printf("\nenter any two values");
scanf("%d%d",&a,&b);
switch(choice)
{
... |
C | #include "InsulinDeliveryMechanism.h"
#include "InsulinReservoir.h"
#include "InsulinOutputCalculator.h"
#include "hardware.h"
#include "msp430.h"
const float k_stepVolume = 15.552; //ml/step *3600
const int k_motorOutputFreqLimit = 600; //maximum number of steps motor can take per minute
#define FORWARD 1
#define ... |
C | #include "syscall.h"
#include "console.h"
#include "fs.h"
#include "kernel/print.h"
#include "stdint.h"
#include "string.h"
#include "thread.h"
int32_t __syscall0(SYSCALL_NUMBER n);
int32_t __syscall1(SYSCALL_NUMBER n, void* arg0);
int32_t __syscall2(SYSCALL_NUMBER n, void* arg0, void* arg1);
int32_t __syscall3(SYSCA... |
C | //------------------------------------------------------
// Main function written by Joseph Daniel Moreno
//
// read_line(...) and isAnagram(...) functions provided
// by the course instructor.
//
// Reads in a text file, stores each line in a 2D array,
// then compares the lines with each other to determine
// if they... |
C |
/* ungets.c */
/* Pushes a NUL-terminated string back into an */
/* input stream; returns the number of characters ungotten */
/* This code is public domain - it is from here - */
/* http://foobook.org/jwodder/scraps/ungets/ */
#include <stdio.h>
#include <string.h>
int ungets(const char* str, FILE*... |
C | #include <stdio.h>
#include "libft.h"
char *ft_substr(char const *s, unsigned int start, size_t len)
{
char *sub;
int i;
int j;
i = 0;
while (s[i])
i++;
sub = (char*)malloc((i + 1) * sizeof(*s));
if (!sub)
return (0);
j = 0;
while(j < (int)len)
{
sub[j] = s[j + (int)start];
j++;
}
return (sub... |
C | #include<stdio.h>
int main()
{
int num, sum = 0, rem;
printf("enter the number:\n");
scanf_s("%d", &num);
while (num != 0)
{
rem = num % 10;
sum = sum + rem;
num = num / 10;
}
printf("%d", sum);
scanf_s("%d", &sum);
} |
C | #include "common_header.h"
int findFreeIdx();
void handleMessage(char message[MAX_LENGTH], int priority);
void handleStop(char message[MAX_LENGTH]);
void handleDisconnect(char message[MAX_LENGTH]);
void handleList(char message[MAX_LENGTH]);
void handleInit(char message[MAX_LENGTH]);
void handleConnect(char message[MA... |
C | //#include <04display7seg03.h>
/*
- Aluno:Andr Geraldo, Eng. da Computao (7 semestre).
- Professor Dr. Alberto Willian Mascarenhas.
- Disciplina: Microcontroladores.
- Objetivo: construir um contador decimal com PICSimLab configurado com a placa McLab1-PIC16F628A.
O contador... |
C | #define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
/*
fprintf() fscanf() дļ־ļdz㣬ܹʶûҲԿֶġ
*/
void fscanfAndFprintf() {
#define N 2
struct stu {
char name[10];
int num;
int age;
float score;
} boya[N], boyb[N], *pa, *pb;
FILE *fp;
int i;
pa = boya;
pb = boyb;
if ((fp ... |
C | #include <stdio.h>
#include <time.h>
/************************************************************************/
/* */
/************************************************************************/
/* Indirect macros required for expanded argument p... |
C |
// Needed before *all* includes to correctly load syscall constants
#define _GNU_SOURCE
#include <stdio.h> // printf
#include <stdlib.h> // exit
#include <unistd.h>
#include <sched.h> // CLONE_NEWPID
int main(int argc, char *argv[])
{
printf("IMPORTANT: Make sure to use this program using root privileges!\n\n\n... |
C | #include <string.h>
int strncmp(const char *s1, const char *s2, size_t n) {
unsigned char u1;
unsigned char u2;
while(n --> 0) {
u1 = (unsigned char) *s1++;
u2 = (unsigned char) *s2++;
if(u1 != u2) {
return u1 - u2;
}
if(u1 == '\0') {
return 0;
}
}
return 0;
}
|
C | #include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <errno.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <netdb.h>
#include <string.h>
extern int errno;
int port;
unsigned short verificareIP(char ip[])
{
for(int i=0;i<strlen(ip);++i)
{
if(ip[i]<'0... |
C | /*
* ered.c, part of the knark package
* (c) Creed @ #hack.se 1999 <creed@sekure.net>
*
* This program may NOT be used in an illegal way,
* or to cause damage of any kind.
*
* See README for more info.
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
#include <time.h>
#i... |
C | /* This program implements the creation of shared memory segment
*
* Email : abinashprabakaran@gmail.com
* Date : 14.09.2021
* Author : Abinash
*/
#include<stdio.h> /* required for printf */
#include<sys/ipc.h> /* required for shmget() */
#include<sys/shm.h> /* required for shmget() */
#include<sys/stat.h> ... |
C | #include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
void plusMinus(int arr_size, int* arr) {
double positives=0.0;
double negatives=0.0;
double zeros=0.0;
int i;
for(i=0;i<arr_size;i++)
{
if(arr[i]>0)
... |
C | #include<stdio.h>
typedef struct {
int r;
int c;
int v;
} Triple;
int main() {
int m, n, i = 0, j = 0;
scanf("%d%d", &m, &n);
Triple A[130000];
for (;;) {
int r, c, v;
scanf("%d%d%d", &r, &c, &v);
if (r == 0 && c == 0 && v == 0)
break;
A[i].r = r... |
C | #define _CRT_SECURE_NO_WARNINGS 1
//ͷļ
#include <stdio.h>
#include <stdlib.h>
//-
//int main()
//{
// //ӡ--⺯
// printf("hello world\n");//ӡ
// printf("hello world\n");//ӡ
// printf("hello world\n");//ӡ
// printf("hello world\n");//ӡ
// printf("hello world\n");//ӡ
//
// //ͣ
// system("pause");
// return 0;
//}
//
/... |
C | #include <stdio.h>
#include <string.h>
int main()
{
char s[101],t[101];
int frequencys[26],frequencyt[26],i,s100[101],t100[101];
while(~scanf("%s%s",s,t))
{
memset(frequencys,0,26*sizeof(int));
memset(frequencyt,0,26*sizeof(int));
memset(s100,0,101*sizeof(int));
memset(t100,0,101*sizeof(int));
for(i=0;s[i... |
C | #include"heap.h"
void HeapInit(Heap* php, HPDataType* a, int n)
{
php->_a = (HPDataType*)malloc(sizeof(HPDataType) * n);
memcpy(php->_a, a, sizeof(HPDataType) * n);
php->_capacity = n;
php->_size = n;
//
}
//void Swap(int* p,int* c)
//{
// int* tmp = *p;
// *p = *c;
// *c = *tmp;
//}
void AdjustDown(int* a, int ... |
C | //
// Created by 李文达 on 2020/4/2.
//
#ifndef UNTITLED3_INTERP_H
#define UNTITLED3_INTERP_H
#endif //UNTITLED3_INTERP_H
// todo 先搞字符串 跟数字 布尔,等逻辑走通了 再搞函数跟指针 内存回收
typedef struct MEM_Storage_tag *MEM_Storage;
typedef enum {
CRB_FALSE = 0,
CRB_TRUE = 1
} CRB_Boolean;
typedef struct River_String_tag CRB_Str... |
C | /*
* @lc app=leetcode id=934 lang=c
*
* [934] Shortest Bridge
*/
// @lc code=start
void dfs(int x, int y, int **grid, int n, int *queue, int *tail)
{
if (x < 0 || y < 0 || x >= n || y >= n || grid[x][y] != 1)
{
return;
}
queue[(*tail)++] = x * n + y;
grid[x][y] = -1;
dfs(x - 1, y, g... |
C | #include<stdio.h>
#include<stdlib.h>
main(){
int n1,n2, *ptr,i;
printf("Enter size array : ");
scanf("%d",&n1);
ptr = (int*) malloc(n1*sizeof(int));
printf("Address of previously allocated : ");
for(i=0; i<n1; i++){
printf("%d\n",ptr+i);
}
printf("Enter new element size of array : ");
scanf("%d", &n2);
p... |
C | /*
* BucketSort.h
*
* Created on: Oct 23, 2012
* Author: arming
*/
#ifndef BUCKETSORT_H_
#define BUCKETSORT_H_
#include "definition.h"
#include <malloc.h>
typedef struct node
{
Item value;
struct Node *next;
} Node, *pNode;
void bucket_sort(Item a[], int n);
void insert_node(Node *start,Node *b);
#endif... |
C | #include <stdio.h>
#include <stdlib.h>
#define NN 100005
typedef struct _soldier {
int l, r;
int id;
}SOLDIER;
typedef struct _match {
int sid;
int vid;
}MATCH;
int cmp(const void* a, const void* b)
{
SOLDIER* c = (SOLDIER*)a;
SOLDIER* d = (SOLDIER*)b;
if (c->r == d->r) {
return c->l - d->l;
}
return c->r... |
C | #ifndef CACHE_H
#define CACHE_H
#include <stdbool.h>
#include <string.h>
#include <stdint.h>
#include <stdio.h>
#define KiB (1024)
#define TAMANIO_MEMORIA_PPAL (64*KiB)
#define BITS_DIRECCION_MEMORIA 16
char memoria_ppal[TAMANIO_MEMORIA_PPAL];
int tamanio_cache;
int tamanio_bloque;
int cantidad_vias;
typedef struct... |
C | #include <stdio.h>
#define TOTALALUNO 50
#define TOTALNOTA 5
int main() {
float notas[TOTALALUNO][TOTALNOTA], media[TOTALALUNO], soma = 0, nota1, nota2, nota3, nota4, nota5, maiormedia;
int aluno, nota, qtd = 0;
for(aluno = 0; aluno < TOTALALUNO; aluno++){
for(nota = 0; nota < TOTALNOTA; nota++) {
pri... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.