language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <netinet/in.h>
#include "../source_shared/protocol.h"
#include "create_sockets.h"
/*
Connect to socket (TCP)
Used by nodes
*/
int create_and_connect_socket(int baseport) {
struct sockaddr_in server_addr;
int client_socket = socket(AF_INET, SOCK_STREAM, 0);
if (client_socket == -1) {
perro... |
C | /*Havanur Dervişoğlu 17011604*/
#include<stdio.h>
#include<stdlib.h>
#include<pthread.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <errno.h>
#include<string.h>
#define m_boyut 100
#define NUM_THREADS 100
/*bu programda giriş değerlerini bir structta tuttuk kullanıcı... |
C | #include "types.h"
#include "stat.h"
#include "user.h"
void mutex_lock(int index)
{
acquire_mutex_spinlock(index);
while(get_mutex_value(index))
cond_wait(1, index);
set_mutex_value(index, 1);
release_mutex_spinlock(index);
}
void mutex_unlock(int index)
{
acquire_mutex_spinlock(index);
set_mutex_value(index,... |
C | #include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include "tecnicofs-client-api.h"
#define END_COMMAND "v v"
#define MAX_STRING 101
int sockfd = -1;
/* Estabelece uma sessao com o servidor TecnicoFS localizado no endereço... |
C | #include<stdio.h>
#include<conio.h>
void main()
{
char a[100],b[100],d[100];
int i=0,x=0,z=0;
clrscr();
printf("\nEnter First String: ");
gets(a);
printf("\nEnter Second String: ");
gets(b);
while(a[i]!=NULL){
x++;
i++;
}
i=0;
while(b[i]!=NULL){
x++;
i++;
}
i=0;
while(x!=0){
... |
C | /** @author yaishenka
@date 10.03.2021 */
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include "superblock.h"
#include "defines.h"
#include "../utils.h"
void init_superblock_arrays(struct superblock* superblock) {
superblock->reserved_blocks_mask =
(boo... |
C | // parse.c
#include <stdio.h>
#include <string.h>
#include "symtypes.h"
unsigned int parseLine( working_t *working, char *schematype )
{
unsigned int element;
char token[LEN];
int tokpos, linepos=0;
for ( element = 0 ; element < MAX_ELEMENTS ; element++ )
{
if ( working->line[linepos] == 0 ) bre... |
C | /* $Author: rr2b $ */
/*
$Disclaimer:
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice, this permission notice, and the fo... |
C | /*
TRABALHO 5 - ORGANIZAÇÃO DE ARQUIVOS
Nome: Michelle Wingter da Silva nUSP: 10783243
Leonardo Rossi Luiz 10851691
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "funcionalidades.h"
#include "rdados.h"
#include "manipulaReg.h"
#include "organizaArq.h"
#include "indice.h"
#include ... |
C | #include<stdio.h>
char lower(char c);
int main()
{
return 0;
}
char lower(char c)
{
return (c >= 'A' && c <= 'Z') ? c + 'a' - 'A' : c;
} |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define BUFFSIZE 4096
int main(int argc, char *argv[])
{
int read_len;
int write_len;
size_t pread_offset = 0;
size_t pwrite_offset = 0;
char buf[BUFFSIZE];
while((read_len = pread(STDIN_FILENO, buf, BUFFSIZE, pread_offs... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define N 40 //tamanho do buffer
//struct para os elementos
typedef struct no
{
char pal[20];
int urg;
struct no *prox;
}Elem;
//prototipo das funções
Elem *criaElemento(char pal[20], int urg);
void criaLista(Elem **W, Elem **R);
void preenc... |
C | #include<string.h>
#include<getopt.h>
#include<sys/socket.h>
#include<arpa/inet.h>
#include<netinet/in.h>
#include<libev/ev.h>
#include<fcntl.h>
#include<errno.h>
#include<sys/time.h>
#include<time.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#define READ_BUF_LEN (4096)
#define WRITE_BUF_LEN (4096)
... |
C | /*
** main.c for exit in /home/knocka_a/repositories/42sh/builtins/my_exit
**
** Made by antoine knockaert
** Login <knocka_a@epitech.net>
**
** Started on Sat May 5 13:57:46 2012 antoine knockaert
** Last update Fri May 18 16:02:36 2012 antoine knockaert
*/
#include <stdlib.h>
#include <sys/types.h>
#include <s... |
C | #include "../lib.h"
#include "../lib_list.h"
void add_option(sll_s *p_sll, void *option, int is_required, void *data)
{
if (sizeof(p_sll) > 0) {
sll_insert (p_sll, option, data, is_required);
} else {
my_error("add_option: pleas use a valid generic option list");
}
}
void **validate_options(char **optio... |
C | /*
* @explain: Copyright (c) 2020 WEI.ZHOU. All rights reserved.
* The following code is only used for learning and communication, not for illegal and commercial use.
* If the code is used, no consent is required, but the author has nothing to do with any problems
* and consequences.
*
* In case of code problem... |
C | /*) 2) Elaborar um programa que aceita e valida uma senha com 6 dgitos numricos, que deve ser armazenada
em uma string. O usurio tem trs tentativas para acertar a senha, se ultrapassar esse limite, ele deve ser
informado. O usurio tambm deve ser informado se ele acertou a senha em at trs tentativas.
Dica: Considere que... |
C | /*
* client.c: Write strings for printing in POSIX shared memory object
* compile with:
* gcc -o client logger_client.c -lpthread -lrt
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#inclu... |
C | /*
* Author: Manuel Ángel Suárez Álvarez
* E-mail Manuel_Angel99@outlook.com
* Created: 2016-08-15 16:44:48
*
* File: keyboard.h
* Description:
*/
#ifndef KEYBOARD_H
#define KEYBOARD_H
#include <stdint.h>
#include <stdbool.h>
#ifdef _cplusplus
extern "C" {
#endif
/* KEYBOARD STATUS REGISTER:
Bit 0: Output Buf... |
C | #include "global.h"
#include "moteur.h"
#include "collisions.h"
#include "city.h"
#include "bender.h"
#define NBROBOTS 3 // Number of robots
#define NBBUILDINGS 12 // Number of buildings
#define TURNING 0 // IA action
#define MOVING 1 // IA action
#define ARROW_UP 0 // Constants for arrow keys
#define A... |
C | /*
* Leds.c
*
* Created: 4/13/2014 8:27:29 PM
* Author: paul
*/
#include <util/delay.h>
#include "Leds.h"
#include "config/BoardConfig.h"
static const uint8_t LedConfig_Pins[BOARDCONFIG_LEDCOUNT]
= { LED0PIN, LED1PIN, LED2PIN, LED3PIN,
LED4PIN, LED5PIN, LED6PIN, LED7PIN};
volatile stati... |
C | #include "function_pointers.h"
/**
* array_iterator - perform an action on each element of an array
* @array: the array to iterate over
* @size: the size of array
* @action: the action to perform on each array element
*
* Return: void
*/
void array_iterator(int *array, size_t size, void (*action)(int))
{
if (a... |
C | // Simple example of client.
// Client prints received messages to stdout and sends from stdin.
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <sys/select.h>
#include <netinet/in.h>
#include <stdlib.h>
#include <string.h>
#include "message.h"
peer_t server;
... |
C | #include <stdio.h> /* for getline, stdin */
#include <memory.h> /* for strtok, strlen, strcmp */
#include <stdlib.h> /* for malloc, free, strtoll */
#include <stdbool.h> ... |
C | #include<stdio.h>
#include<math.h>
#define MAX 1000001
int a[MAX]={0};
int main()
{long m,n;
int i,j,count;
for(i=0;i<=MAX;i++)
a[i]=i;
a[0]=0;a[1]=0;
for(i=2;i<sqrt(1.0*MAX);i++)
{for(j=i+1;j<=MAX;j++)
{if((a[i]!=0)&&(a[j]!=0))
if(a[j]%a[i]==0) a[j]=0;
}
}
while(scanf("%ld%ld",&m,&n)==2)... |
C | #ifndef __DYNAMIC_LIST__
#define __DYNAMIC_LIST__
#include "../boolean/boolean.h"
#include "../komponen/komponen.h"
#define InitialSize 100
typedef int IdxType;
typedef Komponen ListEl;
typedef struct {
ListEl *A;
int Capacity;
int Neff;
} List;
List MakeList();
/* I.S. sembarang
F.S. Terbentuk List ... |
C | #include <stdio.h>
#include <sys/shm.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <sys/sem.h>
#include <string.h>
#include <time.h>
void initSemValue(int semId, int n)
{
struct sembuf op;
op.sem_op = 1;
op.sem_flg = 0;
op.... |
C | /* lookahead.c */
#include "globals.h"
#include "rules.h"
#include "tokensets.h"
#include "lalr.h"
#include "work.h"
static TOKEN_SET new_context;
static void compute_starters( ip )
ITEMPTR ip;
{
register TOKEN t, *rhsp;
clear_set( &new_context );
rhsp = &( (ip->rule)->rhs[ip->pos+1] );
for( t = ... |
C | /*************************************************************
* Předmět: IFJ / IAL *
* Projekt: Implementace compilátoru imperativního jazyka *
* Soubor: precedent.c *
* Tým: 087 *
* Va... |
C | /*
* Exercise 9.4 Kochan - Programming in C
*
* If you take the value of N as computed in exercise 2, subtract 621,049 from
* it, and then take that result modulo 7, you get a number from 0 to 6 that
* represents the day of the week (Sunday through Saturday, respectively) on
* which the particular day falls... |
C | #include <stdio.h>
int main(){
int aux = 0;
int a;
printf("Ingrese un numero: ");
scanf("%d",&a);
aux+=a;
while(a!=0){
printf("Ingrese un numero: ");
scanf("%d",&a);
printf("\n");
}
printf("%d", aux);
return 0;
}
|
C | #include<stdio.h>
#include<stdlib.h>
int main()
{
int *p;
p = (int*)malloc(sizeof(int));
printf("done\n");
free(p);
p = NULL;
free(p);
free(p);
free(p);
free(p);
printf("done\n");
return 0;
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstnew.c :+: :+: :+: ... |
C | /**
* Kostra programu pro 3. projekt IZP 2015/16
*
* Jednoducha shlukova analyza: 2D nejblizsi soused.
* Single linkage
* http://is.muni.cz/th/172767/fi_b/5739129/web/web/slsrov.html
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <math.h> // sqrtf
#include <limits.h> // INT_MAX
/***************... |
C | // ------------------------------------------------------------------
// exemple-mutex-type-3.c
// Fichier d'exemple du livre "Developpement Systeme sous Linux"
// (C) 2000-2010 - Christophe BLAESS -Christophe.Blaess@Logilin.fr
// http://www.logilin.fr
// ----------------------------------------------------------------... |
C | #include "Main.h"
//socket variables
int socket_desc;
struct sockaddr_in server_addr;
char msgBuffer[BUFLEN];
int main (int argc, char *argv[])
{
initDataLists();
initSocket();
char *data;
data = malloc(sizeof(char) * 255);
int server_struct_length = sizeof(server_addr);
while (1) {
ProcessData(data);
st... |
C |
#include<stdio.h>
int main()
{
int a = 3;
//printf的计算顺序为从右往左
//后置--,在计算之前先保存一份
printf("%d %d %d\n",a--,a--,a--);//1,2,3
//前置--:待整个表达式计算完毕后才给出结果,之前的结果都不保存
printf("%d %d %d\n",--a,--a,--a);//-3,-3,-3
printf("%d %d %d\n",a--,--a,a--);//-5,-6,-3
return 0;
}
|
C | /**
* adc-sensor.h
*/
/**
* adc sensor ϰϵģͨadcɼ
* 1.ɱֵС2.ߴֵĴС
*/
#include "sensors.h"
#include "stm8s_adc2.h"
#include "adc-sensor.h"
#include "stm8s_gpio.h"
/**
* ,ֵλ ŷķ
*
*/
int get_resistance(int type, int adc)
{
long int r=0;
if (type==ADC_TYPE_RW)
{//
r = 10000ul*adc/1024;
}
else... |
C | #include<stdio.h>
#include<string.h>
void main()
{
char str[50];
int i,count=0;
printf("enter the string:");
gets(str);
for(i=0;str[i]!=NULL;i++)
{
if(str[i]=='.')
{
count++;
}
}
printf("%d",count+1);
}
|
C | #include "fractal.h"
#include <inttypes.h>
#include <math.h>
#include <stdio.h>
#include <time.h>
#include <pthread.h>
uint8_t gradient_pow(uint8_t gradient, uint8_t stepen)
{
uint8_t result;
result = gradient;
while (stepen-- != 1)
{
result *= gradient;
}
return (result);
}
t_... |
C | /****************************************
* Author: David Berman *
* Last Update: 18/11/2019 *
* Data structure: Sorted List *
* Tester file. *
* **************************************/
#include <stdio.h>
#include <stdlib.h> /* for malloc */
#include <assert.h> /* ... |
C | /*
** ressources.c for keylogger in /home/azword/delivery/Perso/PSU/Keylogger/src
**
** Made by Nathan Tréhout | Az'
** Login <nathan.trehout@epitech.eu>
**
** Started on Sat Dec 31 15:07:23 2016 Nathan Trehout
** Last update Sat Dec 31 15:07:30 2016 Nathan Trehout
*/
#include "my.h"
char retmaj(char dest)
{
... |
C |
//LCD (PortB)
#define E LATAbits.LATA0
//#define R_W LATBbits.LATB6
#define RS LATAbits.LATA1
#define LCDdata LATB
#define rw_delay 20
void command(unsigned char);
void write(unsigned char);
void Nybble(unsigned char);
void Lcd_init(void);
void Lcd_PutMessage(rom char *);
void Lcd_PutMessageArray(un... |
C | #include <avr/io.h>
#include <avr/eeprom.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include "structs.h"
#include "eeproms.h"
#include "library/LUFA/Version.h"
#include "library/LUFA/Drivers/USB/USB.h"
#include "hardware/rtc.h"
#include "hardware/led.h"
#include "ISS-Notify.h"
#include "commands.h"
... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include "msgQueue.h"
queue* CreateQueue() {
queue* obj = (queue*)malloc(sizeof(queue));
if (obj == NULL)
return NULL;
obj->front = 0;
obj->rear = 0;
obj->len = 0;
memset(obj->data, 0, sizeof(obj->data));
return obj;
}
void DestoryQueue(qu... |
C | /**
* @file dpatch/status.c
*
* `dpatch/status.c` defines functions for querying the status of dpatch.
*
* @author H Paterson.
* @copyright BSL-1.0.
* @date November 2020.
*/
#include "status.h"
char* status_strings[] =
{
[DPATCH_STATUS_OK] = "Success",
[DPATCH_STATUS_ERROR] = "General, unspecified, o... |
C | int toten(int,char *);
void tento(int,char *,int);
int main()
{
int a,b,sum;
char x[100];
scanf("%d %s %d",&a,x,&b);
sum=toten(a,x);
tento(sum,x,b);
puts(x);
return 0;
}
int toten(int a,char *x)
{
int n=strlen(x);
char as[100];
int sum=0,i,j,c,b[100];
for(i=0;i<n;i++)
{
if('a'<=x[i]&&... |
C | #include<stdio.h>
void main()
{
int n,c,i;
printf("\n enter the number");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(n%i==0)
{
c++;
}
}
if(c!=2)
{
printf("\n composite");
}
getch();
}
|
C | #include <stdarg.h>
#include <stdio.h>
#include "sls_buffer.h"
#include "sls_tinytest.h"
static int read_known_string(sls_buffer* b)
{
TINYTEST_ASSERT(sls_buffer_getc(b) == 'a');
TINYTEST_ASSERT(sls_buffer_getc(b) == 'b');
TINYTEST_ASSERT(sls_buffer_getc(b) == 'c');
TINYTEST_ASSERT(sls_buffer... |
C | # include <stdio.h>
# include <stdlib.h>
# include "BinaryTree.h"
int pos = 0;
void menu()
{
char menu[12][50] = {
"************************************",
"** Binary Tree **",
"************************************",
"** 1.Initialize binary tree **",
"** ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <mpi.h>
#define MASTER 0
int main(int argc, char* argv[]) {
if (argc!=3){
printf("\n Usage %s input file, output file \n",argv[0]);
return -1;
}
int rank,size,n,chunk;
MPI_Status status;
MPI_Datatype rowtype;
MPI_Datatype coltype;
MPI_Datatype matrixtype;
... |
C | #include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
int main()
{
int n,fd;
char buff[50];
fd=open("test.txt",O_RDONLY); //opens test.txt in read mode and the file descriptor is saved in integer fd.
printf("The file descriptor of the file is: %d\n,fd); // the value of the fi... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
int main()
{
pid_t child_pid;
child_pid = fork();
if (child_pid != 0)
{
printf("A\n");
child_pid = fork();
if (child_pid != 0)
{
child_pid = fork();
if (child_pid != 0) {}
else
printf("D\n");
}
else
prin... |
C | #include<stdio.h>
#include<string.h>
struct gift
{
char str[20];
int p;
};
int main()
{
struct gift group[15];
char str1[20];
int i,j,k,l,m,n,g,f=0;
while(scanf("%d",&n)!=EOF)
{
for(i=0;i<n;i++)
scanf("%s",group[i].str);
for(i=0;i<n;i++)
group[i].p=0;
for(l=0;l<n;l++)
{
scanf("%s%d%d",str1,&g,&m);... |
C | #include <stdio.h>
#include <stdlib.h>
//A C example about functions
void printSomething();
int main() {
//calls the function printSomething and prints out the statement
printSomething();
return 0;
}
void printSomething() {
printf("Hello World!");
return;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <pwd.h>
int main (int argc, const char *argv[]) {
const uid_t uid = getuid();
struct passwd *pw_uid = getpwuid(uid);
const char *name = pw_uid->pw_name;
struct passwd *pw_nam = getpwnam(name);
if (strcmp(pw_uid->pw_di... |
C | #include <stdio.h>
#include <stdlib.h>
int foo(int*a,int*b)
{
return *a-*b;
}
int main()
{
int tab[] = {0,2,-3,0,-3,3,3};
int *wsk=tab-1;
int b = *(wsk+=4); //b=0
int c = b+2; // b=0 , c=2
int d = foo(&b,&c); // b=0 , c=2 , d=-2
int e = (wsk+=-1)[3]; // b=0 , c=2 , d=-2 , e=3
e = ... |
C | /*
* operations.c
*
* Created on: Oct 5, 2020
* Author: Training
*/
#include <functions.h>
#include "main.h"
/*
* @Breif Description - Switch On the LED to show the system is On and turn off the LED to indicate
* @Function - system begin and initialise
*
* @Param1- FLAG which is an interuppt ... |
C | #include <avr/io.h>
void Master_begin(){
TWSR = 0x03;
TWBR = 0xFF; //frequencia do clock
}
void Master_Send(uint8_t data){
TWDR = data;
TWCR = (1<<TWINT) | (1<<TWEN);
while(!(TWCR & 1<<TWINT));
}
void Master_Start(){
TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN);
while(!(TWCR & 1... |
C | #include "utils_en_comun.h"
#include "datos_comanda.h"
// ENVIO
void enviar_respuesta(bool respuestaBool, uint32_t socketCliente){
t_paquete* paquete_a_enviar = crear_paquete(CONFIRMAR_PEDIDO);
t_respuesta2 respuesta;
if(respuestaBool){
respuesta = OK2;
} else{
respuesta = FAIL2;
}
serializar_respuesta(r... |
C | #include "gabor.h"
#include <math.h>
#include <assert.h>
#include <stdlib.h>
#include "inline.h"
#include "libdwt.h"
float complex gabor_atom(
float t, ///< time around 0
float alpha, ///< Gaussian envelope parameter
float omega ///< frequency in radians
)
{
assert( alpha >= 0.f );
#if 0
return sqrtf(alpha/(floa... |
C | /**
*
* Considerações sobre compilar o código fonte pelo terminal do Linux:
* algumas funções matemáticas não são reconhecidas pelo gcc, por isso
* sugerimos usar o g++ para compilar o arquivo.c
* No CodeBlocks, Windows, nenhum cuidado extra se mostrou necessário.
*
* Trabalho de Probabilidade e Estatística II... |
C | #include <stdio.h>
#include <stdbool.h>
#include "int_set.h"
#include "tests.h"
void test_basic_behavior()
{
struct IntSet set = new_int_set();
assert_false(int_set_includes(&set, 0), "A new set should not include 0.");
int_set_add(&set, 0);
assert_true(int_set_includes(&set, 0), "A set with 0 added should in... |
C | #include <stdio.h>
#include <stdlib.h>
int main(void) {
printf("\033[31m");
puts("赤い文字");
printf("\033[0m");
printf("\033[43m");
puts("黄色い背景");
printf("\033[0m");
printf("\033[31;43m");
puts("赤い文字;黄色い背景");
printf("\033[0m");
puts("元通り");
puts("元通り2");
return EXIT_SUC... |
C | #include <assert.h>
#include <stddef.h>
#include "warnp.h"
#include "scryptenc.h"
#include "scryptenc_print_error.h"
/**
* scryptenc_print_error(rc, infilename, outfilename):
* Print the error corresponding to ${rc}. If relevant, use ${infilename}
* or ${outfilename} to display an error about reading or writing;... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "config.h"
#include "puredb_p.h"
#include "puredb_read.h"
#include "puredb_write.h"
/************************************************************************/
/* ... |
C | #include<stdio.h>
#include<stdlib.h>
struct n
{
int a;
struct n *p;
}*h=NULL,*t;
void insert();
void delete();
void display();
int main()
{
int i;
do
{
printf("\n\tMENU\n\n1.Insert\n2.Delete\n3.Display\n4.Exit\n\nEnter your choice -");
scanf("%d",&i);
printf("\n");
switch(i)
{
case 1:
insert()... |
C | #include <stdio.h>
#include <stdlib.h>
void transpose (int a[][3], int row, int col);
int main()
{
int a[3][3]={{1,2,3},{4,5,6},{7,8,9}};
transpose(a,3,3);
int i,j,temp;
for (i=0;i<3;i++) {
for (j=0;j<3;j++)
printf("%d\t",a[i][j]);
printf("\n");
}
}
void transpose (int a[][3], int row, int... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* color_inter.c :+: :+: :+: ... |
C | int
main()
{
int arr[2];
int *p;
arr[0] = 2;
arr[1] = 3;
p = &arr[0];
if(*(p++) != 2)
return 1;
if(*(p++) != 3)
return 2;
p = &arr[1];
if(*(p--) != 3)
return 1;
if(*(p--) != 2)
return 2;
p = &arr[0];
if(*(++p) != 3)
return 1;
p = &arr[1];
if(*(--p) != 2)
return 1;
return 0;
}
|
C | #include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
extern int j1;
extern int l1;
extern int j2;
extern int l2;
extern int j3;
extern int l3;
extern int j4;
extern int l4;
extern int j5;
extern int l5;
extern int j6;
extern int l6;
extern int j7;
extern int l7;
extern int j8;
extern int l8;
extern int j9;
exte... |
C | #include<stdio.h>
#include<stdlib.h>
#include"sqlist.h"
int main()
{
sqlist *list;
datatype arr[] = {1,2,3,4,5};
datatype arr1[] = {11,22,33,44,55};
int i,err;
//list = sqlist_create();
sqlist_create1(&list);
if(NULL == list)
{
fprintf(stderr, "sqlist_create failed!\n");
exit(1);
}
for(i=0; i<sizeof(... |
C | /*
Brandon Mord
Csci 451 Hw 4
9/23/18
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <stdbool.h>
bool reading = true;
bool printable = false;
pthread_mutex_t lock;
pthread_t tid[2];
pthread_cond_t handled;
int number=0;
void* Producer(void ... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#pragma warning(disable:4996)
//1ĸ
#include <stdio.h>
#include <windows.h>
#include <math.h>
#include <assert.h>
#include <stdarg.h>
int count(int num);
int main()
{
int num = 1231;
printf("%d\n", count(num));
system("pause");
return 0;
}
int count(int num)
{
unsigned char* p... |
C | #include "../../Librerie/Lista/lista.h"
#include <stdio.h>
#include <assert.h>
lista carica_lista(char* nome_file) {
int elementi, i;
float valore;
lista l = crea_lista();
FILE* fp = fopen(nome_file, "r");
assert(fp != NULL);
fscanf(fp, "%d", &elementi);
for (i = 0; i < eleme... |
C | /*
* mm_alloc.c
*
* Stub implementations of the mm_* routines.
*/
#include "mm_alloc.h"
#include <stdlib.h>
#include <sys/resource.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <memory.h>
#include <unistd.h>
struct metadata* first_metadata;
struct metadata* metadata_init(size_t new_size... |
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 | #include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
void * run( void * data ){
//(void)data;
size_t thread_num = (size_t)data;
printf( "HELLO WORLD from secondary thread %zu\n", thread_num );
return NULL;
}
int main( int argc, char* argv[] ){
size_t t_count = sysconf(_SC_NPROCESSORS_O... |
C | #include<stdio.h>
#include<stdlib.h>
#include "sorting.h"
#define KB (1024)
#define MB (1024 * KB)
#define GB (1024 * MB)
#define LARGEST_CACHE_SZ (3 * MB)
#define NUM_SORTS 4
#define VEC_SIZE 200000
static unsigned char dummy_buffer[LARGEST_CACHE_SZ];
void cache_clean()
{
unsigned long long i;
for (i=0;... |
C |
#include<stdio.h>
int main()
{
int n,i,count;
printf("\n Enter the value:");
scanf("%d",&n);
for(i=0;i<n;i++)
{
if(i%2==0)
{
count++;
}
}
if(i==2)
{
printf("yes");
}
else
{
printf("no");
}
}
|
C | /* Problem 10598 - Find the Latitude */
#include <stdio.h>
#include <math.h>
#ifndef M_PI
#define M_PI 3.141592653589793238462643383279
#endif
int main() {
int t = 1, k;
double n, R;
while (1) {
scanf("%lf %lf", &R, &n);
if (!R && !n) break;
printf("Case %d:\n", t++);
for (k = 1; k < 11; k++) {... |
C | /*
#include<stdio.h>
#include<string.h>
main()
{
FILE *fp;
char f[15],str[15];
int c=0;
printf("enter the word to be checked\n");
gets(f);
fp=fopen("file3.txt","r");
if(fp=NULL)
{
printf("file cannot open");
exit(1);
}
while(!feof(fp))
{
... |
C | //Program to swap two numbers without using third variable
//Author Aakash Date 18 Dec 2020
#include<stdio.h>
int main()
{
int a,b;
printf("Enter first number :");
scanf("%d",&a);
printf("Enter second number :");
scanf("%d",&b);
a=a+b;
b=a-b;
a=a-b;
printf("After ... |
C | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>
#define CHILD 0
int main(int argc, char *const argv[], char *const envp[]) {
puts("Opening a pipe.");
int pipe_fd[2];
int pipe_res = pipe(pipe_fd);
if (pipe_res... |
C | #include <stdio.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <string.h>
#include "job.h"
int nextjid = 1;
/* 清除job,把job的值恢复为默认值 */
void clearjob(job_t *job)
{
job->pid = 0;
job->jid = 0;
job->state = UNDEF;
job->cmdline[0] = '\0';
}
/* 初始化job_table */
void initjob_tabl... |
C | #include <stdio.h>
#include <math.h>
#define S (a+b+c)/2
#define H s*(s-a)*(s-b)*(s-c)
#define M sqrt(H)*4/3
#define P2 printf("%.3lf\n",m)
///AC
int main() {
double a,b,c,s,m;
while(scanf("%lf%lf%lf",&a,&b,&c)==3) {
s=S;
if(H<=0)
m=-1;
else
m=M;
P2;
}... |
C | #include "isi_hash.h"
/*
* This hash function code is taken from Robert Jenkins. See
* http://burtleburtle.net/bob/hash/evahash.html
*/
/**
* @param _k the key
* @param len the length of the key in bytes
* @param initval the previous hash, or an arbitrary value
*/
uint32_t
isi_hash32(const void *_k, size_t l... |
C | /*
* Erich Kramer Concurrency Homework 3 CS444
* Problem 2,
*
* */
#include <pthread.h>
#include <semaphore.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <time.h>
#define THREAD_COUNT 10
typedef struct{
}arg;
arg* argGen(){
arg* tmp = (arg*)malloc(sizeof(arg) )... |
C | /*
Tim M. Lael
CS4280
p1
26-FEB 2017
*/
/*
testScanner.c
source file containing scanner testing functions
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "testScanner.h"
#include "token.h"
#include "scanner.h"
/*
Token name array to display on terminal feedback
Mapped to token ... |
C | /*-----------------------------------------------------------------------------------------------
* Author : Rammya Dharshini K
* Date : Fri 23 Jul 2021 19:30:04
* File : C_Sample_Chapter-1_Program-31_arith_oper_pre_post.c
* Title : Operators - Arithmetic - Pre and Pos... |
C | /*
* Eli-Henry Dykhne
* 0996524
* 04/03/2019
* A3
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/timeb.h>
#include "A3.h"
int main(){
FILE *file = fopen("data_5.txt", "r");
struct timeb *start = malloc(sizeof(struct timeb));
struct timeb *stop = malloc(sizeof(struct timeb));
int num... |
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 | /**
* Reading-Transmitter
* @author [David Tolbert](npm.merlin@gmail.com)
* @see https://curl.haxx.se/libcurl/c/
* @todo refactor code and add more functions
*/
#ifndef HEADER_FILE
#define HEADER_FILE
#include <curl/curl.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <unistd.h>
#defi... |
C | #include<stdlib.h>
#include<stdio.h>
#include<math.h>
#include<GL/glut.h>
void init()
{
gluOrtho2D(-300, 300, -300, 300);
}
//Desenha os 8 pontos da circuferência dado um ponto (x,y)
void CirclePoints(int x, int y)
{
glColor3f(1, 0, 0);
glBegin(GL_POINTS);
glVertex2i(x,y);
glVertex2i(x,-y);
glVertex2i(-x,y);
... |
C | int* get_value-wrong() {
int x = 20;
return &x;
}
int add_value(int y) {
int a = 99;
return a + y;
}
int main(void) {
int *a, b;
a = get_value_wrong();
printf("First result %d\n", *a);
b = add_value(7);
printf("Second value %d\n", b);
printf("First result (change... |
C | #include "useful.h"
/**
* Ӽ̶ȡһַ浽buff
* 룺ŵbuffַ飬鳤
* ȡַ
*/
int mygetline(char* buff, int length){
int i = 0;
char c;
while((c = getchar()) != EOF && c != '\n' && i < length - 1){
buff[i++] = c;
}
buff[i] = '\0';
return i;
}
int myisblank(char c){
return c == ' ' ||... |
C | /**
*
*@author Israel Schimitz
*@date 23/04/2013
*@brief Tabalho I - Sistemas Embarcados UCS
*@details Deverá ler um vetor de 20 caracteres, ordenar crescentemente, calcular a média, o desvio padrão e a variância
*
*@version 1.0
*/
#include <stdio.h>
#include <math.h>
int i=0; ///Variável do tipo inteiro pa... |
C | typedef struct
{
char nombre[50];
char dni[15];
int edad;
int estado;
}ePersona;
ePersona agregarPersona(ePersona[], int);
/** \brief Agrega una persona al array.
*
* \param Un array del tipo ePersona.
* \param Entero que representa el tamao del array.
* \return Devuelve la persona ing... |
C | #include <stdio.h>
#include <math.h>
long penta(long num){
long num2;
num2 = (1+sqrt(1+24*num))/6;
if((num2*(3*num2-1))/2 == num) return num2;
return 0;
}
long hexa(long num){
long num2;
num2 = (1+sqrt(1+8*num))/4;
if(num2*(2*num2-1) == num) return num2;
... |
C | //60070501054
//60070501064
#include <mpi.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define MatrixA "matAlarge.txt"
#define MatrixB "matBlarge.txt"
#define MatrixOut "matBlockOut.txt"
float **malloc2d(int row, int col)
{
float *data = malloc(col * row * sizeof(float));
float **arr = mallo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.