language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /******************************************************************************/
/*Files to Include */
/******************************************************************************/
#include <stdint.h> /* For uint8_t definition */
#include <stdboo... |
C | /** @file
* Interfejs obsługujący logikę gry
*
* @author Jan Olszewski
* @copyright Uniwersytet Warszawski
* @date 16.05.2020
*/
#ifndef LOGIC_H
#define LOGIC_H
#include "gamma.h"
/** @brief typ mówiący o trybie, w którym ma być rozgrywana rozgrywka
*/
enum mode{Batch, Interactive};
/** @brief struktura prz... |
C | #include<stdio.h>
main()
{
int a,b;
printf("Enter two number\n");
scanf("%d%d",&a,&b);
a^b?printf("Not equal"):printf("Equal");
}
|
C | #include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <assert.h>
#define N 10
/*
* A permutation is an ordered arrangement of objects. For example, 3124 is one
* possible permutation of the digits 1, 2, 3 and 4. If all of the permutations
* are listed numerically or alphabetically, we call it lexico... |
C | /* ************************************************************************** */
/* */
/* :::::::: */
/* filler.c :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
struct nodo
{
TipoDato elemento;
struct nodo* siguiente;
};
typedef struct nodo Nodo;
typedef struct
{
Nodo* Frente;
Nodo* Final;
}Cola;
// * Los prototipos de las operaciones * /
void CrearCola(Cola* Q); // * Tnicializa la cola como vacía */
void Insert... |
C | #include "stdio.h"
static const char *colors[] = {" c black", ". c #001100", "X c #111100"};
int main() {
unsigned char code;
char color[32];
int rcode;
for (int i = 0; i < 3; i++) {
rcode = sscanf(colors[i], "%c c %s", &code, color);
printf("%i, %c, %s\n", rcode, code, color);
}
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strjoin.c :+: :+: :+: ... |
C | int getlettervalue(char letter) {
if(letter == 'I') {
return 1;
}
else if(letter == 'V') {
return 5;
}
else if(letter == 'X') {
return 10;
}
else if(letter == 'L') {
return 50;
}
else if(letter == 'C') {
return 100;
}
else i... |
C | /* fuxiti4.c -- ϰ4*/
#include <stdio.h>
#include <stdlib.h>
struct month{
char mname[30];
char suoxie[3];
int days;
int No;
};
void printall(struct month);
int main(void)
{
struct month year[12];
struct month amonth;
int i;
for(i = 0; i < 12; i++)
{
amonth = year[i];
... |
C | #include <cstdio>
#include <cstring>
#include <ctype.h>
char a[50], len = 0;
void d(char c) {
int i;
for(i = 0; i < len; i++)
if(a[i] == c)
break;
if(i == len)
return;
for(; i < len; i++)
a[i] = a[i + 1];
len--;
}
void insert(char c1, char c2) {
int i, ... |
C | #include <stdio.h>
#define MAX_LEN 25
int main(int argc, char* argv[])
{
char name[MAX_LEN];
printf("What is your name? ");
scanf("%s", name);
printf("Hello, %s, nice to meet you!\n", name);
return 0;
} |
C | #include "test_utilities.h"
#include <stdlib.h>
#include <ctype.h>
#include <inttypes.h>
#include <string.h>
#include "../memcache.h"
#define ASSERT_TRUE(x) ASSERT_TEST(x);
#define ASSERT_EQUAL(x,y) ASSERT_TEST((x) == (y));
#define ASSERT_EQUAL_STR(x,y) ASSERT_TEST(strcmp((x),(y)) == 0);
#define ASSERT_SUCCESS(x) ASSE... |
C | #include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include "api.h"
#define REAL 0
#define IMAG 1
static double evm(complex symbol, complex ref) {
double real_diff = pow(symbol[REAL] - ref[REAL], 2);
double imag_diff = pow(symbol[IMAG] - ref[IMAG], 2);
return sqrt(real_diff + imag_diff);
}
static char gra... |
C | #include<stdio.h>
#include<stdlib.h>
#include"busdetails.c"
#include"decleration.c"
#include<strings.h>
struct busdetails person[300];
int count=0;
int id2=1000;
int main()
{
int **seat,choice,price=500,slection,i;
seat=(int **)calloc(101,sizeof(int *));
for (i=0;i<3;i++)
*(seat+i)=(int *)calloc(101,s... |
C | /*
** command_center.c for 42sh in /home/somasu_b/rendu/mysh/src
**
** Made by somasu_b
** Login <somasu_b@epitech.net>
**
** Started on Fri May 16 01:40:44 2014 somasu_b
** Last update Sun Jun 1 19:50:04 2014 somasu_b
*/
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include "sh.h"
static int ispri... |
C | int a = 0, b = 0;
struct Vector {
unsigned size;
unsigned capacity;
int *data;
};
int Init(struct Vector *V, unsigned capacity) {
if (!V) {
return -1;
}
V->data = malloc(sizeof(int) * capacity);
if (!V->data) {
return -1;
}
V->size = 0;
V->capacity = capacity;
... |
C | #include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#define NUM_THREADS 20
#define NUM_INCREMENT 100000
int counter;
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
void *addThings(void *threadId) {
for (int i = 0; i < NUM_INCREMENT; i++) {
pthread_mutex_lock(&mutex);
counter += 1;
pthread_m... |
C | #include "buffer.h"
#include <stdlib.h>
#include <alloca.h>
#include <string.h>
void sbuf_create(sbuf_t* sbuf, int max_length)
{
sbuf->data = NULL;
sbuf->max_length = max_length;
sbuf->data = (uint8_t*)malloc(max_length);
if(sbuf->data == NULL)
sbuf->max_length = 0;
sbuf->length = 0; ... |
C | #include <stdio.h>
#include <stdlib.h>
void printnum(long n, void (*p)()){
if(n < 0){
printf("n is negative .\n");
(*p)('-');
n = -n;
}
if(n >= 10)
printnum(n/10, p);
(*p)("0123456789"[n % 10]);
}
void func(char c){
printf("%c\n",c);
}
int main(){
long x = -145l;
printnum(x, (void (*)())func); /... |
C | #include "holberton.h"
/**
* _isalpha - returns if c is a letter or not
*
* @c: 1 is a letter, 0 is not
*
* Return: Ends program
*/
int _isalpha(int c)
{
if ((c >= 65 && c <= 90) || (c >= 97 && c <= 122))
return (1);
else
return (0);
}
|
C | #include "sh61.h"
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <sys/wait.h>
#include <libgen.h>
static volatile sig_atomic_t SIGINT_RECEIVED = 0; //boolean for whether or not Cntrl+C has been received
pid_t shell_pgid = 0; ... |
C | #include<stdio.h>
#include<stdlib.h>
#include<assert.h>
struct node {
int data;
struct node* next;
};
int Length(struct node* head) {
int count = 0;
struct node* current = head;
while (current != NULL) {
count++;
current=current->next;
}
return(count);
}
// Given a reference (pointer to pointer)... |
C | #include "sort.h"
/**
* shell_sort - sorts an array using the Shell sort algorithm
* using the Knuth sequence
* @array: the array
* @size: the size of the array
*
* Return: Nothing
*/
void shell_sort(int *array, size_t size)
{
size_t interval = 1;
size_t outer, inner;
int valueToInsert;
if (array != NULL &&... |
C | #include <stdio.h>
int main() {
int a = 0, b = 0, rs = 0, cont;
scanf("%d %d", &a, &b);
if(a >= b) {
for(cont = a - 1; cont > b; cont--) {
if((cont % 2) != 0)
rs += cont;
}
} else {
for(cont = a + 1; cont < b; cont++) {
if((cont % 2) != 0)
rs += cont;
}
}
printf("%d\n", rs);
ret... |
C | #ifndef __LIBAEDS_DATA_CONTAINER_LINKEDLIST_H__
#define __LIBAEDS_DATA_CONTAINER_LINKEDLIST_H__
#include <stdbool.h>
#include <stddef.h>
#include <libaeds/data/container/iterator.h>
#include <libaeds/memory/allocator.h>
// A LinkedNode is a node of a linked list.
typedef struct LinkedNode LinkedNode;
// A linked l... |
C | #include <stdio.h>
#include <stdlib.h>
#include "lista.h"
int main(int argc, char *argv[]) {
Lista l;
Celula * p;
iniciarLista(&l);
inserirInicio(&l, 1);
inserirInicio(&l, 0);
inserirInicio(&l, 3);
inserirInicio(&l, 4);
inserirInicio(&l, 5);
imprimir(&l);
countElementos(&l);
p = busca(&l, ... |
C | // fibonacci sequence
int main(){
// test number
int n = 6;
int fib[n+2];
// beginning of fibonacci sequence
fib[0] = 0;
fib[1] = 1;
// perform sequence and populate array
for (int i = 2; i <= n; i++){
fib[i] = fib[i-1] + fib[i-2];
}
// the n-th number in the sequence
int result = fib[n];
... |
C | #include <stdbool.h>
#include "keyboard.h"
#include "print.h"
#include "types.h"
#include "chars.h"
#include "utils.h"
#include "color_spin.h"
static ui8 get_input_keycode() {
ui8 code = 0;
while (!code) {
nanosleep(10000);
show_date_time();
show_color_spin();
show_random_ship(... |
C | #include<stdio.h>
#include<stdlib.h>
typedef enum boolean {FALSE,TRUE} Boolean;
/*Pre: Points to the message to be printed
Post: the function prints the message and terminates the program.*/
void Error(const char* s)
{
fprintf(stderr,"%s\n",s);
exit(1);
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "gasdev.c"
typedef double(*funcPtr)(double, double, int*);
typedef struct distributor{
funcPtr func;
char* name;
double arg1;
double arg2;
} distributor;
double uniform_random(double l, double r, int* idum);
double ... |
C | /*
* control.c
* Author: Christian Würthner
* Description: control for project 2
*/
#include "control.h"
int main(int argc, char **argv) {
/* Check argument count */
if(argc < 5) {
console_error("CONTROL",
"Not enough arguments, usage: "
"mem‐sim pages quantum pr‐policy trace‐file [verbose [step]]");
... |
C | /**
* @file
*
*/
#pragma once
#include "pebble.h"
/**
* Read what configuration data we have from watch flash into RAM cache.
* Best called from program init, as this might be a lengthy operation.
*/
void config_data_init();
/**
* Convenience function to simply check whether location data is persis... |
C | #include <stdio.h>
long function(long a, long b) {
long x = a, y = b;
return (x + y);
}
int main(int argc, char* argv[]) {
long a = 1, b = 2;
printf("%d\n", function(a, b));
return 0;
} |
C | /*
// Copyright (c) 2010-2017 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable la... |
C |
#include <stdio.h>
#define NL 20
#define NC 76
char space[NL][NC];
char space1[NL][NC];
display (char space[NL][NC])
{
int l, c;
gotoxy (1, 1);
printf ("\n");
for (l=0; l<NL; l++)
{
for (c=0; c<NC; c++)
{
if (space[l][c] > 0)
printf ("#");
else
printf (".");
}
printf... |
C | #include<stdio.h>
int main(void){
int num[5][5]={{2,1,3,2,5},{1,2,6,1,0},{4,0,0,0,2},{5,6,7,8,0},{1,0,1,1,0}};
int i,j,n;
for(i=0;i<=4;i++){
for(j=0;j<=4;j++){
n=(num[i][j]==0);
num[i][j]=n;
printf("%d ",num[i][j]);
}
printf("\n");
}
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
int add(int a, int b)
{
return a + b;
}
int sub(int a, int b)
{
return a - b;
}
void program_usage(char *prog_name)
{
printf("%s <add/sub> num1 num2\n");
}
int main(int argc, char **argv)
{
if (argc != 4)
{
program_usage(argv[0]);
return -1;
}
if (!strcmp(argv[1], "add"))
{
prin... |
C | #include <stdio.h>
#include <string.h>
#include "sensorIR.h"
#include "train.h"
#include "model.h"
#include "railway.h"
#include "crossingGate.h"
#include "semaphore.h"
#include "trafficLight.h"
#define MAX_OBJS 100
static struct object_ref_t {
observable_t* obs;
const char* name;
} objs[MAX_OBJS];
static int n_ob... |
C | #include "../base.h"
int main(){
void *context=zmq_ctx_new();
void *receiver=zmq_socket(context, ZMQ_PULL);
int rc=zmq_bind(receiver, "tcp://*:5558");
assert(rc==0);
void *controller=zmq_socket(context, ZMQ_PUB);
rc=zmq_bind(controller, "tcp://*:5559");
assert(rc==0);
char string[256];
s_recv(rece... |
C | #include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include "kw26.h"
// print an Int40 (followed by a newline character)
void kw26Print(Int40 *p)
{
int i;
if (p == NULL)
{
printf("(null pointer)\n");
return;
}
for (i = MAX40 - 1; i >= 0; i--)
printf("%x", p->digits[i]);
printf... |
C | void Inner(int Lower, int Middle, int Upper)
{
int i;
int A[Middle-Lower+1];
int B[Upper-Middle+1];
for (i=0; i< Middle-Lower+1;i++)
A[i] = i;
for (i=0; i < Upper-Middle+1; i++)
B[i] = i;
for (i=0; i < Upper-Middle+1; i++)
B[i] = A[i % (Middle-Lower+1)];
}
int main()
{
Inner(1, 15, 30);
}... |
C | /****************************** (C) COPYRIGHT 2016 *******************************
*
* ܣ
* Ҫ㣺̿ƣmathãҪעĽ˼·ص㡣
* ص㣺ǰģ˺϶ڵĴѭʵ
* Ǵ-1~1иɶݵġÿжӦλþҪǺˣע
* һжӦ㣬acosֻһ㣬ڶƵݾ庯
*
********************************************************************************/
#include <stdio.h>
#include <math.h>
#define PI 3.14
vo... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#define MYFIFO "./record_for_client"
#define BUFFER_SIZE 1024
int main()
{
char buf[BUFFER_SIZE];
int fd,nread;
if(access(MYFIFO, F_OK)==-1)
{
i... |
C | #include "shell.h"
/**
* path_append - Append program or command to the path
* @path: PATH directory
* @cmd: program file or command
* Return: pointer to a PATH newly string or NULL on failure
*/
char *path_append(char *path, char *cmd)
{
int len_path = 0, len_cmd = 0;
char *full_path;
if (path == NULL)
pa... |
C | #include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <sys/ioctl.h>
#include <unistd.h>
/*
* KwPBar for C, v0.2.0
* Copyright © 2013-2018, Chris Warrick.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or witho... |
C | /*------------------------------------------------------------------------
*
* geqo_pool.c
* Genetic Algorithm (GA) pool stuff
*
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/backend/optimizer/geqo/geqo_po... |
C | #ifndef _AGENTE_H_
#define _AGENTE_H_
#include "ambiente.h"
// define o pontuação caso o agente encontre o
// ouro.
#define PREMIUM 1000
// define a penalidade sobre o agente caso
// seja atirado uma flecha.
#define THROW_ARROW -10
#define hash(linha, coluna) ((linha) * 10) + (coluna)
typedef enum ACAO{
ANDAR, A... |
C | /*
** EPITECH PROJECT, 2017
** yassine.benmessahel@epitech.eu
** File description:
** fonction.c
*/
#include "../include/my.h"
#include "../include/lib.h"
void my_print_map(char **map)
{
int nb = 0;
while(map[nb][0] != '\0') {
printw(map[nb]);
nb = nb + 1;
}
}
int my_collision_check(int y, int x, char **map)... |
C | char * addBinary(char * a, char * b){
int iLengthOfa = strlen(a);
int iLengthOfb = strlen(b);
int iCarry = 0;
int iIndexOfa = iLengthOfa;
int iIndexOfb = iLengthOfb;
int iMax = (iIndexOfa>iIndexOfb?iIndexOfa:iIndexOfb)+1;//?:必须加(),不然最后iIndexOfb+1会当做整体
char *sRet = malloc((iMax+1)*sizeof(char... |
C | int main(){
int n,i,j,count;
char dna[256];
scanf("%d",&n);
gets(dna);
for(i=0;i<n;i++){
gets(dna);
count=strlen(dna);
for(j=0;j<count;j++){
if(dna[j]=='A')
printf("T");
else if(dna[j]=='T')
printf("A");
else if(dna[j]=='C')
printf("G");
else if(dna[j]=='G')
printf... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct data{
int dia, mes, ano;
}niver;
typedef struct tad{
char nome[20];
niver data;
int cpf;
}dados;
void armazenar (dados *p);
void imprimir (dados *p);
int main(){
dados p;
//p = (dados *) malloc(sizeof(dados));
armazenar(&p);
i... |
C | #include "Header.h"
/*************************************************************
* Function: display_menu *
* Date Created: 10/18/7 *
* Date Last Modified: 10/18/17 *
* Description: Displays the menu
* I... |
C | #include <pal.h>
/**
*
* Calculates the inverse hyperbolic cosine of 'a'. Input values must be > 1.
* The function does not check for illegal input values.
*
* @param a Pointer to input vector
*
* @param c Pointer to output vector
*
* @param n Size of 'a' and 'c' vector.
*
* @param p Number ... |
C | #include <stdio.h>
#include<stdlib.h>
int main(){
//calloc stands for CONTINUOUS ALLOCATION It initialize each memory nlock with a default value of 0
//syntax => (float *)calloc(30,sizeof(float));
//calloc(30,sizeof(float)) => allocates continous space in memory for 30 blocks(float)
// if the space is not sufficient... |
C | #include "vogle.h"
#ifdef TC
extern double cos();
extern double sin();
extern double asin();
extern double sqrt();
#else
#include <math.h>
#endif
/*
* NOTE: the words hither and yon are used in this file instead of near and far
* as they are keywords on some PC compilers (groan). Change them back at your
* o... |
C | #include "libc/assert.h"
#include "third_party/chibicc/chibicc.h"
/* TODO(jart): Why can't these be const? */
Type ty_void[1] = {{TY_VOID, 1, 1}};
Type ty_bool[1] = {{TY_BOOL, 1, 1}};
Type ty_char[1] = {{TY_CHAR, 1, 1}};
Type ty_short[1] = {{TY_SHORT, 2, 2}};
Type ty_int[1] = {{TY_INT, 4, 4}};
Type ty_long[1] = {{TY_L... |
C | /*
- Andrew Bagwell
- CS362 Assignment 3
- bagwella@oregonstate.edu
- Test of dominion's whoseTurn function
*/
#include "dominion.h"
#include "dominion_helpers.h"
#include "rngs.h"
#include <stdio.h>
#include <stdlib.h>
//custom assert function
void assertTrue(int val1, int val2) {
if (val1 != val2)
printf("... |
C | # include <stdio.h>
# include <string.h>
# include <stdlib.h>
# include "hstio.h"
# define MINVAL -1000
/* crrej_sky -- Calculate the sky for an image.
Description:
------------
Computes the sky level which will be subtracted during cosmic ray
rejection and added back at the end of processing.
Date Aut... |
C | //#define _BSD_SOURCE
#include <time.h>
#include <sys/time.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <termios.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <pwd.h>
#define MAX_FLASH_SIZE 1024*8
... |
C | # include <stdlib.h>
# include <stdio.h>
# include <stdbool.h>
# include <math.h>
# include <time.h>
int main ( int argc, char *argv[] );
void test_amp ( void );
void test_ampamp ( void );
void test_bang ( void );
void test_bar ( void );
void test_barbar ( void );
void test_caret ( void );
void test_lshiftlshift ( voi... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* builtin_setenv.c :+: :+: :+: ... |
C | /**
* @file dec2bin.c
* @author your name (you@domain.com)
* @brief
* @version 0.1
* @date 2020-10-07
*
* @copyright Copyright (c) 2020
*
*/
#include <stdio.h>
#include <stdlib.h>
/**
* @brief
*
*/
#define APP_USAGE "Pouziti: dec2bin <pozitivni-hodnota>\n"
#define MAX_OUTPUT_LENGTH 32
int main(int ar... |
C | /*
This file is part of podds.
podds is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
podds is distributed in the hope that it will be usefu... |
C | #include <stdio.h>
#include <math.h>
int isprime(int n){
if(n<=1) return 0;
if(n<=3) return 1;
if(n%2==0 || n%3 == 0) return 0;
int i;
int sq = sqrt(n);
for (i=5; i<=sq; i=i+6)
// printf("%d %d\n",i, i+2);
if (n%i == 0 || n%(i+2) == 0)
return 0;
return 1;
}
/*5 4 3
6 1 2
7 8 9*/
int m... |
C | /*
* Dada una base en formato 8 bits, regresa su representacion en string, muy simple
*/
#include "bevolucion.h"
char *
nombre_par_base (int8_t n)
{
char *ptr;
switch (n)
{
case AT:
ptr = "AT\0";
break;
case TA:
ptr = "TA\0";
break;
case CG:
ptr = "CG\0";
break... |
C | #include "xfifo.h"
#include "xfifo_internal.h"
xfifo_t xfifo_init(unsigned int fifo[], unsigned int n)
{
fifo[LEN_INDEX] = n+FIFO_START+1;
fifo[IPOS_INDEX] = FIFO_START+1;
fifo[OPOS_INDEX] = FIFO_START;
fifo[SPOS_INDEX] = FIFO_START+1;
fifo[OVERFLOW_INDEX] = 1;
return ((xfifo_t) &fifo[0]);
}
unsigned int... |
C | #include <stdio.h>
#include "batalla.h"
#include "perfil.h"
#include <time.h>
#include <stdlib.h>
#include <ctype.h>
void validar_respuesta_crear( char* rta ){
while( ( *rta ) != 'S' && ( *rta ) !='N' ){
printf( "ERROR. No es una respuesta valida. Si quiere crear un personaje insgre 'S' o 's'\nEn caso contrario in... |
C | /*******************************************************************
** Lcd.h
*
* DESCRIPTION: LCD.c module header file
*
* AUTHOR: Todd Morton
*
* HISTORY: 01/23/2013
*
*********************************************************************
* WWULCD Function prototypes ... |
C | #include <stdio.h>
#include <string.h>
char buf[100000], a[128][1000];
int isdig(int c)
{
return c >= '0' && c <= '9';
}
int main()
{
int cas, count, n, i, temp;
char *ptr;
cas = 0;
for(i=0; i<=127; i++)
{
memset(a[i], i, sizeof(a[i]));
}
gets(buf);
sscanf(buf, "%d", &count);
while(count--)
{
printf("... |
C | #include <stdio.h>
#include <stdint.h>
#include <string.h>
#include "mindless_machine.h"
#include "graphio.h"
struct graph {
size_t size_graph;
char** v_graph;
double** e_graph;
} graph;
int read_string (char *str) {
char s = ' ';
int n = 0;
if (str == NULL) {
return -2;
}
... |
C | #include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
static void catch_function(int signal)
{
int n = 0;
printf("Enter the number\n");
scanf("%d",&n);
}
int main(void)
{
time_t start,... |
C | /*
* test_bind.c
*
* Created on: Jun 20, 2014
* Author: Ali Gholami
*/
#include "testcases.h"
int main(int argc, char **argv)
{
test_bind();
return 0;
}
void test_bind( )
{
int sockfd;
struct sockaddr_in dest;
/* open a streaming socket */
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
fpr... |
C | #include <shell.h>
#include <interprete.h>
#include <builtins.h>
#include <string.h>
#include <stdio.h>
t_env *init_env(void)
{
t_env *env;
if (!(env = (t_env *)debug_malloc(sizeof(t_env))))
return (ERROR);
/* Old was 65536 */
env->local_variables = ht_create( 8192 );
env->alias = ht_create( 8192 );
env->b... |
C | #ifndef AFFICHAGES_H
#define AFFICHAGES_H
#include <math.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "projet.h"
void print_tab_BYTE(BYTE *tab, size_t len)
{
for (size_t i = 0; i < len; ++i)
{
printf("{");
for (size_t j = 0; j < 8; ++j)
{
... |
C | #include <stdio.h>
#include <string.h>
#include <ctype.h>
#define LEXEME_COUNT 26 // Number of members in cifLexemes
#define CIF_RESULT_FILENAME "cif_result.txt"
char * get_arguments(int argc, char * argv[])
{
return (argc > 1) ? argv[1] : NULL; // Return the cifFileName of NULL
}
char * get_cif_l... |
C | //References used: UNIX Programming Textbook AND several youtube videos (can provide list and urls if necessary)
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
#include <errno.h>
#include <sys/shm.h>
char slave_id[3];
int sharedmemid_sharedNum; //Shared... |
C | /* -------------------------------------------
Name: Edward Vuong
Student number: 120246186
Email: evuong1@myseneca.ca
Section: SII
Date: July 31, 2018
----------------------------------------------
Assignment: 2
Milestone: 4
---------------------------------------------- */
#define _CRT_SECURE_NO_WARNINGS
... |
C |
/*******************************
** commonHeader.c **
** Chieh-An Lin **
** Version 2015.02.25 **
*******************************/
#include "commonHeader.h"
//----------------------------------------------------------------------
//-- Functions related to int_arr
int_arr *initialize_int_arr(... |
C | /*
* console.h
*
* Created on: 27.01.2015
* Author: pascal
*/
#ifndef CONSOLE_H_
#define CONSOLE_H_
#include "stddef.h"
#include "stdint.h"
#include "stdbool.h"
#include "lock.h"
#define CONSOLE_AUTOREFRESH 1
#define CONSOLE_AUTOSCROLL 2
typedef struct{
uint8_t x, y;
}cursor_t;
typedef struct{
uint8_t... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main() {
srand(time(0));
int max = 0;
int max_num = 0;
for (int i = 1000; i < 1003; i++) {
int ran = rand() % 101;
printf("%d : %d", i, ran); printf("\n");
if (max < ran) {
max = ran;
max_num = i;
}
}
printf("1 : %d ... |
C | #include "gpio_cfg.h"
void Pin_Cfg(GPIO_TypeDef * GPIO, uint8_t pin, GPIO_MODER_Type mode, GPIO_OTYPER_Type type, GPIO_OSPEEDR_Type speed, GPIO_PUPDR_Type pull, GPIO_AF_Type af)
{
GPIO->MODER = (GPIO->MODER & ((uint32_t)~(0x03 << (pin * 2)))) | (mode << (pin * 2));
GPIO->OTYPER = (GPIO->OTYPER & ((uint32_... |
C | #include "windows.h"
#include "stdio.h"
int main(){
char mensaje[20];
DWORD leidos;
HANDLE hStdln=GetStdHandle(STD_INPUT_HANDLE);
SECURITY_ATTRIBUTES pipeSeg={sizeof(SECURITY_ATTRIBUTES), NULL, TRUE};
ReadFile(hStdln, mensaje, sizeof(mensaje), &leidos, NULL);
printf("Mensaje recibido del proceso padre: ... |
C | #ifndef S2PP_MSG_H__
#define S2PP_MSG_H__
#include <stdint-gcc.h>
static void send_msg(const uint32_t addr, const uint32_t data)
{
static const uint32_t offset = 0;
asm volatile("ecowx %0, %1, %2"
: /* output */
: "r"(data), "r"(addr), "r"(offset)/* input */
: /* clobber */);
}
static uint32_t recv_msg(c... |
C | /* exall.c */
#include "ram_includes.h"
#include "ram.h"
#include "dos/exall.h"
/* also works for examinefh, since fh_Arg1 == lock for me (object = 0) */
LONG
exnext (pkt,object)
struct DosPacket *pkt;
LONG object; /* 0 = examine object, 1 = exnext */
/* 2 = examine all */
{
struct FileInfoBlock *ivec;
st... |
C | //prepare: -lm
#include <stdio.h>
#include "number_theory.c"
#include "integer_maths.c"
/* The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime.
There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97.
How many ... |
C | #include <stdio.h>
#include <math.h>
int main(int argc, const char *argv[])
{
int a,b,c;double d,x1,x2;
printf("请输入a、b、c的值\n");
scanf("%d%d%d",&a,&b,&c);
getchar();
printf("%d%d%d\n",a,b,c);
d = b*b-4*a*c;
printf("%.2f\n",d);
if(d>0){
x1 = (-b+sqrt(d))/2*a;
x2 = (-b-sqrt(d))/2*a;
printf("x1 = %.2f,x2 = %... |
C | #include<stdio.h> // main(), printf()
// 1. #include : ( ϴ ɾ)
// 2. <stdio.h> : (ٸ ִ ԽŲ.)
void main()
{
printf("Hello world");
} |
C | /*
Given non-negative integer a and positive integer b as C-strings, return a pointer "array" char ** of length 2 containing the quotient and remainder of the result in that order. The quotient and remainder should both be pointer-strings and not character arrays; furthermore, their memory (and the memory of the entire... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* test.c :+: :+: :+: ... |
C | #include"project.h"
int decrypt4_file (char *file_name, char *key_file_name)
{
char *key_file_data, *enc_data, *dec_data;
key_file_data = NULL;
enc_data = NULL;
dec_data = NULL;
int i, j;
key_file_data = reading_file (key_file_name);
printf("Key file data: \n %s\n", key_file_data);
enc_data = reading_fi... |
C | /*
* Filename: teststrToULong.c
* Author: Wenhui Tang
* Userid: cs30xlv
* Description: Unit test program to test the function strToULong.
* Date: Oct. 30, 2013
*/
#include "pa2.h" /* For strToLong() function prototype */
#include "test.h" /* For TEST() macro and stdio.h */
#include <errno.h>
/*
* unsigned lo... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* work_with_file.c :+: :+: :+: ... |
C | #include<stdio.h>
int main()
{
int n,m;
scanf("%d",&n);
for(;n%10!=1;) {
n=n/10;
if (n == 0) break;
}
if (n==0) printf("No\n");
else printf("Yes\n");
return 0;
} |
C | #ifndef UTIL
#define UTIL
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <stdbool.h>
void create_array(int array_size, int **array);
void create_array_x(int array_size, int **array, int x);
void spaces(int amount);
void print_array(int size, int *array);
void print_complexity(int... |
C | /*Tarea 3
-Peralta Luna Karen Lisseth
-S17002346
*/
#include <stdio.h>
#include <stdlib.h>
typedef struct nodo_padre
{
int dato;
struct punteros_hijos *frente;
struct punteros_hijos *final;
}n_padre;
typedef struct punteros_hijos
{
n_padre * raiz;
struct punteros_hijos *hermano;
}hijo;
/*---... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_charnoutrev.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<string.h>
int main(){
int T,N,i,j,G,W;
int prices[1005],weight[1005];
int table[1005][35];
int total,t;
scanf("%d",&T);
while(T--){
scanf("%d",&N);
for(i=1;i<=N;i++) scanf("%d%d",&prices[i],&weight[i]);
memset(table,0,sizeof(table));
for(i=1;i<=N;i++)
for(j=0;j<=30;j++)
i... |
C | /**
* @file p1ch.c
* @author Jayanth
* @brief Inputs given by player1 and storing them in grid
* @version 0.1
* @date 2021-04-16
*
* @copyright Copyright (c) 2021
*
*/
#include"function.h"
/**
* @brief Inputs given by player1 and storing them in grid
*
* @param k
* @param g
* @param z
*/
void p1ch(... |
C | #include <stdio.h>
#include<windows.h>
#include<string.h>
void reverse(char *str)
{
int len = strlen(str);//ַ
char *left = str;
char *right = str + len - 1;
char tmp = 0;
while (left<right)//ҽַ
{
tmp = *left;
*left = *right;
*right = tmp;
left++;
right--;
}
}
int main()
{
char arr[] = "Hello World!";... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.