language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /*****************************************************************************
Filename: bignum.h
Author : Chuck Li (lch0821@foxmail.com)
Date : 2018-01-19 12:39:01
Description:
*****************************************************************************/
#ifndef __BIGNUM_H__
#define __BIGNUM_H__
#include <stdint... |
C | /*
* Copyright (c) 2019 Pedro Falcato
* This file is part of Onyx, and is released under the terms of the MIT License
* check LICENSE at the root directory for more information
*/
#define _GNU_SOURCE
#include <stdio.h>
#include <limits.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <onyx/public/memstat.h>
i... |
C | #ifndef SYMBOLTABLE_H
#define SYMBOLTABLE_H
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define TABLE_SIZE 25
typedef enum identifier_type {FUNC_ID,PROC_ID,VAR_ID,PROG_ID} ID_TYPE;
//typedef enum scope {LOCAL,GLOBAL} SCOPE;
//typedef enum return_type {,GLOBAL} RETURN_TYPE;
typedef struct list_node{
c... |
C | #include <keyboardDriver.h>
#include <colors.h>
#include <interrupts.h>
#include <videoDriver.h>
#include <syscalls.h>
#define PRESS 1
#define RELEASE 2
#define ERROR -1
#define BUFF_LEN 30
static int buffSize=0; //cantidad de elementos del buffer
static int ridx=0; //posicion de escritura
static int widx=0; //posicio... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
void toto(char *str)
{
str[0] = 'p';
}
void tata(char *str)
{
str = "fwfew";
//str[0] = 'l'; seg pace que pas d'attribution et pas de malloc non plus
}
int main()
{
char *str;
char *new;
str = NULL;
str = (char *)malloc(sizeof(char) * 42);
toto(str);
tata(new);
prin... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void)
{
long loop = 10000000L;
double duration;
clock_t start, end;
printf("Time to do %ld empty loops is ", loop);
start = clock();
while(loop--) ;
end = clock();
duration = (double)(end-start)/CLOCKS_PER_SEC;... |
C | #include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
/* forward declarations: */
void memDisaply(char* filename);
void fileDisplay(char* filename);
void quit(char* filename);
struct fun_desc {
char *name;
void (*fun)(char* filename);
};
struct void_array {
int *array;
int sz;
void (*map) (s... |
C | #include <stdio.h>
#include <stdlib.h>
#include <netinet/if_ether.h>
#include <unistd.h> // close()
#include <string.h> // strcpy, memset(), and memcpy()
#include <netdb.h> // struct addrinfo
#include <sys/types.h> // needed for socket(), uint8_t, uint16_t, uint32_t
#include <sys/s... |
C | #ifndef __LINKEDLIST_H__
#define __LINKEDLIST_H__
typedef int Data;
typedef struct _node {
Data data;
struct _node * next;
} Node;
typedef struct _list {
Node * head;
Node * cur;
Node * before;
int numOfData;
} List;
void ListInit(List * list);
void LInsert(List * list, Data data);
Node * LFirst(List... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fill_board.c :+: :+: :+: ... |
C | #include <stdio.h>
int mx_sqrt(int x);
int main() {
printf("Square root of 0 is %d\n", mx_sqrt(0));
printf("Square root of 1 is %d\n", mx_sqrt(1));
printf("Square root of 3 is %d\n", mx_sqrt(3));
printf("Square root of 4 is %d\n", mx_sqrt(4));
printf("Square root of 193600 is %d\n", mx_sqrt(-193600... |
C | /*
I/STRUCT
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "vsslc.h"
#include "vsmiscmacros.h"
/*
* Includes of function prototypes.
*/
#include "vsslcproto.h"
/*----------------------------------------------------------------------------*/
VS_NODE *VSallocNode __(( void )) {
VS_NODE *n ;
... |
C | #include "init.h"
#include "msg_list.h"
#include "utils.h"
void add_to_msg_list(struct window *window, struct msg_list *msg_list, char msg[MAX_MESSAGE_SIZE])
{
struct msg_list *temp = msg_list;
while (temp->next)
temp = temp->next;
temp->next = xmalloc(sizeof(struct msg_list), window->window, win... |
C | /***************************************************
* Author: Hoky GUAN *
* Date : 2019/7/15 *
* Last : 2019/7/15 *
* Notes : single.c *
**************************************************/
#i... |
C | /*
// Author: Alessio Parzian
// Filename: shellcode_crypter.c
//
// Encrypt a shellcode using the XXTEA algorithm: https://github.com/xxtea/xxtea-c
// Compile with:
// gcc -fno-stack-protector -z execstack shellcode_crypter.c -o shellcode_crypter
*/
#include <stdio.h>
#include <string.h>
#include "xxtea.c"
#define ... |
C | /**
CSC 246
Homework 6
@file rider.c
@author Soorya Kumar
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <pthread.h>
#include "coordinator.h"
#include "rider.h"
#include "sleeper.h"
void * startRider(void * riderNumber) {
int * r = (int *) riderNumber;
int oldstate... |
C | #ifndef __RINGQUEUE_H__
#define __RINGQUEUE_H__
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/types.h>
typedef struct {
uint64_t head;
uint64_t tail;
uint32_t mask;
uint32_t len;
uint8_t flag;
char data[0];
} ringqueue_t;
#define RINGQUEUE_USE_SHM 0x01
#define RINGQUEUE_NOMEM ... |
C | #include "linkedlist.h"
#include <stdlib.h>
#include <stddef.h>
struct LinkedList * linkedlist_new()
{
struct LinkedList * list = malloc(sizeof(struct LinkedList));
list->head = NULL;
list->tail = NULL;
return list;
}
void linkedlist_prepend(struct LinkedList * list, void * value)
{
if (list->head == NULL) {
l... |
C | // 출처: 한빛아카데미 'C로 배우는 쉬운 자료구조'
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// 단순 연결 리스트의 노드 구조를 구조체로 정의
typedef struct ListNode {
// 데이터가 들어갈 공간
char data[100];
// head가 들어갈 구조체
struct ListNode* link;
// 구조체 별칭을 listNode로 선언
} listNode;
// 리스트 시작을 나타내는 head 노드를 구조체로 정의
typedef struct {
... |
C | #include <stdio.h>
#include <string.h>
int main(){
int a[10] = {1,2,3};
int b[]= {22,33,44,55};
//strcpy(a,b);
memcpy(a,b,sizeof(int) * 4);
for(int i = 0; i < sizeof(a) / sizeof(int); ++i){
printf("%d ",*(a+i));
}
printf("\n");
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include "tokenizer.h"
int arrCount = 0;
/* Counts the number of characters in the string argument. */
int string_length(char* str){
int num = 0;
while(*str != '\0'){
num++;
str++;
}
return num;
}
/* Evaluates if the character c is an acc... |
C | #include <stdio.h>
#include <stdlib.h>
#define MAX_SIZE 100
/*
树:树是一种自定义结构.由n(n>0)个节点组成,有且只有一个节点作为树根.n-1个节点组成一个子树.树是一种递归定义.
节点为0的树称为空树
树节点由存储数据和指向其子树指针(n>=1)
树最大特点控制目标数比较次数,可以实现在O(logn a ,n>=1).提高搜索效率
树是一个无环的图
树名词:
1.子节点:节点指向一个个子树,子树的根称为子节点
2.终端节点(叶子节点):没有任何子树的节点,一般是树对下层节点
3.节点度:节点存在子树个数(一般为 0 1 2 3 ...)
4.树广度:节点度最大值
5... |
C | /*
* File: ex14-listShallow.c
* Implementation file for the shallow interface
* Implements:
* the interface for shallow lists
* the interface for shallow enumerations
*/
#include <stdlib.h>
#include <stdio.h>
#include "ex14-listShallow.h"
#include "ex14-enumShallow.h"
typedef struct elem {
voi... |
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
char * getStr1()
{
char *p1 = "abcdefg2";
return p1;
}
char *getStr2()
{
char *p2 = "abcdefg2";
return p2;
}
void main55()
{
char *p1 = NULL;
char *p2 = NULL;
p1 = getStr1();
p2 = getStr2();
/... |
C | // C Standred
#include <assert.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
// File Header
#include "util_vector.h"
VecInt_t VecIntAlloc(size_t cap)
{
cap = VEC_INIT_CAP;
VecInt_t vec = (VecInt_t)malloc(sizeof(*vec));
if(vec =... |
C |
/*
+-+-+-+-+
|0|1|2|3|
+-+-+-+-+
|4|5|6|7|
+-+-+-+-+
|8|9|A|B|
+-+-+-+-+
|C|D|E|F|
+-+-+-+-+
*/
void updateKeys(){
// redefine the pins
// pins for keypad
DigitalOut c1 = DigitalOut(EXT3); // P0_11
DigitalOut ... |
C | #include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "gf2.h"
#include "html.h"
int
snprint_line( char* line, int line_len, int bit_size, uint32_t* a, uint32_t* b )
{
int line_ndx = 0;
int word_count = p_gf2_wc(bit_size);
int top_word_ndx;
top_word_ndx = word_count-1;
... |
C | /* Get the smaller value
*/
inline uint2x2 min(const uint2x2& a, const uint2x2& b)
{
return uint2x2(min(a[0], b[0]),
min(a[1], b[1]));
}
/* Get the larger value
*/
inline uint2x2 max(const uint2x2& a, const uint2x2& b)
{
return uint2x2(max(a[0], b[0]),
max(a[1], b[1]));... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr_base.c :+: :+: :+: ... |
C | /* Fast unicode equal function optimized for dictobject.c and setobject.c */
/* Return 1 if two unicode objects are equal, 0 if not.
* unicode_eq() is called when the hash of two unicode objects is equal.
*/
Py_LOCAL_INLINE(int)
unicode_eq(PyObject *aa, PyObject *bb)
{
assert(PyUnicode_Check(aa));
assert(PyU... |
C | #include <stdio.h>
int main(void)
{
int n1,n2,max;
printf("请输入2个数:");
printf("整数1:");scanf("%d",&n1);
printf("整数2:");scanf("%d",&n2);
max = (n1 > n2)?n1:n2;
printf("较大的数是%d。\n",max);
return 0;
}
|
C | /** @file lifecyle_syscalls.c
*
* @brief implementation of functions for process and
* thread lifecycles
*
* @author Rohit Upadhyaya (rjupadhy)
* @author Prajwal Yadapadithaya (pyadapad)
*/
#include <core/fork.h>
#include <core/exec.h>
#include <core/task.h>
#include <core/wait_vanish.h>
#include <core/sche... |
C | /*
-------------------------------------------------------
Name : Max Min Medium
Author : Kushal Singh Rathore
Discription : Max, Min, Med With Ternary Operator
-------------------------------------------------------
*/
#include<stdio.h>
void main()
{
int a,b,c,d,e,max,smax,tmax,fmax,min,sum;
scanf("... |
C | /*
* VoidPointers.c
*
* Created on: Jun 1, 2020
* Author: akshaybodla
*/
#include <stdio.h>
#include <stdlib.h>
void voidPointers() {
puts("Pointers can have the type 'void' meaning they can reference \nany type");
puts("Syntax: void *vPtr;");
puts("\nHowever, to use the pointer it must be casted as suc... |
C | #include<stdio.h>
#include"trans.c"
int main()
{
int n, m, i, j;
printf("Enter Number of Rows and Columns:-");
scanf("%d %d", &n,&m);
int A[100][100];
printf("\n Enter Elements of matrix");
for(i=0; i<n; i++)
{
for(j=0; j<m; j++)
{
printf("\n Enter Element A%d%d ", i+1,j+... |
C | #include <stdio.h>
int main() {
/*
double matrix[5][5] = {
{8, 1, 1, 1, 1},
{8, 1, 1, 1, 1},
{7, 1, 1, 1, 1},
{7, 1, 1, 1, 1},
{6, 5.6, 5.5, 5.1, 5}
};
*/
/*
double matrix[5][5] = {
{1, 1, 1, 1, 1},
{-1, 1, 1, 1, 1},
... |
C | #ifndef __CONTACT_H__
#define __CONTACT_H__
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#define NAME_MAX 20
#define SEX_MAX 5
#define ADDR_MAX 25
#define TELE_MAX 12
#define MAX 1000
typedef struct PeoInfo
{
char name[NAME_MAX];
int age;
char sex[SEX_MAX];
char addr[ADDR_MAX];... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct StackType {
char item[1001];
int top;
}StackType;
char pop(StackType *s) {
char sav;
if (s->top == -1) {
printf("Stack Empty\n");
}
else {
sav = s->item[s->top];
s->item[s->top--] = '\0';
return sav;
}
}
i... |
C | #include <stdio.h>
int fresh(void);
int main() {
for (int i=0; i<10; i++) {
int temp = fresh();
printf("fresh()=%d\n", temp);
if (temp == i) puts("ok");
else puts("ng");
}
return 0;
}
|
C | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
void fill(int n, float a[])
{
int i;
for (i = 0; i < n; i++)
a[i] = rand() % 101 - 50;
}
float sr(float s, int n, float a[])
{
for (int i = 0; i < n; i++)
s += a[i];
return (float)s / n;
}
float izm(float x, float y, int z)
{
... |
C | #include "complex.h"
complex_t set_complex(int a, int b){
return (complex_t) {a, b};
}
void print_complex(complex_t in){
printf("(%.2f + %.2fi) ", in.a, in.b);
}
complex_t add_complex(complex_t a, complex_t b){
return (complex_t) {a.a + b.a, a.b + b.b};
}
complex_t sub_complex(complex_t a, complex_t b){
... |
C | #include <stdio.h>
#include <math.h>
int main(void){
unsigned short x;
int m, n;
unsigned short mask = 0;
int k;
scanf("%d", &k);
while(k--){
int maskl[16] = {};
mask = 0;
scanf("%hd%d%d", &x, &m, &n);
int i;
for(i = 0; i <= 15; i++){ //利用循... |
C | /**
* Neural filters are grids filled with neurons that have a predefined wiring pattern
* and perform a computational function. The outer plexiform layer is the first layer
* of synapses in the retina. It are synapses between the light receptors (cods and
* cones), the horizontal cells and the bipolar cells. See ... |
C | #include<stdio.h>
#include<stdlib.h>
int main(void)
{
printf("%d",__LINE__);
printf("\n %s",__FILE__);
printf("\n %s",__DATE__);
printf("\n %s",__TIME__);
return EXIT_SUCCESS;
}
/*
#define PI 3.14
int main(void)
{
#ifdef PI
printf("\n PI is defined");
#else
... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
unsigned char mem[260];
void trans(){
int i;
if(mem[0] > 16){
for(i=0;i<256;i++){
if(mem[i] <='F' && mem[i] >= 'A'){
mem[i] -= 'A';
mem[i] += 10;
} else {
mem[i] -= '0';
}
}
} else {
for(i=0;i<256;i++){
if(mem[... |
C | //-----------------------------------------------------------------------------
// Include
//-----------------------------------------------------------------------------
#include "draw.h"
//-----------------------------------------------------------------------------
// Global variable
//----------------------------... |
C | #include "i2c_slave.h"
#include "debug.h"
#include <string.h>
#define I2C_CTRL ((I2C_SLAVE_CTRL_TYPE *) I2C_SLAVE_CTRL_BASE)
static I2C_SLAVE_IRQ_CALLBACK_TYPE irq_cb;
void I2CS_IRQHandler(void)
{
if (irq_cb) {
irq_cb(I2C_CTRL->INT_STATUS);
}
I2C_CTRL->I2CS_INT_CLEAR = 1;
}
void i2c_slave_... |
C | #include "types.h"
#include "stat.h"
#include "user.h"
#include "fs.h"
#include "fcntl.h"
int
main(int argc, char *argv[])
{
//int fd = open("foo", O_CREATE|O_CHECKED);
//printf(1, "%d\n", fd);
uint a = 0xff000000;
a = a & 0xd4123456;
a = a >> 24;// can get the checksum this way
printf(1, "%x\n", a);
exit();
... |
C | #include <stdio.h>
#include<string.h>
int main(void) {
int s,b=0,i,j;
scanf("%d",&s);
for(i=2;i<s;i++)
{
if(s%i==0)
{
printf("yes");
b=1;
break;
}
}
if(b==0)
{
printf("no");
}
return 0;
}
|
C | #include<stdio.h>
//register int a = 10; //error as register var never use as a global variable
int main(void)
{
register int a = 10;
a++;
printf("%d\n", a);
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#define SERVER_KEY_PATHNAME "key"
#define PROJECT_ID 'M'
#define QUEUE_PERMISSIONS 0666
#define MAXSIZE 1024
#define NUM_SEND 10
struct message {
long type;
char text[MAXSIZE];
};
i... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define TAM 5
typedef struct{
int dia;
int mes;
int anio;
} eFecha;
typedef struct{
int legajo;
char nombre[20];
float sueldo;
eFecha Fecha;
}eEmpleado;
void miFuncion(int*);
void altaEmpleado(eEmpleado*);
void printEmpleado(eEmpleado*);
... |
C | #ifndef _SYS_SYSCTL_H_
#define _SYS_SYSCTL_H_
#define CTL_MAXNAME 12 /* largest number of components supported */
/*
* Each subsystem defined by sysctl defines a list of variables
* for that subsystem. Each name is either a node with further
* levels defined below it, or it is a leaf of some particular
* type giv... |
C | #include "search_algos.h"
/**
* interpolation_search - function to find a value using a
* interpolation search algorithm.
*
* @array: The array
* @size: The size of the array
* @value: The value to find
*
* Return: natural number value, 0 or -1
*/
int interpolation_search(int *array, size_t size, int value)
{... |
C | #include <testutils.h>
void
sub_spline_assert_sub_spline(CuTest *tc,
tsBSpline *spline,
tsBSpline *sub)
{
size_t dim, i, n;
tsStatus status;
tsReal *pts = NULL, dist, eps;
tsDeBoorNet net = ts_deboornet_init();
/* POINT_EPSILON is slightly too small to co... |
C | /* ************************************************************************** */
/* */
/* :::::::: */
/* fill_number.c :+: :+: ... |
C | #include<stdio.h>
#include<locale.h>
main()
{
setlocale(LC_ALL,"portuguese");
system("title Calculadora");
float a,b,c;
int opt;
printf("\t ===== Calculadora =====\n");
printf("Escolha a operao\n");
printf("[1] - Adio\n");
printf("[2] - Subtrao\n");
printf("[3] - Multiplicao\n");
printf("[4] - Divis... |
C |
// Requested sample time in milliseconds
int sampleTime = 22;
#define SAMPLE_TIME_DIFFERENCE ( 1.5 )
float dt = ( 1.0 * sampleTime + SAMPLE_TIME_DIFFERENCE ) / 1000.0;
// Robot position in m
float robotPosition = 0.0;
/**
Sensor fusion constants
**/
float gainAngularVelocity = 1.3;
float gainAngle = 21.7;
float... |
C | #include "intersection.h"
Intersection* init() {
Intersection* intersection = createSharedMemory();
fillTerrain(intersection);
generateHorizontalRoad(intersection);
generateVerticalRoad(intersection);
int semid = semget((key_t) SEMAPHORE_KEY, 2, IPC_CREAT | S_IRUSR | S_IWUSR);
intersection->sha... |
C | #include <stdio.h>
#include <stdlib.h>
int sum(int v[], int left, int right)
{
if (left > right)
return 0;
if (left == right)
return v[left];
int mid = (left + right) / 2;
return sum(v, left, mid) + sum(v, mid + 1, right);
}
int main()
{
int n, *array;
scanf("%d", &n);
a... |
C | #include <stdio.h>
#include "parser.h"
int main(int argc, char *argv[]) {
int seed;
gameParams *game;
seed = 5;
if (atoi(argv[argc - 1]) != 0) {
seed = atoi(argv[argc - 1]);
}
srand(seed);
game = (gameParams *) malloc(sizeof(gameParams));
if (game == NULL) {
printf("E... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
//##### Pattern #####
/*
int main()
{
int i, j, k, t=0, row;
# left triangle #
for (i = 0; i < 5; i++)
{
for (j = 0; j < 5; j++)
{
if (j >= 4-i)
{
printf(" *");
}
else
{
printf(" ");
}
}
prin... |
C | #include <stdio.h>
#include <stdlib.h>
#define CANTIDAD_NUMEROS_ALEATORIOS 100
#define TOPE_SUPERIOR 10
int main(int argc, char *argv[]) {
int numero_aleatorio, semilla, vector_numeros[CANTIDAD_NUMEROS_ALEATORIOS], vector_repetidos[TOPE_SUPERIOR], max_cantidad_veces_repetido, numero_mas_repetido;
// Inicializar e... |
C | #ifndef __STRUCTS_H__
#define __STRUCTS_H__
#include "lista.h"
#define MAX_NOMBRE 50
typedef int (*funcion_batalla)(void*, void*);
typedef struct pokemon{
char nombre[MAX_NOMBRE];
int velocidad;
int ataque;
int defensa;
int mejora;
}pokemon_t;
typedef struct entrenador{
char nombre[MAX_NOMB... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include "pa06.h"
#define MAX_LEN 80
#ifndef TEST_CONSRUCT
/*
Construct SelectedField.
1. This function returns a pointer to SelectedField object.
2. Allocate memory for SelectedField object.
3. Initialize all the fields in this objec... |
C | #include <stdio.h>
#include <stdlib.h>
int main(){
int x = 0;
printf("x is = %d \n",x);
return 0;
}
|
C | #include "shell.h"
extern job_info_ctr job_ctr;
extern job_info *job_lists[MAX_JOBS_NUM];
extern jmp_buf restart_buf;
/*
* malloc an space to place an initalized job line
* input(3) : PID of job & JID of job & command that staring the job(char*)
* output : pointer to the alloced space if success
* : NULL othe... |
C | #include <stdio.h>
#include <stdlib.h>
struct node
{
int data;
struct node *next,*prev;
};
struct node *head;
int creat()
{
int n,i;
struct node *temp;
head=NULL;
struct node *newnode=(struct node*)malloc(sizeof(struct node));
printf("how man... |
C | #include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
#include "miner.h"
#include "simd-utils.h"
/////////////////////////////
////
//// NEW FEATURE: algo_gate
////
//// algos define targets for their common functions
//// and define a function for miner-thread to call to register
//// their targets... |
C | /*************************************************************************
> File Name : rawString_strcat.c
> Author : lirongwei
> Mail : a2413044193@gmail.com
> Created Time : 2020/07/07 10:23:28
************************************************************************/
#include <stdio.h>
#in... |
C |
//----------------------------- PrintGPUVector ----------------------------------
void GPUPrintVector(int eNum, char* gpuVector, char suppressZero ){
char *vector;
CopyFromGPU((void**)&vector, gpuVector, sizeof(char)*eNum, 1);
for(int i=0;i<eNum;i++){
if(suppressZero==1 && vector[i]==0)continue;
... |
C | #include <stdio.h>
#include <stdlib.h>
void SaveNum(int num, int * nums, int i)
{
if(num==-1)
{
return;
}
if(i%3==0 && i>=6)
{
nums = (int *)realloc(nums, sizeof(int)*(i+2));
}
nums[i] = num;
return;
}
int main(void)
{
int num=0;
int * nums = (int *)malloc(... |
C | #include <stdlib.h>
#include <string.h>
#include <suffix_array.h>
int cmp(const void* ptr_a, const void* ptr_b){
suffix_t a = *((suffix_t*)ptr_a);
suffix_t b = *((suffix_t*)ptr_b);
return (a.rank[0] == b.rank[0])? (a.rank[1] < b.rank[1]) ? 0:1 :(a.rank[0] < b.rank[0]) ? 0:1;
}
int build_suffix_array(int* suffix_a... |
C | /*************************************************************************
> File Name: wake_drv.c
> Author:
> Mail:
> Created Time: 2020年01月01日 星期三 21时34分19秒
************************************************************************/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/fs.h>
#includ... |
C | /*
* Link Set
*/
#ifndef _LS_H_
#define _LS_H_
struct link {
struct link *next; // next entry
struct link *prev; // prev entry
node peer0, peer1; // link peers
int port0, port1;
int sockfd0; // if peer0 is itself, local port is bound
int sockfd1; // if peer1 is itself, loc... |
C | #include<stdio.h>
#include<stdlib.h>
struct Node
{
int data;
struct Node *next;
};
typedef struct Node node;
node *head=NULL;
node *curr=NULL;
void insert()
{
node *temp=(node *) malloc(sizeof(node));
printf("Enter data: ");
int in;
scanf("%d",&in);
temp->data=in;
temp->next=NULL;
... |
C | /* -------------------------------------------------------------------
* @doc Arboreus weekday name handler headers
* @notice
*
* @copyright Arboreus (http://arboreus.systems)
* @author Alexandr Kirilov (http://alexandr.kirilov.me)
* @created 12/24/2018 at 19:10
* */// --------------------------------------... |
C | #include <screen.h>
#include <keypad.h>
#include "game.h"
#define TO_STR(ch) ( ( ((ch) >= 0 ) && ((ch) <= 9) )? (48 + (ch)) : ('a' + ((ch) - 10)) )
int main() {
startGame();
/*
clear_screen();
set_color(WHITE, BLACK);
set_cursor(29, 15);
/* put_char('H');
put_char('e');
put_char... |
C | /*ж:1.4Ҳܱ100Ϊ.2004,1901겻꣩
2.ܱ400.(2000,1900겻)*///
#include<stdio.h>
int main()
{
int year;
printf("please intput a year:\n");
scanf_s("%d", &year);
((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) ? printf_s("%d is a leap year. \n", year) : printf_s("%d is not a leap year.\n", year);
return 0;
} |
C | #include "holberton.h"
/**
* _isalpha - check if the ASCII character is alphabetic.
* @c: An ASCII character code
*
* Return: 1 if is alpha,
* Otherwise, return 0
*/
int _isalpha(int c)
{
if (((c >= 65) && (c <= 90)) || ((c >= 97) && (c <= 122)))
{
return (1);
}
else
{
return (0);
}
}
|
C | #include <stdlib.h>
#include <stdio.h>
#include "tile.h"
#include "ansi.h"
#define NUMBER_OF_EDGES 4
struct tile
{
int i; // Decimal (unique) representation of the Wang tile
// NOTE: i = ((e_n * C + e_s) * C + e_e) * C + e_w,
// with C being the number of colors used in the tile set
struct color* edges[NU... |
C | #include <stdio.h>
/*sumar 12 a todas las variables con el formato abrevido*/
int main(){
/*inicializar variables*/
int num=15;
int num1=-10;
int num2=214;
/*abreviado*/
num+=12; /*se pone += y no =+ porque sino borra el valor de la variable y pone el 12*/
num1+=12;
num2+=12;
/*saca... |
C | #ifndef H_ENSEMBLE
#define H_ENSEMBLE
#include <stdlib.h>
#include <stdio.h>
//structure représentant un arc
typedef struct arete {
int s1;
int s2;
int poids;
} arete;
//structure cellule pour une file
//next pointe sur l'elem suivant et ens sur l'ensemble auquel il appartient
typedef struct cellS {
int val;// ... |
C | #include <stdio.h>
#include <string.h>
typedef enum
{
BMW,
ACURA
}carTypes;
typedef CarData
{
float mileage;
int topSpeed;
char colour;
float brakeRate;
int horsePower;
}CarData;
carTypes identifyCar();
void getspecs();
carTypes Car = ACURA;
int main()
{
identifyCar();
getspecs... |
C | #ifndef STACK_H_INCLUDED
#define STACK_H_INCLUDED
#include <stdlib.h>
typedef struct node {
StackData data;
struct node *next;
} Node, *NodePtr;
typedef struct stackType {
NodePtr top;
} StackType, *Stack;
Stack initStack() {
Stack sp = (Stack) malloc(si... |
C | #include "log.h"
#include <stdio.h>
struct LogThresholds logThresholds = {.console_threshold = LEVEL_ERROR,
.logfile_threshold = LEVEL_NOLOG};
const char* log_level_description(LOG_LEVEL level) {
switch (level) {
case LEVEL_ERROR:
return "[ ERROR ]";
... |
C | /* Compute a sequence of integers in parallel.
How do we do this nifty trick? First we must seed a chunk of
consecutive integers, up to the maximum width of our parallel
compute. This is essentially a _binary tree unfold_, the reverse
of a binary tree reduce/fold. Then, we can compute the next set of
... |
C | #ifndef _GAME_H
#define _GAME_H
#include <cmath>
#include "player.h"
#include "Entity.h"
#include "maps.h"
#include "Mob.h"
#include "SpeedyMob.h"
#include "SlowMob.h"
#include "StationaryMob.h"
#include "Boss.h"
#include "Ammobox.h"
#include "Health.h"
#include "Framework\timer.h"
extern CStopWatch g_swTimer;
extern ... |
C | #include<stdio.h>
main()
{
int a;
printf("enter the number to check does it negative or postive\n");
printf("enter your number here");
scanf("%d",&a);
if(a<0)
{
printf("the given number is negative");
}
else
{
printf("the given number is postive");
}
}
|
C | #include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
int ft_strlen(char *str)
{
int i;
i = 0;
while (str[i])
i++;
return (i);
}
char *ft_strdup(char *src)
{
char *dest;
int i;
dest = (char*)malloc((sizeof(char) * ft_strlen(src)));
while (src[i])
{
dest[i] = src[i];
i++;
}
... |
C | /**
* @file misbehave_wrap.c
* @author Nathaniel Wesley Filardo <nwf@andrew.cmu.edu>
* @brief Executes a given command with all misbehave values and compares
* return values to expected values.
*
* Takes the expected return value and the command line for a given test.
* It will cycle the test throu... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* structs.h :+: :+: :+: ... |
C | /*
* File: instructionCycle.c
* Author: M.Adil Shaikh
* School: Dalhousie University
* Dept : Electrical and Computer engineering
* Course : ECED3403 Computer Architecture
* Purpose: Fetch and decodes the instruction as word from mem array until
* PC(Program counter) being R7 register reaches the breakpoint a... |
C | /**********************************************************************
* Դ: futu_message_interface.h
* Ȩ: ӹɷ˾
* ϵͳ : 06汾ڻϵͳ
* ģ : ڻܱ߽ӿ
* ˵ : ܱ߽ӿݲ
* : xdx
* : 20110315
* ע : Ͷ
* Ա
*
* ˵ 20110315
**********************************************************************/
#ifndef _FUTU_MESSAGE_I... |
C | #include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#define REQUEST_SIZE 8000
#define PATH_LEN 1024
int
main(int argc, char* argv[]) {
printf("going to read the first %u bytes of each file...\n", REQUEST_SIZE);
char ddf... |
C | #include "network.h"
/* Network Connections Module */
volatile int ip6to4 = 0;
net_info* cur_netinfo = (void *) 0;
int work_net_count = 0;
void *work_net_list = (void *) 0;
int cur_net_count = 0;
void *cur_net_list = (void *) 0;
void net_list_add(char *new_protocol, void *new_localip, unsigned new_loc... |
C | /* Client Program*/
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
void main()
{
char buf[BUFSIZ];
int fd,n;
/* open FIFO for writing */
fd = open("/tmp/server", O_WRONLY);
if (fd < 0 ) {
perror("Open");
exit(1);
}
/* read data from standard input and write... |
C | /*
* Q. Implement below mentioned bitwise functions.
*
* int get_nbits(int num, int n);
* int set_nbits(int num, int n, int val);
* int get_nbits_from_pos(int num, int n, int pos);
* int set_nbits_from_pos(int num, int n, int pos, int val);
* int toggle_bits_from_pos(int num, int n, int pos);
* void prin... |
C | /** @file traceback.c
* @brief The traceback function
*
* This file contains the traceback function for the traceback library
*
* @author Harry Q. Bovik (hqbovik)
* @bug Unimplemented
*/
#include "traceback_internal.h"
#include "traceutils.h"
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#inclu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.