language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include "inssort.h"
void inssort( void *base, size_t nelem, size_t size,
int (*compar) (const void *, const void *)){
for(size_t i = 1; i < nelem; ++i){
int slot = i;
void* element = malloc(size);
memcpy(element, (char*)(base + slot * si... |
C | /* Maciej Michalec */
#include <stdio.h>
#include <string.h>
#define MAX_TEXT 31
struct student {
char imie[MAX_TEXT];
char nazwisko[MAX_TEXT];
float oceny[30];
int liczba_ocen; /* trzeba jeszcze wyzerowac!!*/
};
typedef struct student student;
int porownywacz(const void* jeden, const void* drugi) /* porownywanie ... |
C | #include "double_list.h"
int borrow_list(int op1, int op2, int borrow_in, Dlist *next, Dlist **result_head, Dlist **result_tail)
{
int borrow_out = 0, diff , temp = 100000000;
// printf("diff %d op1 %d op2 %d borrow_out %d borrow_in %d\n", diff, op1, op2, borrow_out, borrow_in);
if (next)
{
if (op1 < op2)
{
... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int ROW, COLUMN;
printf("Enter Row: ");
scanf("%d", &ROW);
printf("Enter Column: ");
scanf("%d", &COLUMN);
printf("Enter the elements of Matrix:\n");
int arr[ROW][COLUMN], minimum, i, j, temp, k, w, z = 0, q = 0 ;
/*
i = row iter... |
C | #include <config.h>
#include <cglib/cglib.h>
#include <stdarg.h>
#include "test-cg-fixtures.h"
/*
* This tests reading back an RGBA texture in all of the available
* pixel formats
*/
static const uint8_t tex_data[4] = { 0x12, 0x34, 0x56, 0x78 };
static void
test_read_byte (cg_texture_2d_t *tex_2d,
... |
C | #include <pthread.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
void* counter(void* x);
pthread_mutex_t mut;
typedef struct tParams{
int start;
int end;
pthread_t handle;
}tParams;
int main(int c, char *args[]){
long N = 100000000;
globalSum = 0;
int numThreads = 8;
pthread_t handle[numThreads... |
C | /*
Copyright (c) 2019 Olivier Meloche
L'autorisation est accordée, gracieusement, à toute personne acquérant une
copie de cette bibliothèque et des fichiers de documentation associés
(la "Bibliothèque"), de commercialiser la Bibliothèque sans restriction,
notamment les droits d'utiliser, de copier... |
C | #ifndef INIT_STRUCT
#define INIT_STRUCT(Struct_t, structure) Struct_t structure = {#structure}
#endif
#ifndef INIT_STRUCT
#define INIT_STRUCT(Struct_t, structure) Struct_t structure = {};
#endif
#ifndef NAME_OF_ARG_DEF
#define NAME_OF_ARG_DEF(ARG) #ARG
#endif
#include <assert.h>
const unsigned long CANARY_VAL =... |
C | //
// main.c
// Lab2 Problem 1C
//
// Aiden Barrett
// Student ID; B00075033
#include <stdio.h>
#include <stdlib.h>
int main()
{
float base , height , area;
printf("Enter base , height: ");
scanf("%f %f", &base , &height );
area = (base * height) /2.0... |
C | #include <stdlib.h>
#include <unistd.h>
#include <sys/time.h>
#include <errno.h>
#include "message_queue.h"
#include "mem.h"
#include "up_config.h"
#ifdef MB_TRACE
#define MB_MEM_STATIC_POOL_SIZE 100
struct mb_mem_static {
MessageBlock *mb;
int used;
};
static struct mb_mem_static mbms[MB_MEM_STATIC_POOL_SIZE];
s... |
C | #include <stdio.h>
#include <stdlib.h>
struct DOB /*structure for storing the date of birth in dd mm yyyy format*/
{
int dd;
int mm;
int yyyy;
};
struct student /*structure for storing the student data*/
{
char name[64];
struct DOB dob;
int height;
double weight;
} ;... |
C | #include<stdio.h>
#include<conio.h>
int main()
{
int i,num;
printf("Enter the number of elements:\n");
scanf("%d",&num);
int a[num];
printf("Enter %d elements in Array:\n",num);
for(i=0;i<num;i++)
{
scanf("%d",&a[i]);
}
printf("Eelments of array are:\n");
for(i=0;i<num;i++)
{
printf("a[%d] = %d\... |
C | #include <stdio.h>
#include <wchar.h>
#include <assert.h>
int main()
{
printf("1..1 - wcslen_c\n");
wchar_t *s;
size_t len;
s = L"abcdefghijkl";
len = wcslen(s);
printf("len: %lu\n", (unsigned long)len);
assert(len == 12);
printf("ok 1 - wcslen_c\n");
return (0);
}
|
C | #include <stdio.h>
#include <string.h>
#include "config.h"
JVSConfig config;
void trimToken(char *str, int maxlen)
{
int length = strnlen(str, maxlen);
/* Look for unwated paterrns and terminate the token*/
for (int i = 0; i < length; i++)
{
char val = *(str + i);
if (('\n' == val) |... |
C | # include <stdio.h>
# include <math.h>
# include <time.h>
# define LOWERLIMIT 2
# define UPPERLIMIT 1000
int is_prime(int i);
int main(void)
{
//测量时间
clock_t start, finish;
double duration;
start = clock();
//打印素数
printf("2-1000内所有的素数为:\n");
for(int i = LOWERLIMIT; i <= UPPERLIMIT; i++)
{
if(is_prime(i)... |
C | #include "bufio.h"
#include "helpers.h"
#include <stdlib.h>
struct buf_t *buf_new(size_t capacity) {
struct buf_t *res = (struct buf_t *)malloc(sizeof(struct buf_t));
if (res != NULL) {
res->data = (char*)malloc(capacity);
res->capacity = capacity;
res->size = 0;
}
return res;
}... |
C | #include "create_hero.h"
void print_attr(int active, int changed, char* name, int val, int line, int coll, int free_points)
{
if(active)
{
attrset(COLOR_PAIR(1));
if(changed)
attrset(A_BLINK | COLOR_PAIR(1));
}
mvaddstr(line, coll, name);
attroff(A_BLINK | COLOR_PAIR(1));
mv... |
C | #include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#define _GNU_SOURCE
#include <sched.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <sys/mman.h>
static char *child_stack;
static char *child_stack_end;
static size_t chil... |
C | /*
* Dylan Brown
*
* The purpose of this code is to accept a user's integer input, and output the
* prime numbers in the range and the number of twin prime sets there are.
*
*/
#include <stdio.h>
#include <math.h>
int checkForPrime(int val);
int promptUserForInteger();
int checkInputForCorrectValue(int input);
int fi... |
C | #include <stdio.h>
#include <math.h>
int n = 0; //存储棋盘大小
int res[16] = {-1}; //存储对应行的皇后列数
int count = 0; //记录总方法数
//在第n行找皇后的位置
void tosolve(int line)
{
//一列列搜索
for (int i = 1; i <=n; i++)
{
if (line != 1 && i == res[line - 1])
continue;
int flag = 1;
for (... |
C | #include <stdio.h>
#include <stdlib.h>
#include <linux/limits.h>
#include "shell_usage/term_utils.h"
void pash_loop(void) {
char *line;
char **args;
int status;
char *shell;
shell = pash_check_dir(shell);
do {
printf("%s", shell);
line = pash_read_line();
args = pash... |
C | /**
* \file io_graphique.h
* \brief Declaration des fonctions d'affichage graffique d'une grille
*/
#ifndef __IO_H
#define __IO_H
#include <stdio.h>
#include <cairo.h>
#include <cairo-xlib.h>
#include <X11/Xlib.h>
#include "grille.h"
#include "jeu.h"
/**
* \fn affiche_grille_gr(const grille *g, cairo_surface_t *... |
C | // Задача 2. Напишете функция area() без параметри. Поискайте от
// потребителя да въведе радиуса с помощта на функциите :
// printf("Enter a radius\n");
// scanf("%lf", &r);
// Използвайте горната функция 1.за изчисляване на площта на кръг,
// която написахме преди малко за да изчислите площта на кръга с този
// радиу... |
C | #include <stdio.h>
#include <math.h>
int main()
{
float P, c, d, n = 1.0, temp;
printf("\nEnter the original cost: ");
scanf("%f", &c);
printf("\nEnter the depriciation rate: ");
scanf("%f", &d);
printf("\nEnter the scrap value: ");
scanf("%f", &P);
while (temp >= P)
{
temp =... |
C | #include <stdio.h>
void printando(char M, int i, int N);
int main() {
int N; // N=ordem da matriz
while(scanf("%d",&N)!=EOF){ // condição para não ser EOF
// N é a ordem da matriz, mas os elementos são N*N
int elementos = N*N;
char M[elementos];
int i=0;
int meio= (elemen... |
C | #include<iostream>
#include<stdio.h>
#include<GL/glut.h>
#include<GL/gl.h>
float X1,X2,Y1,Y2;
void pixel(int x, int y) {
glBegin(GL_POINTS);
glVertex2i(x,y);
glEnd();
glFlush();
}
void bresenham(void){
glClear(GL_COLOR_BUFFER_BIT);
int dx, dy, i, p;
int incx, incy, inc1, inc2;
... |
C | #ifndef CAMERA_H
#define CAMERA_H
#define CAM_PARALLEL 1
#define CAM_CONIC 2
#define CAM_TRIPODE 3
#define CAM_PAN 4
#define CAM_STOP 0
#define CAM_EXAMINAR 1
#define CAM_PASEAR 2
typedef struct _Camera
{
// we consider a rigth handed reference system for the camera
// V point where the camera is placed (world ... |
C | #include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
//º¸µåÆÇ ÃʱâÈ »óÅÂ
int main(int argc, char *argv[]) {
int gameboard[6][6]={0};
board();
return 0;
}
int board(int gameboard[6][6]) {
int i,j;
printf(" 0 1 2 3 4... |
C | /*
* timer_setup.c
*
* Created: 14/09/2018 8:53:20 AM
* Author: Oliver K jkim838 846548800
*
* Revision 1.3.0
*
* This script file contains definitions for functions related to Timer and PWM.
*
*/
/*** Header Files ***/
#include <avr/io.h>
#include <stdint.h>
/*** Custom Header Files ***/
... |
C | // 计算谱半径
#include <stdio.h>
#include <math.h>
int main(int argc, char const *argv[])
{
int nums;
scanf("%d", &nums);
int i;
double a, b, temp;
double res = 0.0;
for(i=0; i<nums; i++){
scanf("%lf %lf", &a, &b);
temp = sqrt(a*a + b*b);
if(temp > res) res = temp;
}
printf("%.2lf\n", res);
return 0;
}
|
C | #include <stdio.h>
int main()
{
int a, b, c;
int max(int, int);
while (scanf("%d %d %d", &a, &b, &c) != EOF)
printf("%d\n", max(a, max(b, c)));
}
int max(int a, int b)
{
if (a > b)
return a;
else
return b;
} |
C | /* ************************************************************************** */
/* LE - / */
/* / */
/* ft_string.c .:: .:/ . .:: ... |
C | /**
* @file event.h
*
* @brief Simple definition of an event
*
* @author Gornet Mélanie
*
* This is a simple definition of an event
*/
#include <stdbool.h>
#include "particle.h"
#ifndef EVENT_H
#define EVENT_H
/**
* @brief An alias to the structure representing the event
*/
typedef struct event event;
/*... |
C | //멀티쓰레드
#include <stdio.h>
#include <Windows.h>
CRITICAL_SECTION cs; //cs에는 하나의 스레드만 들어갈 수 있다.
void delay()
{
for (int i = 0; i < 10000000; i++);
}
DWORD __stdcall foo(void *p)
{
// int x = 0;
static int x = 0;
for (int i = 0; i < 20; i++)
{
//Serialization : 직렬화
EnterCriticalSection(&cs); //cs에 들어간다
//---... |
C | /*
** EPITECH PROJECT, 2021
** error.c
** File description:
** error function
*/
#include "my.h"
#include "struct.h"
#include <stdlib.h>
void get_coords(map_i_t *map_i)
{
int idx = 0;
map_i->loc_coord = malloc(sizeof(row_col) * map_i->nb_loc);
for (int i = 0; map_i->map[i]; ++i)
for (int j = 0; m... |
C | #include <stdlib.h>
#include <unistd.h>
char *affiche_h(char c)
{
write(1, &c, 1);
return c;
}
char *affiche_e(char c)
{
write(1, &c, 1);
return c;
}
char *affiche_l(char c)
{
write(1, &c, 1);
return c;
}
char *affiche_l(char c)
{
write(1, &c, 1);
return c;
}
char *affiche_o(char c)
{
write(1, &c, 1);
return ... |
C | /*
** EPITECH PROJECT, 2019
** pushswap
** File description:
** push_list
*/
#include <linked_list.h>
void push_back(dlist_t **dlist, void *data, int name)
{
node_t *new_elemnt = malloc(sizeof(node_t));
new_elemnt->prev = NULL;
new_elemnt->next = NULL;
new_elemnt->data = data;
new_elemnt->name = n... |
C | #include <stdio.h>
#include <stdlib.h>
#include "customer.h"
#include "seller.h"
void *seller(void *seller_args) {
seller_args_t args = *((seller_args_t *) seller_args);
printf("{%s} id: %d, priority: %d\n", args.name, args.id, args.priority);
return NULL;
}
|
C | #include <sys/types.h>
#include <sys/wait.h>
#include <stdio.h>
#include <unistd.h>
int main()
{
pid_t p1,p2,p3,p4;
pid_t parent = getpid();
int c=0;
printf("Parent Process\n",getpid());
p1=fork();
if(p1<0)
{
return -1;
}
if(p1==0)
{
printf("Process 2 with pid: %d CREATED\n",getpid());
p2 = fork(... |
C | #include <string.h>
#include <stdlib.h>
#include <math.h>
int Back(const char* str, int len, int i) {
int c = str[i] - 48;
if (i == len - 1)
return c* pow(10, len - i - 1);
int numero = c*pow(10, len - i -1);
return numero + Back(str, len, i + 1);
}
int AToI(const char* str) {
if (str == NULL)
return... |
C | #include<unistd.h>
#include<pthread.h>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
extern void err_quit(const char *, ...);
void *thr_fn1(void *arg)
{
printf("thread 1 returning...\n");
return ((void *)1);
}
void *thr_fn2(void *arg)
{
printf("thread 2 returning...\n");
return ((void *)2);
}
int main... |
C | #include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#define ERROR(x) do { perror(x); exit(-1); } while (0)
#define ASSERT(x, y) do { if (!(x)) { perror(y); exit(-1); } } while (0)
void check(int i) {
if (i == 0x1234) {
... |
C | #include "sum.h"
#include "pipes.h"
#include <unistd.h>
#include <sys/wait.h>
int sum_of_one_proc(const int *arr, size_t size, int64_t *sum) {
if (arr == NULL || sum == NULL || size < 1) {
return NULL_ARGS;
}
*sum = 0;
size_t i_end = (int)((size - 1) / UPPER_BOUND);
for (size_t i = 0; i ... |
C | //
// StaticLink.h
// FuckC
//
// Created by pinn on 2018/12/25.
// Copyright © 2018 PINN. All rights reserved.
//
#ifndef StaticLink_h
#define StaticLink_h
#include <stdio.h>
#include <stdlib.h>
#endif /* StaticLink_h */
//通过 "数组+游标" 的方式存储具有线性关系数据的存储结构就是静态链表。
//静态链表中的节点
typedef struct {
int data;//数据域
... |
C | /**
* Dada Kernel
* October 2014
*
* Wiktor Lukasik (wiktor@lukasik.org)
*/
#include "console.h"
#include "sys.h"
void cpuid() {
register int b asm("ebx");
register int c asm("ecx");
register int d asm("edx");
__asm__("movl $0, %eax");
__asm__("cpuid");
cpu_name[... |
C | //C program to find vowels and consonants in a string using pointer.
#include<stdio.h>
void main()
{
char b[10];
char *p;
printf("Enter any string to find vowel or cosonant\n");
scanf("%s",b);
p=b;
if(*p=='a'||*p=='e'||*p=='i'||*p=='o'||*p=='u'||*p=='A'||*p=='E'||*p=='I'||*p=='O'||*p=='U')
{
printf("Given stri... |
C | #include<stdio.h>
#include<string.h>
#include<conio.h>
#include<time.h>
#include<stdlib.h>
int t=10000000;//t of play in seconds
int speed=10;//speed of snake(1 to 100 is prefereble).
int cw=82,ch=22;//canvas size
char CAN[50][125];//canvas array
int TAILX[4600]={0},taily[4600]={0},tails=0;//tail coordinates and number... |
C | /*
* File: faults.c
* Author: C17431
*
* Created on February 20, 2018, 8:52 AM
*/
#include "xc.h"
#include "faults.h"
#include "defines.h"
#define DRV_FLT_LED FAULT_LED_PORT
static LED_FLT_STATE fltLEDState = FAULT_LED_ON;
static uint8_t fltLEDToggleCnt = 0, fltDelayBlinks = 0;
static uint8_t fltLEDB... |
C | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* struct ListNode *next;
* };
*/
struct ListNode* addTwoNumbers(struct ListNode* l1, struct ListNode* l2)
{
struct ListNode *head, *tail;
int carry;
head = tail = (struct ListNode *)malloc(sizeof(struct ListNode));
... |
C | /*
** EPITECH PROJECT, 2019
** connection
** File description:
** connect to the other player
*/
#include "navy.h"
void handler(int sig, siginfo_t *si, void *unused)
{
if (info.p2 == 0)
info.p2 = si->si_pid;
}
int player_1(char **pos)
{
struct sigaction sa;
info.p1 = getpid();
info.p2 = 0;
... |
C | #include <stdio.h>
int main() {
int i, num, mv = 0, mp = 0;
for(i = 1; i <= 100; i++){
scanf("%d", &num);
if(num>mv){
mv = num;
mp = i;
}
}
printf("%d\n%d\n", mv, mp);
return 0;
}
|
C | /*
* KNN.c
* For assignment 4
* Created by Haomin Lin on 9/22/19.
* Copyright © 2019 Haomin Lin. All rights reserved.
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "KNN.h"
#include "queue.h"/* include two .h files for functions in this file */
/*
* define function all_distances
*/
void a... |
C | #include <stdio.h>
int main(void)
{
int n;
int m=1;
int k=1;
int g;
printf("Enter n:\n");
scanf("%d", &n);
printf("%8d%8d",m,k);
for (int i = 3; i <= n; i++)
{
g=m+k;
m=k;
k=g;
printf("%8d",g);
if(i%5==0){
printf("\n");
}
... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int numeros;
//int cantidadNumerosTotales = 0;
//int cantidadPares = 0;
//int sumaPositivos = 0;
//int maximo;
//int minimo;
//int negMax;
//int posMin;
//int entreNumeros;
//int promedio;
char pregunta;
... |
C | liste_occur* creer_case_liste_occur(char c)
{
int i=7;
liste_occur* nouv_case;
nouv_case = malloc(sizeof(liste_occur));
nouv_case->symbole = c;
nouv_case->nmb_occur = 0;
for(i=0; c > 0; i++) //ici on converti le num ascii du caractére... |
C | #include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#define DATA "The sea is calm tonight, the tide is full . . ."
int main(int argc, char *argv[])
{
int sock;
struct sockaddr_in name;
stru... |
C | #include <stdio.h>
void strncat(char *s1, char *s2, int len)
{
int i = 0; //Counters
int j = 0;
while (i < len)
{
if (*(s1 + j) != '\0')
{
j++;
}
else
{
*(s1 + j) = *(s2 + i); //Add an element of 's2' to the end of 's1'
i++;
j++;
*(s1 + j) = '\0'; //Clearing all the elements of 's1' afte... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* status.c :+: :+: :+: ... |
C | #include <stdlib.h>
#include <stdio.h>
#include <math.h>
void main() {
int numbCounter = 0;
int lookNum, rows = 0, cols = 0, num;
printf("What number do you want to find? ");
scanf("%d", &lookNum);
printf("Enter the rows of your array: ");
scanf("%d", &rows);
printf("Enter the cols of your arr... |
C | /***********************************************************
5num.c -- 五数要約
***********************************************************/
#include <stdio.h>
#include <stdlib.h>
int cmp(const void *k1, const void *k2) /* 比較 */
{
if (*((double *)k1) < *((double *)k2)) return -1;
if (*((double *)k1) > *((doub... |
C | #include<stdio.h>
int main(){
int a[10],b[10],i;
for(i=0;i<10;i++){
printf("a[%d]=%d\n",i,i+1);}
for(i=0;i<10;i++){
b[i]=i*i;
printf("b[%d]=%d\n",i,b[i]);}}
|
C | /*程序功能:
* 使用framebuffer向屏幕上面绘制颜色块。
* 具体为:
* 在屏幕的指定区域,绘制红,绿,蓝三种方形颜色块。
*目前的问题:
绘制颜色(ok).
如何正确的映射内存?
*
* 一个例子输出:
* # ./fbColor
* depth(bits per pixel) = 16
* xres= 1024,yres = 600,xres_virtual = 1024,yres_virtual = 600
* xoffset = 0, yoffset = 0, grayscale = 0
* height = 0 , width = 0 ,activate = 0
* pixcl... |
C | #include<stdio.h>
#include<pthread.h>
void *imprime_seno (void *x_seno)
{
int *x_seno = (int*)x_seno;
printf ("Valor do seno eh: %.2f",*x_seno);
pthread_exit(NULL);
}
int main ()
{
pthread_t thread_seno;
if (pthread_create(&thread_seno, NULL, incrementa_x, &x))
printf ("Erro... |
C | /*
* queuetest.c
*
* Created on: Feb 22, 2015
* Author: Tri
*/
#include <stdlib.h>
#include <stdio.h>
#include "queue.h"
typedef struct {
int x;
double y;
} Foo; // Just some arbitrary struct
int main() {
const int max_entries = MAX_ENTRIES;
Foo* new_foo1;
Foo* new_foo2;
Foo* new_foo3;
Foo* new_fo... |
C | /*
* Author: Manuel Ángel Suárez Álvarez
* E-mail Manuel_Angel99@outlook.com
* Created: 2016-08-13 20:03:31
*
* File: gdt.c
* Description: Implements the necesary functions for setting up the GDT
*/
#include <stdint.h>
#include <stddef.h>
#include <arch/x86/gdt.h>
// Setup a descriptor in the Global Descriptor Table... |
C | /* Code to generate CNF from Boolean & separation logic expressions */
/* General */
#define HAVE_LONGLONG 1
#if HAVE_LONGLONG
/* Might need to disable this when compiler doesn't support long long's */
typedef long long int llong;
typedef unsigned long long int ullong;
#else
typedef long int llong;
typedef unsigned ... |
C | #include <stdio.h>
int
main()
{
int i,j,rows;
/* printf(" enter the rows ");
scanf("%d\n", &rows );*/
printf("enter the no u want");
scanf("%d\n", &rows);
for(i = 0; i < rows; i++){
for (j = 0;j <= i;j++){
printf( "*" );
}
printf( "\n" );
}
return 0;
}
|
C | /*
* File: main.c
* Author: ZeroSama
*
* Created on 26 de Junho de 2014, 11:37
*/
#include <stdio.h>
#include <stdlib.h>
/*
*
*/
int main(int argc, char** argv) {
// 4 - Faça um programa que converta uma temperatura de Celsius para Fahrenheit e vice-versa.
// Utilize as fórmulas abaixo:
// Fahren... |
C | /****************************************************************
File: Stack.h
----------------
This is an interface for a stack ADT. The ADT supports routines
for stack creation, deletion, pushing (inserting), popping and
printing in an interpreted way.
********************************************************... |
C | #include "pipex.h"
#include <string.h>
#include <signal.h>
void ft_exit(char *str)
{
write(2, str, ft_strlen(str));
write(2, "\n", 1);
exit(0);
}
void freematrix(char **matrix)
{
int i;
i = -1;
while ((matrix)[++i])
free((matrix)[i]);
free(matrix);
}
void ft_execute(char *path,... |
C | /*
** algorithm.c for malloc in /home/gregoi_j/rendu/PSU_2014_malloc
**
** Made by Jean-Baptiste Grégoire
** Login <gregoi_j@epitech.net>
**
** Started on Sun Feb 1 16:12:39 2015 Jean-Baptiste Grégoire
** Last update Fri Feb 13 00:30:20 2015 Jean-Baptiste Grégoire
*/
#include "malloc.h"
t_header *first_fit(t_head... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <signal.h>
#include "SharedStructure.h"
void sig_handler(int);
int CheckTermination(int term);
int main () {
signal(SIGINT, sig_handler); //Register the signal handler
int shmId... |
C | #include <stdio.h>
#include <windows.h>
#include <math.h >
#pragma warning (disable : 4996)
int FindNumber(int arr[] , int len){
int number = 0;
for (int i = 0; i < len; i++){
// 相同的数异或为0, 最终只剩下唯一单独的数
number ^= arr[i];
}
return number;
}
int main(){
int arr[] = {2,2,4,1,9,4,9,8,1};
int len = sizeof(... |
C | #include "holberton.h"
/**
* rev_string - reverses a string
* @s: pointer to stringg
*/
void rev_string(char *s)
{
int i, j;
char k;
i = 0;
j = 0;
while (*s != '\0')
{
j++;
s++;
}
if (j > 0 && *s == '\0')
{
s -= j;
j--;
}
while (i < j)
{
k = *(s + i);
*(s + i) = *(s + j);
*(s + j) = k;
... |
C | //This will receive a string from tcl and process it as an RPN expression.
//Any token on the command line is first checked to see if it is a variable
//name. Then it is checked to see if it is a command name. Then it is
//checked for the special form: "fixN" or st:abc. Anything not fitting any
//of these forms is a... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <limits.h>
#include <libgen.h>
#include "sha.h"
#include "bootimg.h"
typedef unsigned char byte;
int read_padding(FILE* f, unsigned itemsize, int pagesize)
{
byte* buf = (byte*)malloc(siz... |
C | // kadai-14
#include <stdio.h>
#include <stdlib.h>
typedef struct shouhin {
char code[10];
char name[40];
int price;
} shouhinData;
int main(){
shouhinData items[100];
int i = 0;
while( scanf("%s %s %d", items[i].code, items[i].name, &(items[i].price)) != EOF){
printf("商品コード:%s\n", ite... |
C | #include<stdio.h>
int main()
{
float d,p;
printf("Enter diameter:");
scanf("%f",&d);
p=2*3.1416*(d/2);
printf("Perimeter=%.3f",p);
return 0;
}
|
C | #include <stdio.h>
/* Exercise 1_10 */
main ()
{
int c;
while((c = getchar()) != EOF)
{
if (c == '\t')
printf("\\t"); /* I am not sure if this is implied in the book. However perhaps if I had done ex1-2 (as I now have), experimentation could of revealed the result.
... |
C | #include "holberton.h"
/**
* rot13 - using rot13 to encode a string
* @s: character being changed
* Return: Always 0.
*/
char *rot13(char *s)
{
char in[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
char out[] = "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm";
int a;
int b;
for (a = 0; s[... |
C | #include <stdio.h>
#include <stdlib.h>
int i =15;
int j =20;
int main()
{
printf("I=%d\n",i);
printf("J=%d\n",j);
return 0;
} |
C | // Copyright (c) 2020, devgo.club
// All rights reserved.
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
int main(int argc, char const *argv[])
{
if (argc != 3)
{
fprintf(stderr, "Usage: %s <file> <bytes>\n", argv[0]);
return EXIT_FAILURE;
... |
C | #include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include "mainAux.h"
#include "commands.h"
#include "linkedList.h"
#define maxCommandSize 256
/* parsing input from the user and addresses the relevant command method */
void readAndReactBuffer() {
char command[maxCommandSiz... |
C | /**
* @file PWM.c
* @author
* @brief
* @version 0.1
* @date 2021-08-11
*
* @copyright Copyright (c) 2021
*
*/
#include "DataTypes.h"
#include "PWM.h"
/**
* @brief Initailze Phase Correct PWM
*
* @return EN_ERRORSTATE_t Error state
*/
EN_ERRORSTATE_t PWM_ENInitPhaseCorrect(void)
{
EN_ERRORSTATE_t sta... |
C | /* Take a maximum of 100 characters from the user.
* Stop taking inputs when the user enters dot (.),
* and print the number lowercase, uppercase letters,
* and the number of digits the user entered.
* Use break. (Take the characters with enter (newline) between them) */
#include <stdio.h>
int main()
{
... |
C | /*********************************************************************************************/
/**
* \fn max_h_Case(int a)
* \brief Fonction qui vérifie la limite des cases de la grille.
*
* \param a La taille de la grille.
*/
/*int max_h_Case(int a) {
if(a%2 == 1) {
a = a-1;
a++;
}
return a;
}*/
/**
* \... |
C | /* The MIT License
Copyright (C) 2011, 2012 Zilong Tan (eric.zltan@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the ... |
C | #ifndef MORFOSSINTAXE_H_INCLUDED
#define MORFOSSINTAXE_H_INCLUDED
/*Estrutura da Lista de Palavra.*/
typedef struct palavra{
char texto[100]; //Palavra da frase original.
char raiz[100]; //Raiz da palavra.
double percentagem; //Certeza da ferramenta em relacao a análise realizada.
int quantidade; //Qua... |
C | #include <stdio.h>
struct keysflag
{
unsigned int is_keyword : 1; // single bit width field, with use of colon we can say how many bits width field we want
unsigned int is_extern : 1;
unsigned int is_static : 3; // 3 bits wide
} flags = { 1, 1, 7 };
int main()
{
unsigned char c = 255;
printf("Val... |
C | #include "monty.h"
stainst_t stainst;
/**
* push_function - adds a new node at the beginning of a dlistint_t list.
* @stack: stack
* @line_number: line number
* Return: void
*/
void push_function(stack_t **stack, unsigned int line_number)
{
stack_t *new = NULL;
(void) line_number;
if (!stack)
exit(EXIT_FAILUR... |
C | #define _POSIX_C_SOURCE 1
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <strings.h>
#include <stdarg.h>
#include <stdlib.h>
#include <assert.h>
#include <ctype.h>
#include <unistd.h>
#include "yjson.h"
char ySymbolStr[][10] = {"null", "true", "false"};
int _debug = 0;
int _calllevel = 0;
void deb... |
C | /*
PROGRAMMER: khoa Tran
b. COURSE: CSCI 3133.01
c. DATE: feb 6, 2014
d. ASSIGNMENT: program 2
e. ENVIRONMENT: window 7, visual studio 2012
f. FILES INCLUDED: Visual studio 2012
h. INPUT: Allow your application to select the type of account and enter the number of checks written. The application should compu... |
C | #include <stdio.h>
void temperatura_msemana(int n, int m, int matriz[n][m]){
int i;
int j;
int suma_temp=0;
float temp_media_Semana=0;
for (i=0; i<n;i++){
for(j=0; j<m; j++){
suma_temp= matriz[i][j] + suma_temp;
}
}
temp_media_Semana = (suma_temp /(168));
printf("la temperatura media de la semana... |
C | #ifndef MSOLVER_H
#define MSOLVER_H
#include<cstdint>
//given a board and total number of mines,
//if this game is consistent
// set prob to MAX_PROB * (probability of a corresponding tile to be a mine)
// and return true
//elsewise return false
//_board: 0~8 is numbers, anything else is unknown
bool MSo... |
C | #include <stdio.h>
// 使用结构体(struct)将两个复数相加。
typedef struct complex
{
float real;
float imag;
} complex;
complex add(complex n1, complex n2);
int main(int argc, char const *argv[])
{
complex n1, n2, temp;
printf("The first complex: \n");
printf("Input the real and imag: \n");
scanf("%f %f", &n... |
C | #include <signal.h>
#include <assert.h>
#include "sr_nat.h"
#include "sr_protocol.h"
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
int sr_nat_init(struct sr_nat *nat) { /* Initializes the nat */
assert(nat);
/* Acquire mutex lock */
pthread_mutexattr_init(&(nat->attr));
pthread_mutexatt... |
C | #include "stdio.h"
#include "conio.h"
void main ()
{
/* Variable/Function prototype Declaration */
char source[25];
char target[25];
void mystrcp (char *,char *);
int mystrlen (char *);
/*Main Program*/
clrscr();
printf ("Enter String to be copied less than 25 Char:");
gets(source);
mystrcp (source,target);... |
C |
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <sys/queue.h>
#include "utils.h"
#include "config.h"
static TAILQ_HEAD(config_list, cfg_element) config_list = TAILQ_HEAD_INITIALIZER(config_list);
typedef struct cfg_element {
char *name;
... |
C | //shapes.h - header file containing shape info for ncurses tetris program
#define ABOVE -1
#define BELOW 1
#define RIGHT 1
#define LEFT -1
#define INLINE 0
typedef struct state {
int oldstate;
int newstate;
} board;
int shapes[144] = //shape maps, grouped as units of 3, doublets indicating position relative to el... |
C | #include<stdio.h>
#include<math.h>
int x[20], ansNum;
int main()
{
int n,i,j;
void NQueen(int k,int n);
printf("\n\nEnter the number of Queen for n Queen Problem: ");
scanf("%d",&n);
NQueen(1,n);
printf("\n\n");
return 0;
}
void print(int n)
{
int i,j;
printf("\n\nAnswer %d: \n", ++ansNum);
printf("(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.