language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | //greatest of 2 integers
#include<stdio.h>
void main()
{
int a,b;
printf("Enter 1st number: ");
scanf("%d", &a);
printf("Enter 2nd number: ");
scanf("%d", &b);
if(a>b)
printf("First number is greater");
else if(b>a)
printf("Second number is greatest");
else
printf("Both are same");
}
|
C | /*
* Copyright 2011-12 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... |
C | #include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include "blobsBack.h"
#include <time.h>
#include <string.h>
static void llenaTablero (tTablero * tablero);
static int validaMovimiento (tMovimiento * movimiento, tTablero * tablero, int turno);
static size_t longSalto (tPosicion desde, tPosicion hasta);
static... |
C | #include <stdio.h>
#include <string.h>
#include <conio.h>
void main()
{
int i, n = 0;
int item;
char x[10] [12];
char temp[12];
clrscr();
printf("Enter each string on a separate line \n\n");
printf("Type 'END' when over \n\n");
/* Read in the list of strings */
do
{
print... |
C | #include <stdio.h> //inclusão da biblioteca que contem as funções de printf e scanf
void main (){ //declarando a função principal;
int numero, somaMultiplos = 0; //declarando variaveis como inteiras;
do{ //iniciado antes da execução de cada interação do laço
printf("digite um numero: "); //entrada de usuari... |
C | /*
* Name: MicroEMACS
* Buffer handling.
* Version: 30
* Last edit: 17-Feb-86
* By: rex::conroy
* decvax!decwrl!dec-rhea!dec-rex!conroy
*/
#include "def.h"
/*
* Attach a buffer to a window. The
* values of dot and mark come from the buffer
* if the use count is 0. Otherwise, they come
* from some other w... |
C | #include "../../inc/ush.h"
static int check_name_alias(t_alias *als, char *name, char *value) {
t_alias *tmp = als;
while (tmp && name && value) {
if (mx_strcmp(tmp->name, name) == 0){
mx_strdel(&(tmp->value));
tmp->value = mx_strdup(value);
return 1;
}
... |
C | #include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#include<math.h>
void check(int b,const char* msg)
{
if(!b)
{
fprintf(stderr,"error: %s\n\n",msg);
exit(-1);
}
}
void* long_new_array(const size_t N,const char* error_msg)
{
void* ptr;
int err;
/*if (_deviceType == 3){
err = posix_memalign(&ptr,ACL_... |
C | // Oisin Murphy - D00191700
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include "./valhex.h"
void validate_hexcodes(int argc, char *filename[]) {
// if(argc <= 1) {
// printf("Invalid or insufficient number of arguments. Please try again.\n");
// exit(1);
//... |
C | /* _getcwd.c
Author: BSS9395
Update: 2021-10-29T22:47:00+08@China-Guangdong-Shenzhen+08
Design: Windows C Library: _getcwd
*/
/* Windows API
#include <direct.h>
int _mkdir(const char *dirname);
int _rmdir(const char *dirname);
int _chdir(const char *dirname);
char *_getcwd(char *buffer, int maxlen);
*/
#define _CRT_S... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "MiLibreria.h"
int main()
{
char seguir='s';
int opcion=0,indice,dni,validar;
EIndice aux;
EPersona lista[20];
inicializarLista(lista);
while(seguir=='s')
{
printf("Elija la opcion que desea: \n\n");
printf(... |
C | // Write a program to add first seven terms of the following series
// 1/1! + 2/2! + 3/3! .........
// using a for loop:
#include<stdio.h>
int main(){
int num=1,limit,i;
float sum=0,factorial;
printf("Enter the limit = ");
scanf("%d", &limit);
for(num=1;num<=limit;num++)
{
... |
C | #include <stdio.h>
void main(void)
{
int IdadeAnos, IdadeDias;
printf("\nDigite sua idade em anos: ");
scanf("%i", &IdadeAnos);
while (IdadeAnos > 0)
{
IdadeDias = IdadeAnos * 365;
printf("Sua idade em dias: %i", IdadeDias);
printf("\nDigite sua idade em anos: ");
scanf("%i"... |
C | #include <stdio.h>
char *find_first_occurance(char *string, char character);
int main()
{
char *string = "abcdefghijklmnopq";
for (char character = 'a'; character <= 'z'; character++)
printf("%p\n", find_first_occurance(string, character));
return 0;
}
char *find_first_occurance(char *string, char c... |
C | /*
** my_factorielle_rec.c for my_factorielle_rec in /home/ungaro_l/rendu/Piscine_C_J05
**
** Made by Luca Ungaro
** Login <ungaro_l@epitech.net>
**
** Started on Fri Oct 2 09:24:26 2015 Luca Ungaro
** Last update Fri Oct 2 13:28:41 2015 Luca Ungaro
*/
int my_factorielle_rec(int nb)
{
if (nb < 0 || nb > 21474... |
C | #ifndef LAB3_DYNAMIC_PROGRAMMING_PART1_UTILS_H
#define LAB3_DYNAMIC_PROGRAMMING_PART1_UTILS_H
#include <stdlib.h>
int max_of_two(int a, int b) {
return a > b ? a : b;
}
int max_of_three(int a, int b, int c) {
if (a > b) {
if (a > c) {
return a;
} else {
return c;
... |
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 "circular_buf.h"
#include <assert.h> /* assert */
#include <stdlib.h> /* strtol */
#include <stdio.h> /* perror, printf */
void test_push(int capacity)
{
circular_buf *cbuf;
cbuf = new_circular_buf(capacity);
if (cbuf == NULL)
{
fprintf(stderr, "%s: Failed to allocate memory for buf... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cJSON.h"
int MakeJsonNameAge(char *pszJsonContent, int iJsonLen);
int MakeJsonPersonInfo(char *pszJsonContent, int iJsonLen);
int MakeJsonTwoPersonInfo(char *pszJsonContent, int iJsonLen);
int MakeJsonIDPersonInfo(char *pszJsonContent, int ... |
C | /*****************************************************************************
FileName: main.c
Processor: PIC24HJ128GP502
Compiler: XC16 ver 1.30
Created on: 14 listopada 2017, 09:37
Description: SPI MASTER
************************************************************************... |
C | #include "posix_sem.h"
#include "misc.h"
#include <stdio.h>
#include <semaphore.h>
#include <errno.h>
/*
POSIX Semaphore related functions
*/
enum decision sandbox_check_sem_create(const char *name)
{
sem_t *existing_sem = sem_open(name, 0);
if (existing_sem != SEM_FAILED) {
// There already is such... |
C | #include <msp430.h>
/**
* File: main.c
* Author: William Cronin
* Date Created: October 1st 2018
* Date of Last Revision: October 3rd 2018
*/
int timerdelay;
void main(void)
{
WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer
P1SEL = 0; //Sets Pin 1 as a GPIO
P1DIR &= ~BIT3; ... |
C | #ifndef __MAIN_LIST_H
#define __MAIN_LIST_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "list.h"
void createList(struct list** l);
//List 생성
void dumpdataList(struct list* l);
//List 데이터 순서대로 모두 출력
bool list_less(const struct list_elem* a, const struct list_elem* b... |
C | #include <stdio.h>
#include <stdlib.h>
int a[100],n,i,j,temp;
heapsort(int *a,int n)
{
int heapsize=n;
for(i=n/2;i>=1;i--)
{
maxheapify(a,i,n);
}
for(i=n;i>=2;i--)
{
temp=a[1];
a[1]=a[i];
a[i]=temp;
heapsize=heapsize-1;
maxheapify(a... |
C | /*
Devolver o índice i de um dado vetor v com n inteiros tal que v[i]==k ou -1 caso tal
índice inexista. k é dado.
*/
#include <stdio.h>
#include <string.h>
//funçao abaixo nao copie acima
int retInd(int vet[], int tam, int i, int k)
{
if (i > tam - 1) return -1;
if (vet[i] == k) return i;
return retInd(vet, ta... |
C | #include <stdio.h>
#include <mm_malloc.h>
#include <stdlib.h>
#define MAX_SIZE 5
typedef struct queue
{
int value[MAX_SIZE];
int front;
int rear;
}QUEUE,* PQUEUE;
_Bool push(PQUEUE,int);
_Bool pop(PQUEUE );
_Bool is_empty(PQUEUE);
_Bool is_full(PQUEUE);
void initQueue(PQUEUE);
void show_queue(PQUEUE);
void ini... |
C | #include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
int i = 0;
int count = 0;
char *b[256];
char a[] = "I like this game !";
char *p, *q;
char *s = NULL;
//if (argc < 1)
//{
//printf("please input a separator !\n");
//return 0;
//}
p = q = a;
w... |
C | #include<stdio.h>
void main(){
int a;
scanf("%d",&a);
if(a>=0&&a<=100){
printf("赤贫打工人");
}
else if(a>=101&&a<=1000){
printf("普通打工人");
}
else if(a>=1001&&a<20000){
printf("土豪打工人");
}
else{
printf("错了");
}
}
|
C | /**************************************************************************//**
* @file
* @brief GPIO Interrupt Example
* @author Energy Micro AS
* @version 1.0.0
******************************************************************************
* @section License
* <b>(C) Copyright 2014 Silicon Labs, http://www.sil... |
C | #include <stdio.h>
int main(int argc, char const *argv[])
{
int a[10] = {3,2,3,4,5,6,7,8,9,10};
int *p1 = a;
int *p2 = &a[5];
printf("p1 apunta a %d\n", *p1);
printf("p2 apunta a %d\n", *p2);
p1 = p1 + 9;
printf("p1 ahora apunta a %d\n", *p1);
return 0;
} |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../jsmn.h"
/*
* A small example of jsmn parsing when JSON structure is known and number of
* tokens is predictable.
*/
static const char *JSON_STRING =
"{\"user\": \"johndoe\", \"admin\": false, \"uid\": 1000,\n "
"\"groups\": [\"users\", \"wh... |
C | #include "libft.h"
int ft_voidlen(unsigned int *src)
{
int i;
int counter;
counter = 0;
i = -1;
while (src[++i])
counter += nbr_bytes(src[i]);
return (counter);
}
|
C | #include <stdio.h>
#define SIZE 6
int A[SIZE] = {10, 9, 8, 7, 1, 5}; // = {6, 9, 4, 15, 5, 7};
void swap(int *a, int *b)
{
int temp = *a;
*a = *b;
*b = temp;
}
int
getPos(int a[], int low, int high)
{
int pivot = a[high];
int i = (low -1);
for (int p = low; p <= high - 1; p++)
{
if (a[p] <= pivo... |
C | /**********************************************************************
wn_enter_vect(vect,len_i)
wn_enter_mat(mat,len_i,len_j)
wn_print_vect(vect,len_i)
wn_print_mat(mat,len_i,len_j)
**********************************************************************/
/************************************************************... |
C | #include <stdio.h> // abrindo biblioteca
#include <stdlib.h>
#include <locale.h>
int main(void){
/*Programadores Lohan e Marcelo*/
setlocale(LC_ALL, "Portuguese");
float f, c, p, mm;
printf("programa de converso de Fahrenheit em Celsius \n");
printf("Digite o valor em Fahrenheit:"... |
C | /*
** tp3_firstimage.c for tp3_fisrtimage in /home/RODRIG_1/rendu/Minilibx-TP.3
**
** Made by rodriguez gwendoline
** Login <RODRIG_1@epitech.net>
**
** Started on Thu Nov 13 10:09:32 2014 rodriguez gwendoline
** Last update Mon Nov 13 16:05:47 2017 Gwendoline Rodriguez
*/
#include "header.h"
void mlx_pixel_put_t... |
C | #include <stdio.h>
#include <stdlib.h>
#include<math.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main() {
int l=0,c=0;
scanf("%d",&l);
scanf("%d",&c);
l = l%2;
c = c%2;
int cor = (l==c) ? 1 : 0; //COR DA CASA DO XADREZ 1(BRANCO) 0(PRETO)
printf("... |
C | #include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <mpi.h>
#include <sys/time.h>
// Длина стержня
#define L 20
// Параметр теплопроводности
#define Lamb 0.5
// Временные узлы
#define TIME 10
// Шаг по времени
#define dT 1
int main(int argc, c... |
C | #include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <sys/mman.h>
#include "framebuffer_info.h"
int getDisplayInfo() {
int fbfd = 0;
struct fb_var_screeninfo vinfo;
struct fb_fix_screeninfo finfo;
long int screensize = 0;
char *fbp = 0;
int x = 0, y = 0,i;
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_POLYS 100
#define BUFFER_LENGTH 100
struct term
{
int coef;
int expo;
struct term *next;
};
typedef struct term Term;
typedef struct polynomial
{
char name;
Term *first;
int size;
}
Polynomial;
Polynomial *polys[MAX_POLYS]... |
C | void MergeOne(int a[],int b[],int n,int len) //完成一遍合并的函数
{
int i,j,k,s,e;
s=0;
while(s+len<n)
{
e=s+2*len-1;
if(e>=n)//最后一段可能少于len个结点
{
e=n-1;
}//相邻有序段合并
k=s;
i=s;
j=s+len;
while(i<s+len && j<=e)//如果两个有序表都未结束时,循环比较
... |
C | #include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main() {
long int eps, i, j, perguntas, res, ep, pipoca;
scanf("%ld", &eps);
long int duracao[eps];
for(i = 0; i < eps; i++)
{
scanf("%ld", &duracao[i]);
}
scanf("%ld", &perguntas);... |
C | #include <stdio.h>
#include <unistd.h>
#include <termios.h>
#include <signal.h>
#include <stdlib.h>
#include <memory.h>
#include <errno.h>
#include <wait.h>
#include <stdbool.h>
#define ROWS (20 + 2)
#define COLS 20
void printBoard();
void initBoard();
void startRound();
void updateShapeToBoard();
void playOneTurn()... |
C | #include <assert.h>
#include <stdlib.h>
typedef struct st
{
struct st *next;
int data;
} st_t;
st_t dummy;
st_t *func();
void main()
{
st_t *st = func();
assert(st != NULL);
assert(st->next != NULL);
assert(st->next->next != NULL);
assert(st->next->next->next == NULL);
assert(st != &dummy);
ass... |
C | #ifndef MIDI_H
#define MIDI_H 1
#include <stdio.h>
#define MAX_TRACKS 128
#define MAX_EVENTS 128
#define EVENT_TYPES X(NOTE_ON), X(NOTE_OFF), X(PROGRAM_CHANGE), X(CONTROL_CHANGE), X(SYSEX), X(TEMPO_CHANGE), X(AFTERTOUCH), X(PITCH_WHEEL)
typedef enum {
#define X(x) x
EVENT_TYPES
#undef X
} MIDI_ev_type;
extern cha... |
C | /* acmicpc.net - 2523 - 13 */
#include <stdio.h>
int main(){
int i, j, N;
scanf("%d", &N);
for (i=1; i<=N; i++){
for (j=1; j<=i; j++) printf("*");
printf("\n");
}
for (i=N-1; i>=1; i--){
for (j=1; j<=i; j++) printf("*");
printf("\n");
}
return 0;
} |
C | #include<stdio.h>
#include<stdlib.h>
struct node{
int data;
struct node *next;
};
struct node *start=NULL,*tail=NULL;
int size();
void push_front(int n);
int pop_front();
void display();
int empty();
int value_at(int loc);
void push_back(int item);
int pop_back();
int front();
int back();
void inserts(int, int);
voi... |
C |
/*
===========================================================================
FILE: timetickLegacy.c
DESCRIPTION:
This is the file with wrapper functions accessing Timetick DAL.
===========================================================================
*/
/*===========================================... |
C | /*
* Data la dimensione del lato, disegnare un quadrato a schermo
* mettendo dove sui lati i caratteri "*"
* Input: lato x
* Output: quadrato disegnato con lato x
*
* (c) Marco Aceti, 2017. Some rights reserved.
* See LICENSE file for more details.
* THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF A... |
C | #include<stdio.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<netinet/in.h>
#include<netinet/ip.h>
#include<stdlib.h>
#include<string.h>
#include<unistd.h>
#include<arpa/inet.h>
void main(){
int sockfd = socket(AF_INET, SOCK_STREAM, 0);
if(sockfd == -1) {
printf("socket error\n");
exit(1);
}
struc... |
C | #include <stdio.h>
#include <string.h>
#include "Entidade.h"
#include "Validacoes.h"
#include <stdlib.h>
#define true 1
#define false 0
#include <time.h>
#define MAX_Detentos 200
#define Max_Penas 100
#define Max_Atividade 100
#define Max_FuncAtividade 500
#define Max_Visitantes 200
#define Max_Visitas 500... |
C | #ifndef LAB1_STUDENT_H
#define LAB1_STUDENT_H
struct value {
unsigned int age;
unsigned int weight;
value( unsigned int a, unsigned int b ) {
age = a;
weight = b;
}
value() {
age = 0;
weight = 0;
}
~value() {}
friend bool operator!=( const value& a,... |
C | // C Program for Message Queue (Writer Process)
#include <stdio.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <string.h>
// structure for message queue
struct user {
long message_type;
char account_number[100];
int cash_amt;
} stru1;
int main()
{
key_t key;
int messagesgid;
printf(" ... |
C | #include "utils.h"
#include <ctype.h>
/* Skip everything that is not alphanumeric value before that start of the word */
int skipDelim(FILE *file){
int input;
while(!(isalnum(input = fgetc(file)))){
/* We check if we reached a necessary char */
if(input == '\n')
return NEWLINE;
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
char *buffer = NULL;
size_t size1;
size_t size2;
FILE *filedes;
filedes = fopen("out.txt", "w+");
if (filedes == NULL){
printf("Could not open file\n");
}
/* A total of 6 characters including the nu... |
C | #include <stdlib.h>
#include <gba.h>
#include "obj_utils.h"
void InitObj(OBJ_UTILS* oud) {
oud->obj = (OBJATTR*)malloc(sizeof(OBJATTR) * OBJ_MAX);
}
void FinishObj(OBJ_UTILS* oud) {
free(oud->obj);
}
void SetObjChr(OBJ_UTILS* oud, const void* tiles_adr, const void* pal_adr) {
// グラフィックデータをメモリへコピー
dmaCopy((u16*)t... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int agrc, char *argv[]){
char input[200];
int len;
int ans;
int pow[32];
int i;
pow[0] = 1;
for(i=1; i<32; i++){
pow[i] = pow[i-1] * 2;
}
while(1){
gets(input);
if(strcmp(input, "0") =... |
C | #include <stdio.h>
#include <stdlib.h> /* atoi */
#include <string.h>
int main()
{
char *str = "12, 0";
char *pc = strchr(str, ',');
int first, second;
printf("*pc:%c\n", *pc);
first = atoi(str);
second = atoi(pc + 1);
printf("first:%d\n", first);
printf("second:%d\n", second);
return 0;
}
|
C | #include "config/output_format.h"
#include <getopt.h>
#include <stdlib.h>
#include <string.h>
#include "log.h"
#include "config/str.h"
#define OFM_VALUE_CSV "csv"
#define OFM_VALUE_JSON "json"
#define DEREFERENCE(void_value) (*((enum output_format *) void_value))
static void
print_output_format(struct option_fiel... |
C | /*
gcc -std=c17 -lc -lm -pthread -o ../_build/c/numeric_math_fabs.exe ./c/numeric_math_fabs.c && (cd ../_build/c/;./numeric_math_fabs.exe)
https://en.cppreference.com/w/c/numeric/math/fabs
*/
#include <stdio.h>
#include <math.h>
/* This numerical integration assumes all area is positive. */
#define PI 3.14159
double nu... |
C | #ifndef TCPHELPER_H
#define TCPHELPER_H
#include "util.h"
typedef struct tcpHeader{
uint16_t sourcePort;
uint16_t destPort;
uint32_t seqNumber;
uint32_t ackNumber;
uint8_t headerLength;
uint8_t reserved;
uint8_t TCPFLAGS;
uint16_t window;
uint16_t checksum;
} tcpHeader;
int readTcp... |
C | /* output the sum of squares of numbers
filename: Ch5Ex6.c
ver 1.0
Alexandr Kravtsov */
#include <stdio.h>
int main()
{
int correct_enter;
int number = 0, sum = 0;
int limit;
printf("Enter limit(integer number): ");
correct_enter = scanf("%d", &limit);
if(correct_enter != 1) {
printf("Error enter. ... |
C | #include <stdio.h>
#include <stdlib.h>
int f[20000000];
int
find_len(m)
{
int times = 0;
int n = m;
while (n>1)
{
if (f[n] != 0)
{
times += f[n];
return times;
}
if (n % 2 == 0)
n = n / 2;
else n= n * 3 + 1;
times++;
}
f[m] = times;
return(times);
}... |
C | #include <stdio.h>
#include <stdlib.h>
#include<time.h>
/* [v L */
#define LOOP 10
/* Ԓl 0: not prime, 1: prime */
long int isPrimeFermat(long int);
long int input() {
long int val; char buf[100]={0};
printf("Tf͈̔͂߂ĉi)\n");
fgets(buf, 50, stdin);
sscanf(buf, "%ld", &val);
return val;
}
m... |
C | #include <stdio.h>
#include <stdlib.h>
#include <locale.h>
int comparacao(int num1,int num2){
if(num1<num2){
printf("\n\nO seu nmero menor que o nmero sorteado!");
return 1;
}
else if(num1>num2){
printf("\n\nO seu nmero maior que o nmero sorteado!");
return 1;
}
else{
return 0;
}
}
int main(void){
... |
C | #include <stdio.h>
int if_num_is_magic(int n){
int num = n;
while(n>0){
if(n%10 == 0)return 0;
if(num % (n%10) != 0)return 0;
n = n/10;
}
return 1;
}
int main(){
int num;
scanf("%d", &num);
printf("%d\n", if_num_is_magic(num));
return 0;
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* move.c :+: :+: :+: ... |
C | #include "estructuras_arbol.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
#include <stab.h>
#include <stdlib.h>
#include <sharksCommons/protocolo.h>
#include <sys/dir.h>
#include <dirent.h>
#include <aio.h>
#include <curses.h>
#include <ncurses.h>
int dato;
/*void main(void) {... |
C | /*
* meansquarediff.c
* by Samuel Weaver (sweave05) and Ross Kamen (rkamen02)
* October 21, 2016
* HW 4
*
* The implementation of a function to compare two images.
*/
#include "meansquarediff.h"
#include <assert.h>
#include <math.h>
#include <stdlib.h>
/*
* closure structure
* used to carry information for t... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "fnctl.h"
#include "ramdisk.h"
#include "vfs.h"
DISK disk = {
.dev_id = 0xFF,
.data = NULL,
.size = 0,
.write = writeRamdisk,
.read = readRamdisk,
.init = createRamdiskDevice,
.deinit = removeRamdiskDevice
};
int removeRamdiskDevice()
{... |
C | /**
* @file k210_gpio.c
* @brief
* @author sksat <sksat@sksat.net>
* @version 0.1
* @date 2020-08-15
*/
#include <assert.h>
#include <util/log.h>
#include <embox/unit.h>
#include <util/bit.h>
#include <util/array.h>
#include <drivers/gpio/gpio_driver.h>
#include <drivers/gpio/k210.h>
#include <drivers/gpio/k21... |
C | /* runp, runvp -- execute process and wait for it to exit
*
* Usage:
* i = runp (file, arg1, arg2, ..., argn, 0);
* i = runvp (file, arglist);
*
* Runp and runvp have argument lists exactly like the corresponding
* routines, execlp and execvp. The runp routines perform a fork, then:
* IN THE NEW PROCESS... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
char key[50] = "\x79\x17\x46\x55\x10\x53\x5f\x5d\x55\x10\x58\x55\x42\x55\x10\x44\x5f\x3a";
void win(void)
{
system("/bin/sh");
}
void main(void)
{
char input[50];
fgets(input, sizeof(input) - 1, stdin);
if (strlen(input) == strlen(key)) {
for (int ... |
C | #include<stdio.h>
#include "holberton.h"
/**
* print_to_98 - prints to 98 from n
* @n: starting point
*
* Description: prints from a starting point to 98
* in a cool way
* Return: void
*/
void print_to_98(int n)
{
while (n <= 98 || n >= 98)
{
if (n == 98)
{
printf("%d\n", n);
break;
}
printf("%d... |
C | #include <stdio.h>
#include <windows.h>
/*
y = [435048], x = [43504C];
map = [434C21];
004051A6 CMP EAX,100; [esp+4] == WM_KEYDOWN
*/
int main() {
char soko[16][20];
int x,y; HWND target;
unsigned long proc_id; HANDLE souko;
int i = 0x434C20; char sokox, sokoy;
printf("Soukoban Teleporter v1.0 by BoR0\n written 25... |
C | #pragma once
#define SORTED_VECTOR_INITIAL_CAPACITY 1
typedef unsigned int sortedVectorType;
typedef struct {
sortedVectorType *elements;
unsigned int size, capacity;
} sortedVector;
void sortedVectorCreate(sortedVector *vector);
void sortedVectorFree(sortedVector *vector);
void sortedVectorAddUnique(sortedVector... |
C | /**************************************************************
* modul: system memory freeing routines
*
* copyright: Yafra.org
**************************************************************/
static char rcsid[]="$Header: /yafraorg/cvsroot/foundation/ansic/libs/pssys/source/free.c,v 1.1.1.1 2002-10-26 20:49:54... |
C | // common.c -- Defines some global functions.
// From JamesM's kernel development tutorials.
#include "common.h"
// write a byte out to the specified port.
void outb(u8int value, u16int port) {
__asm__ __volatile__("outb %1, %0" : : "dN"(port), "a"(value));
}
// write a word (16 bit) out to the specif... |
C | /*
En la fotocopiadora de docentes de la facultad, cada vez que un
profesor retira copias, se registra el código de departamento , la cantidad de copias doble
faz y la cantidad de copias simple faz . La lista se elabora por cada uno de los veinte días
laborables del mes.
Suponer que hay sólo tres departamentos, identif... |
C | //https://blog.csdn.net/k1ang/article/details/80397173
/*
* Copyright reserved. <== Correct
* file
* author
* date
* version
*/
#include "sdk_hc595.h"
static void DelayTime(void)
{
for (uint16_t t=5; t>0; t--);
}
static void GPIO_WRITE(uint16_t hc595_Pin, uint8_t val)
{
if(!val)
{
HAL_GPIO_WritePin(HC... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <limits.h>
#include <unistd.h>
#include <pthread.h>
struct Queue{
int front, rear, size;
int capacity;
int *array;
};
/* Function to create a queue with a given capacity.
* starts with a size of queue as 0
*/
struct Qu... |
C | #define T_DIR 1 // Directory
#define T_FILE 2 // File
#define T_DEV 3 // Device
struct stat {
short type; // Type of file
int dev; // File system's disk device
uint ino; // Inode number
short nlink; // Number of links to file
uint size; // Size of file in bytes
uint second;
uint minu... |
C | #include <stdio.h>
#include <netdb.h>
#include <sys/socket.h>
#include <strings.h>
#include <string.h>
#include <unistd.h>
int main(){
struct sockaddr_in serverAddress;
serverAddress.sin_family = AF_INET; //IPv4
serverAddress.sin_port = htons(2727); //Los primeros 1024 puertos requieren privilegios de ... |
C | //RESUMOS
//Least Recently Used (LRU) page replacement algorithm works on the concept that the pages that are heavily used in previous instructions are likely
//to be used heavily in next instructions. And the page that are used very less are likely to be used less in future. Whenever a page fault occurs,
//the page th... |
C | #include <signal.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <opencv/cv.h>
#include <mapper/mapper.h>
#include <xdo.h>
#include <lo/lo.h>
#define MAX_NOPOSITION 30
#define CLICK_SPEED 5
#define CLICK_LENGTH 5
#define MARKER_SIZE 128
#define WIDTH 1024.f
#define HEIGHT 768.f
int gIsRunning... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* parse_texture.c :+: :+: :+: ... |
C | // Sameh Shahin ew20b001
#include <stdio.h>
// prototypes
void read_input_array(int l, int arr[l][l]);
void calculate_output_matrix(int l, int arr_output[l][l], int arr1[l][l], int arr2[l][l]);
void print_result_matrix(int l, int arr_output[l][l]);
int main()
{
int array_length = 0;
int input_matrix_1[50][5... |
C | /* Author: Chris Bradley (635 847)
* Contact: chris.bradley@cy.id.au */
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "list.h"
// Private function! Here instead of header.
node_t *get_node_for(list_t *list, void *data);
/* Creates a new list of size zero and returns a pointer
* to it.
*
* ... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "item.h"
#include "utils.h"
typedef struct shelf shelf_t;
// -------------------------------
// Structs & Enums
// -------------------------------
typedef struct shelf {
char *name;
int amount;
} shelf_t;
struct item {
cha... |
C |
#ifndef UNTITLED_FIRST_COVER_H
#define UNTITLED_FIRST_COVER_H
/* first_cover is called from main after getting a line from the file. The function is the "headquarter" of most of the program's functions.
* It trims the line, and delivers the desired arguments to the responsible functions. It checks if line is empty,... |
C | /*
Name:Abid Ahmed
Reg No:2018831062
Sub:Data Structure
Course Name:SWE127,SWE128
Program Topic:String Processing
Substring
Indexing
Length
... |
C |
void check_Key(int k)
{
if((k >= 32 && k < 127))
printf("The character < %c > entered is NORMAL" ,k);
else if ((k >= 128 && k <= 255))
printf("The character < %c > entered is EXTENDED" ,k);
else
printf("The key pressed < %c > is a control key" ,k);
}
|
C | /*
Alexandro Francisco Marcelo Gonzalez A01021383
Credits to Gilberto Echeverria
01/03/2019
*/
#include "sockets_tools.h"
int prepareServer(char * port, int max_queue)
{
struct addrinfo hints;
struct addrinfo * address_info = NULL;
int server_fd;
// Clear the structure before filling the data
... |
C | #include "stdio.h"
#include "math.h"
int main(int argc, char* argv[])
{
int n = 0, i = 0;
__int64 s = 0;
double x = 0.0;
#ifndef ONLINE_JUDGE
freopen("input.txt", "rt", stdin);
freopen("output.txt", "wt", stdout);
#endif
scanf("%d", &n);
/* f(n) = 1 + n*(n-1)/2 */
for(i... |
C |
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include "RingBuffer.h"
#define MAX_TEXT 1000
#define ASSERT_TRUE(expr, result) \
if (result.success && !(expr)) { \
result.success = false; \
result.line = __LINE__; \
strncpy(result.e, #... |
C | #include "inc/syscall.h"
int global=100;
int main(void){
int local=0;
if(fork()==0){
fork();
fork();
while(local<10){
uart_printf("pid: %d, local: 0x%x %d, global: 0x%x %d\n",getpid(),&local,local,&global,global);
local++;
global--;
delay(1000000);
}
}else{
int* a=0;
uart_printf("%d\n",*a);... |
C | #include<stdio.h>
#include<stdlib.h>
static int count;
int check(int** chess_board,int n,int row,int col){
if(row<0 || row>=n || col<0 || col>=n)
return 0;
if(chess_board[row][col]==1)
return 0;
for(int i=0;i<n;i++)
if(chess_board[row][i]==1)
return 0;
for(int i=0;i<n;i++)
if(chess_board[i][col])
ret... |
C | #include "list.h"
void list_pop(list** root) {
// stack is empty
if (!*root) return;
// delete top and update stack
list* old_root = *root;
*root = old_root->next;
free(old_root);
}
void list_prepend(list** root, tree* node) {
// create new node
list* new_item = (list*)malloc(sizeof(list));
new_item->node =... |
C | #include <stdio.h>
int age(int n, int level)
{
int tmp = 0;
int i = 0;
//输出不同递归层次的制表符
for (i = 0; i < level; i++)
{
printf("\t");
}
printf("--->age(%d)\n", n);
if (1 == n)
{
tmp = 10;
return tmp;
}
tmp = age(n - 1, level + 1) + 2;
//输出不同递归层次... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
// Ƽ带
#include <pthread.h>
// udp tcpʹ ٸ 迭 ũ⸦ ũ ȵ.
#define BUF_LEN 128
// udp tcp ٸ Ŭ̾Ʈ Ǵ ƴ ְ ޱ
// 带 ʿ .
int s, len, msg_size;
cha... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.