language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /*
Name :Jayesh tambe
Description: DNS resolution using multi threading
// 2 exra credits covered
// matching number of cores with threads
// IPV6 code covered in util.c
*/
#include "multi-lookup.h"
// locking queue for critical region
pthread_mutex_t QueLock;
// locking file for critical region
pthread_mutex_t FileLo... |
C | /*
============================================================================
Name : lecture-03.c
Author : mr
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
============================================================================
*/
#include <std... |
C | /*
File : blocking_disk.c
Author : Sabyasachi Gupta
Modified : 4/14/2019
Description : blocking disk implementation
*/
/*--------------------------------------------------------------------------*/
/* DEFINES */
/*-------------------------------------------------------------------... |
C | /*二叉搜索树*/
#ifndef _TREE_H
#define _TREE_H
#include <stdlib.h>
typedef struct item {
char petname[20];
char petkind[20];
}Item;
#define MAXITEMS 10
typedef struct node {
Item item;
struct node *left;
struct node *right;
}Node;
typedef struct tree
{
Node * root;
int size;
} Tree;
void IntializeTree (Tree *pt... |
C | /********************************************************************
Module Name: Input/Output
Process: It contains all operation related to input/output from user
and as well few help operatons
*******************************************************************/
#include "calls.h"
#include "files.h"
#ifndef _io_... |
C | include <stdio.h>
int input(){
int x = 0;
printf("Enter a number to be placed in the Accumulator: ");
scanf("%d",x);
while(1){
while((x < (−32768)) || (x > (32767))){
printf("Your entry is not the correct length.")
printf("Enter a number to be places in the Accumulator: ");
scanf("%d",x);
}
ret... |
C | #include <stdio.h>
int main(void)
{
int a = 7;
//set Ptr to the address of a
int *aPtr = &a;
//%p = printing the addrress
printf("The value of a is %p.\nThe address of a is %p.\n", a, &a);
printf("The value of aPtr is %p.\nThe value of *aPtr is %p.\n", aPtr, *aPtr);
printf("... |
C | #include "lists.h"
/**
*insert_dnodeint_at_index - Insert a new node at a given position
*@h: The head of the doubly linked list
*@idx: The given position
*@n: The data
*Return: The address of the new node or NULL if failed
*/
dlistint_t *insert_dnodeint_at_index(dlistint_t **h, unsigned int idx, int n)
{
unsign... |
C | #include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <config.h>
#include "mymem.h"
#include "memlist.h"
DescriptorNode * _usedList;
int _usedCount = 0;
DescriptorNode * _freeList;
int _freeCount = 0;
size_t _minFreeSize = INT_MAX;
size_t _maxFreeSize = INT_MIN;
char _initialized = 0;
size_t _total... |
C | /*
Lista o conteúdo do diretório fornecido no caminho fornecido (absoluto).
Se por um acaso não existir diretórios que aparecem no meio do string de caminho,
o programa dirt2 retorna um mensagem de erro.
A saída desse programa é a listagem do conteúdo dos registros do arquivo de diretório
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* flags.c :+: :+: :+: ... |
C | #pragma once
#include <basetsd.h>
enum COLORS_ENUMS {
WHITE = (UINT32)0xff'ff'ff'ff,
RED = (UINT32)0xff'00'00'ff,
GREEN = (UINT32)0xff'00'ff'00,
BLUE = (UINT32)0xff'ff'00'00,
BLACK = (UINT32)0xff'00'00'00,
YELLOW = (UINT32)0xff'00'ff'ff,
MAGENTA = (UINT32)0xff'ff'00'ff,
CYAN = (UINT32)0xff'ff'ff'... |
C | #include <stdlib.h>
#include <stdio.h>
#include "graphs.h"
#include "graph-user-input.h"
#include "dijkstra.h"
void create_node_option(Graph* input_graph) {
create_node(input_graph);
printf("Vertice adicionado na posicao %d.\nQuantidade de vertices atual: %d\n", (input_graph->node_count - 1), input_gra... |
C | /**
* @brief It declares the sprite module
*
* @file sprite.c
* @author Antonio Solana
* @copyright GNU Public License
*/
#include "../include/sprite.h"
struct _Sprite
{
Id id; /*!< Id del sprite*/
char data[17][39]; /*!< Datos en ascii*/
};
Sprite *sprite_create(Id id)
{
Sprite *sprite;
int i;
sprit... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char ** argv) {
int opt = 0;
int delay = 8000;
int volume_scale = 4;
int source_index = 1;
int dest_index = 2;
FILE *input, *input2, *output;
if (argc == 3 || argc == 5 || argc == 7) {
while ((opt = getopt(argc, argv, "d:v:")) > -1... |
C | //
// Created by James Miles on 31/08/2021.
//
// You may need to create your own data streams - the OS will allow you to do this
// these streams will go beyond Stdin, Stdout, Stderr
/*
Each data stream is represented by a pointer to a file and you can create a new data stream with fopen()
FILE *in_file (This wil... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_atoi_base.c :+: :+: :+: ... |
C | /* This allows coordinate data to be entered using the mouse. */
#include "ipl.x"
get_point( x, y )
double *x, *y;
{
int s;
double x2, y2;
char ans[20];
if( Dev == 'm' ) { /* terminal interface */
fprintf( stderr, "Enter a position in inches. First x: " );
fgets( ans, 20, stdin ); *x = atof( ans );
fprintf( std... |
C | #include <stdbool.h>
#include "mitsu.h"
bool validateArgs(int temp, int on, int operation);
int main(int argc, char *argv[]) {
if (argc != 4) {
printf("Usage: #>sudo mitsu <temp> <on> <operation>\n");
printf("\t<temp> = 10, 16 ... 31\n");
printf("\t<on> = 1=ON | 0=OFF\n");
printf... |
C | #include<stdio.h>
#include<conio.h>
#include <stdlib.h>
void push();
void pop();
int a[50];
int n, size, top=-1;
void main()
{
char ch1='y', ch2='y';
clrscr();
printf("\n enter size");
scanf("%d", &size);
while(ch1!='n')
{
push();
ch1=getch();
}
dis... |
C | /* # Name: Anoushka Gupta
* # Date: 02/07/2021 (Th 9:15am)
* # Title: Lab5 – Synchronization using semaphores, lock, and condition variables
* # Description: Producer Consumer Problem using semaphores
*/
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
#include <semaphore.h>
#include <time.h>
#include <... |
C | #include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <unistd.h>
#include "dask.h"
#define Channel 15
#define ScanCount 500
#define ReadCount (Channel+1)*ScanCount
#define SampIntrv 160
#define ScanIntrv SampIntrv*(Channel+1)
int main(int argc, char **argv)
{
I16 card, err;
U16 card_num;
U16 ... |
C |
#include<stdio.h>
using namespace std;
//方法一 定义一个数组类型
typedef int(ARRAY_INT_10)[10];
//方法二 定义一个数组指针类型
typedef int(*ARRAY_INT_10_P)[10];
int main(void)
{
// int array[10];
// ARRAY_INT_10 *array_p = NULL;
//
//
// array_p = &array;
//
// for (int i = 0; i < 10; i++) {
// (*array_p)[i] = i + 10... |
C | /*
Turn on LED while button is pressed using interrupt
Button connected on PB2
LED connected on PA2
*/
#include<avr/io.h>
#define F_CPU 20000000
#include<util/delay.h>
#include<avr/interrupt.h>
ISR(INT0_vect){ //interept service routine while interept is made by int0 pin
if (!(PINB&(1<<2))) { //... |
C | #include<stdio.h>
void bin(int n){
if (n==0) printf("0");
else{
bin(n/2);
printf("%d",n%2);
}
}
int main(){
int n;scanf("%d",&n);
bin(n);
return 0;
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_atoi_base.c :+: :+: :+: ... |
C | #include <stdio.h>
#define str(s) #s
#define cat(a, b) a##b
int main(int argc, char **argv)
{
int i1 = 1;
printf("%s\n", str(ssss)); //将ssss转换成字符串并输出。
printf("%d\n", cat(i, 1)); //将i和1连接起来,因此打印i1的值。
return 0;
}
|
C | /**
2.ΪҪβʵαͬ
ȷ˵
ԪʵΣֻͬ
ΪֱӰʵÿԪ
ָβĸ
ԪʵΣȰβʵηͬԪڴӵԪֵ
**/
#include <stdio.h>
void test(int b[10]);//voidҪ
void main()
{
int a[10]={2,4,6,8,10,12,14,16,18,20};//ʵaβbͬ
test(a);//鴫빫ʽβȥ
putchar('\n');//printf("\n") putcharֻһַ,ѭ
}
void test(int b[10])//ܵʵεĴ ʵaβbͬ
{
in... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "hidrante.h"
typedef struct hidrante{
char id[20]; /*numero identificador do objeto*/
double x; /*coordenada x*/
double y; /*coordenada y*/
char cfill[20]; /*cor de preenchimento do objeto*/
char cstrk[20]; /*cor da borda do objeto*/
char sw[10]; /*es... |
C | #include <stdio.h>
#include <stdlib.h>
void reverse_sentence ();
int main(void) {
printf("Enter a Sentence : ");
fflush(stdout);
reverse_sentence();
}
void reverse_sentence (){
char c;
scanf("%c",&c);
if (c != '\n'){
reverse_sentence();
printf("%c",c);
}
}
|
C |
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
#include "luaUtil.h"
#define MAX_COLOR (255)
typedef struct _ColorTable {
char* name;
unsigned char red;
unsigned char green;
unsigned char blue;
}ColorTable... |
C | /*
** my_nbrcmp.c for my_nbrcmp in /home/puccio_c/rendu/Piscine_C_infinadd/lib/my
**
** Made by cyril puccio
** Login <puccio_c@epitech.net>
**
** Started on Sat Oct 31 15:29:46 2015 cyril puccio
** Last update Fri Nov 13 10:30:08 2015 cyril puccio
*/
int my_nbrcmp(char *str1, char *str2)
{
int i;
i = 0;
i... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* display_errors.c :+: :+: :+: ... |
C | // main.c
// Devolution_Beta
//
// Created by Marcus Anderson on 7/17/19.
// Copyright © 2019 CodeBound. All rights reserved.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdbool.h>
#include "fileManager.h"
#include "textManipulation.h"
#include "mylib.h"
#include "graph... |
C | #include "deeplearning.h"
MultibandImage *normalize(MultibandImage *img, AdjRel *A){
int xq, yq, band, yp, xp,i;
float val;
MultibandImage *normalized = CreateMultibandImage(img->nx, img->ny, img->nbands);
for (band=0; band<img->nbands; band++)
for (yp=0; yp < img->ny; yp++)
... |
C | #include <stdio.h>
int main(void)
{
int n;
double num;
double sum = 0;
scanf("%d", &n);
//根据片段:0.1出现4次,0.2出现6次,0.3出现6次,0.4出现4
//发现规律:每个数都将与其后每个数均构成一个片段,
//如0.2会产生(0.2), (0.2, 0.3),(0.2, 0.3, 0.4),
//除此之外,它之前的每个数也都将与这些片段构成一个新片段,
//比如0.2前有0.1,这个0.1会产生(0.1, 0.2),(0.1, 0.2, 0.3),(0.1, ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <errno.h>
void siginthandler(int sign);
int main(int argc,char *argv[]){
//questo programma, termina solo quando il fratello secondo figlio gli manda SIGINT, quindi
//dovremmo disattivare tutti i segnali che non sono un SIGINT in ... |
C | #include "job.h"
// job list sssss
Jobs *head;
int jobCount;
void initJob(){
//head=(Jobs *) malloc(sizeof(Jobs));
head = NULL;
jobCount = 0;
}
void printJobList(){
int count=0;
Jobs *temp;
temp = head;
if (temp==NULL) {
printf("No suspended jobs\n");
}
while(temp!=NULL){... |
C | #ifndef RASP3UART_H_
#define RASP3UART_H_
#include "rasp3base.h"
#include <stdint.h>
#define UART_BUFFER_SIZE 100
static char *tab = "0123456789ABCDEF";
/**Initialize the uart.*/
void RP3_UART_init(int baudrate);
/**Set if the received chars will be directly transmitted again.*/
void RP3_UART_set_rep... |
C | /*
** EPITECH PROJECT, 2020
** MUL_my_defender_2019
** File description:
** render_queue_flush implementation
*/
#include "my/my.h"
#include "rpg/render_queue.h"
void render_queue_flush(render_queue_t *self, bool ascending)
{
if (ascending)
for (usize_t i = self->len; i > 0; i--)
self->queue[i... |
C | /*
* @author: Shiva K Govindaraju
* Winter 2020
* COEN 283, Assignment 2
*/
#include <stdio.h>
#include <pthread.h>
//adding some more Includes because the compiler Warnings are annoying
#include <stdlib.h>
#include <string.h>
char USAGE[] = "naive_lock n_threads\n"
"USAGE: run n threads with a naive lock\n";
... |
C | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
ListNode* Solution::mergeKLists(vector<ListNode*> &A) {
// Do not write main() function.
// Do not read input, instead use the arguments to the... |
C | #include <stdio.h>
main()
{
printf("\c"); // Gives "unknown escape sequence".
printf("\x"); // Gives "\x used with o following hex digits".
printf("\f");
}
|
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define CHUNK_MEMORY 1024
typedef struct Chunk Chunk;
typedef struct Tape Tape;
typedef struct Loop Loop;
enum Error{
ERROR_MEM_ALLOC = 1, /* Malloc/calloc error. */
ERROR_DEAD_FILE = 2, /* I/O error with a file. */
ERROR_WRONG_USE = 3, /* No fil... |
C | #include <stdint.h>
#include "packet.h"
static uint16_t build_packet(uint8_t *buffer, uint16_t buffer_len, const uint8_t *payload, uint16_t payload_size)
{
PACKET *packet;
uint8_t sum;
uint16_t i;
if (sizeof(PACKET) - 1 + payload_size > buffer_len)
{
/* payload too large */
return PACKET_TOO_LONG;
}
... |
C | #include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#define TAILLE 20
int main() {
char mot[TAILLE];
int i = 0;
mot[0] = 0;
printf("Mot: ");
scanf_s("%s", mot, _countof(mot));
int taille= strlen(mot);
taille;
for ( i = 0; i < taille/2; i++)
{
if (mot[taille - i] == mot[i])
;
el... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <limits.h>
#include <sys/types.h>
#include <sys/stat.h>
#define FIFO_NAME "./fifo"
#define BUFFER_SIZE PIPE_BUF
#define TEN_MEG (1024 * 10)
int main() {
int fd, res;
int mode = O_WRONLY;
int bytes = 0;
c... |
C | #include <stdio.h>
#include <gpioLib.h>
int main(){
int salida1,salida2,entrada1;
salida1=4;
salida2=17;
entrada1=24;
/*
* Enable GPIO pins
*/
if (-1 == GPIOExport(salida1) || -1 == GPIOExport(entrada1))
return(1);
/*
* Set GPIO directions
*/
if (-1 == pinMode(salida1, OUT) || -1 =... |
C |
// =============================================================================
// pagerank.c
// =============================================================================
// Outputs a list of urls sorted by a weighted PageRank algorithm to
// pagerankList.txt
// ============================================... |
C | /*
*
* Nom: Joan Guillem Castell Ros-Zanet login:ls23841
* Nom: Arnau Perramon login:ls26027
*
* File: comand.h
* Fitxer .h on tenim el tipus Command declarat i totes les funcions públiques
* del command.c.
*
*/
// Tipus CommandLine: guardem la informació del usuari.
// commandName: nom de la comanda.
// dataP: caden... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct node
{
char name[10]; /*进程标识符*/
int prio; /*进程优先数*/
int cputime; /*进程占用CPU时间*/
int needtime; /*进程到完成还要的时间*/
char state; /*进程的状态*/
struct node *next; /*链指针*/
}PCB;
PCB *finish,*ready,*tail,*run; /*队列指针... |
C | ///------------------------------------------------------------------------------
/// Challenge 2: Please get back to us with the clear / compact / efficiently
/// written code you can come up for the following requirements.I sincerely
/// appreciate you taking time to program this.
/// UART driver Write a simple U... |
C | #ifndef __JEEP_DEFINED__
#define __JEEP_DEFINED__
/**
* \defgroup JEEP General Purpose Pure Functions
* \{
* This module is implements misc pure functions
*
* \file gtimer.h
* \brief header of the gTimer module
* \author Gerard Gauthier
* \date 2016/02
*/
/*
* dependencies
*/
/* where boolean, dword, word... |
C | #define _CRT_SECURE_NO_WARNINGS 1
//ָ뺯ҵ
//1.մӴС(ָʵ)
//#include <stdio.h>
//int main(){
// int a = 0;
// int b = 0;
// scanf("%d%d", &a, &b);
// int* pa = &a;
// int* pb = &b;
// if (*pa > *pb){
// printf("%d ", *pa);
// printf("%d", *pb);
// }
// else
// printf("%d ", *pb);
// printf("%d ", *pa);
// return 0;
//}
//... |
C | #include <stdio.h>
int main(void) {
int valore, max, somma=0;
int inseriti = 0;
// int uscita;
char uscita;
do {
printf("Inserire un numero: ");
scanf("%d", &valore);
if( inseriti == 0 )
max = valore;
else if( valore > max )
max = valore;
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* list.c :+: :+: :+: ... |
C | #include<stdio.h>
typedef struct binarytree{
int data;
struct binarytree *left,*right;
}node;
node* createnode(int d)
{
node *n=(node*)malloc(sizeof(node));
n->data=d;
n->left=NULL;
n->right=NULL;
return n;
}
typedef struct queue{
node* *a;
int head,tail;
}queue;
queue* initialize(int n)
{
queue *t... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#define TAM 60
clock_t start, end;
double cpu_time_used;
int n;
int lectura() {
FILE *fApu;
fApu = fopen("maze4.txt","r");
char linea[TAM];
char *token;
long ret;
int n = -1;
while (!feof(fApu)) {... |
C | #include <math.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
//La permutation initiale et son inverse
int PI[64] = {58,50,42,34,26,18,10,2,
60,52,44,36,28,20,12,4,
62,54,46,38,30,22,14,6,
64,56,48,40,32... |
C | #include<stdio.h>
struct complex
{
int real, img;
};
int main()
{
struct complex a,b,c;
printf("enter a and b where a+bi is the first complex number.\n");
scanf("%d%d",&a.real,&a.img);
printf("enter c and d where c+di is the second complex number.\n");
scanf("%d%d",&b.real,&b.img);
c.real=a.real+b.... |
C | #include <std.h>
// fancy bracers, made by hades
#include <daemons.h>
inherit "/d/common/obj/armour/bracers";
int uses = 10;
void create(){
::create();
set_name("Bracers of the weave");
set_id(({ "bracers", "bracer", "bracers of the weave",}));
set_short("%^RESET%^%^MAGENTA%^Bra%^BOLD%^ce"+
"%^RESET%... |
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 | /******************************************************************************
Online C Compiler.
Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.
***********************************************... |
C | #include<stdio.h>
#include<stdarg.h>
int var_arg(char *first, ...)
{
va_list list;
char *p;
va_start(list, first);
while ((p = (char *)va_arg(list, char *)) != NULL)
printf("Got argument: %s\n", p);
va_end(list);
}
int main()
{
var_arg("firsta", "second", "third");
}
|
C | /*
* formulas.c
*
* Created on: 17 abr. 2021
* Author: pfede
*/
#include "formulas.h"
int suma(int a, int b)
{
return a+b;
}
int resta(int a, int b)
{
return a-b;
}
float division(int a, int b)
{
return (float) a/b;
}
int multiplicacion(int a, int b)
{
return a*b;
}
int factorial(int ... |
C | #include "util.h"
#define SYS_READ 3
#define SYS_WRITE 4
#define STDIN 0
#define STDOUT 1
#define STDERR 2
extern int system_call();
int diff = 'a' - 'A';
void debug(int id, int code)
{
system_call(SYS_WRITE, STDERR, "ID: ", 4);
system_call(SYS_WRITE, STDERR, itoa(id), strlen(itoa(id)));
system_call(SYS_WRITE... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <pbc.h>
#define STAR 2
#define LEVEL 10
#define TESTPARAM 30
typedef struct param{
element_t g;
element_t h0[LEVEL];
element_t h1[LEVEL];
element_t k0[LEVEL];
element_t k1[LEVEL];
element_t h_zero;
element_t k_zero;
element_t omega;
}param;
ty... |
C | #include <stdio.h>
#include <stdlib.h>
int foo(int t)
{
int mennyi=0;
if(t<0)
{
return 0;
}
while (t!=0)
{
if(t%2==1)
{
mennyi++;
}
t=t/2;
}
return mennyi;
}
|
C | /*
JTSK-320111
a4_p2.c
Eaindra Wun Pyae
e.wunpyae@jacobs-university.de
*/
#include <stdio.h>
float convert (int cm)
{
float km;
km = cm / 100000.0;
//formula for the conversion from cm to km
return km;
}
int main()
{
int cm;
scanf("%d", &cm);
printf("Resul... |
C | /* Andre Augusto Giannotti Scota (a2gs)
* andre.scota@gmail.com
*
*
*
* MIT License
*
*/
/* func.c
*
* Who | When | What
* --------+------------+----------------------------
* a2gs | 18/07/2019 | Creation
* | |
*/
float weight(float prevWe... |
C | #include<stdio.h> //Inclusion of Necessary Header File.\
int insertion_sort(int a[],int n) // Definition of insertion Sort() function .
{
int j,t,i;
for(i=1;i<n;i++)
{
j=i-1;
t=a[i];
while(j>=0 && t<a[j])
{
a[j+1]=a[j];
j--;
}
a[j+1]=t;
}
}
void main()
... |
C | #define F_CPU 8000000L
#define baudrate 19200L
#include <avr/io.h>
#include <avr/interrupt.h>
#include "macro.h"
#include "usart.h"
#define CMD_BUF 4
uint8_t cmd_buf_p;
char cmd_buf[CMD_BUF];
void clearcmdbuf()
{
cmd_buf_p = 0;
uint8_t i;
for (i = 0; i<CMD_BUF; i++) {
cmd_buf[i] = 0;
}
}
... |
C | /*
* ftrace_log -- Pull trace_pipe and save to disk
*
* Compile: gcc -g -o ftrace_log ftrace_log.c -Wall
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <time.h>
#include <errno.h>
#include <signal.h>
#include <sys/file.h>
#include <linux/limits.h>
#ifn... |
C | void code_free_user (Stmt* s) {
assert(s->sub == STMT_USER);
assert(s->User.isrec);
const char* sup = s->User.tk.val.s;
fprintf (ALL.out,
"void %s_free (struct %s** p) {\n"
" if (*p == NULL) { return; }\n",
sup, sup
);
out("switch ((*p)->sub) {\n");
for (int i=0;... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_flag.c :+: :+: :+: ... |
C | #define _GNU_SOURCE
#include <assert.h>
#include <errno.h>
#include <inttypes.h>
#include <pthread.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#include "../include/config.h"
#include "../include/connmgr.h"
#include "../... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf_conversion_ls.c :+: :+: :+: ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* printing.c :+: :+: :+: ... |
C | /**************************************************************************
Author: Stav Ofer
Creation date: 2013-08-04
Last modified date: 2013-08-04
Description: some testing for CatsList
***************************************************************************/
#include <stdio.h>
#include "Ca... |
C |
#ifndef GAME_STATE_H
#define GAME_STATE_H
#pragma once
#include <stdbool.h>
#include "bullet.h"
#define MAX_PLAYER_BULLETS 200
#define MAX_ENEMY_BULLETS 10000
// uses a small-block allocator style scheme
typedef struct t_bullet_slot_header
{
bool is_used;
struct t_bullet_slot* next_free;
}
t_bullet_slot_he... |
C | #include <stdio.h>
#include <stdlib.h>
#include "moto.h"
#include "tipo.h"
#include "color.h"
#include "servicio.h"
#include "trabajo.h"
#include "fecha.h"
#include "validaciones.h"
#include "dataBank.h"
#include "informes.h"
#define TAMT 4
#define TAMC 5
#define TAMS 4
#define TAMM 50
#define TAMTR 50
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <dirent.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
/*
* Archive format
*
* 0x2B bytes: Magic number
* 0x01 bytes: Encryption key
* 0x04 bytes: File count
* 0x04 bytes: File table position
* 0x** bytes... |
C | //cat
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
int main(int argc, char** argv)
{
char *buffer;
size_t len = 0;
if(argc == 1)
{
while(getline(&buffer, &len, stdin) != -1)
printf("%s", buffer);
}
int arg_count = argc;
while(arg_count-- > 1)
{
int source_file = open(ar... |
C | /*
* proportional_control.c
*
* Created on: Nov 29, 2020
* Author: sandr
*/
#include "controller.h"
/**
* @brief Executa controlador
*
* Executa o controlador conforme a capsula recebida por parâmetro, quando o erro chegar a zero,
* ativa a válvula de água e a bomba principal.
*
* @retval none
* @pa... |
C | #include <stdio.h>
#define LOWER 0 /* 温度表的下限 */
#define UPPER 300 /* 温度表的上限 */
#define STEP 20 /* 步长 */
float convert_temperature(int f);
/* 练习 1-5 打印华氏-摄氏温度对照表 */
int main()
{
int i;
float c;
printf("%s\t%s\n", "fahr", "celsius");
for (i = UPPER; i >= LOWER; i-=STEP) {
c = convert_temperature(i);
printf("... |
C | /*Name-check whether a given no. is posetive or -ve
date-08.09.2015
file-check.c */
#include<stdio.h>
main()
{
int no;
printf("Enter one integr :");
scanf("%d",&no);
if(no==0)
{
printf("The no is 0 ");
}
else if(no>0)
{
printf("The no is posetive ");
}
else
{
printf("The no is negetive ");
... |
C | #include<stdio.h>
void swap(char* x, char* y);
int main() {
char a = 'A', b = 'B';
swap(&a, &b);
printf("a=%c, b=%c\n", a, b);
return 0;
}
|
C | #include "libraries.h"
#include "definitions.h"
#include "structures.h"
#include "packet.h"
#include "network.h"
int newtork_connect_to (char *ip_address, char *port)
{
struct addrinfo hints, *servinfo, *p;
int rv;
int socket_fd;
memset ((void *) &hints, 0, sizeof (struct addrinfo));
hints.ai_family = AF_... |
C | #include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include "tlc5000.ecg.h"
#define CACHED_CHANNELS_COUNT 8
struct TLC5000Ecg
{
FILE *file;
float frame_rate;
int first_cached_frame;
int last... |
C | /*
============================================================================
Description : 格式化读写
============================================================================
*/
#include <stdio.h>
#include <stdlib.h>
void my_fprintf(char *path) {
FILE *fp = NULL;
//读写方式打开
fp = fopen(path, "w+");
... |
C | // Arrays and strings
#include <stdio.h>
int main(int argc, char* argv[])
{
int numbers[4] = { 4 };
printf("\nLength of numbers 'int numbers[4] = {4}': %lu\n\n", sizeof(numbers)/sizeof(int) );
char name[4] = { 'a' };
printf("\nLength of numbers 'char name[4] = { 'a' };': %lu\n\n", sizeof(name)/sizeof(ch... |
C | /* Find the first non-repeating character in a given string
Method 1: Naive approach
Scan every character and for each character, check if it is being repeated in the string
by scanning all the remaining characters (even to the left of the current character).
Time taken: For every character, #comparisons=(n-1)
TC=O(... |
C | #include "balanceoDeCargas.h"
#include <math.h>
void incrementarAvailability(t_list* listaBalanceo){
int posicion;
for(posicion = 0; posicion < list_size(listaBalanceo); posicion++){
datosBalanceo* nodo = list_get(listaBalanceo, posicion);
incrementarAvailabilityDeNodo(nodo);
}
}
void reducirWL(char* nodo){
b... |
C | int comp(char ch[], char ch1[]){
int i=0,j=0;
while(ch[i] != '\0')
{
i++;
}
while(ch1[j] != '\0')
{
j++;
}
if(i==j)
{ int k=0,l=0;
while(ch[k] != '\0')
{
if(ch[k] == ch1[l])
{
return 1;
}
else
return 0;
}
return 1;
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
void roll_a_dice1(int *one, int *two, int *three);
void roll_a_dice2(int array[]);
int main(){
/*
int seed;
printf("Enter a seed: ");
scanf("%d", &seed);
srand(seed);
*/
srand(time(0));
int rnd[3];
printf("%p\n", rnd);
printf("%... |
C | /*------------------------------------------------------------------
// University of Central Florida
// CGS3269 - Fall 2016
// Program Author: Kyle Gildea
The program is entirely my own work and I have neither developed my code together with any another person, nor copied program code from any
other person, nor permi... |
C | #include <u.h>
#include <libc.h>
#include "map.h"
/* elliptic integral routine, R.Bulirsch,
* Numerische Mathematik 7(1965) 78-90
* calculate integral from 0 to x+iy of
* (a+b*t^2)/((1+t^2)*sqrt((1+t^2)*(1+kc^2*t^2)))
* yields about D valid figures, where CC=10e-D
* for a*b>=0, except at branchpoints x=0,y=+-i,+-... |
C | #include "ir.h"
#include "semantic.h"
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
Operand createOperand(int kind, ...) {
Operand op = (Operand)malloc(sizeof(struct Operand_));
op->kind = kind;
va_list args;
va_start(args, kind);
switch (kind) {
case TEMP:
case VARIABLE:
case LABEL:
op->... |
C | /*
** Copyright 2015 K.J. Hermans (kees.jan.hermans@gmail.com)
** This code is part of simpledbm, an API to a dbm on a finite resource.
** License: BSD
*/
#ifdef __cplusplus
extern "C" {
#endif
#include "td_private.h"
static
int td_rmw_locked
(
td_t* td,
const tdt_t* key,
tdt_t* value,
unsigned fla... |
C | /* Program to change a BST to Binary Tree such that key of a Node becomes original key plus sum of all smaller keys in BST */
#include <stdio.h>
#include <stdlib.h>
/* A BST Node has key, left child and
right child */
struct Node {
int key;
struct Node* left;
struct Node* right;
};
/* Helper function that ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.