language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include "PhysicsBody.h"
// Create a body with the given shape and the given velocity
physics_body* create_body(SDL_Rect* p_shape, vector2 initial_velocity){
physics_body* p_new_body = malloc(sizeof(physics_body));
p_new_body -> p_shape = p_shape;
p_new_body -> velocity = initial_velocity;
return p_... |
C | /* David Castellano Sanchez */
/*
He utilizado una jerarquia abuelo-padre-hijo en el cual el abuelo es el primero en
escribir por que de esta forma los hijos redirigen la tuberia por la entrada
estandar y no se pierde el prompt.
Es mala idea utilizar una jerarquia padre con varios hijos en la cual el... |
C | /*
Son conjuntos que tienen un nombre y elementos inmutables
en su interior , una vez declarados no se aumentan ni cambian,
los identificadores de los elementos siguen las reglas para
nombrar variables no debenen empezar en numero ni tienen tipo
los elementos del enum empienzan en 0 y continuan asi
*/
/*
#include <s... |
C | /* tree.c -- tree support functions */
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include "tree_exec07.h"
/* local data type */
typedef struct pair
{
Trnode * parent;
Trnode * child;
} Pair;
/* prototypes for local functions */
static Trnode * MakeNode(const Item * pi);
static bool ToLeft(const ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
void shuffle(int wDeck[][6]);
int main(void)
{
const int *suit[6] = { 1,2,3,4,5,6 };
const int *face[6] ={ 1,2,3,4,5,6 };
int deck[6][6] = { {2,3,4,5,6,7} ,{3,4,5,6,7,8},{4,5,6,7,8,9},
{5,6,7,8,9,10},{6,7,8,9,10,11},{7,8,9,10,11,12} }... |
C | #include "fosterlexer.h"
#include <stdio.h>
#include <stdlib.h>
void chompchomp(Scanner* s, long size) {
Token t;
int n = 0;
unsigned char yych;
while(1) {
int chan = scan_token(s, &t, size, &yych);
if(t.tok == FINI) {
break;
}
++n;
}
printf("%d tokens\n", n);
}
int main(int argc, c... |
C | #include <stdio.h>
#include <stdlib.h>
#define OVERFLOW -20
typedef int ElemType;
typedef enum {
INFEASIBLE = -2,
ERROR = -1,
OK = 1
} Status;
// 线性表的双向链表存储结构
typedef struct Node {
ElemType data;
struct Node *prior, *next;
} Node, *LinkList;
// 带头结点的双向循环链表的基本操作(14个)
void InitList(LinkList *L) {... |
C | /*
* =====================================================================================
*
*i n Filename: task2.c
*
* Description: prompt for positive number, stay in loop until one is entered
*
* Version: 1.0
* Created: 02/06/2018 10:05:05 AM
* Revision: none
* Compil... |
C |
#include "move.h"
#include <SDL/SDL.h>
#include <stdbool.h>
#include "const.h"
#include "coord.h"
#include "material.h"
bool isBox(Material* material, SDL_Surface*** map, int y, int x) {
return map[y][x] == material->box;
}
bool isBoxOk(Material* material, SDL_Surface*** map, int y, int x) {
return map[y][... |
C | #include<stdio.h>
#include<stdlib.h>
#include<conio.h>
int main(void){
float kmph,miph;
char line_text[50];
printf("Input kilometers per hour: ");
fgets(line_text, sizeof(line_text), stdin);
sscanf(line_text, "%f",&kmph);
miph = (kmph * 0.6213712);
printf("%f miles per hour\n", miph);
retu... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "commands.h"
commands commands_copy_commands(commands c){
commands ret = NULL;
if(c != NULL){
ret = (commands)calloc(sizeof(char), strlen((char *)c)+1);
strcpy((char *) ret,(char *) c);
}
return ret;
}
void commands_end_commands(commands c)
... |
C | #include<stdio.h>
int main()
{
static int i=5;
if(--i){
main();
printf("%d ",i);
}
}
// Explanation: Since i is a static variable and is stored in Data Section, all calls to main share same i.
// static intilises the value to 0 |
C | #include <stdio.h>
#include <stdlib.h>
#include "book.h"
#include "linkedListAPI.h"
void deleteFunction(void *tobeDeleted){
if(tobeDeleted != NULL){
free(tobeDeleted);
}
tobeDeleted = NULL;
}
int compareFunction(const void *first, const void *second){
Book *book1 = (Book*) first;
Book *book... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<memory.h>
#include<stdarg.h>
#define memset_s(buffer, sizea, value, sizeb) memset(buffer, value, sizea)
#define sprintf_s(_buffer, len, fmt, args...) sprintf(_buffer, fmt, args)
/*
给你一个字符串 S、一个字符串 T,请在字符串 S 里面找出:包含 T 所有字符的最小子串。
示例:
输入: S = "ADOBECODE... |
C | #include "rtpc.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
float calcChi(int tracknum, int chainnum)
{
/////////////////////////////////////////////////////////////////////////
//this routine calculates the residual of each point from a straight line
//fit ... |
C | #ifndef UTF8_H
#define UTF8_H
#include <wchar.h>
#include <assert.h>
#include <stdlib.h>
#include "debug.h"
extern int wcswidth (const wchar_t *__s, size_t __n) __THROW;
__attribute__((unused))
static int utf8_scrlen(const char *s) {
assert(s);
wchar_t wcstr[512];
mbstowcs(wcstr, s, sizeof(wcstr)/sizeof(*wcstr))... |
C | #ifndef __FONTS_H__
#define __FONTS_H__
static char font_A[16] = {0x00, 0x18, 0x18, 0x18, 0x18, 0x24, 0x24, 0x24,
0x24, 0x7e, 0x42, 0x42, 0x42, 0xe7, 0x00, 0x00};
/**
* @brief 输入一个字符
*
* @param vram 显示内存起始位置
* @param xsize 屏幕的宽度,因为要换行显示,需要知道宽度
* @param x 位置x
* @param y 位置y
* @param c ... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct {
float Re;
float Im;
} complex_t;
complex_t* add( complex_t* a, complex_t* b){
complex_t *t=(complex_t*) malloc (sizeof (complex_t));
t->Im=a->Im+b->Im;
t->Re=a->Re+b->Re;
return t;
}
complex_t* mul( complex_t* a, comp... |
C |
#include <unistd.h>
#include <string.h>
#include <stdio.h>
int main(){
int fd[2];
int func;
char input[] = "wow";
char output[3];
func = pipe(fd);
printf("Let's start... \n");
if (func == 0){
write(fd[1], input, sizeof(input));
read(fd[0], output, sizeof(output))... |
C | /**
* recover.c
*
* Computer Science 50
* Problem Set 4
*
* Daniel Emergente Loiola
*
* Recovers JPEGs from a forensic image.
*/
#include <stdio.h>
#include <stdint.h>
#include <cs50.h>
//typedef to replce the struct
typedef uint8_t DATA;
//prototypes
bool newjpg (DATA a, DATA b, DATA c, DATA d);
// variabl... |
C | /*-------------- Telecommunications & Signal Processing Lab ---------------
McGill University
Routine:
void VRlPrint (FILE *fp, const char Header[], const long int x[], int N)
Purpose:
Print a long integer array along with a header text
Description:
This routine prints the values o... |
C | #include "linkedlist.h"
#include <stdbool.h>
typedef struct
{
LinkedList* list;
unsigned int size;
unsigned int capacity;
_Bool auto_growing;
} Queue;
static Queue* setup_queue(Queue* queue, unsigned int capacity, _Bool auto_growing);
Queue* create_queue(_Bool auto_growing);
Queue* create_queueN(uns... |
C | /*
** EPITECH PROJECT, 2019
** tools.c
** File description:
** Cummon functions
*/
#include <unistd.h>
#include <stdlib.h>
#include "./include/my.h"
char *malloc_digit(char *to_copy, int i)
{
char *result;
result = malloc(sizeof(char) * (i + 1));
if (to_copy != NULL) {
my_strcpy(result, to_copy);... |
C | /**
* This program takes an a dictionary of words and
* allows users to enter a series of letters that match
* the words in the dictionary.
* @Author Ady Francis
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <ctype.h>
/** Number of expected arguments */
#define ARG_N... |
C | #include <stdio.h>
#include "libhtab.h"
void htab_clear(htab_t * t) //Clears table to empty array
{
struct htab_listitem *cursor = NULL;
struct htab_listitem *temp_item = NULL;
if(t != NULL)
{
for(unsigned i = 0; i < htab_bucket_count(t); i++)
{
cursor = t->... |
C | #include <conio.h>
#include <mem.h>
#include <multiboot.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <video.h>
#include "loader.h"
#include "config.h"
#include "messages.h"
/*
* Making this variable a global is _extremely_ easy for heap allocation.
* Besides, its not so w... |
C | // C code to check if the given two strings are anagram or not.
// Author: AdityaSingh17
#include <stdio.h>
void checkanagram(char str1[], char str2[])
{
int arr[26] = {0};
int i;
for (i = 0; (str1[i] != '\0' && str2[i] != '\0'); i++)
{
arr[str1[i] - 'a']++;
arr[str2[i] - 'a']--;
}... |
C | #include "handle_request.h"
void do_cd(pNode pthd, char *reply, char *order);
void handle_request(pNode pthd){
char order[1000];
char reply[1000];
char path[1000];
int new_fd = pthd->new_fd;
int len_init = pthd ->massage.len_init;
while(1){
memset(order, 0, 1000);
memset(reply, 0, 1000);
memset(path, 0, 100... |
C | #include<stdio.h>
#include<stdlib.h>
//remove duplicates from a sorted linkedlist.Traverse only once
struct node
{
struct node* next;
int data;
};
void push(struct node** head_ref, int new_data)
{
struct node* new_node =(struct node*) malloc(sizeof(struct node));
new_node->data = new_data;
new_node->n... |
C | #include <stdio.h>
#include "mpi.h"
int main(int argc, char ** argv)
{
int rank, size, token, next;
MPI_Status status;
MPI_Init(&argc,&argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
token = 5;
next = (rank+1)%size;
if(rank == 0)
{
pri... |
C | //
// Created by Push on 11/19/18.
//
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <fcntl.h>
#include "memory.h"
int REPEAT_TIMES = 10;
int ACCESS_TIMES = 1000;
double measure_ram_with_parameters(int array_size, int stride)
{
double average_cycles = 0;
for (int r... |
C | /*****************************************************
copyright (C), 2014-2015, Lighting Studio. Co., Ltd.
File name:
Author:Jerey_Jobs Version:0.1 Date:
Description:
Funcion List:
*****************************************************/
#include <stdio.h>
#define FAIL -1
#define SUCCESS 0
struct node
... |
C |
#include "block.h"
#include <math.h>
struct Block * each_block(struct Block * block);
int each_shape(struct Block * block, uint32_t shape_start_id, uint32_t shape_end_id);
int each_part(struct Block * block, uint32_t part_start_id, uint32_t part_end_id);
/*
The design of this script is _very_ specific. It takes mu... |
C | #include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
typedef struct Node{
int num;
struct Node *next;
}Node,*pNode;
int main(int argc, char *argv[]) {
int i;
pNode pi,p,Head;
Head=(pNode)malloc(sizeof(Node));
Head->next = NULL;//ע->nextΪգܽHeadΪգֱҲHeadĵַ
pi = Head;//piҪָHeadɱ
for(i=0;i<4;i++){
p=(pNo... |
C | #include "../wdb.h"
#include <stdlib.h>
wdb_internal WDB_ARR_CMP(i32_cmp)
{
i32 i32_a = *(i32 *)a;
i32 i32_b = *(i32 *)b;
if (i32_a < i32_b) return -1;
if (i32_a > i32_b) return 1;
return 0;
}
void wdb_arr_test()
{
wdb_arr(i32) array;
wdb_arr_init(array);
printf(">> init: cap: %ld co... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* hashing.c :+: :+: :+: ... |
C | /*
中国大学MOOC-翁恺-C语言程序设计习题集
07-0. 写出这个数 (20)
读入一个自然数n,计算其各位数字之和,用汉语拼音写出和的每一位数字。
输入格式:每个测试输入包含1个测试用例,即给出自然数n的值。这里保证n小于10^100。
输出格式:在一行内输出n的各位数字之和的每一位,拼音数字间有1 空格,
但一行中最后一个拼音数字后没有空格。
输入样例:
1234567890987654321123456789
输出样例:
yi san wu
自然数(natural number),可以是指正整数(1, 2, 3, 4),亦可以是非负整数(0, 1, 2, 3, 4)。
在数论通常用前者,而集合论和... |
C | /*GPIO Library for the Raspberry Pi
Written by Bill Vandenberk for CIS4900, Summer 2013
Judi McCuaig
Bill Gardner
Description: this is a library for use with the Raspberry Pi's GPIO controller.
Intended for use with the University of Guelph's CIS students
*/
#ifndef __RPi_GPIO_H
#define __RPi_GPIO_H
#include <stdboo... |
C | #include "holberton.h"
/**
* rev_string - function that reverses a string.
* @s: checked char
* Return: always 0 (success)
*/
int _strlen(char *s)
{
int i, len;
len = 0;
for (i = 0; s[i] != '\0'; ++i)
{
len++;
}
return (len);
}
void rev_string(char *s)
{
int strsize = _strlen(s);
int i;
char c;
i = 0;
while ... |
C | #include <stdlib.h>
#include <stdio.h>
#define MSG 1
int abrir_archivo (FILE**, char *, char *, int);
void mostrarReg(vect);
int main(void)
{
int i;
int vect[90];
FILE *archi;
if((archi=fopen("archalea","wb+"))==NULL);
{
puts("imposible abrir archivo");
}
printf("90 numeros aleato... |
C | /*********************************************************************/
/* */
/* Copyright (C) 2006, AVIQ Systems AG */
/* */
/* Project: dg ... |
C | // Header file for drone.c
//
// *** THIS HEADER FILE SHOULD NOT BE MODIFIED ***
//
// Contains data structure to track the drone
//
// Contains following routines
//
// place_drone(unsigned int x, unsigned int y)
// - place drone at an initial location (x,y)
//
// move_drone()
// - move drone to one ... |
C | /*
* utils.h
*
* Created on: 25/07/2013
* Author: vitor
*/
#ifndef UTILS_H_
#define UTILS_H_
/**************************************************************************************************
* Time definitions.
*/
#define MILI 1000
/*********************************************************************... |
C | #ifndef GPR_TYPES_H
#define GPR_TYPES_H
#include <stdint.h>
// short type aliases: please use that
typedef uint8_t U8;
typedef int8_t I8;
typedef uint16_t U16;
typedef int16_t I16;
typedef uint32_t U32;
typedef int32_t I32;
typedef uint64_t U64;
typedef int64_t I64;
typedef float F32;
type... |
C | #include <stdint.h>
#include "app.h"
extern uint8_t counter1_g;
extern uint8_t counter2_g;
extern uint8_t counter3_g;
void Decrement_If(uint8_t port_index ,uint8_t pin)
{
uint8_t pressed = 0;
//uint8_t mask = 0;
//mask |= (pin << 1); //To only check the intended PIN
/* If the button is pressed set th... |
C | #include<stdio.h>
#include<string.h>
int main()
{
char s[201];
int t=1,i;
scanf("%s",s);
for(i=0;i<strlen(s);i++)
{
if(s[i]=='W' && s[i+1]=='U' && s[i+2]=='B')
{
i=i+2;
if(t==0)
{
printf(" ");
}
}
else
... |
C | #include <stdio.h>
int main()
{
double matriz[3][3];
int i,j;
double d_principal,d_secundaria,d,s;
//preenchendo a matriz com os pontos do triangulo
for(i=0;i<3;i++){
printf("Insira o valor de X%c: ",97+i);
scanf("%lf",&matriz[i][0]);
printf("Insir... |
C | /*******************************************************************************
*
*
* ------------------------------------------
* 2017.03.09, Create by CCZY;
*/
#include <string.h>
#include "cqueue.h"
//*********************************************************************************
void CQueueInit(tCQu... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line.c :+: :+: :+: ... |
C | /*
* File: main.c
* Author: mwj7
*
* Created on 03 December 2015, 11:15
*/
#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
/*
*
*/
int main(int argc, char** argv) {
char directory[50];
char chosenFile[50];
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.h :+: :+: :+: ... |
C | #include "DEF.h"
aset(str) {
string who, what;
object ob;
if(!str) { write("aset <who> <what> \n"); return 1; }
sscanf(str,"%s %s",who,what);
if(!find_player(who)) { write("Not logged in...\n"); return 1; }
if(what == "scrime") {
find_player(who)->set_crime();
write("CRIME of "+who+" is "+HIR+"SET"+NORM+".\n");
... |
C | #include "holberton.h"
/**
* get_bit - Get the bit at index of n
* @n: The number to be read
* @index: The index to get the bit from the number
*
* Return: The bit at index index
*/
int get_bit(unsigned long int n, unsigned int index)
{
int mask, masked, th;
mask = 1 << index;
masked = n & mask;
th = maske... |
C | #include "holberton.h"
/**
* _strlen - Fdc
* @s: sdc
* Return: dc
**/
int _strlen(char *s)
{
if (*s == '\0')
{
return (0);
}
s++;
return (_strlen(s) + 1);
}
/**
* _cmp - dc
* @s1: v
* @s2: dc
* @i: dc
* @j: dc
* @wc: dc
* @lwc: ldc
* @len: ldc
* Return: 1dc
**/
int _cmp(char *s1, char *s2, int i, int j, int wc, int... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int match(char* s,char* sub){
int i,j;
for(i=0;i<strlen(s);i++){
for(j=0;j<strlen(sub);j++){
if(s[i+j]!=sub[j])
break;
}
if(j==strlen(sub))
return i;
}
return -1;
}
int main(){
char s[100],sub[100];
printf("\nEnter string and substring");
sc... |
C |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int calcParity(int *vec, int index, int max);
int *loadInput(int *in, int *max);
int main(){
int x, y=0, z=0, p=0, d, w=0;
int *input = NULL;
int *output = NULL;
input = loadInput(input, &d);
// 2^p >= p + d + 1;
... |
C | /*
* server.c
*
* Copyright (c) 2014 Virtual Open Systems Sarl.
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*
*/
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include "vhost_client.h"
#includ... |
C | /**
* Matriz.
*
* @author Mateus Calza
**/
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
float ** cria_matriz (int lin, int col) {
float** matriz = malloc(lin * sizeof(float*));
for (int linha_atual = 0; linha_atual < lin; linha_atual++) {
float* valores = calloc(col, sizeo... |
C | /**
******************************************************************************
@file bsp_driver_sd.c
@author
@version
@date
@brief
******************************************************************************
@history
***************************************************************... |
C | /*
* This is sample code generated by rpcgen.
* These are only templates and you can use them
* as a guideline for developing your own functions.
*/
#include "calcula.h"
#include <stdlib.h>
#include <string.h>
void
prog_100(char *host, char * operando_1, char operador, char * operando_2)
{
CLIENT *clnt;
int *r... |
C | #pragma once
#include <stdint.h>
typedef struct px4flow_frame
{
uint16_t frame_count;// counts created I2C frames [#frames]
int16_t pixel_flow_x_sum;// latest x flow measurement in pixels*10 [pixels]
int16_t pixel_flow_y_sum;// latest y flow measurement in pixels*10 [pixels]
int16_t flow_comp_m_x;// x velocity*10... |
C | /**
* GS1 Barcode Engine
*
* @author Copyright (c) 2021 GS1 AISBL.
*
* 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 ... |
C | /****************************************************************************
Module
TestingHSM.c
Revision
1.0
Description
-Controls the program flow during the testing state of the crimping machine.
-The testing mode (TestingHSM) is activated from the WaitingForModeSelect state
in the MasterHSM by pr... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
char s1[20]= "12345";
char s2[]="New Year";
char s3[40]="";
printf("s1=%s\ns2=%s\n",s1,s2);
printf("strcat(s1,s2) =%s \n",strcat(s1,s2));
printf("strncat(s3,s1,6)=%s\n",strncat(s3,s1,6));
printf("strcat(s3,s1)=%s\n",strcat(s3,s1));
int a=at... |
C | /* 1. Refaça os Exercícios 7 e 8 da Lista 02 utilizando o operador &&. */
/* 8. Escreva um programa que pede para o usuário digitar dois inteiros e:
• imprime a média aritmética desses inteiros se ambos forem maiores ou iguais a 5;
• imprime o menor desses inteiros caso contrário. */
#include <stdio.h>
int main() {
... |
C | #include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
#include<inttypes.h>
//Use address space
//as a define
#define ADDRESS_BITS 64
//Declare the global variables
struct cache_bits {
int tag_bits;
int index_bits;
int offset_bits;
} cache_bits_size;
unsigned long long int address;
int size;
//... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <assert.h>
#include "mu-mips.h"
/***************************************************************/
/* Print out a list of commands available */
/*********************... |
C | #include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/timer.h>
char* name;
unsigned long period = 500;
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Nachiket");
MODULE_DESCRIPTION("First module");
module_param(name, charp, 0644);
MODULE_PARM_DESC(name,"Enter your name");
module_param(pe... |
C | #include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
#include "linkedlist.h"
#include "nodetype.h"
Linked_List *LL_init()
{
Linked_List *l = (Linked_List*) malloc(sizeof(Linked_List));
l -> head = NULL;
l -> tail = NULL;
return l;
}
bool LL_append(Linked_List *list, Node_Type *q)
{
if... |
C | /*
* unitTest.c
*
* Created on: Oct 22, 2019
* Author: SURAJ THITE ,ATHARV
*/
#include "unitTest.h"
cbuff* test ;
//test-example-1
/*******************************************************************************************************
* Function:static void test_cbuff_init(void)
* Description :Test to v... |
C | #include <unistd.h>
#include <sys/types.h>
#include <pthread.h>
#include <semaphore.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#define ERR_EXIT(m) \
do \
{ \
perror(m); \
exit(EXIT_FAILURE); \
} while(0)
#define CONSUMERS_C... |
C | #include <stdio.h>
#include <string.h>
int main(void) {
int quantidadeCobaias[3]; //0 = c R = 1 S = 2
int quantidadeTotal = 0, entrada = 0, i, cobaiaEntrada = 0;
char tipoCobaia;
quantidadeCobaias[0] = quantidadeCobaias[1] = quantidadeCobaias[2] = 0;
scanf("%d", &entrada);
for(i = 0; i < entrada; i++) {
scan... |
C | #include "mlx90614.h"
/*******************************************************************************
* : MLX90614MLX90614 ʼλ SMBus_StartBit
* : MLX90614 ʼλ ʼλ
* Input : None
* Output : None
* Return : None
*******************************************************************************/
vo... |
C | #include <string.h>
#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <stdlib.h>
int main(int argc, char *argv[]){
int fd[2],ret,fda[2],reta,a;
pid_t pid;
ret=pipe(fd);
reta=pipe(fda);
if(ret<0 || reta<0){
fprintf(stderr,"Erreur de creation du pipe... |
C | #include<stdio.h>
#include<stdlib.h>
int main (int argc, char *argv[])
{
int titi = 5;
char* toto = "bonjour";
printf("L'entier est : %d\n", titi);
printf("La chaine est : %s\n", toto);
return EXIT_SUCCESS;
}
|
C | void
shift(unsigned int *tag, int i)
{
if (i > 0) /* left circular shift */
*tag = ((*tag << i) | (*tag >> (LENGTH(tags) - i)));
else /* right circular shift */
*tag = (*tag >> (- i) | *tag << (LENGTH(tags) + i));
}
/* send a window to the next/prev tag */
void
shifttag(const Arg *arg)
{
Arg shifted = { .... |
C |
//Alocao e Desalocao da Matriz que contm os pixels da imagem.
void Alloc_Dealloc(int **mat_img,int lines,int columns,char mod){
int i;
switch (mod){
case 'A':
mat_img = (int **) calloc(lines,sizeof(int *));
for (i = 0;i < lines;i++){
mat_img[i] = (int *... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main(void){
char nome[201];
char* sandro = "Sandro";
int tamanho, total = 0, i, totalmax = 100, k, tam;
scanf("%s", nome);
tamanho = strlen(nome);
for(k = 0; k<tamanho-5; k++){
total = 0;
tam = k;
for(i=0; i<6; i++){
... |
C | #include <stdio.h>
#include <string.h>
int main() {
// char ch1='A'+'6'-'3';
// printf("%c\n",ch1);
// printf("%d\n",sizeof(45645.545));
// int a,b,c;
// scanf("a=%db=%dc=%d",&a,&b,&c);
// printf("a=%db=%dc=%d",a,b,c);
// int x,i,j,k;
// x=(i=4,j=16,k=32);
// printf("%d",x);
... |
C | /*
* lua_exec.c
* Run lua code from C. script got from stdin, result put into stdout.
* Created on: 06.07.2012
* Author: yaroslav
*/
#include <stdlib.h> /* For function exit() */
#include <stdio.h> /* For input/output */
#include "zshell.h"
#include ... |
C | /**
* print server by zTrix, create server socket and print all of what it heard
* for ftp debug
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
// #include <signal.h>
#include <types.h>
#include <sockets.h>
#include <ulib.h>
#include <malloc.h>
#include <ftputils.h>
#define BUF_SIZE1 10
#define BUF... |
C | #include <stdlib.h>
#include <stdio.h>
#include <math.h>
typedef struct {
float x, y;
} Ponto;
typedef struct{
Ponto *v;
int n;
} Poligono;
float perimetro(Poligono p);
Ponto centroG(Poligono p);
float area(Poligono p);
int main()
{
int i, n;
Poligono p;
printf("Quanto... |
C | /**
@file fonctions.h
@brief Prototype fonction matrices
@author Biardeau Tristan Bussereau Keryann Tabot Alexandre
@version v1.00
@date 14/11/2015
*/
#define N 4 /**< Taille de la matrice */
/**
* Permet de remplir la matrice de caractères générés aléatoirement
* @param Mat Matrice de caractères comprenant l... |
C | // 5.7. readlines, ,
// main, alloc.
// ?
// , ,
//
// readlines , char lines[][MAXLEN]
// , .. , .. ,
// char *lineptr[]
#include <stdio.h>
#include "sort_lines.h"
static int max_lines = 10;
int main(int argc, char const *argv[])
{
... |
C | // 20171005
// main()里的没交换成功;swap()里的交换成功了。
#include <stdio.h>
#include <stdlib.h>
void swap(int p1, int p2)
{
printf("\np1和p2交换前\n");
printf("p1=%d\tp2=%d\n", p1, p2);
int temp;
temp = p1;
p1 = p2;
p2 = temp;
printf("\np1和p2交换后\n");
printf("p1=%d\tp2=%d\n", p1, p2);
return; // void类型,其实啥也不写挺好
}
int ma... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* make_heat_map.c :+: :+: :+: ... |
C | #include "common.h"
#include "ll.h"
#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <math.h>
#include <unistd.h>
#include <string.h>
#ifdef TIME
#include <time.h>
FILE *timeLog;
void openTimeLogFile()
{
timeLog = fopen("timeLog.txt", "a");
}
void closeTimeLogFile()
{
fclose(timeLog);
}
#endif
... |
C | #include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include "dmem_libc_stdlib.h"
#include "dynamic_memory.h"
#include "dmem_utils.h"
#define HEAP_ALIGN UINT32_C(64)
typedef struct heap_info_t {
uint32_t size;
int used;
struct heap_info_t* next;
} heap_info_t;
static uint32_t heap_start;
static heap_inf... |
C | #include "MysqlCDriver.h"
int main(void)
{
MYSQL *conn = Connect("localhost", "root", "123456", "test");
if(!CreateTable(conn, "message"))
{
printf("create table error");
return EXIT_FAILURE;
}
if(!InsertTable(conn, "message", "1", "Hello World"))
{
printf("insert table error");
return EXIT_FAILURE;
}
... |
C | int main(int argc, char* argv[])
{
struct point{
float x;
float y;
}a[5000];
int n,i,j;
float q;
double l=0,m=0,m1,m2,m3;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%f",&a[i].x);
scanf("%f",&a[i].y);
}
for(i=0;i<n-1;i++)
{
for(j=i+1;j<n;j++)
{
m1=a[i].x-a[j].x;
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define MAX(a,b) (a>b?a:b)
int main() {
FILE* file = fopen("triangle.txt", "r");
char str[4];
str[3] = 0;
int i, j, n;
int *a = malloc(sizeof(int) * 100);
int *b = malloc(sizeof(int) * 100);
int **current = &b;
int **next = &a;
for... |
C | #include <stdio.h>
#define MAXLINE 1000
int getmyline ( char myline[] );
int findlength ( char myline [] );
int findstart ( char myline[] );
int findend ( char myline[] );
int main()
{
char line[MAXLINE];
int length = 0;
int start = 0;
int end = 0;
int done = 0;
while ( 1 )
{
done = getmyline( line );
leng... |
C | #include <stdio.h>
int bignum(int a, int b) {
if (a > b)
return a;
else if (a < b)
return b;
else
return 0;
}
int main() {
int wert1, wert2, big;
printf("Zahl1 eingeben: "); // der Ton wird rauher...
scanf("%d", &wert1);
printf("Zahl2 eingeben: "); // der Ton wird rauher...
scanf("%d",... |
C | #include <string.h>
#include <stdlib.h>
#include "str_replace.h"
char *str_replace(char *orig, char *rep, char *with)
{
char *result;
char *ins;
char *tmp;
int len_rep;
int len_with;
int len_front;
int count;
if (!orig)
return NULL;
if (!rep)
rep = "";
len_rep =... |
C | /** \file
* \brief ʸ sym4_t ޤ sym8_t ǰ
* \todo inline ؿҤ⤿ʤϤؤб
*/
#ifndef INTERNAL_TYPES_H
# error please include "internal_types.h"
#endif
#ifndef NUSDAS_CONFIG_H
# error "include config.h"
#endif
/** 8ʸѥåΤ4ʸ4ʸѥåȤƼФ
* @note ϥХȥ¸
*/
#if HAVE_SI8_TYPE
# ifdef WORDS_BIGENDIAN
# define SYM8_LEFT4(s8) ((sym4_t)((s8... |
C | /* Copyright (c) 2018-2022 UT Longhorn Racing Solar */
#include "BSP_CAN.h"
#include "Interrupt_Priorities.h"
#include "stm32f4xx.h"
#include "os.h"
#include "Tasks.h"
// The message information that we care to receive
typedef struct _msg {
uint32_t id;
uint8_t data[8];
} msg_t;
// Set up a fifo for receivin... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define FILE_READ_ERROR -1
#define FILE_WRITE_ERROR -2
#define MAX_CMD_OPT 7
#define CMD_OPT_IN_FILE "-i"
#define CMD_OPT_IN_POS 1
#define CMD_OPT_IN_VAL_POS 2
#define CMD_OPT_OUT_FILE "-o"
#define CMD_OPT_OUT_POS 3
#define CMD_OPT_OUT_VAL_POS 4
#define CMD_OPT... |
C | #include "matrix.h"
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <omp.h>
// Include SSE intrinsics
#if defined(_MSC_VER)
#include <intrin.h>
#elif defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__))
#include <immintrin.h>
#include <x86intrin.h>
#endif
/* Below are some intel intrins... |
C | #include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include "multitest.h"
struct threadInfo{
int start;
int end;
}threadInfo;
int toFind;
int *a;
int status;
void* singleTsearch(void* argse){
struct threadInfo* args = (struct threadInfo*) argse;
int begin = args->start;
int last = args->... |
C | #include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
int var_global = 0;
void *do_work(void *null) { // función que ejecutará el nuevo thread
int i = 500;
sleep(5);
var_global = i;
pthread_exit(NULL);
}
int main(int argc, char *argv[]) {
int rc;
pthread_t tid;
printf("Valor de la variable glob... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.