language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define SIZE 100
int undefinedGlobal1, undefinedGlobal2;
int definedGlobal1, definedGlobal2;
void newfunction(int v1, int v2);
extern char __executable_start;
extern char __etext;
int main(int argc, char* argv){
printf("PID: %d\n", getpid());
//printf("Loc... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* handle_decimal.c :+: :+: :+: ... |
C | /*
** EPITECH PROJECT, 2017
** remote-tty
** File description:
** shell commands from session
*/
#include <stdlib.h>
#include "remote-tty.h"
#include "my.h"
#include "defines.h"
int i_command(const char *cmd, __attribute__ ((unused)) session_info_t *session)
{
int alloc;
cmd += 2;
alloc = 0;
if (my_strnc... |
C | /*
* This module deals with everything that has to do with the movesList struct.
* It have methods regarding this struct which can be used by any module which includes utilitiesLinkedList.c
* and uses movesList struct.
*/
#ifndef SOFTWAREPROJECTFINALPROJECT_LINKED_LIST_H
#define SOFTWAREPROJECTFINALPROJECT_LINKED_... |
C | #include "structs.h"
void my_delay(int n) {
while(n--) {
_delay_ms(1);
}
}
int init_motor(struct Motor* m1, struct Motor* m2){
int result = 0;
if (motor_turn(m1, 2950.f))
{
motor_turn(m1, 1475.f);
result += 1;
}
if (motor_turn(m2, 3360.f))
result += 2;
... |
C | #include <stdio.h>
#include <stdbool.h> // boolean values
#include <signal.h> // signal(), kill()
#include <unistd.h> // fork()
#include <sys/wait.h> // wait()
#include <stdlib.h> // exit()
#define NUM_CHILD 6
#ifdef WITH_SIGNALS // Things needed to 2. Task
bool interrupt_flag = false;
void signal_handler(int s... |
C |
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <libxml/parser.h>
#include <event.h>
#include <signal.h>
#include <jansson.h>
#include <inttypes.h>
#include "lib/linklist.h"
#include "branch.h"
#include "vbranch.h"
#include "view.h"
#include "helpers.h"
#include "lib/rb.h"
in... |
C | #include <stdio.h>
int main(){
int opcion;
float monto,saldo=100;
printf("\tBienvenido al cajero virtual");
printf("\n1. Ingreso cuenta");
printf("\n2. Retirar dinero de la cuenta");
printf("\n3. Salir");
printf("\nOpcion:");
scanf("%i",&opcion);
switch(opcion){
case 1:
printf(... |
C | #include <stdio.h>
int main(int argc, char *argv[])
{
int num[4] = {0x0, 0x2, 0x3, 0x1};
int d = num[0];
int i;
for (i = 0; i < 4; i++) {
d ^= num[i];
printf("num: %d, d: %d, status: %d\n", num[i], d, !!d);
}
return 0;
}
|
C | #include "mouse.h"
sword initMouse(MOUSE *mouse)
{
union REGS in, out;
in.x.ax = MOUSE_RESET;
int86(INT_MOUSE, &in, &out);
mouse->on = out.x.ax;
mouse->num_buttons = out.x.bx;
mouse->button1 = 0;
mouse->button2 = 0;
mouse->button3 = 0;
mouse->x = SCREEN_WIDTH/2;
mouse->y = SCREEN_HEIGHT/2;
... |
C | #include "../filler.h"
void row_count(s_board *start)
{
start->i = 0;
start->top = 0;
start->bottom = 0;
int count = 0;
while ((start->i < start->board_x))
{
if (ft_strrchr(start->board[start->i], start->my_piece))
{
start->top = start->i;
break;
}
start->i++;
}
start->i = 0;
while ((start->i ... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct
{
char prodotto[50];
int scatole;
}prodotti;
typedef struct element
{
prodotti P;
struct element *left, *right;
}nodo;
typedef nodo *tree;
tree insord (prodotti PRO, tree t);
void printree(tree t);
int findel(prodotti PRO, tree t); |
C | #include<stdio.h>
#include<conio.h>
void main()
{
int n1,count=0;
clrscr();
scanf("%d",&n1);
while(n1)
{
n1=n1/10;
count++;
}
printf("%d",count);
getch();
}
|
C | #include "holberton.h"
#include <stdio.h>
/**
* print_array - it prints an array
*@a: an array
*@n: is the length of array
* Return: void
*/
void print_array(int *a, int n)
{
int i;
i = 0;
while (i < n)
{
printf("%d", *(a + i));
if (i < (n - 1))
{
printf(", ");
}
i++;
}
printf("\n");
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include "utn_strings.h"
#include "orquesta.h"
#include "instrumento.h"
#include "musico.h"
#include "informes.h"
#define REINTENTOS 3
#define LEN_ORQUESTA 50
#define LEN_INSTRUMENTO 20
#define LEN_MUSICO 1000
int main()
{
Orquesta orquestas[LEN_ORQUESTA];
Instrumento ins... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<unistd.h>
#include<sys/time.h>
#include<sys/types.h>
#include<netinet/in.h>
#include<netdb.h>
void child_process(int n,int newsockfd){
char str[256];
int no_of_send = 0;
char filename[100];
long long int bytes = 0;
struct timeval tv1... |
C | #include <stdio.h>
int main()
{int r;
float p=3.14;
float s;
scanf("%i",&r);
s=r*r*p;
printf("s= %f \n",s);
return 0;
} |
C | int sumNums(int n){
int m = n + 1;
int sum = 0;
int mask = 1;
int bit = 0;
(mask & n) && (sum += m << bit);
mask <<= 1;
bit++;
(mask & n) && (sum += m << bit);
mask <<= 1;
bit++;
(mask & n) && (sum += m << bit);
mask <<= 1;
bit++;
(mask & n) && (sum += m << bit);... |
C | /*
Start total new system v. 0.0
with hard coded long name variables to have clear system
Angelo GIRARDI
*/
#ifndef CN_COLL_H
#define CN_COLL_H
#define ARR_ALLOC(type,len) ((type*)malloc(sizeof(type)*(len)))
#define ARR_REALLOC(type,ptr,len) ((ptr)=(type*)realloc(ptr,sizeof(type)*(len)))
#define ARR_SEARCH(... |
C | #include <stdlib.h>
#include <stdbool.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
#include <assert.h> /* TODO to be removed */
#include "cjson_ext.h"
static struct cjson g_null_json = {};
struct cjson_mempool {
struct cjson_mempool *next;
unsigned count;
unsigned capacity;
struct cjson obj[0];
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <limits.h>
int main (int argc, char **argv)
{
if (argc == 1)
{
printf("No arguments found");
return (1);
}
//2-D array for all ASCII symbols and set each cell to -1
int table[256][256] = {-1};
int count = 0;
char cur_symbol = 0;
char *str = argv[1];
while ... |
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.
*/
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Too... |
C | #include <stddef.h>
//=============================================================================
// copy no more SZ bytes S to D
//=============================================================================
char* strncpy (char *d, const char *s, size_t sz)
{
char *tmp = d;
while ('\0' != *s) {
if (0 == sz)
... |
C | #include <unistd.h>
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "pthread_rwlock.h"
mypthread_rwlock_t rwlock = MYPTHREAD_RWLOCK_INITIALIZER;
char *
gf_time(void);
void *thread1(void *arg);
void *thread2(void *arg);
int main()
{
pthread_t tid1, tid2;
int err;
if ((e... |
C |
#include <rnd.h>
#include <linux/random.h>
#include <linux/slab.h>
u64 *ln_rnd = NULL;
static int is_seeded = 0;
static size_t bytes;
/* We need this for later when we need to figure out how many items we can pull
* out of the ln_rnd pool of randomness, because we use this to mask off any key
* and ensure the key... |
C | // Display sum of all digits of 5 numbers
#include<stdio.h>
void main ()
{
int i,num, total_sum = 0, sum;
for (i=1;i<=5;i++)
{
printf("Enter number :");
scanf("%d",&num);
sum = 0;
while(num > 0)
{
sum += num % 10;
num/= 10;
}
printf("Sum = %d\n", sum);
total_sum +=... |
C | #include <stdio.h>
#include <stdlib.h>
#pragma warning(disable:4996)
struct login_info{
char id[20];
char passwd[20];
};
int main()
{
FILE *fp;
struct login_info *arr = NULL;
int size;
printf(" ȸ ԷϽǰǰ? : ");
scanf("%d", &size);
arr = calloc(size, 40);
for (int i = 0; i < size; i++){
scanf("%s %s", arr[... |
C |
#include<stdio.h>
#include<string.h>
void main()
{
char a[20],b[20];
printf("enter the string a:");
scanf("%d",&a);
strcpy(b,a);
strrev(b);
if(strcmp(a,b)==0)
{
printf("is palindrome");
else
{
printf("not a palindrome");
}
}
}
|
C | #include <stdio.h>
#include "sub.h"
struct info{
int alter;
double gewicht;
}Louis;
struct {
int zahl1;
int zahl2;
} numbers;
typedef struct info Inf;
int main()
{
struct info Daniel={32, 75.4};
printf("Daniel wiegt %f\n", Daniel.gewicht);
Louis.alter = 12;
printf("Louis ist %d\n",Louis.alter);
numb... |
C | #include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <time.h>
#include "header.h"
// quick sort
static void swap(struct s_player **left, struct s_player **right)
{
struct s_player *tmp = *left;
*left = *right;
*right = tmp;
}
static int partition(struct s_player **players, int... |
C | //2.4 Application examples: polynomial additive operation
#include <stdio.h>
#include <stdlib.h>
typedef struct PolyNode {
int coef;
int expon;
struct PolyNode *link;
} *Polynomial;
Polynomial P1, P2;
void Attach(int coef, int expon, Polynomial *PtrRear) {
Polynomial P;
P = (Polynomial)malloc(sizeof(struct P... |
C | #include <stdio.h>
#include <stdbool.h>
int main(int argc, char *argv[]){
// check input
if (argc != 2){
fprintf(stderr, "Usage: ./recover image\n");
return 1;
}
// open memcard file
char *rawName = argv[1];
FILE *rawptr = fopen(rawName, "r");
if (ra... |
C | #include <stdlib.h>
#include <stdio.h>
void print_all(int *p, int p_len) {
for (int i = 0; i < p_len; i++){
printf("p[%d] = %d\n", i, p[i]);
}
printf("=================\n");
}
int main(int argc, char const *argv[]) {
int *p = NULL;
if (p == NULL) {
p = (int*) malloc(5*sizeof(int));
}
p[0] = 17... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* push_backline.c :+: :+: :+: ... |
C | #include <stdio.h>
int main()
{
float l,a,g;
scanf("%f", &l);
scanf("%f", &a);
scanf("%f", &g);
if(l>a && l>g)
printf("\n%.1f", l);
if(a>l && a>g)
printf("\n%.1f", a);
if(g>a && g>l)
printf("\n%.1f", g);
return 0;
}
|
C | #include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include "tokenizer.h"
/* Check for background process and set group id accordingly */
int put_background(struct tokens* tokens) {
if(strcmp(tokens_get_token(tokens, tokens_get_length(tokens)-1), "&") == 0) {
if (setpgid(0, 0) == -1) {
... |
C |
int strStr(char * haystack, char * needle){
int lenh = strlen(haystack);
int lenn = strlen(needle);
int i;
int j;
int pos = 0;
int temp;
int flag = 0;
if (needle[0] == NULL)
return 0;
for(i = 0; i <= (lenh - lenn); i++){
if(needle[0] == haystack[i]){
... |
C | #include<stdio.h>
#include<stdlib.h>
size_t find_same_idx(int N, int arr[N], int x) {
size_t i = 0;
for (; i<N; i++) {
if(arr[i] == x)
return i;
if( arr[i]>=x) {
return --i;
}
}
return i;
}
|
C | /*****
* Project 02: Wheel of Fortune
* COSC 208, Introduction to Computer Systems, Fall 2020
*****/
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <stdbool.h>
// Constants for word list
#define WORDS_FILE "/usr/share/dict/words"
#define MAX_WORD_LENGTH 50
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <netdb.h>
#include <netinet/in.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/select.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <signal.h>
#define BUFF_LEN 1024
#define MAX_BACKLOG 100
#define FD_SIZE 10... |
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 | /*
** launch.c for launch in /home/tekm/tek2/PSU_2016_lemipc
**
** Made by leroy_0
** Login <maxime.leroy@epitech.eu>
**
** Started on Tue Mar 28 23:26:27 2017 leroy_0
** Last update Sun Apr 2 13:22:08 2017 longle_h
*/
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/sem.h>
#include... |
C | #include <stdio.h>
#include <stdlib.h>
#define MAX 100
void insertion_sort(int n);
void agafar_nombres(FILE* fitxer_ansi);
int agafar_primers();
int es_primer(int num);
int mirar_anterior(int i, int j);
int equal_to_0(int j);
void claus_criptografiques(int num_max);
void show(int num, int numbers[]);
int nombres[MAX... |
C | #include <stdio.h>
#include <string.h>
void reverse(char *s)
{
int i, j;
for (i = 0, j = strlen(s) - 1; i < j; i++, j--)
s[i] ^= s[j] ^= s[i] ^= s[j];
return;
}
void int2char(int n, char *s)
{
int i = 0, sign = 1;
if (n < 0)
sign = -1;
do {
s[i++] = sign * ((n) % 10) + '0';
} while((n /= 10) != ... |
C | #include <stdio.h>
#include "SDL.h"
#include <time.h>
int main (int argc, char *argv[])
{
if (SDL_Init(SDL_INIT_JOYSTICK) < 0 )
{
printf( "Unable to init SDL: %s\n", SDL_GetError() );
return 1;
}
freopen("CON", "w", stdout); // reenables console stdout
printf("Number of joysticks: %d\n", SDL_NumJoysticks())... |
C | /*************************************************************************
> File Name: access.c
> Author:
> Mail:
> Created Time: 2018年05月09日 星期三 21时29分51秒
************************************************************************/
#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
int main(int argc,char* a... |
C | #include <stdio.h>
#include <stdlib.h>
#include "pretty.h"
#define INDENT(count) for(int i=0; i<count ; i++) {printf(" ");}
static void _pretty_expr_node(expr_t* expr);
static void _pretty_bin_expr_node(enum binaryexprkind kind, expr_t* l_expr, expr_t* r_expr);
static void _pretty_unary_expr_node(enum unaryexprki... |
C | #include <check.h>
#include <check_extras.h>
#include <curvecpr/messager.h>
#include <curvecpr/bytes.h>
#include <stdlib.h>
#define ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0]))
struct block_container {
size_t size;
struct curvecpr_block blocks[500];
};
struct packet {
long long delivery_time;
c... |
C | #include "nicolas.h"
/** \brief valida una palabra
*
* \param palabra[] char palabra a evaluar
* \return int devuelve 1 si esta bien y 0 si esta mal
*
*/
int validaPalabra(char palabra[])
{
int flag= -1;
int contador = 0;
for(int i=0; i<strlen(palabra); i++)
{
if((palabra[i] < 'a' && pal... |
C | //#include <lpc210x.h>
#include <regx51.h>
//#include <htc.h>
#include "gpio.h"
//#include "delay.h"
#include "i2c_sw.h" //we use software i2c
#include "mcp980x.h" //we use mcp980x
//*************************************************************
// This code is written to interface a pic16f690 with a
//... |
C | void XuatMenu()
{
cout << "\n===================== HE THONG CHUC NANG =====================";
cout << "\n0. Thoat khoi chuong trinh";
cout << "\n1. Doc du lieu tu tap tin";
cout << "\n2. Xuat danh sach canh cua do thi";
cout << "\n3. Them mot dinh co nhan label vao do thi";
cout << "\n4. Xuat thong tin cua mot di... |
C | // CSC 415
// HW3 Win32
#include <stdio.h>
#include <windows.h>
#include <string.h>
#define BUFFERSIZE 1024
int main() {
int exit = 0;
char rawInput[BUFFERSIZE];
char* commandFull = NULL;
char* nextToken = NULL;
int childID = 0;
int status = 0;
STARTUPINFO... |
C | #include<stdio.h>
main ()
{
int i;
while(scanf("%d",&i)&&i!=-1)
{
if(i%3==0)
printf("%d ",i);
}
printf("-1\n");
return 0;
}
|
C | /**
****************************************************************************************
*
* @file demo_qspi.c
*
* @brief QSPI demo (hw_qspi driver)
*
* Copyright (C) 2015-2016 Dialog Semiconductor.
* This computer program includes Confidential, Proprietary Information
* of Dialog Semiconductor. All Rights... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_sorted_list_merge.c :+: :+: :+: ... |
C | /*
* File: list.c
* Author: Carlos Li Hu
*/
#include "list.h"
typedef struct _Node {
OBJ* data;
struct _Node *next;
} Node;
struct _List {
Node *node;
};
/* DECLARACIÓN DE FUNCIONES PRIVADAS PARA TRATAMIENTO DE LOS NODOS */
/*------------------------------------------------------------------
No... |
C | #include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void cheat() {
FILE *fp = fopen("flag.txt", "r");
char flag[100];
if (fp == NULL) {
puts("My bad, I can't find the answers.");
puts("Oh wait, that's a foodable offense!");
puts("[If you are seeing this o... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_sort_tools2.c :+: :+: :+: ... |
C | /* Hotset
* Generates a hotset from SICM's high-level interface's output.
* First run SICM's high-level interface with one of the profiling methods,
* then use this program to generate a hotset from that output. Use this
* hotset to do a subsequent run.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct num{
int val;
struct num *nextPtr;
}Num;
typedef Num* List;
void insertsort(List *headPtr, int num);
void printlist(List corrPtr);
List insalatamista(List A, List B);
int main(void){
List A = NULL;
List B = NULL;
int num;
//inserimento in A
scanf("%d", &nu... |
C | #include <stdio.h>
#define MAX 100
#define MIN 1
#define IMPAR(x) ((x)%2!=0)
int main() {
//int i; ES BUENA PRCTICA DECLARAR ESTA VARIABLE AC, POR SI HAY QUE USARLA DE NUEVO Y POR CONVENCIN Y ESTNDAR
int suma=0;
for (int i=MIN; i<=MAX; i++){
if (IMPAR (i)){
suma+=i;
}
... |
C | # include "../ingres.h"
# include "../symbol.h"
# include "../tree.h"
# include "../pipes.h"
# include "../batch.h"
# include "ovqp.h"
/*
** This file contains all the routines needed
** for communicating with the equel process.
** They are called only if the flag Equel = TRUE.
*/
/* global equel pipebuffer */
struct... |
C | #include "holberton.h"
/**
* _strncat - concatenate two strings
* @dest: destination pointer
* @src: source pointer
* @n: number of bytes to concatenate from src
*
* Return: pointer to concatenated string
*/
char *_strncat(char *dest, char *src, int n)
{
int i, j;
for (i = 0; *(dest + i); i++)
;
j = 0;
... |
C | #include <stdio.h>
#include <dirent.h>
#include <fcntl.h>
#include <pwd.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <sys/dir.h>
#include <sys/param.h>
#include <sys/wait.h>
#include <errno.h>
#include <sys/stat.h>
#include <grp.h>
#include <time... |
C | /********************************************************************
* Victoria Weaver
* vew4644@rit.edu
*
* Homework 3, Program to implement a linked list abstract data type
* as a C module. Practice the use of pointers and memory
* allocation. Compare the time efficiency of linked lists against
* dynamic arrays.
... |
C | # include <stdio.h>
# include <cs50.h>
# include <ctype.h>
# include <string.h>
int main(int argc, string argv[])
{
string key_word;
string temp_key;
int num_key_word;
string plaintext;
int plaintext_to_ascii;
int num_to_ascii;
int ascii_to_num;
int ascii;
char ciphertext;
int c... |
C | //To read an array and search for an element using linear search
#include <stdio.h>
main()
{
int i,a[10],r,j,n,temp;
printf("Enter the number of elements:");
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(a[j]<a[i])
{
temp=a[i];
a[... |
C | #include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
int Split ( char* string, const char* del, char** tokens );
int Split ( char* string, const char* del, char** tokens ) {
int i = 0;
tokens[0] = strtok ( string, del );
while ( ... |
C | #include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys\stat.h>
typedef struct {
double x,y,z,u,v;
} vertex;
typedef struct {
int a,b,c;
} triangle;
vertex *vertexmap;
triangle *trianglemap;
int maxvertex,maxtriangle;
void init_vertices (int total) {
vertexmap=(vertex *) mall... |
C | #include "servidor.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <arpa/inet.h>
#include <sys/socket.h>
int connect_server(char* IP, int Port){
//Estructura del socket
struct sockaddr_in direccionServidor;
direccionServidor.sin_family = AF_INET;
direccionServidor.sin_addr.s_addr = inet_addr... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
void main() {
int a, b, n, i, mid;
char c;
scanf("%d %d %d", &a, &b, &n);
getchar();
for (i = 0; i < n; i++) {
mid = (a + b) / 2;
scanf("%c", &c);
if (c == 'Y') {
a = mid + 1;
}
else {
b = mid;
}
}
printf("%d", a);
}
|
C | /*
* 005ButtonInterrupt2.c
*
* Created on: 14-Apr-2020
* Author: Rahul
*/
#include <string.h>
#include <STM32WB55xx_Gpio_Driver.h>
#define HIGH 1
#define LOW 0
#define BTN_PRESSED LOW
/*
* Software delay function
*/
void delay(void)
{
for( uint32_t i = 0; i <= 500000/2; i++... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* check_error.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "m2tlib.h"
/*
* ここではパケットのヘッダとパース処理のみを行う。
* 各パケットを構造体に入れる処理は、別ファイルに分離する
* そうしないと長すぎてわけわかめ
*/
/*
== パケットのパースについて ==
TSパケットのほとんどはおおむね同じ構造をしてるので、同じように処理する
[TSヘッダ][ペイロード1] [TSヘッダ][ペイロード2] [TSヘッダ][ペイロード3] ...
ヘッダを取り除いて結合させる
→ [ペイ... |
C | /*
* LeetCode Submissions by Xinyu Chen
* Count Primes
* https://leetcode.com/problems/count-primes/
* Runtime: 92 ms
*/
int countPrimes(int n) {
if (n < 2) return 0;
int *numbers = (int*)malloc(n * sizeof(int));
for (int i = 0; i < n; i++) numbers[i] = 1;
numbers[0] = 0;
numbers[1] = 0;
int p = 1;
... |
C | // Copyright (c) 2015 Nuxi, https://nuxi.nl/
//
// SPDX-License-Identifier: BSD-2-Clause
#include <testing.h>
#include <time.h>
TEST(timespec_get, bad) {
ASSERT_EQ(0, timespec_get(NULL, 0xdeadc0de));
}
TEST(timespec_get, time_utc) {
struct timespec ts1;
ASSERT_EQ(0, clock_gettime(CLOCK_REALTIME, &ts1));
stru... |
C | #ifndef BUTTONS_H
#define BUTTONS_H
#include <avr/io.h>
#include "microcontroller.h"
uint8_t old_button_states;
void initbuttons(void)
{
old_button_states = PIND;
}
uint8_t read_button_down(pin)
{
//detect whether this is a change or just repetition
if ( (input_pin(&old_button_states, pin) == 0) && (input_pin(&... |
C | #include <stdio.h>
#include <stdlib.h>
int main(){
FILE *file;
char line;
int namesB = 0;
file = fopen("nomes.txt", "r");
if (file == NULL){
printf("ERRO AO ABRIR O ARQUIVO!\n");
} else {
for (line = getc(file); line != EOF; line = getc(file)){
if (... |
C | #include "GlobalFunctions.h"
void delay(uint16 delay)
{
volatile int counter, counter2;
for(counter2=16; counter2 > 0; counter2--)
{
for(counter=delay; counter > 0; counter--);
}
}
uint8 BCDtoBinary(uint8 character[],uint8 numChar){
uint8 result = FALSE;
uint8 multiplier = 1;
while(numChar > 0){
result +=... |
C | #include <stdio.h>
/* TODO: Implementar condicionais e calculo de meses de trabalho! :) */
int main (void) {
int mes_corrente, ano_corrente, i, matricula_atual;
float salario_atual;
int mes_ingresso, ano_ingresso;
int qtd_funcionarios;
printf("Digite o mês corrente\n");
scanf("%d", &mes_corrente);
pr... |
C | #include <stdio.h>
#include <stdlib.h>
void main()
{
int i, x;
char str[100];
printf("Masukan kalimat anda : ");
scanf("%s", &str);
for(i = 0; (i < 100 && str[i] != '\0'); i++)
{
str[i] = str[i] + 5;
}
printf("String anda adalah : %s", str);
}
|
C | #include "../../commons/com.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/stat.h>
#include <semaphore.h>
#include<unistd.h>
const char *server_name = "/tmp/server_id";
const char *server = "/tmp/my_server";
static char semName[30];
static flag_signa... |
C | #include "../api.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#ifdef _WIN32
#include <windows.h>
#else
#include <unistd.h>
#define Sleep(ms) usleep(1000*ms)
#endif
typedef struct gpio_dev{
char name[16];
}gpio_dev;
static ELF_API void println(const char* msg){
printf(... |
C | #include <stdio.h>
#include <string.h>
int main()
{
char str[16];
scanf("%s", str);
int len = strlen(str);
int cnt = 0;
for(int i = 0; i < (len + 1) / 2; ++i) {
if(str[i] != str[len - 1 - i]) {
++cnt;
}
}
if(cnt == 1) {
puts("YES");
} else if(cnt == 0... |
C | #ifndef _CYCLE_BUF_H
#define _CYCLE_BUF_H
#include <stdint.h>
typedef struct {
int size;
int rpos;
int wpos;
uint8_t *data;
} cycbuf;
#ifdef __cplusplus
extern "C" {
#endif
int cycbuf_init (cycbuf *buf, int capacity) ;
void cycbuf_destroy (cycbuf *buf) ;
int cycbuf_empty (cycbuf *buf);
/* return avaliable data... |
C | /* t002_noexec_error.c */
static int check_val (int v)
{
if (v == 0)
return (0);
else if (v == 1)
return (1);
else if (v == 2)
return (2);
else if (v == 3)
return (3);
else if (v == 4)
return (4);
else if (v == 5)
return (5);
else if (v == 6)
... |
C | /*****************************************************************************
*
* buffer.h: Grow-on-demand buffers.
*
* Copyright (c) 1990-2007 Aldor Software Organization Ltd (Aldor.org).
*
****************************************************************************/
#ifndef _BUFFER_H_
#define _BUFFER_H_
#inc... |
C | /* The main function of this file tests almost every
function of the file queue_pkt.c which contains
all the things we wrote to use our linked lists.
On succesful tests : return 1
On unsuccesfull tests : return 0
On error : return -1
*/
/* 1 on success, 0 if queues are not equ... |
C | #include <stdio.h>
#include <string.h>
int main()
{
int N,i,j,x,y;
char num[1000][5];
char tmp[5];
scanf("%d",&N);
for(i=0;i<N;i++){
scanf("%s",num[i]);
}
for(i=0;i<N;i++)
for (j=0;j<N-i-1;j++)
{
if((strcmp(num[j],num[j+1]))>0)
{
... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct node
{
int x;
struct node *suiv;
} nd;
nd *postadd(nd *debut,int x)
{
if(debut==NULL)
{
debut=(nd *)malloc(sizeof(nd));
debut->x=x;
debut->suiv=NULL;
return debut;
}
nd *ptr=debut;
while(ptr->suiv!=NULL) ... |
C | /************************************************************************
* *
* Program packages 'lvq_pak' and 'som_pak' : *
* *
* sammon.c ... |
C | /**
* Author: James Osgood
* Add various semantic type errors.
*/
#include <stdio.h>
#include <string.h>
#include "myerror.h"
extern myerror *eList;
extern int iserror;
extern int lineno;
extern int last_column;
void
addTypeError(const char *errMsg) {
iserror = 1;
eList = addError(eList, errMsg, last_colu... |
C | //
// Created by piotr on 18.10.2020.
//
#include <stdio.h> //PLUS za zadanie
#include <math.h>
// Konwerter km -> m i m->km
int main() {
printf("1 - m->km\n2 - km-> m\n");
int a;
scanf("%d",&a);
switch(a){
float b;
case 1:
printf("Podaj ilosc: ");
scanf("%f",&b)... |
C | #include <leetcode.h>
struct ListNode* mergeKLists(struct ListNode** lists, int listsSize)
{
struct ListNode *root, *node, *tmp;
int i, j, k, l;
for (i = 0; i < listsSize; i++) {
if (!lists[i])
continue;
lists[0] = lists[i];
break;
}
if (i >= listsSize)
return NULL;
for (i = i + 1, l = 1; i < lists... |
C | #include "libmx.h"
static int fill_12(char **res, wchar_t c) {
int len = 0;
if (c < 0x80) {
len = 1;
(*res)[0] = c;
}
else if (c < 0x0800) {
len = 2;
(*res)[0] = (c >> 6 & 0x1F) | 0xC0;
(*res)[1] = (c & 0x3F) | 0x80;
}
return len;
}
static int fill_34(c... |
C | /*
** EPITECH PROJECT, 2020
** MUL_my_rpg_2019
** File description:
** Update the view of the game
*/
#include "game.h"
void ingame_update_view(game_t *game)
{
v2f view_size = v2f(0, 0);
v2f center = v2f(0, 0);
view_size = sfView_getSize(game->view);
center = sprite_get_center(game->player->sprite... |
C | // Wizard: Gellor
// New Firn'Ville
// newfirn6.c
#include <std.h>
inherit VAULT;
void create() {
::create();
set_property("light", 1);
set_property("indoors", 0);
set("short", "South Of A Building");
set("long", "The road narrows even more here. The trees crowd the "
"trail... |
C | #include <stdio.h>
#include <stdlib.h>
#include "utils.h"
char *get_file_name(char *path) {
char *name = malloc(sizeof(char));
int nameLen = 0;
int i = 0;
while (path[i] != '\0') {
if (path[i] == '.') {
break;
} else {
nameLen++;
name = realloc(name, sizeof(char) * nameLen);
na... |
C | #include "server_router.h"
#include "server_handlers.h"
#include "server_constants.h"
#include "server_logger.h"
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
/*
The serve directive.
This changes the web root directory from which files are served.
Instead of doing lots of string manipulatio... |
C | #include "rda5820.h"
#include "system.h"
#include "iic.h"
/****************************************************************************
* Function Name : RDA5820_DelayMs
* Description : RDA5820ʱ
* Input : msʱʱ
* Output : None
* Return : None
************************************************... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.