language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define C_OK 0
#define C_NOK -1
#define MAX_STR 64
typedef struct {
char title[MAX_STR];
char author[MAX_STR];
int year;
} BookType;
typedef struct Node {
BookType *book;
struct Node *next;
} NodeType;
typedef struct {
NodeType *head;
No... |
C | /* Created: 2020/09/03 21:35:04 by Preposterone */
/* Updated: 2020/09/03 21:55:10 by Preposterone */
#include "ft_list.h"
void ft_list_clear(t_list *begin_list, void (*free_fct)(void *))
{
t_list *temp;
while (begin_list)
{
temp = begin_list;
begin_list = begin_list->next;
free_fct(temp->data);
f... |
C | #ifndef __GEOMETRY_H__
#define __GEOMETRY_H__
#define EPSILON (0.00001)
#include <math.h>
/*
* Les couleurs en coordonnées RGB
*/
typedef struct scolor {
unsigned char r, g, b; // traduire unsigned char par entier <= 255
} color;
/*
* Point et vecteur sont deux objets différents mais ils sont tous
* représent... |
C | #include <stdio.h>
#define MAXLINE 1000
/*
Write the function `strrindex(s,t)` which returns the index position of
the rightmost occurrence of t in s, or -1 if there is none.
*/
/* NOTES
The function `strrindex` is very similar to the books `strindex`. The only
modification needed is to track the last matching ... |
C | #include <stdio.h>
#define DAY 365 /*매크로 DAY 정의 */
#define TIME 24 /*매크로 TIME정의 */
#define MINUTE 60 /*매크로 MINUTE */
#define SECOND 60 /*매크로 SECOND */
main()
{
long int sec;
/*매크로를 이용해 전처리하면 해당 문자열로 바뀐다, */
sec = DAY*TIME*MINUTE*SECOND;
printf("one year is %1d second\n", sec);
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* cmp.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<conio.h>
void main (void)
{
clrscr();
printf("Hello World\n");
getch();
}
|
C | /* Задача 1. Направете две функции и извикайте желаната функция с
указател към функция, съобразно знака, подаден от командния ред: */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int fplus(int a, int b){
return a + b;
}
int fminus(int a, int b){
return a -b;
}
int main(int argc, char *argv[]){
... |
C | #ifndef PAGEALLOCATOR_H_
#define PAGEALLOCATOR_H_
/*
* Every allocation needs an 8-byte header to store the allocation size while
* staying 8-byte aligned. The address returned by "myMalloc" is the address
* right after this header (i.e. the size occupies the 8 bytes before the
* returned address).
*/
#define HEA... |
C | #include "link_list_for_10_and_11.c"
int main(int argc, char const *argv[])
{
int i;
tLink_list *plink_list_A = Creat();
tLink_list *plink_list_B = Creat();
tLink_list *plink_list;
tStudent student;
for (i = 0; i < STD_NUM; ++i)
{
strcpy(student.school_num, SCHOOL_NUM[i]);
strcpy(student.name, NAME[i]);
A... |
C | /**
* \file kernel.c
* Various functions and defintions that are common to several parts of the
* kernel.
*/
#include "sys/kernel.h"
#include "sys/pmm.h"
#include "hal/hal.h"
#include "lib/stdio.h" // kprintf
#include "lib/string.h" // memcpy
void panic(const char* msg, const char* file, uint32_t line) {
clear_int... |
C | #include<assert.h>
#include<stdio.h>
#include<cgenerics/CGAppState.h>
#include"BB_RDParser.h"
CGAppState* appState;
BBScannerRule* startRule = NULL;
void testNewDelete() {
printf("%s... ", __func__);
char* text = "xyz";
BBToken* token = BBToken__new(BBTokenType_identifier, CGString__new(text));
/*
... |
C | #include "Packet.h"
#include <stdlib.h>
#include <string.h>
#define EGGBEATER_SOF_BYTE 0x55
#define EGGBEATER_EOF_BYTE 0xff
#define COMMAND_VALID(cmd) ( ( ( cmd ) == CtrlCommand_None ) \
|| ( ( cmd ) == CtrlCommand_Echo ) \
|| ( ( cmd ) == CtrlComman... |
C | #include<stdio.h>
main()
{
int n,N=0,s;
scanf("%d",&n);
while(n!=0)
{
N=N*10+n%10;
n=n/10;
}
printf("enter the same number");
scanf("%d",s);
if(N==s)
printf("palindrome");
}
|
C | /*
AUTHOR : VISHAL KUMAR GOURAV
PROBLEM : IMPLEMENT EXTENDED EUCLIDEAN ALGORITHM
*/
#include<stdio.h>
int extended(int a,int b,int *x,int *y){
if(a==0){
*x=0;
*y=1;
return b;
}
int x1,y1;
int gcd=extended(b%a,a,&x1,&y1);
*x=y1-(b/a)*x1;
*y=x1;
return gcd;
}
int main(){
int a=35,b=15,x,y;
if(a>b){
a=a... |
C | #include "parse.h"
#include "meme.h"
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
Pair *parse_list(Lexer *lexer) {
Token *const t = lexer->token;
if (!next_token(lexer)) {
fprintf(stderr, "unterminated list (%s:%d:%d)\n",
lexer->file_name, lexer->line, lexer->col);
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*USUARIO UVA: paulmartinezuva*/
int main(){
int x, cas, relevancia=0, nro=1;
scanf("%d",&cas);
while(cas--){
char str[100];
int rel=0;
printf("Case #%d:\n");
for(x=0;x<10;x++){
scanf("%s%d",str,rel);
if(rel>=relevancia){
rele... |
C | /* Author: Tim Nguyen (adopted from Buttenhof's Pthread book)
* -- workq API Pthread
* Allow to init a workq, destroy, and add tasks. */
#include "workq.h"
#include "cmake-build-debug/errors.h"
#include <stdlib.h>
/* initialize a workqueue:
* - Initialize condition variables
* - Initialize flags and workqueue *... |
C | #include "framebuffer.h"
static unsigned char *BitmapFont[256];
/* ============================= Frame buffer ============================== */
SDL_Surface *sdlInit(int width, int height, int bpp, int fullscreen) {
int flags = SDL_SWSURFACE;
SDL_Surface *screen;
if (fullscreen) flags |= SDL_FULLSCREEN;
... |
C | /*
COPYRIGHT (c) 2013 Gabriel Perez-Cerezo. <http://gpcf.eu>
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 rights to use, copy, modify... |
C | #include <stdio.h>
#include <stdlib.h>
void print_screen(char* screen, int byte_width, int length) {
int width = byte_width * 8;
int height = length / width;
char* line = malloc( sizeof(char) * width + 2); //number of pixels in one line + '\n\0'
line[width] = '\n';
line[width + 1] = '\0';
int i = 0;
int... |
C |
void Choix_1 (FILE* battements)
{
int *donnees;
int i,sizetab;
sizetab=init_size(battements);
donnees=malloc(sizeof(int)*sizetab);
for(i=0;i<sizetab;i++)
{
fscanf(battements, "%d\n", &donnees[i]);
}
for(i=0;i<sizetab;i++)
{
printf("%d\n", donnees[i])... |
C | //今儿又是活力满满的一天呢~
#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
unsigned int Gcd(unsigned M, unsigned N)//欧几里得算法 时间复杂度O(logN)
{
unsigned int Rem;
while (N>0)
{
Rem = M%N;
M = N;
N = Rem;
}
return M;
}
int main(void)
{
int a = 50;
int b = 15;
unsigned int ret = Gcd(a, b);
printf("%d ", ret);
retur... |
C | #include <stdio.h>
#include <unistd.h>
#include <stdbool.h>
#include <stdlib.h>
int main(int argc, char* argv[]){
char c;
int opt;
bool lORs = true;
while((opt=getopt(argc, argv, ":ls")) != -1){
switch(opt){
case 'l':
lORs = true;
break;
case 's':
... |
C |
#include <stdio.h>
void main()
{
int n;
scanf("%d",&n);
if(n%2==0)
printf("Even\n");
else
printf("Odd\n");
}
|
C | #include <stdio.h>
#include "util.h"
int main() {
char c;
char open[100];
int index = 0;
while((c = getchar()) != '\n') {
switch(c) {
case '{':
case '[':
case '(':
open[index++] = c;
break;
case '}':
case ']':
case ')':
open[--index] = NULL;
... |
C | #include <stdio.h>
/* Excercise 1-14 Write a program to print a histogram of the lengths of words
in its input. It is easy to draw the histogram with the bars horizal; a
vertical orientation is more challenging */
int main() {
// we need to store the lengths in an array from 0 to 20
int length[20];
int ... |
C | /***************************************************
FILE: Transformations.c
AUTHOR: tbl - based on Texture Town, Spring 2010
DATE: 11/04/10
***************************************************/
#include "Transformations.h"
#include "Shapes.h"
/**************************************************
Transformations... |
C | /* Program de sortare a unui vector prin interclasare */
#include <stdio.h>
#include <conio.h>
#define NMAX 100
int a[NMAX]; /* vectorul de sortat */
void afisare(int n)
{ /* afișarea vectorului */
int i;
printf("\n");
for(i=0; i<n; i++)
{
printf("%5d", a[i]);
if(((i+1) % 10)==0) printf... |
C | #include <stdio.h>
#include <math.h>
/***********************************************************
*Faça um algoritmo que calcule a área de uma esfera, *
*sendo que o comprimento do raio é informado pelo usuário. *
*A área da esfera é calculada multiplicando-se 4 vezes Pi *
*ao raio ao quadrado. ... |
C | /*++
Copyright (c) 2018 Trent Nelson <trent@trent.me>
Module Name:
CreateStringArray.c
Abstract:
This module implements the functionality to create a new STRING_ARRAY
structure as part of the steps required to create a new STRING_TABLE
structure. Routines are currently provided for creating an arra... |
C | #include <stdio.h>
#include <stdio.h>
void swap(int *x, int *y)
{
int c = *x;
*x = *y;
*y = c;
}
int main (void)
{
int x = 2;
int y = 3;
printf ("%d %d\n", x, y);
swap(&x,&y);
printf ("%d %d\n",x, y);
int *xp = &x;
int *yp = &y;
printf ("%p %p\n", &x, &y);
}
|
C | #include "JackTokenizer.h"
#include <string.h>
#include <dirent.h>
#include <errno.h>
#define JACK_FILENAME_MAX_LENGTH 255
#define XML_FILENAME_MAX_LENGTH JACK_FILENAME_MAX_LENGTH // length('.jack') - length('T.xml') = 0
#define JACK_DIRNAME_MAX_LENGTH 255
int analyzeByJackDir(DIR *dpJack, char *jackDirName);
int an... |
C | #include<stdio.h>
int main()
{
int x;
printf("enter the weekday number");
scanf("%d",x);
switch(x)
{
case 1:printf("monday");
break;
case 2:printf("tuesday");
break;
case 3:printf("wednesday");
break;
case 4:printf("thursday");
break;
case 5:printf("friday");
break;
case 6:printf("satur... |
C | #include "holberton.h"
#include <stdio.h>
/**
* _strspn - dfgddf
* @s: ffdsfds
* @accept: fdsds
*
* Return: dsfd
*/
unsigned int _strspn(char *s, char *accept)
{
char c, *p, *str;
for (str = s, c = *str; c != 0; str++, c = *str)
{
for (p = accept; *p != 0; p++)
{
if (c == *p)
{
goto next;
}... |
C | ///
/// main source https://steemit.com/utopian-io/@cuthamza/steps-to-create-animated-text-in-c-programming-language
///
#include <stdio.h>
#include <unistd.h>
#include "c-columns.h"
#include "c-tekswarna.h"
#include "c-teksgerak.h"
#include "c-cursorback.h"
#include "c-gtkwindow.h"
#include "c-gtkhelloworld.h"
#inclu... |
C | #include<stdio.h>
int main()
{
double x1,y1,x2,y2,x3,y3,x4,y4;
while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4)==8)
{
if(x1==x3 && y1==y3)
printf("%.3lf %.3lf\n",(x2+x4-x3),(y2+y4-y3));
else if(x1==x4 && y1==y4)
printf("%.3lf %.3lf\n",(x2... |
C | /******************************************************************************
****汾1.0.0
****ƽ̨
****ڣ2020-07-29
****ߣQitas
****Ȩ
*******************************************************************************/
#include "stmflash.h"
#include "iap_config.h"
/***********************************************************... |
C | /*
CoreSight board registration
Provides an abstract interface to registering boards with the library
Copyright (C) ARM Limited, 2013. All rights reserved.
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 cop... |
C | #ifndef GRAPHICS_H
#define GRAPHICS_H
#include <stdint.h>
#include <font.h>
#include <mailbox.h>
#define SCREEN_WIDTH 800
#define SCREEN_HEIGHT 480
#define COLORDEPTH 24
#define PIXEL_BYTES (COLORDEPTH / 8)
typedef struct {
uint8_t red;
uint8_t green;
uint8_t blue;
} color_t;
typedef struct {
uint3... |
C | /*
** my_swapstr.c for libmy in /home/arbona/CPool/CPool_infinadd/lib/my
**
** Made by Thomas Arbona
** Login <arbona@epitech.net>
**
** Started on Mon Oct 24 14:09:28 2016 Thomas Arbona
** Last update Mon Oct 24 14:10:27 2016 Thomas Arbona
*/
int my_swapstr(char **s1, char **s2)
{
char *tmp;
tmp = *s2;
*s... |
C | //Find the minimum depth of a binary tree
int min_depth(struct Node* root, int depth)
{
if (root->left == NULL && root->right == NULL)
return depth;
int x = (root->left != NULL) ? min_depth(root->left, depth+1) : depth;
int y = (root->right != NULL) ? min_depth(root->right, depth+1) : depth;
return (x < y) ? x... |
C | /*
* Copyright (c) 1994 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "@(#)hash.c 1.1 94/12/05 SMI"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <synch.h>
#include <memory.h>
#include <getxby_door.h>
static int hash_string();
hash_t *
make_hash(size)
int size;
{
h... |
C | /*ECED3204 Sample - Lab #7. By Colin O'Flynn, released into public domain */
#include <stdio.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
static int uart_putchar(char c, FILE *stream);
static int uart_getchar(FILE *stream);
FILE mystdout = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE);
FILE mystdin = F... |
C | #define _POSIX_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
#include <inttypes.h>
#include <limits.h>
#include <pthread.h>
#include <signal.h>
#include <time.h>
#inc... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* input_check.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <pcap.h>
#include <string.h>
#include <netinet/if_ether.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <arpa/inet.h>
#include <netinet/in.h>
void test_smtp(int, int, int, const u_char*, int, in... |
C | #include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "orderBook.h"
struct heap{
int * a;
size_t capacity;
size_t size;
};
struct orderBook{
struct heap * buy_heap;
struct heap * sell_heap;
};
#define INITIAL_SIZE (32)
#define SIZE_MULTIPLIER (2)
// Make a new empty order book.
Or... |
C | #include<stdio.h>
#include<stdlib.h>
#define OFFSET 2
struct RB{
RB * p1;
RB * p2;
unsigned char offset;
unsigned short sec;
};
int main()
{
struct RB * N;
struct RB rb;
printf("struct RB size is %d byte\n",sizeof(struct RB));
printf("struct RB size is %d byte\n",sizeof(rb));
printf("struct RB POINTER size is... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <malloc.h>
#include <windows.h>
#include <stdbool.h>
#include "GAME_CONST.h"
bool isWon(int result)
{
return result > WINNING_RESULT - 1;
}
int generateDiceValues()
{
return rand() % 5 + 1;
}
void fillRandomDices(int* diceArray, int amountUnusedD... |
C | #include <string.h>
#include "cols.h"
struct colors {
int id;
char *name;
char RGB[3];
} COLORS[] = {
{ 0, "black", {0, 0, 0} },
{ 1, "white", {255, 255, 255} },
{ 2, "red", { 255, 0, 0 } },
{ 3, "darkred", { 64, 0, 0 } },
{ 4, "green", { 0, 255, 0 } },
{ 5, "darkgreen", { 0, 64, 0 } },
{ 6, "blue", { 0, 0, ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <my_global.h>
#include <mysql.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/i2c-dev.h>
#include <unistd.h>
#include <string.h>
#include "button.h"
int i2c_fd1;
int i2c_fd2;
#define GPIO4 4
#define GPIO5 5
int pin1 = GPIO4;
int pin2 =... |
C | #include<stdio.h>
#include<math.h>
int main() {
double g=9.8;
double h,v,z;
printf("enter h,v,z:");
scanf("%lf,%lf,%lf",&h,&v,&z);
double a=(z*22)/(7*180);
double V=sqrt(2*g*h-v*v*(sin(a)*sin(a)));
double t=(V+v)/(2*g);
double D=v*cos(a)*t;
double H=h+(v*v*(sin(a)*sin(a)))/(2*g);
printf("H D V are %lf %lf %... |
C | #include <stdio.h>
#include <stdlib.h>
void display(int *A, int len);
void counting_sort(int *A, int *B, int k, int len);
int main(int argc, const char * argv[]) {
int a[8] = {2, 5, 3, 0, 2, 3, 0, 3};
int b[8] = {0};
display(a, 8);
counting_sort(a, b, 6, 8);
display(b, 8);
retur... |
C | #include<stdlib.h>
#include<stdio.h>
int main()
{
float **a;
int i=0, imax=3;
int j, jmax=3;
a =(float **)malloc(imax*sizeof(float *));
for(i=0; i<imax; ++i){
a[i] = (float *)malloc(jmax*sizeof(float));
}
for(i=0; i<imax; ++i){
for(j=0; j<jmax; ++j){
a[i][j] = 0.0;
(i =... |
C | #include <stdio.h>
int main()
{
int money,note100,note50,note20,note10,note5,note2,note1;
scanf("%d",&money);
printf("%d\n", money);
note100=money/100;
printf("%d nota(s) de R$ 100,00\n", note100);
note50=(money%100)/50;
printf("%d nota(s) de R$ 50,00\n", note50);
... |
C | #include <stdio.h>
#include <stdlib.h>
#include "lists.h"
/**
*delete_dnodeint_at_index - deletes the node at index index of linked list.
*@head: head of the linked list
*@index: index of the node to be deleted
*Return: 1 if it succeeded, -1 if it failed
*/
int delete_dnodeint_at_index(dlistint_t **head, unsigne... |
C | #include <stdio.h>
int R, C;
char cine[500][500];
int vr[300][300], vc[300][300], vp[300][300];
int min(int a, int b) { return a < b ? a : b; }
int vago(char c)
{
if(c == '.') return 1;
else return 0;
}
int count(int ri, int ci, int rf, int cf)
{
if(ri == 0 && ci == 0) return vp[rf][cf];
if(ri == 0) return vp[r... |
C | /*
* Example unit test demonstrating how to detect buffer errors.
*
* Author: Mike Bland (mbland@acm.org, http://mike-bland.com/)
* Date: 2014-05-13
* License: Creative Commons Attribution 4.0 International (CC By 4.0)
* http://creativecommons.org/licenses/by/4.0/deed.en_US
*
* URL:
* https://code... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int i, n, npar = 1;
do
{
printf("Enter a number to calculate its factorial\n");
scanf("%d", &n);
} while ((n <= 0) || (n >= 10));
switch (n)
{
case 0:
npar = 1;
break;
case 1:
npar = 1;
... |
C | #include<stdio.h>
#include<stdlib.h>
struct Node {
int data;
struct Node * link;
};
struct Node * top;
void Push(int x) {
struct Node * temp = (struct Node *)malloc(sizeof(struct Node));
temp->data=x;
temp->link=top;
top=temp;
}
void Pop() {
struct Node * temp;
if(... |
C | #include <stdio.h>
//int main(void)
//{
// // ü α ⺻ 3 Ʈ ϴ.
//
// // Ʈ ϸ
// // stdin ǥ Է Ʈ
// // stdout ǥ Ʈ
// // stderr ǥ Ʈ
//
// int ch;
//
// while (1)
// {
// ch = fgetc(stdin);
// if (ch == EOF)
// {
// break;
// }
// fputc(ch, stdout);
// }
// system("pause");
// return 0;
//}
// Ŀ ؽƮ ϰ ̳ʸ Ϸ ... |
C | #ifndef io_k8s_apimachinery_pkg_version_info_TEST
#define io_k8s_apimachinery_pkg_version_info_TEST
// the following is to include only the main from the first c file
#ifndef TEST_MAIN
#define TEST_MAIN
#define io_k8s_apimachinery_pkg_version_info_MAIN
#endif // TEST_MAIN
#include <stdlib.h>
#include <string.h>
#incl... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "recipe.h"
void print_recipes(Recipe recipes[], int num)
{
int i = 0;
for(i = 0; i < num; i++)
{
printf("%d: ", recipes[i].id);
printf("%s\n", recipes[i].name);
}
} |
C | #ifndef MYTIME_H_INCLUDED
#define MYTIME_H_INCLUDED
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <stdio.h>
#include <stdbool.h>
#include <assert.h>
static int day_in_month[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
typedef struct {
int year;
int month;
int day;
i... |
C | #include <stdio.h>
#include <string.h>
#define MAXLEN 1024
void reverse(char s[]);
void reverser(char s[], int i, int j);
int main()
{
char s[MAXLEN];
while (fgets(s, MAXLEN, stdin) > 0) {
reverse(s);
printf("%s\n",s);
}
return 0;
}
void reverse(char s[])
{
reverser(s, 0, strle... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_isint.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define IADD 0x60
#define ISUB 0x64
#define IMUL 0x68
#define IDIV 0x6C
#define ILOAD 0x10
typedef struct ExprNode{
struct ExprNode *left;
char data[10];
struct ExprNode *right;
}ExprNode;
FILE *fp=0;
void postordertraversal(ExprNode *... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_may_pose.c :+: :+: :+: ... |
C | #include "stdio.h"
#include "defs.h"
void s_SwitchSingal();
void g_DisplaySingalSwitch();
int SW__getnum();
static void s_TimeEdit(u8 u8singalColor, u8 u8singalTime);
static u8 s_TimeLimitJudge(u8 u8singalColor, s16 s16Time);
struct ColorTime g_ctTimeSet = {120,10, 120};
struct ColorTime g_ctTimeDown = {120,10, 120};
... |
C | #include <stdio.h>
#include <Windows.h>
int main(void)
{
// pierwszy rzdek
printf_s("%2s|","");
for (char i = 0; i < 16; i++) {
printf_s(" *%X", i);
}
printf_s("\n");
// drugi rzdek
printf_s("%s\n",
"--+------------------------------------------------");
// gwne zadanie
for (char i = 2; i <= 7; i++) {
... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>
double loglikelihood(int t, double R, int *data, int *imp, double **omega, int n);
int main(int argc, char *argv[]){
char *seed = NULL;
gsl_rng *gsl;
int *data;
int *... |
C | /***********************************************************
* Author : M_Kepler
* EMail : m_kepler@foxmail.com
* Last modified: 2018-07-01 13:33:56
* Filename : sys9.c
* Description :
* 首先使用fork创建一个子进程,接着为了保证子进程不在父进程调用kill之前退出
* 在子进程中使用raise函数向子进程发送SIGSTOP信号,使子进程暂停
* 接下来,再在父进程中调用kill向子进程发送信号,请使用SIGK... |
C | #include<stdio.h>
int main(){
//Checking positiveOrNegative
int input;
printf("enter a int number:");
scanf("%d",&input);
if(input>0)
printf("%d is positive number.",input);
else if(input<0)
printf("%d is negative number",input);
else
printf("%d is zero",i... |
C | #include <assert.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#define _GNU_SOURCE
int main(int argc,char* argv[])
{
if(argc!=2)
{
printf("usage:%s <file>\n",argv[0]);
return 1;
}
int filefd=open(argv[1],O_CREAT|O_WRONLY|O_TRUNC,0666);
asse... |
C | #include <stdlib.h>
#include <stdio.h>
int main(int argc, char **argv) {
int cookie;
char buf[80];
printf("buf: %08x cookie: %08x\n", &buf, &cookie);
gets(buf);
if (cookie == 0x01020005)
printf("you win!\n");
}
|
C | // https://cryptopals.com/sets/1/challenges/5
#include "../helper.h"
int main()
{
char *text = "Burning 'em, if you ain't quick and nimble\nI go crazy when I hear a cymbal";
char *answer = "0b3637272a2b2e63622c2e69692a23693a2a3c6324202d623d63343c2a26226324272765272a282b2f20430a652e2c652a3124333a653e2b2027630c692b... |
C | /*
* Rewrite the temperature conversion program of Section 1.2 to use a function
* for conversion
*/
#include <stdio.h>
/*
* Summary:
* Converts a temperature in Fahrenheit to Celsius
* Parameters:
* fahr (float): temperature in Fahrenheit
* Return Value:
* Celsius value of 'fahr' (float)
* Description... |
C | /*
* psutils.c
*/
#include <stdio.h>
#include "psutils.h"
static char psstring[10000];
static FILE *opf;
void ps(char *string)
{
fprintf(opf, "%s\n", string);
}
void psDrawChar(char aChar)
{
switch (aChar) {
case '(':
sprintf(psstring, "(\\50) show");
break;
case ')':
sprintf(psstring, "(\\51) sh... |
C | #include "reverse_aska.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define B32_SIGNATURE "\x05\xe2\x00\xcf\xee\x7f\xf1\x88"
int fetch_b32value(const unsigned char* code, int* pos, int code_bytes)
{
int i;
int offset;
int fetch_bytes;
int ret_value;
if (*pos < 0) return 0;
if (code[*pos] == 0... |
C | /* $Source$
* $State$
* $Revision$
*/
#include <fcntl.h>
#include "libsys.h"
/*
* Say whether a particular fd is currently open in text or binary mode.
* Assume that the fd is valid. Return O_TEXT or O_BINARY.
*/
int _sys_getmode(int fd)
{
int reqbegfd = fd & ~_FDVECMASK;
struct _fdmodes *p = &_sys_fdmodes;
... |
C | #include<stdio.h>
#include<stdlib.h>
int main()
{
int i,*pizza,maximum,curr_slice,curr_type,type,counter;
printf("Maximum number of pizza slices");
scanf("%d",&maximum);
printf("types of pizza");
scanf("%d",&type);
pizza=(int*)malloc(type*sizeof(int));
for(i=0;i<type;i++)
scanf("%d",... |
C | #ifndef QUEUE_H
#define QUEUE_H
#include <stdint.h>
#include <stddef.h>
struct queue_item;
struct queue_item
{
struct queue_item* next;
uint32_t v;
};
typedef struct queue_item queue_item_t;
typedef struct
{
queue_item_t* front;
queue_item_t* last;
size_t size;
} queue_t;
void queueInit(queue_t... |
C | #include "density_map.h"
#define MAX_PEAKS 100
#define MIN_DENSITY 1500
#define xkl 20
#define ykl 20
#define xcl ( DENSITY_MAP_WIDTH + xkl - 1 )
#define ycl ( DENSITY_MAP_HEIGHT + ykl - 1 )
double xk[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
double yk[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1... |
C | #include "print_uart.h"
#include <avr/power.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/sleep.h>
#include <util/atomic.h>
#include <stdbool.h>
#include <stdlib.h>
volatile bool rxcflag = false;
/* USART Data Register Empty interrupt handler */
ISR(USART_UDRE_vect, ISR_BLOCK)
{
if (('\0' == wrbuf... |
C | #include "expression/ast.h"
#include <stdlib.h>
struct ast_node *ast_make(int type, struct ast_node *left,
struct ast_node *right)
{
struct ast_node *res = malloc(sizeof(struct ast_node));
if (!res)
return NULL;
res->type = type;
res->data = NULL;
res->nb_data =... |
C | //http://projecteuler.net/problem=39
//Author - Ashish Kedia, NITK Surathkal
//@ashish1294
#include<stdio.h>
#include<math.h>
int i,j,k,arr[1001]={0},root[10000001],max=9;
int main()
{
for(i=0;i<1000001;i++) root[i]=-1;
for(i=0;i<1001;i++) {arr[i]=0;root[i*i]=i;}
for(i=1;i<500;i++)
{
... |
C | #include<stdio.h>
unsigned setbits(unsigned x, int p, int n, unsigned y);
int main(){
unsigned int x = 150;
unsigned int y = 25;
printf("test: %d\n", ~(~0<<3)<<2 );
printf("x: %d\n", setbits(x, 4, 3, y));
return 0;
}
unsigned setbits(unsigned x, int p, int n, unsigned y){
return x & ~(~(~0 << n) << (p+1-n... |
C | /*
* uart_cli.c
*
* Created on: Mar 25, 2021
* Author: Wiktor Lechowicz
*
* This code contain reusable code for usart based command line interface targeted for stm32 MCUs based on HAL drivers.
*
* * HOW TO USE *
* Create struct CLI_field_destrictor array to describe content of memo... |
C | //
// This file was generated by the Retargetable Decompiler
// Website: https://retdec.com
// Copyright (c) 2015 Retargetable Decompiler <info@retdec.com>
//
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
/* ------- Float Types Definitions ------ */
typedef float float32_t;
typedef double float64_t;
/*... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <signal.h>
#include <errno.h>
#include <sys/wait.h>
#define MAXBUF 1024
void handler2(int sig) {
int olderrno = errno;
while(waitpid(-1, NULL, 0) > 0) {
printf("handler reaped child\n");
}
sleep(1);
errno = olderrno;
}
... |
C | #include <sexo.h>
#include <dirs.h>
private mapping clases = ([ ]);
private nosave object * obs_clases = ({ });
int cargar_clase() {
object ob;
string err;
foreach(string clase in keys(clases)) {
err = catch(ob = load_object(clase));
if ((err) || (!ob)) {
write("Error cargando la clase "+clase+"\n... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fractals_v2.c :+: :+: :+: ... |
C | /**
* Copyright (C) 2019-2020 Tristan
* For conditions of distribution and use, see copyright notice in the COPYING file.
*/
#include "stream.h"
#include <stdio.h>
#include <stdlib.h>
h2stream_list_t *h2stream_list_create(uint32_t max_size) {
h2stream_list_t *list = malloc(sizeof(h2stream_list_t));
if (!list)
... |
C | #include <stdio.h>
#include "date.h"
void printDate(const Date *pd)
{
//printf("(%d/%d/%d)\n", (*pd).year, (*pd).month, (*pd).day);
printf("(%d/%d/%d)\n",pd->year, pd->month, pd->day);
}
|
C | /**
* NWEN 302 ARP Implementation
* This is where you should implement the functions
*
* Name:Kurtis Fenton
* Student ID:300473865
*/
#include "arp_functions.h"
#include "my_arp.h"
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <net/if.h>
#include <net/if_arp.h>
/*mac address*... |
C | /* Copyright (C) 2019 SCARV project <info@scarv.org>
*
* Use of this source code is restricted per the MIT license, a copy of which
* can be found at https://opensource.org/licenses/MIT (or should be included
* as LICENSE.txt within the associated archive or repository).
*/
#include "util.h"
int opt_debug ... |
C | //27. WAP to find the number of and sum of all integers greater than n1 and less than n2 and divisible by 7, where n1<n2 and n1 & n2 are read from the keyboard.
#include<stdio.h>
void main()
{
int n1,n2,i,sum=0,c=0;
printf("Enter value of n1 and n2:\n");
scanf("%d%d",&n1,&n2);
if(n2>n1)
{
... |
C | #include <stdio.h>
void swap(int* a, int* b){
int a1 = *a, b1 = *b;
*a = b1;
*b = a1;
}
int main(){
int a, b;
scanf("%i %i", &a, &b);
printf("a = %i, b = %i\n", a, b);
swap(&a, &b);
printf("a = %i, b = %i\n", a, b);
return 0;
}
|
C | /* ========================================
*
* Copyright YOUR COMPANY, THE YEAR
* All Rights Reserved
* UNPUBLISHED, LICENSED SOFTWARE.
*
* CONFIDENTIAL AND PROPRIETARY INFORMATION
* WHICH IS THE PROPERTY OF your company.
*
* ========================================
*/
#include "project.h"
#include <stdio.h>
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.