language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include "calculate.h"
void print_error_and_exit(int err)
{
if(err == FAILURE)
{
printf("The calculation failed. Please retry.\n");
}
else if(err == OUT_OF_BOUNDS)
{
printf("The calculation failed due to ... |
C | /*
Write a C program to calculate
factorial of a number.
*/
#include <stdio.h>
main()
{
int numberInput,i,result;
printf("C program to calculate factorial of a number\n");
printf("Enter a Number: ");
scanf("%d",&numberInput);
result = 1;
for(i = 1; numberInput >= i; i++){
... |
C | /*
** get_size.c for get_size in /home/sachs_a/delivery/IA/dante/depth/src/depth
**
** Made by Alexandre Sachs
** Login <sachs_a@epitech.net>
**
** Started on Sun Apr 23 12:36:09 2017 Alexandre Sachs
** Last update Sun Apr 23 12:36:09 2017 Alexandre Sachs
*/
#include "get_next_line.h"
int get_size(int fd)
{
in... |
C | /*
** EPITECH PROJECT, 2021
** libmy
** File description:
** Defines qsort_r_do_quick
*/
#pragma once
#include "my/stdlib.h"
#include "my/cpp-like/algorithm.h"
#include "my/string.h"
#include "my/features.h"
#include <stddef.h>
#include <stdbool.h>
struct qsort_state {
char *base;
char *p_median;
char *p... |
C | //
// server.c
//
#include "server.h"
int numServers = 1;
int main(int argc,char** argv) {
int clientSock = 0, numReady,numClients,full,serverSock;
struct sockaddr_in client;
socklen_t clientLen = sizeof(client); //To pass &clientLen
struct in_addr statAddr;
long bytesRead = 0,bytesWritten = 0;
int fds[FD_SE... |
C | #include "volume_base.h"
#include "volume.h"
#include "volume_dispatch.h"
static
STATUS
_VolInitialize(
IN PDEVICE_OBJECT Disk,
IN PPARTITION_INFORMATION PartitionInformation,
INOUT PDRIVER_OBJECT DriverObject
);
STATUS
(__cdecl VolDriverEntry)(
... |
C | /* Alexaner Simchuk, string_manip_tests.c
* Unit test infrastructure for testing the methods in string_manip.c
*/
#include "string_manip.h"
#define RED "\x1B[31m"
#define GRN "\x1B[32m"
#define YEL "\x1B[33m"
#define BLU "\x1B[34m"
#define MAG "\x1B[35m"
#define CYN "\x1B[36m"
#define WHT "\x1B[37m"
#... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* rotate_if.c :+: :+: :+: ... |
C | /*
** show_list.c for showlist in /home/peau_c/rendu/PSU/PSU_2015_tetris
**
** Made by Clement Peau
** Login <peau_c@epitech.net>
**
** Started on Thu Mar 3 14:26:49 2016 Clement Peau
** Last update Thu Mar 3 15:46:11 2016 Clement Peau
*/
#include "linked_list.h"
void show_list(t_tetriminos *list)
{
t_tetrimin... |
C | /* test-expr.c -- Testing: filter expression parsing and processing.
Copyright (C) 2020, 2022 Genome Research Ltd.
Author: James Bonfield <jkb@sanger.ac.uk>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to d... |
C | //
// server.c
// File Server
//
// Created by Alessio Giordano on 23/12/18.
//
// O46001858 - 23/12/18
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <sys/types.h>
#include <dirent.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#... |
C | #include <stdio.h>
int main(void) {
char c;
int counter = 0;
while((c = getchar()) != '\n') {
if(c == ' ' && counter == 0) {
printf("\n");
}
else {
printf("%c", c);
counter = 0;
}
}
return 0;
}
|
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
void memdump(char * p , int len) {
// Add your code here.
int i;
unsigned char buff[17];
unsigned char *pc = (unsigned char*)p;
for (i = 0; i < len; i++){
if ((i % 16) == 0){
if (i != 0){
printf(" %s\n", buff);
}
printf(" %04x ", i);... |
C | #include"List.h"
int main()
{
List s;
ListInit(&s);
ListPushBack(&s, 1);
ListPushBack(&s, 2);
ListPushBack(&s, 3);
ListPushBack(&s, 4);
ListPushBack(&s, 5);
ListPrint(&s);
ListPushFront(&s, 10);
ListPushFront(&s, 20);
ListPushFront(&s, 30);
ListPushFront(&s, 40);
ListPushFront(&s, 50);
ListPrint(&s... |
C | #include "../src/internal.h"
#include "../src/types.h"
#include "test.h"
#include <assert.h>
#include <passwand/passwand.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
TEST("pack: basic functionality") {
char _pt[] = "hello world";
const pt_t p = {
.data = (uint8_t *)_pt,
.length = siz... |
C | #include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/wait.h>
void write_fifo(int descriptor)
{
char *message = "Kolokwium na 30 pkt";
if(write(descriptor,message,strlen(message))<0)
perror("write");
}
int main(void)
{
int descriptor = open("fifo",O_WR... |
C | #include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv) {
int x;
int y;
for (x = 1; x<=10; x++){
printf("Tabla del %d\n", x);
for (y = 1; y <= 10; y++){
printf("%d x %d = %d\n", x, y, x*y);
}
y = 1;
... |
C | /*
** EPITECH PROJECT, 2019
** game loop
** File description:
** yeh yeh yeh
*/
#include "navy.h"
int client_server_loop(snavy_t *navy, int current_hit,
int current_string)
{
if (connection.is_server) {
attack_s(navy, current_hit);
if ((navy->game_status = check_win(navy)) != 0)
... |
C | #include <stdio.h>
int queuearr[];
int N,s=0,front=0,rear=0;
int size(){
return s;
}
int dispFront(){
return(queuearr[front]);
}
int isEmpty(){
return (size()==0);
}
void enqueue(int el){
if(size()==N){
printf("\nQueue is full\n");
}
else{
s++;
que... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* swap_funcs.c :+: :+: :+: ... |
C | #include "types.h"
#include "stat.h"
#include "user.h"
#include "fs.h"
void loop(int p){
double i, j;
for(i = 0; i < 10000; i++)
for(j=0; j < 100000; j++);
printf(1, "Terminou %d\n", p);
}
int main(void){
int p[10];
p[0] = fork(10);
printf(1,"%d tickets\n", 10);
if(p[0] == 0){... |
C | // 2
/*
BIJ
ָһ¼key, valueļֵԡBѴҪļֵԣ
Ҫvalue滻ɵvalueBkey,һҶӽнв
1ҪkeyֵҵҶӽ㲢롣
2жϵǰkeyĸǷСڵm-1е3
3ԽмkeyΪķѳ֣Ȼмkey뵽УkeyָѺ벿֣
keyָ֧ѺҰ벿֣Ȼǰָ㣬е3
*/
#include "pch.h"
extern struct config_information config_inf; //configϢб b+tree.c
extern struct disk_file_information disk_file[FILE_AMOUNT]; //ÿļϢ b+tree.c
extern s... |
C | #define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#define MABANGJIN_SIZE 3
int main()
{
int k, l;
int mabangjin[MABANGJIN_SIZE][MABANGJIN_SIZE];
char answer;
for (k = 0; k < MABANGJIN_SIZE; k++)
{
for (l = 0; l < MABANGJIN_SIZE; l++)
scanf("%d", &mabangjin[k][l]);
}
int i=0, result1 = 0, result2 = 0,... |
C | /*
* (C) Copyright 2012
* Joe Hershberger, National Instruments, joe.hershberger@ni.com
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef __ENV_ATTR_H__
#define __ENV_ATTR_H__
#define ENV_ATTR_LIST_DELIM ','
#define ENV_ATTR_SEP ':'
/*
* env_attr_walk takes as input an "attr_list" that takes the form:
* attri... |
C | /* call tagFile to tag a file. Call getFileTag to read the tag of that file. */
#include "types.h"
#include "user.h"
#define O_RDONLY 0x000
#define O_WRONLY 0x001
#define O_RDWR 0x002
#define O_CREATE 0x200
#undef NULL
#define NULL ((void*)0)
int ppid;
volatile int global = 1;
#define assert(x) if (x) {} els... |
C | #include <stdio.h>
int main() {
int x[5], cont[4]={0}, i;
for(i=0; i<5; i++){
scanf("%d", &x[i]);
if(x[i] < 0)
cont[0]++;
if(x[i] > 0)
cont[1]++;
if(x[i]%2 == 0)
cont[2]++;
if(x[i]%2 != 0)
cont[3]++;
}
printf("%d v... |
C | #include<stdlib.h>
#include<stdio.h>
#define ElementType int
#define ERROR -1
struct Node{
ElementType Data;
struct Node* Next;
};
struct QNode{
struct Node* rear;
struct Node* front;
};
typedef struct QNode* Queue;
/*出队*/
ElementType DeleteQ(Queue PtrQ){
struct Node* FrontCell;
ElementType F... |
C | #include<stdio.h>
int main()
{
int i=4,z;
int *p=&i;
z=100;
z=z/(*p);
printf("%d%d",*p,z);
return 0;
}
|
C | /* stringlib: split implementation */
#ifndef STRINGLIB_FASTSEARCH_H
#error must include "stringlib/fastsearch.h" before including this module
#endif
/* Overallocate the initial list to reduce the number of reallocs for small
split sizes. Eg, "A A A A A A A A A A".split() (10 elements) has three
resizes, to si... |
C | //
// Created by sayan on 11/21/18.
// Adapted from http://moodycamel.com/blog/2013/a-fast-lock-free-queue-for-c++
//
#include "hclasses.h"
#define MEMORY_ORDER_RELAXED 0
#define MEMORY_ORDER_ACQUIRE GASNETT_ATOMIC_ACQ
#define MEMORY_ORDER_RELEASE GASNETT_ATOMIC_REL
const char* HQUEUE_TAGSTR = "QIEU";
struct _hqueu... |
C | #include <string.h>
#include <stdio.h>
int main(int argc, char* argv[]){
double num = 11.0111111111;
char arr[200];
sprintf(arr, "%2.13f", num);
int end=1;
int i=0;
while(end!=0x00){
printf("%c\n and size of arr %lu",arr[i],sizeof(arr));
i++;
end=arr[i];
}
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
main(){
int array[10];
int file;
char *filename = "./ehaasch_foo.txt";
char buffer[20];
printf("Enter 10 integers: \n");
file = open(filename, O_WRONLY | O_CREAT, 064... |
C | #pragma once
static const char *ALPHA_BASE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
/*
* ַתΪBase64
*/
void char2base64(const char *buf, const long size, char *base64Char) {
int a = 0;
int i = 0;
while (i < size) {
char b0 = buf[i++];
char b1 = (i < size) ? buf[i++] : ... |
C | /* Build an (unbalanced) binary search tree of words in input. */
#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static void * xrealloc(void *buf, size_t num, size_t si... |
C | #include <errno.h>
//#include <pthread.h>
//#include <semaphore.h>
#include <signal.h>
//#include "buffer.h"
#include <stdlib.h>
#include <pthread.h>
#include <stdio.h>
#include <string.h>
pthread_t thid1,thid2,thid3,thid4,thid5;
/*****************************************************************/
void *dispaly5(void *... |
C | /**
* Quadrofly Software (http://quadrofly.ni-c.de)
*
* @file controller/lib/pid.c
* @brief PID controller
* @ingroup controller
* @author Willi Thiel (wthiel@quadrofly.ni-c.de)
* @date Apr 29, 2012
*/
#include "main.h"
#include "pid.h"
#include <stdlib.h>
#include <inttypes.h>
#ifdef EEPROM_AVAILABLE
... |
C | #include <stdio.h>
int isEven(int num){
if(num%2==0){
return 1; // if even
}
return 0; // if not even
}
int main(){
printf("1: %d\n",isEven(1));
printf("2: %d\n",isEven(2));
return 0;
}
|
C | // finding the nth number in the series.
#include<stdio.h>
#include<math.h>
int main()
{
int i;
printf("input");
scanf("%d",&i);
int a[8] = {1,5,13,25,41,61,85,113};
printf("Output : %d",a[i-1]);
return 0;
}
|
C |
// print pyramid by abc
#include <stdio.h>
char abcArray[26] = {'A','B','C','D','E','F','G','H','I','J','K','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
void printabcArray();
void printPyramid();
int sizeofarray = sizeof(abcArray) / sizeof(abcArray[0]); // to count how many elements in array
int row;... |
C | #include "smp_calendar.h"
#include "smp_spin.h"
#include "smp.h"
#include "i18n.h"
//supported year֧һ
#define SMP_CALENDAR_YEAR_MIN 1900
#define SMP_CALENDAR_YEAR_MAX 2100
//supported month֧
#define SMP_CALENDAR_MONTH_MIN 1
#define SMP_CALENDAR_MONTH_MAX 12
#define SMP_CALENDAR_SPIN_YEAR 1 //ye... |
C | #include "main.h"
#define STEPS 100
#define BUDGET 9
int main(int argc, char **argv) {
if (argc < 3) {
printf("Not enough arguments. Must supply and input and output file for evaluation.\n");
return 0;
}
// Buffers for reading inputs
char *inputs_path = argv[1];
char *output_path... |
C | #include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int hello(int argc, char** argv) {
printf("hello, word!\n");
printf("%s\n", "hello, word!");
printf("%s %s\n", "hello,","1234");
}
int main()
{
int num1; //
int num2;
int num3;
num1 =... |
C | #include <stdlib.h>
#include <stdio.h>
#include "SL_list.h"
int is_empty(SL_list *LL) {
if(LL == 0) return 1; else return 0;
}
int get_first(SL_list *LL) {
return LL->content;
}
SL_list *get_next(SL_list *LL) {
if(is_empty(LL)) {
printf("ERROR: trying to get_next "
"from NULL pointer\n");... |
C | #include <gtk/gtk.h>
int main( int argc,char *argv[] )
{
// 1.gtk初始化工作
gtk_init(&argc, &argv);
// 2.创建一个顶层窗口
GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
// 3.1 创建一个table
GtkWidget *table = gtk_table_new(5,4,TRUE);
// 3.2 将table加入到window中
gtk_container_add(GTK_CONTAINER(window),table);
// ... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <btn/cstr.h>
#include <btn/print.h>
#include <btn/vector.h>
#include "print.h"
#include "option.h"
void print_option(const option * opt)
{
#define INDENT 2
#define DETAIL_INDENT 25
static const char * detail_indent = " ... |
C | /***************************************************************************//**
@file mapa.c
@brief Creacion y actualizacion constante del mapa de juego, de los troncos
y de los vehiculos
@author Grupo 1: Cristian Meichtry, Juan Martin Rodriguez
*********************************************... |
C | //
// Created by mkg on 10/7/2016.
//
/* json.c parses json files for view objects */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <ctype.h>
#include "../include/json.h"
/* global variables */
int line = 1; // global var for line numbers as we parse
object ... |
C | #include <stdio.h>
#include <stdlib.h>
int mark[1000];
void markfunc(int x,int n)
{
for(int j=2*x;j<=n;j+=x)
mark[j]=1;
}
int main()
{
int n;
scanf("%d",&n);
for(int i=2;i<n;i++)
if(mark[i]==0)
markfunc(i,n);
for(int i=1;i<=n;i++)
if(mark[i]==0)
print... |
C | /* LuaBER utilities */
#include <ctype.h> /* isdigit */
#include <string.h> /* memmove */
#include <lauxlib.h>
#define atod(cp, num) \
while (isdigit (*(cp))) \
(num) = ((num) << 3) + ((num) << 1) + (*((cp)++) & ~'0');
#define bytes_count(x) \
!(x) ? 0 : ((x) & 0xFF000000) ? 4 : ((x) & 0x... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <limits.h>
#include <errno.h>
#define MAXBIN 32
#define MAXHEX 8
#define MAXDBL 100
/*
Author: Genaro Martínez S.
id: A01566055
date: 13/03/2020
use the routines to display several types of data from strings.
*/
unsigned int hexToInt(const char *h... |
C | #include<stdio.h>
int main(void) {
short int i = 0;
printf("%ld", sizeof(i));
for(i<=5 && i>=-1; ++i; i>0) {
printf("%u,", i);
}
return 0;
}
|
C | /* day_mon2.c -- 让编译器计算元素个数 p247 */
#include <stdio.h>
int main (void)
{
int days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31};
int index;
for (index = 0; index < sizeof days /sizeof days[0] ; index++)
printf ("Month %d has %2d days.\n", index + 1,
days[index]);
return 0;
}
|
C | #define _GNU_SOURCE
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>
#include <sched.h>
#include <signal.h>
#include <sys/wait.h>
#include <sys/ioctl.h>
#include <linux/sched.h>
#include <linux/types.h>
#in... |
C | #include<stdio.h>
#include<stdlib.h>
#include<assert.h>
#include<string.h>
#include "stack.h"
Stack* CreateStack() //ջ,һλô0ʼ
{
Stack* p = (Stack*)malloc(sizeof(Stack));
p->array = (ElementType*)malloc(MAXSIZE*sizeof(ElementType));
for (int i = 0; i < MAXSIZE; i++)
{
p->array[i] = 0;
}
p->Top = -1... |
C | /*
域名解析,获取指定域名对应的别名和地址。
*/
#include <stdio.h>
#include<netdb.h>
#include<unistd.h>
int main()
{
struct hostent *ent = NULL;
ent = gethostbyname("www.baidu.com");
printf("%s\n",ent->h_aliases[0]);
printf("%hhu.%hhu.%hhu.%hhu\n",ent->h_addr_list[1][0],ent->h_addr_list[1][1],ent->h_addr_list[1][2],ent->h_addr_list[1... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_errors_otool.c :+: :+: :+: ... |
C | /* monitor.c -- This file is part of ctools
*
* Copyright (C) 2015 - David Oberhollenzer
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
#define TL_OS_EXPORT
#include "tl_thread.h"
#include "os.h"
int tl_monitor_init(tl_monitor *this)
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* writting_helper.c :+: :+: :+: ... |
C | #include <stdio.h>//preprocessor directive to include standard input output function headerfile
int main()
{
int i,num,n,large=0;// integer variables declaration
printf("How many numbers: ");//Ask user to input how many numbers
scanf("%d",&n);//scanf function for taking the input values from user
for(i=... |
C | #include <stdio.h>
int main()
{
int array[10] = {1, 2, 3, 4, 2, 3, 5, 2, 1, 1};
/*int buffArray[2];
memset(array, 2, 10);*/
int indexFirst = 0;
int indexLast = 0;
int count = 1;
for (int i = 9; i >= 0; i--)
{
for (int j = i - 1; j >= 0; j--)
{
if (array[i] == array[j])
{
indexLast = i;
i... |
C | /*
Sistema de una empresa de alquiler de equipos que tiene clientes que pueden alquilar equipos
para uno o varios proyectos. Permite ingresar/modificar/eliminar clientes, proyectos, equipos,
los procesos de: conteo, despacho, devolucin, generacin de facturas, cuenta del cliente y
cobros al cliente.
Auto... |
C | #include <stdio.h>
#define D_S 1
#if D_S
#include <conio.h>
#endif
char* expand(char const * const, char *);
char* expand(char const * const s1, char * s2){
static char oc = '\0';
char *psrc = s1, *ptar = s2;
while(*psrc != '\0'){
switch(*psrc){
case '-':
if(oc && oc < psrc[1]){
++psrc;
while(*psr... |
C | #include "file.h"
int main(int argc, char *argv[]) {
char *name_source, *name_result;
char step_to_step_mode = 0; //0 pour directe, 1 pour pas à pas
char error_check = 0;
program prog;
char input = '\0';
printf(" ----------MIPS EMULATOR---------- \n");
if (argc > 3) printf("ERROR : U... |
C | int gotoxy(int y, int x){
printf("\033[%d;%dH",y,x);
}
char buttonLabel[8][60]={
{"1. Add student"},
{"2. Search Student"},
{"3. Modify Student Record"},
{"4. Generate Marksheet"},
{"5. Delete Student Record"},
{"6. Change Password"},
{"7. Exit"},
{"What do you want:"}
};
int mapButton[8][2]={ // [0] is y and ... |
C | // ex8
// Typedef
// Named structures
// Anon. structures, typedef is declared just after the struct
// Plain typedef
struct a{
int fa;
};
typedef struct {
int fb;
};
typedef int myint;
typedef myint myint2;
typedef struct a sa;
typedef sa tsa;
typedef struct {
int fb;
}sb, sb2;
typedef sb tsb;
typedef in... |
C | #include <stdio.h>
int main()
{
char a[100];
int i,uper,lower,marks,num;
i=0;
uper=0;
lower=0;
marks=0;
num=0;
printf("please input a string:\n") ;
scanf("%s",a);
i=0;
while(a[i]!=NULL)
{
if(a[i]<=57&&a[i]>=48)
{
num++;
}
else
{
if(a[i]<=90&&a[i]>=65)
{
... |
C | #define _CRT_SECURE_NO_WARNINGS
#include"LinkStack.h"
int IsNumber(char c)
{
return c >= '0' && c <= '9';
}
void NumberOperate(char* p)
{
printf("%c", *p);
}
int IsLeft(char c)
{
return c == '(';
}
int IsRight(char c)
{
return c == ')';
}
int IsOperator( char c)
{
return c == '+' || c == '-' || c == '*' || ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_split.c :+: :+: :+: ... |
C | #include <stdio.h>
int main(void)
{
int n,i;
int v[10]={0};
printf("请输入一个正整数:");
scanf("%d",&n);
while(n>0){
switch(n%10)
{
case 0:v[0]=v[0]+1;break;
case 1:v[1]=v[1]+1;break;
case 2:v[2]=v[2]+1;break;
case 3:v[3]=v[3]+1;break;
... |
C | /*
A01 Fraction Program
Program Structure:
- This file:
Runs fnctions from various header files.
- IO.h
Header file containing IO functions,
Interface between User and Program
- Operations.h
Header file containing all functions created for specific operations,
In... |
C | /******************************************************************************
filename RoomExit.h
author Matthew Picioccio
DP email mattpic@digipen.edu
course GAM100 ** Do not use this code in your team project
Brief Description:
This file declares the RoomExit interface, which is used to mana... |
C | #include "pthreads.h"
int count = 0;
int capacity = INIT_CAPACITY;
// int numberArray[INIT_CAPACITY];
int *numberArray;
int finalArray[INIT_CAPACITY];
int main(int argc, char *argv[])
{
pthread_t tid_s1; /* The thread identifier */
pthread_t tid_s2; /* The thread identifier */
pthread_t tid_m; /* The thre... |
C | //
// Created by win10 on 2021/6/19.
//
#include "Student.h"
struct StudentTable init_student_table() {
struct StudentTable table;
strcpy(table.type, "S");
// Fill the table with 1000 demo entries
for (int i = 1; i <= 1000; ++i) {
// Init student
struct Student *demo_student = malloc(... |
C | #include <stdio.h>
#include <stdlib.h>
#define SIZE 3
int main()
{
int i;
int *ptr;
int *temp;
ptr = (int *)malloc(sizeof(int)*SIZE);
temp = ptr;
for(i=0;i<SIZE;i++)
{
scanf("%d",ptr++);
}
ptr = temp;
for(i=0;i<SIZE;i++)
{
printf("\n%d",*ptr++);
}
return 0;
}
|
C | #include <stdio.h>
#include "holberton.h"
/**
* sqrt_ - fun
* @x: var
* @y: var
*
* Return: 0
*/
int sqrt_(int x, int y)
{
if (x > y)
return (-1);
if ((x * x) == y)
return (x);
else
return (sqrt_(++x, y));
}
/**
* _sqrt_recursion - fun
* @n:var
*
* Return: 0
*/
int _sqrt_recursion(int n)
{
if (n == 0)
re... |
C | /* Fast Fourier Transform
* Cooley-Tukey algorithm with 2-radix DFT
*/
#include <complex.h>
#define PI 3.14159265358979323846
void fft_slow(int* x, double complex* X, unsigned int N) {
unsigned int n, k;
// Iterate through, allowing X_K = sum_N of the complex frequencies.
for (k = 0; k < N; k++) {
... |
C | #include <stdint.h>
#include <stdbool.h>
// includes da biblioteca driverlib
#include "inc/hw_memmap.h"
#include "driverlib/gpio.h"
#include "driverlib/sysctl.h"
#include "driverlib/systick.h"
#include "grlib/grlib.h"
#include "cfaf128x128x16.h" // Projects/drivers
uint8_t LED_D1 = 0;
tContext sContext;
void DisplayI... |
C | #include <stdio.h>
int pow4(int x) {
return x * x * x * x;
}
int main(void)
{
int x;
printf("请输入整数:");
scanf("%d", &x);
printf("%d 的4次幂是: %d", x, pow4(x));
return 0;
} |
C | #include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
int main()
{
int a,i,j,b,d,c;
scanf("%d", &i);
for (a=0; a<i; a++)
{
for (b=(i-1-a); b>0; b--)
printf(" ");
for (j=0; j<=a; j++)
... |
C | //
// Created by seanchen on 2020-02-15.
//
#include <stdio.h>
#include "utils.h"
#include <include/shared.h>
#include <string.h>
#include <fcntl.h>
#include <zconf.h>
#include <sys/mman.h>
#include <elf.h>
#include <errno.h>
#define __arm__
#ifdef __arm__
#define Elf_Ehdr Elf32_Ehdr
#define Elf_Shdr Elf32_Shdr
#def... |
C | Write a C program to find the maximum and minimum from the 3 user inputted numbers.
#include <stdio.h>
int main()
{
int num1, num2, num3, min,max;
scanf("%d%d%d",&num1,&num2,&num3);
if(num1>num2)
{
if(num1>num3)
{
max=num1;
}
else
{
max=num3;
}
... |
C | #include<stdio.h>
void reverse(char *str);
int main() {
char str[] = "abcdef";
printf("%s\n", str);
reverse(str);
printf("%s\n", str);
return 0;
}
void reverse(char *str) {
char *incr_idx, *decr_idx;
char tmp;
incr_idx = str;
for(decr_idx = str; *(decr_idx+1) != '\0'; decr_idx++);
for(; incr_idx < decr_idx... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* create_bmp.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<stdlib.h>
#include<MATH.H>
// Matteo Raccichini, 3 INA, 14/11/2016
// Scambio di valori tra due variabili
main()
{
int A; //variabile che contiene A
int B; //variabile che contiene B
int TEMP; //variabile che contiene la variab... |
C | #include <stdlib.h>
#include <stdio.h>
#include "preset.h"
void preset_menu_print()
{
system("clear");
printf("1. Gliger\n");
printf("2. Gosper's gliger gun\n");
printf("3. Pulsar\n");
printf("4. Lightweight spaceship\n");
printf("5. Pentadecathlon\n");
}
int preset_menu_check_input(char input... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* new_elem.c :+: :+: :+: ... |
C | #include <stdio.h>
#include "typs.h"
#include "sources.h"
int main() {
DblLinkedList* list = createDblLinkedList();
int keyW = 1;
int keyB = 2;
int a = 1;
int b = 1;
int c = 2;
int d = 1;
int e = 2;
int f = 2;
int g = 1;
pushFront(list, &a);
pushFront(list, &b);
pushFront(list, &c);
pushBack(list, &d);
... |
C | //
// OneWire interface
//
// Implements Maxim OneWire device interface
//
#include "OneWire.h"
#include <avr/io.h>
#include <avr/interrupt.h>
#include "util/delay.h"
#define OW_DEVICE_PIN PA6
#define OW_DEVICE_OUTPORT PORTA
#define OW_DEVICE_INPORT PINA
#define OW_DEVICE_DIR DDRA
... |
C | #include <stdio.h>
#include <stdbool.h>
bool perfect(int n)
{ int s=0; int i;
for(i=1;i<n;i++)
{ if(n%i==0)
{
s=s+i;
}
}
if(n==s)
return true;
else
return false;
}
int main()
{
int n;
printf("Enter the number: ");
scanf("%d",&n);
... |
C | /*
* string - string list routines
*
* Copyright (C) 1999-2004 David I. Bell and Ernest Bowen
*
* Primary author: David I. Bell
*
* Calc is open software; you can redistribute it and/or modify it under
* the terms of the version 2.1 of the GNU Lesser General Public License
* as published by the Free Software... |
C |
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
typedef struct BST
{
int data;
struct BST *lchild;
struct BST *rchild;
}node;
node *create( node *root, int key)
{
node *temp;
if(root==NULL)
{
temp=(node *)malloc(sizeof(node));
temp->data=key;
temp->lchild=NULL;
temp->rchild... |
C | #include <unistd.h>
#include <sys/types.h>
#include <dirent.h>
#include <stdio.h>
#include <string.h>
void listdirint(const char *name, int indent);
void handle_dir(char* name, char* filename, int indent){
char path[1024];
int space = 0;
snprintf(path, sizeof(path), "%s/%s", name, filename);
space = 40 - ... |
C | #include "lists.h"
/**
* add_nodeint_end - entry point.
* @head: double pointer to struct.
* @n: contains the numbers to list.
* Return: address of memory of new element.
*/
listint_t *add_nodeint_end(listint_t **head, const int n)
{
listint_t *node;
listint_t *new;
node = malloc(sizeof(listint_t));
if (nod... |
C | /**************************
Exercice 44 : Ecrire un programme qui demande en boucle dentrer un nombre positif
jusqu obtenir satisfaction.
**************************/
#include <stdio.h>
#include <stdlib.h>
int main()
{
int N;
do
{
printf("\n Entrez le nombre positif n :");
s... |
C | #include<stdio.h>
double mean(double x[],int n){
double sum=00.0;int i;
for(i=0;i<n;i++)sum+=x[i];
sum/=n;
return sum;}
int main(){
int i,n;double a[20];
printf("please input n as length:");
scanf("%d",&n);
printf("please input %d numbers:",n);
for(i=0;i<n;i++)scanf("%f",&a[i]);
for(i=0;i<n;i++)printf("%4.1f\... |
C | #include <stdint.h>
#include <string.h>
#define MBEDTLS_XTEA_ENCRYPT 1
#define MBEDTLS_XTEA_DECRYPT 0
#define MBEDTLS_ERR_XTEA_INVALID_INPUT_LENGTH -0x0028
/*
* 32-bit integer manipulation macros (big endian)
*/
#ifndef GET_UINT32_BE
#define GET_UINT32_BE(n,b,i) \
{ ... |
C | #include <stdio.h>
#include <string.h>
#include <ctype.h>
int main() {
char input[30];
int n;
int j = 0;
int cntr = 1;
scanf("%s", &input);
while (input[j]) {
input[j] = tolower(input[j]);
j++;
}
int lgth = strlen(input);
int k;
int bool = 0;
int maximumCntr = 1;
for (k = ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "code.h"
#include "ast.h"
#include "parser.h"
int regist=0;
char* create_register(){
char* var = (char*) malloc(sizeof(char));
sprintf(var,"%s%d","t",regist);
regist++;
return var;
}
List_Instr* compile_cmdlist(CmdList* cmd_list,char... |
C | /*
AA 3.3 - Consistncia de datas
Contexto
Verificaes de consistncia so importantes para os algoritmos.
O objetivo verificar se datas so vlidas e quais as relaes entre elas.
Informaes
Para esta atividade, so consideradas datas vlidas aquelas em que o nmero de
dias est nos limites usuais, o que depende do m... |
C | /*
* fork demo
*/
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <wait.h>
static void sigchld_handler(int sig)
{
int status;
pid_t pid;
while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
printf("process %d exit\n", pid);
}
}
int main()
{
pid_t ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.