language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* di.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <unistd.h>
#include <assert.h>
#include<fcntl.h>
#include<errno.h>
#include<wait.h>
#include<sys/select.h>
#include<sys/time.h>
//select的使用
int main()
{
int fd = 0;//stdin键盘输入
while(1)
{
fd_set fdset;//声明文件描述符集... |
C | #include <stdio.h>
int num[1000500]={0},y[1000500];
int main(void){
int n,m,dx,dy,a,b,temp;
long long int i;
scanf("%d%d%d%d",&n,&m,&dx,&dy);
y[0] = 0;
for(i=0;i<n;i++){
y[(i*dx) % n] = (i*dy) % n;
}
for(i=0;i<m;i++){
scanf("%d%d",&a,&b);
temp = b -y[a]>=0?b-y[a]:b+n-y[a];
num[temp]++;
}
t... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
//Global variables
//No. of items
int n = 0;
//Capacity of Knapsack
int capacity = 0;
int *profitArray, *weightArray, *bestset, *include;
float maxprofit = 0;
int num = 0;
int newN;
//Function declarations
void readFile(char *filePath);
void Knapsack();
void kna... |
C | #include<stdio.h>
void main()
{
int i,j;
i=8,j=10;
printf("%d,%d,%d%,%d\n",i,j,++i,j++);
} |
C | #include <stdio.h>
#include <pthread.h>
#include <stdint.h>
#include <unistd.h>
#include <stdlib.h>
#define PHILOSOPHERS 5
#define DAYS 10000
static const char* names[] = {
"Enryo", "Socrates", "Platon", "Aristoteles", "Kant"
};
int fork_status[PHILOSOPHERS]= {0, 0, 0, 0, 0}; // 0: available, 1: taken
pthread_t ... |
C | /* comms.c
*
* Author: Michael Bossner
*
* comms.c contains functions related to communication
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "comms.h"
#include "lib.h"
/////////////////////////////////// Defines ///////////////////////////////////
#define ZERO 48
#define NINE 57
#defi... |
C | #include "main.h"
char* load_path(char* path)
{
FILE *fp;
if ((fp = fopen(*path, "r")) != NULL)
{
fprintf(stderr, "file open error!\n");
return 1;
}
char line[2][128];
int cnt = 0;
while (memset(line[cnt], 0, sizeof(line[cnt])), fgets(line, sizeof(line[cnt]), fp) != EOF)
{
line[cnt++][strle... |
C | #ifndef __TEMPERATURE_H
#define __TEMPERATURE_H
/* Definitions and Macros */
// in degrees celcius
#define MIN_TEMP 10 // req 28: "The default minimum temperature shall be 10C."
#define MAX_TEMP 100 // req 27: "The default maximum temperature shall be 100C."
#define ROOM_TEMP 20
#define DEFAULT_M... |
C | #include <stdio.h>
#include <unistd.h>
int main(int argc, char *argv[]) {
int c;
int oa = 0;
int ob = 0;
int oc = 0;
while((c = getopt(argc, argv, "a:bc")) != -1) {
switch(c) {
case 'a':
oa = 1;
break;
case 'b':
ob = 1... |
C | /**
1 byte
00 : unk : free
01 : 64b : linked mem
02......
07 : 4kb : linked mem
User Data : 8b : 3b size, 4b Ref to user data
User Data Int : 8b : 7b int
User Data TinyUTF8: 8b : 7b string
Large Dict : 8b : 1b nparents, 2b nslots, 4b Ref to ext || parents guaranteed to be in the first block
Large List : 8b : 1b np... |
C | /* Chapter 3 programming projects */
#include <stdio.h>
int main (void)
{
//Question 1.
int day, month, year;
printf("Enter a date (dd/mm/yyyy): ");
scanf("%d/%d/%d", &day, &month, &year);
printf("You entered the date %4.4d%2.2d%2.2d\n", year, month, day);
//Question 2.
int in;
float ... |
C | /********
Excercise on using math, if else prep. Found on page 53 of the Cheng book.
PimentaDriverTest .c
Jenna Pimenta
C Programming *******/
#include <stdio.h>
#include <math.h> //for macro M_PI
int main()
{
double r;
(4.0/3)*3.14*r*r*r;
(9.0/5)* c + 32;
(4.0/3)*3.14*r*r... |
C | #include <stdio.h>
#include <string.h>
/* copy at most n characters of string ct to s ; return s . Pad with '\0' characters if ct has fewer than n characters. */
char *strncpy2(char *s, char *ct, int n);
char *strncpy2(char *s, char *ct, int n) {
while (*s++ = *ct++ && n-- > 0)
;
while (*ct++)
*s++ = '\... |
C | #include"../stacks.h"
void coinpre(stack *s)
{
//infix to prefix
printf("\n Enter the infix expression : ");
scanf(" %s",aa);
int len=strlen(aa); int c[30]; int j=0; int count=0;
printf("\n Length of above expression is : %d \n",len);
printf("\n The prefix expression is :\t");
for(i=len-1,p... |
C | /*
* File: SerialLED.c
* Author: junmo
*
* Created on 2019/10/21, 14:07
*/
#include<xc.h>
#include"SerialLED_PIC18F25K22.h"
void OUT_NONE(unsigned char LED_POWER) {
OUT_CHECK(0);
OUT_CHECK(0);
OUT_CHECK(0);
}
void OUT_RED(unsigned char LED_POWER) {
OUT_CHECK(LED_POWER);
OUT_CHECK(0);
... |
C | /*
* File: LED.h
* Purpose: Routines for the LEDs
*
* Notes:
*
*/
//Preprocessor Directives
#ifndef LED_H
#define LED_H
/* Includes */
#include <stdint.h> //stdint.h is a header file in the C standard library introduced in the C99 standard library section 7.18 to allow programmers to write more portable c... |
C | //Write a program to copy one binary tree to another binary tree
#include<stdio.h>
#include<stdlib.h>
struct Node{
int num;
struct Node *left;
struct Node *right;
};
struct Node *tree = NULL;
struct Node *insert(struct Node *tree, int digit);
void *exchange(struct Node *tree);
struct Node *temp;
int selec... |
C | #include <minix/drivers.h>
#include <minix/com.h>
#include "test4.h"
static int proc_args(int argc, char *argv[]);
static unsigned long parse_ulong(char *str, int base);
static long parse_long(char *str, int base);
static void print_usage(char *argv[]);
// *argc = number of arguments written.
// For example, in: se... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
//include "list.h"
#include "list1.h"
#include "sort.h"
int main()
{srand(time(NULL));
int *list; int a=1;
list=(int*)malloc( 44 );
list[0]=0; max=10;
char act[3];
while(1)
{
menu();
printf("\nChoose point: ");
... |
C | /*
The 50-30-20 strategy is a simple way to budget, which involves spending 50% of after-tax income on needs,
30% after tax income on wants, and 20% after-tax income on savings or paying off debt.
Given the after-tax income as ati, what you are supposed to do is to make a function that
will return an object that show... |
C | /* getenv(3)
*
* Author: Terrence W. Holm Aug. 1988
*/
#define NULL (char *) 0
extern char **environ;
char *getenv( name )
char *name;
{
char **v;
register char *n;
register char *p;
if ( environ == (char **) NULL || name == NULL )
return(NULL);
for ( v = e... |
C | /*
AUTHOR : SACHIN V B, SACHIN R
DESCRIPTION: PROGRAM FOR SIGN UP BY TAKING USER_NAME, PASSWORD AND NAME.
*/
#include<unistd.h>
#include<stdio.h>
#include<string.h>
#include<time.h>
char* date()
{
time_t t;
time(&t);
return (ctime(&t));
}
main(int argc,char **argv)
{
char *filename=NULL;
char *log_f... |
C | /*
* @lc app=leetcode.cn id=122 lang=c
*
* [122] 买卖股票的最佳时机 II
*/
// @lc code=start
int maxProfit(int* prices, int pricesSize)
{
int i, buy, sell, sum;
// 单调栈,反序递增减,当5出现时,弹出 如果是3 < 6直接弹出6-3,
// 1 < 5 , 弹出5 - 1 = 4
// 7,4
// 左侧最小值
i = 0;
sum = 0;
while (i < prices... |
C | #include "framestack.h"
#include "memoryinspect.h"
Frame* newFrame(JavaClass* jc, method_info* method)
{
Frame* frame = (Frame*)malloc(sizeof(Frame));
if (frame)
{
attribute_info* codeAttribute = getAttributeByType(method->attributes, method->attributes_count, ATTR_Code);
att_Code_info* co... |
C | #include <stdio.h>
#include <stdlib.h>
#include <locale.h>
int main()
{
int idade;
setlocale(LC_ALL, "Portuguese");
printf("Digite a idade em anos do nadador: ");
scanf("%d", &idade);
if (idade < 5)
printf("\nNadador no se encaixa em nenhuma categoria!\n");
else if (idade >= 5 && idad... |
C | /* Convert letters to upper case */
#include "stdio.h"
#include "string.h"
#include "ctype.h"
main()
{
char str[80];
int i;
strcpy(str, "this is a test");
for(i=0; str[i]; i++) str[i] = toupper(str[i]);
printf("%s", str);
}
|
C | #include <stdio.h>
#include <stdlib.h>
struct node
{
int data;
struct node *left, *right;
};
struct node *create()
{
int x;
struct node *newNode;
newNode = (struct newnode *)malloc(sizeof(struct node));
printf("enter data(-1 for no node)\n");
scanf("%d", &x);
if (x == -1)
{
r... |
C | // Emanuel Fonseca
// CSC 255 C AND UNIX
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
void Lowercase(char letter);
void Uppercase(char letter);
int TotalVowel(void);
void number(int num);
int Lowercounter=0;
int Uppercounter=0;
int vowelCounter=0;
char new[20];
char new2[20];
int num... |
C | extern int yylineno;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "table.h"
struct treenode {
struct treenode* bro;
struct treenode* chd;
char* type;
char* content;
int lineno;
int is_token;
int _type;
int dim;
struct struct_node* st;
};
struct treenode* new_node(char* type, int line... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <conio.h>
#include <time.h>
#include <windows.h>
#include <stdlib.h>
/*
һ⣺ö define 峣 ʲô
1#define ij Խе
2defineıʶ öپ
Ŀöٻ оϢ
ַ
1ӡַʹøʽ%s.Ҫע⣺%sӡʱ
ԭ\0ֹͣӡ
2strlen(); ַij:ǰַַĸ
ԭ\0ֹͣ
*/
#if 0
int main()
{
int year = 0;
for(year = 1000... |
C | /*=============================================================================
* Copyright (c) 2019, Eric Pernia <ericpernia@gmail.com>
* All rights reserved.
* License: bsd-3-clause (see LICENSE.txt)
* Date: 2019/05/03
* Version: 1.0.0
*===========================================================================... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "empleados.h"
//datos del empleado
struct empleadoE{
char nombre[30];
};
//almaceno datos
empleado crearEmpleado(char nombre[]){
empleado e = malloc(sizeof(struct empleadoE));
strcpy(e->nombre,nombre);
return e;
}
//cargo datos y los r... |
C | /*
A fork of CanonicalArduinoRead by Chris Heydrick
www.chrisheydrick.com
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdint.h>
#include <fcntl.h>
#include <termios.h>
#include <errno.h>
#include <sys/ioctl.h>
#define DEBUG 1
int setup(int * pfd, char * tty_dev, in... |
C | //program do ktorego podajemy z klawiatury ciagi znakow a on umieszcza je w tablicy dwuwymiarowej
#include <stdio.h>
#include <string.h>
void dane(char tab[][12], int j)
{
printf("Wprowadz wyraz: ");
scanf("%s", &tab[j]);
}
int main(void)
{
int i, j, min, char_int1, char_int2;
char tmp;
char tabli... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/wait.h>
#include<unistd.h>
#include<ctype.h>
#include<fcntl.h>
#define MAXCHAR 10000
#define MAXCOMMANDS 1000
int tokenize_at_pipes(char input[MAXCHAR],char tokens[MAXCOMMANDS][MAXCOMMANDS]);
int redirectionCheck(char* command... |
C | #include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#define MSGSZ 256
/*
* Declare the message structure.
*/
typedef struct msgbuf {
long mtype;
char mtext[MSGSZ];
}message_buf;
int sendMessage(){
//printf("*... |
C |
/******************************************
*
* mincsubvol
*
* Cuts down the minc file size by taking only
* a subvolume of the entire data
*
* Johnathon Walls, 2006
*
******************************************/
#include "fdr.h"
int isverbose=1;
int main(int argc, char *argv[]) {
int result;
long n3,... |
C |
/**
* hilla halevi 208953083
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <unistd.h>
#include <wait.h>
#include <memory.h>
#define MAX_COMMAND 1024
#define MAX_COMMAND_ARGS 512
#define MAX_BACKGROUND_PROCESSES 512
#define PRINT_ERROR fprintf(stderr, "Error in system call");
#define UPDA... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
char s[20];
int dig=0, vow=0, i=0;
printf("\t VOWELS AND DIGITS\n");
printf("Enter a String:");
gets(s);
while(s[i]!='\0')
{
switch(s[i])
{
case '0':
case '1':
case '2':
case '3':
case '4':
case '5... |
C | #include <ctype.h>
#include <errno.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "date.h"
#include "file.h"
#include "list.h"
#include "todo.h"
struct todo_item* new_todo_item(void)
{
return (struct todo_item*) calloc(1, sizeof(struct todo_item));
}
v... |
C | /**
*@brief スタックにデータを積む関数pushとデータを取り出す関数popを作る。
*
*
*@version 1.0.0
*
*/
#include <stdio.h>
#define MAXSIZE 100 /* スタックサイズ */
int stack[MAXSIZE]; /* スタック */
int stack_p = 0; /* スタックポインタ */
//int push(int n);
//int pop(int *n);
void main(void)
{
int c;
int n;
while (printf("]"),(c == ge... |
C | #include<stdio.h>
struct node
{
int data;
struct node *next;
};
struct node *head = NULL;
struct node* createNode()
{
struct node *temp;
temp = (struct node*)malloc(sizeof(struct node));
return temp;
}
void insertFront(struct node *ptr,int data)
{
ptr->data = data;
p... |
C | /* Hello World Parallel for program with illustarion to dynamic schedule clause */
#include <stdio.h>
#include <omp.h> // Header file for OpenMP
int main ()
{
/* Serial Section */
int i, j;
/*******************/
/* Parallel Section */
// #pragma omp parallel for private(i) schedule(dynamic)
#pragma omp para... |
C | #define _CRT_SECURE_NO_WARNINGS
/*ֹʹscanf()Ⱥʱ*/
/*
Ҫʵһʽı
ӿڶ壺
int Length( List L );
Listṹ£
typedef struct LNode *PtrToLNode;
struct LNode {
ElementType Data;
PtrToLNode Next;
};
typedef PtrToLNode List;
LǸLengthҪʽijȡ
1 3 4 5 2 -1
5
*/
#include <stdio.h>
#include <stdlib.h>
typedef int ElementType;
typede... |
C | // Use AES-based RNG
#include "aes-rng.h"
#ifdef __AES__
struct RNG_state *init_aesrand_r(uint32_t seed1, uint32_t seed2) {
// Internal state: count + t
struct RNG_state *rng = (struct RNG_state *) malloc(sizeof(struct RNG_state));
assert(rng);
rng->count = _mm_setr_epi32(seed1, seed2, 0, 0);
rng->k = _mm_setr_e... |
C | #define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
int demo(void) {
int i;
printf("-----------------ͻϢ-----------------\n");
printf(" 1 \n");
printf(" 2 \n");
printf(" 3 ɾ \n");
printf(" 4 \n");
printf(" ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* rotate.c :+: :+: :+: ... |
C | #ifndef REGISTRY_H
#define REGISTRY_H
#ifdef FEOS
#include <feos.h>
#else
#define FEOS_EXPORT
#endif
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
KEY_VOID, /* NULL data */
KEY_NUMBER, /* 64-bit int, signed or unsigned (user keeps track of signedness) */
KEY_STRING, /* string data... |
C | #include <stdbool.h>
#include "audio.h"
#ifndef __BEAT_H__
#define __BEAT_H__
msec_t beat_to_msec(float bpm,float beat);
typedef void (*drum_f)(track_t *t, float vol);
#define MAX_SUBTRACKS 32
typedef struct beatloop_s{
float bpm;
float beatCount; /* length of the loop in beats*/
int drumCount; /* total amount... |
C | #include <stdio.h>
#include <conio.h>
void main()
{
int a, b;
for(a = 1 ; a <= 7 ; a++)
{
b = a;
while(b <= 7)
{
printf("* ");
b++;
}
printf("\n");
}
getch();
} |
C | #include "holberton.h"
/**
* _isalpha - checks for alphabet characters
* @c: c argument has character value in ASCII
* Return: 1/0 character is alphabet/not alpha
*
*/
int _isalpha(int c)
{
if ((c >= 97 && c < 123) || (c >= 65 && c < 91))
{
return (1);
}
else
{
return (0);
}
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_texture_lock.c :+: :+: :+: ... |
C | #include <stdio.h>
// 排列組合
// 照順序排列
// 組合
// 每個字元輪流當首位,往後做排序
// list all permulations of an array
// @data array of chars to permulate
// @n length of array
void swap(char data[], int x, int y) {
char tmp = data[x];
data[x] = data[y];
data[y] = tmp;
}
// n為陣列長度
// m為想取的組合個數
// from為目前處理... |
C | #include "stc89c51_tim.h"
/*
* brief : Initial TIM0 and TIM1
* param_1: TIM0TIM1
* param_2: Timing_500usTiming_1msTiming_10msTiming_50ms
* param_3: TIM0_TimeBase_Mode_1TIM0_TimeBase_Mode_2TIM0_MeasrePW_ModeTIM0_PusCnt_Mode
* TIM1_TimeBase_Mode_1TIM1_TimeBase_Mode_2TIM1_MeasrePW_ModeTIM1_PusCnt_Mode
*/... |
C | #
/*
* Copyright c. John Hallam <sw@j.hallam.dk> 2015.
*
* This program is free software licensed under the terms of the GNU General
* Public License, either version 3 of the License, or (at your option) any
* later version. See http://www.gnu.org/licenses/gpl.txt for details.
*/
#include "general.h"
#include... |
C | #include <stdio.h>
int main()
{
printf("size of char: %ld byte(s)\n", sizeof(char) );
printf("size of unchar: %ld byte(s)\n", sizeof(unsigned char) );
printf("size of short: %ld byte(s)\n", sizeof(short) );
printf("size of unshort: %ld byte(s)\n", sizeof(unsigned short) );
printf("size of int: %ld byte(s)\n", s... |
C | #ifndef FitFunctions_h
#define FitFunctions_h
#include <math.h>
Double_t fitfunction(Double_t *x, Double_t *par){
Double_t value, value_th, value_0;
if (x[0]<par[2]) {
value = par[0] + par[1]*sqrt(x[0]) + par[3]*x[0]*sqrt(x[0]); // x^1/2 + x^3/2
}
else
{
value_th = par[0] + par[1]*sqrt(par[2]) + par... |
C | /* ************************************************************************** */
/* LE - / */
/* / */
/* ft_check_viewport.c .:: .:/ . .:: ... |
C | //
// Triplet_text.c
// dataStructure
//
// Created by 程传翔 on 2020/12/31.
//
#include "Triplet_text.h"
#include "Triplet.h"
#include "../predefined/predefined.h"
#include <stdio.h>
#include <stdlib.h>
void Triplet_text(void){
Triplet *T = InitTriplet(1, 2, 3);
print(T);
int e = 0;
Get(T, 2, &e);
... |
C | /*----------------------------monta_matriz.c---------------------------------*/
/* Este arquivo contem a funcao monta_mat que e responsavel por construir a matriz B' e B''
Ela utiliza as seguintes subfuncoes:
1) preench -> reenche as matrizes jacobianas B' e B''
... |
C | /*
* RandomMinute.c
*
* Created on: 07.03.2012
* Author: maersk
*/
#include "RandomMinute.h"
#include <stdlib.h>
static int b;
void RandomMinute_Create(int bound) {
b = bound;
srand(10);
}
int RandomMinute_GetImpl(void) {
// return (rand() % (2 * b + 1)) - b;
return b - rand() % (b * 2 + 1);
}
int (*R... |
C | #include "io_poll.h"
#include "io_poll_impl.h"
#if defined(HAVE_EPOLL)
#include <corelib/bin.h>
#include <corelib/close.h>
#include <corelib/error.h>
#include <sys/epoll.h>
/* iop->pd_in unused
* iop->pd_out used to hold epollfd structured returned from epoll_wait()
*/
static int iop_epoll_init(struct io_poll *io... |
C | #include <cs50.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
if (argc != 2) {
printf("Usage: %s key\n", argv[0]);
return 1;
}
string key = argv[1];
if (strlen(key) != 26) {
printf("Key must contain 26 characte... |
C | #pragma once
struct TreeNode
{
int value;
TreeNode *left;
TreeNode *right;
};
struct Tree
{
TreeNode *root;
};
Tree *createTree();
void add(Tree *root, int value);
bool exists(Tree *root, int value);
void remove(Tree *&root, int value);
void printSymmetrically(Tree *tree);
void printAntiSymmetrically(Tree *tr... |
C | #include "avl.h"
// Todas as funções implementadas por Janaine Rodrigues
noLista* buscaAVL(avl *r, unsigned long naochave) {
if(r == NULL)
return NULL;
if(naochave == r->naochave)
return r->regs;
if(naochave < r->naochave)
return buscaAVL(r->esq, naochave);
else
return buscaAVL(r->dir, naochave);
}
in... |
C | /*
Exercise 3-1. Our binary search makes two tests inside the loop, when one
would suffice (at the price of more tests outside). Write a version with only one
test inside the loop and measure the difference in run-time.
Version: 1
Date: April 19, 2018
Author: BornTuft
*/
#include <stdio.h>
int bins... |
C | /******************************************************************************/
/******************************************************************************/
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <inttypes.h>
/* qsort() u64s numerically */
static in... |
C | /*
** EPITECH PROJECT, 2019
** my_sort_int_array.c
** File description:
** task06
*/
void my_sort_int_array(int *array, int size)
{
int storage;
for (int o = 0; o < size - 1; o++) {
if (array[o + 1] < array[o]) {
storage = array[o + 1];
array[o + 1] = array[o];
arra... |
C | #include <stdio.h>
int main() {
double total_pembelian, discount = 0;
printf ("Total Pembelian = Rp ");
scanf("%lf",&total_pembelian);
if (total_pembelian >= 100000) {
discount = 0.05 * total_pembelian;
printf("Besarnya discount =Rp %.2lf\n",discount );
}
else if (total_pembelian < 100000) {
pr... |
C | /*----------------------------------------------------------------------------
* Author: Eshwar
* Created on 4 September, 2017, 8:37 PM
* Description: Linear queue
*----------------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#define M 20 // queue size
voi... |
C | /*********************************************************************************
*
* problem_ten.h
* Author: Mohamed Mostafa Abdel Karim
* Mohamed Hassan
*
********************************************************************************/
/****************************[Problem Description]*******************... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* is_correct.c :+: :+: :+: ... |
C | #include "ft_strlen.c"
#include <stdio.h>
int main()
{
char a[13] = "Hello World!";
int b;
b = ft_strlen(a);
printf("%d",b);
} |
C | #define _CRT_SECURE_NO_WARNINGS 1
//дһ 1 100 гֶٸ9
//#include <stdio.h>
//
//int main()
//{
// int m = 0;
// int n = 0;
// int i = 0;
// int count = 0;
// for (i = 1; i <= 100; i++)
// {
// m = i / 10;
// n = i % 10;
// if (m > 8 && m < 10)
// {
// printf("%d ", i);
// count++;
// }
// if (n > 8 && n < 10)... |
C | #include<stdio.h>
void main()
{
int n;
printf("Enter number limit:");
scanf("%d", &n);
for(int i=2; i<=n; i++){
if(i==2||i==3||i==5||i==7)
{
printf("\n%d\n", i);
}
else{
if(i%2!=0&&i%3!=0&&i%4!=0&&i%5!=0&&i%6!=0&&i%7!=0&&i%8!=0&&i%9!=0){
printf("\n\n%d\n", i);
}
}
... |
C | #define _CRT_SECURE_NO_WARNINGS
# include<stdio.h>
# include <math.h>
# include<stdlib.h>
# include<time.h>
#define ROW 3
#define COL 3
char g_board[ROW][COL];
void Init()//ʼ
{
srand((unsigned int)time(0));
for (int row = 0; row < ROW; row++)
{
for (int col = 0; col < COL; col++)
{
g_board[row][col] = ' ';... |
C | #include<stdio.h>
//void pokaz(void (* fw)(char *), char * lan);
void map( int(*pfn)(int) ,int tab[],int size);
int add4(int val);
int main(){
int tab[10] = {0,1,2,3,4,5,6,7,8,9};
map(add4,tab,sizeof(tab)/sizeof(int));
puts("Wyswietl elementy po modyfikacji");
for(int i=0;i<sizeof(tab)/sizeof(int); i++){
pr... |
C | /*
* profile.c -- For timing and event counting.
*
* **********************************************
* CMU ARPA Speech Project
*
* Copyright (c) 1996 Carnegie Mellon University.
* ALL RIGHTS RESERVED.
* **********************************************
*
* HISTORY
*
* 01-Aug-96 M K Ravishankar (rkm@cs.cmu.edu... |
C | #include<stdio.h>
#include<math.h>
int main()
{
int a[50];
int n;
int sum=0;
float average;
printf("enter the value of n\n");
scanf("%d",&n);
printf("enter the elements of array\n");
for(int i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(int i=0;i<n;i++)
{
sum=sum+a[i];
}
average=sum/n;
... |
C | #include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/cdev.h>
#include <linux/device.h>
#include <linux/wait.h>
#include <linux/slab.h>
#include <linux/semaphore.h>
#include <linux/sched.h>
#include <linux/uaccess.h>
struct generic_device
{
wait_queue_h... |
C | /*********************************************************************************/
/* Author : Islam Abdo */
/* Version : V01 */
/* Date : 17 OCT 2020 ... |
C | #include <stdio.h>
int main(){
int casos;
scanf("%d",&casos);
while(casos--){
int e, f, c, t = 0;
scanf("%d%d%d", &e, &f, &c);
if(c != 1){
e += f;
while(e / c){
t += e / c;
e = e / c + e % c;
}
}
printf("%d\n",t);
}
return 0;
} |
C | #include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
/*
* This is my solution to Project Euler Problem 4. In this problem, the user
* is asked to find the largest palindrome made from the product of two 3-digit
* numbers.
*/
int main(int argv, char *argc[])
{
int a[6];
int i, j, prod;
int palindrome =... |
C | #include <stdio.h>
#define BOARD_SIZE 10
void display(char b[][BOARD_SIZE])
{
char ch;
int i, j;
printf(" ");
for (i = 0; i < BOARD_SIZE; i++)
printf("%2d", i);
printf("\n ---------------------\n");
for (i = 0; i < BOARD_SIZE; i++) {
printf("%3d |", i);
for (j = 0; j < BOARD_SIZE; j++)
printf(" %c"... |
C | #include <stdio.h>
#include <stdlib.h>
char a[20] = "rucham dzieci";
struct ArrayQueue {
int *t;
size_t size; // Liczba elementów w kolejsce
size_t first; // Indeks pierwszego elementu w kolejce
size_t capacity; // Wielkość tablicy
};
struct ArrayQueue make_queue(size_t initial_capacity) {
struc... |
C | #include "util.h"
#include "data-structures.h"
#include "interp.h"
expr_t* expr;
env_t* env;
cont_t* cont;
expval_t val;
void value_of() {
switch (expr->tag) {
case const_exp:
val = inj_num(expr->num);
apply_cont();
break;
case var_exp:
val = apply_env(env, expr->var);
apply_cont();
bre... |
C | //
// Created by y123456 on 2021/9/23.
//
#include "include/ast.h"
#include "include/as_frontend.h"
#include <string.h>
#include <stdio.h>
static ast_t *var_lookup(list_t* list,const char* name){
for (int i = 0; i <list->size ; ++i) {
ast_t *child_ast = list->items[i];
if(child_ast->type != AST_VA... |
C | #include<stdio.h>
#include<stdlib.h>
struct node
{
int data;
struct node *left;
struct node *right;
}*root=NULL;
struct node *create(int data)
{
struct node *newnode=(struct node *)malloc(sizeof(struct node));
newnode->data=data;
newnode->left=NULL;
newnode->right=NULL;
return newnode;
}
void ... |
C | /*
* Copyright 2009 The Native Client Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can
* be found in the LICENSE file.
*/
/*
* Some useful formatting tools that allow us to build our own directive
* processing simply. The code assumes that directives of the form... |
C | /* Program to find a number is Even or Odd using Function with
no return value and argument */
#include<stdio.h>
#include<conio.h>
main()
{
void even();
even();
getch();
}
void even()
{
int a;
printf("Enter number: ");
scanf("%d",&a);
if(a%2==0)
{
printf("\n%d is an Even number",a);
}
... |
C | #ifndef _BHEAP_H_
#define _BHEAP_H_
#ifdef __cplusplus
extern "C"{
#endif
typedef struct bheap_t{
void *data;
int data_size;
int current_length;
int total_length;
}bheap_t;
typedef int (*bheap_compare_t)(void *a, void *b);
/* general compare method */
int bheap_compare_int_smaller(void *a, void *... |
C |
#include "v7_user.h"
#include <sys\time.h>
#include <sys\times.h>
#include <sys\queue.h>
#include "v7_internal.h"
#include <stm32f7xx.h>
#include <stm32746g_discovery.h>
#include <pin_macros.h>
#include "asm.h"
#define CLOCK_PRIOITY 1 /* high piroirty on clock but honestly it just ticks */
static struct timeval arch_... |
C | #include "types.h"
#include "stat.h"
#include "user.h"
#include "fs.h"
#include "fcntl.h"
#define NUM_CHILDREN 2
#define TARGET_COUNT_PER_CHILD 50
#define COUNTER_FILE "counter"
#define SEMAPHORE_NUM 0
int counter_init(char *filename, int value)
{
int fd;
if ((fd = open(filename, O_CREATE | O_RDWR))... |
C | #include<stdio.h>
#define N 200004
#define N1 N/2
/*problem id-11327
*
*language-ANSI C
*
*/
typedef unsigned long long ull;
int p[N],phi[N];
ull sum[N];
void EulerPhiSieve()
{
int i,j;
phi[1]=2, phi[2]=1;
for(i=3;i<N;i++) phi[i]=i;
for(i=4;i<N;i+=2) { phi[i]/=2;p[i]=1; }
for(i=3;... |
C | #include <stdio.h>
int main (void) {
int year;
printf("Enter year: ");
scanf("%d", &year);
int a, b, c, d, e, f, g, h, i, j, k, l, m, easterMonth, easterDate, p;
a=year%19;
b=year/100;
c=year%100;
d=b/4;
e=b%4;
f=(b+8)/25;
g=(b-f+1)/3;
h=(19*a+b-d-g+15)%30;
i=c/... |
C | #include <stdio.h>
int main()
{
float i = 64.25;
printf("Enter a floating-point value:%.2f \n", i);
printf("fixed-point notation:%f\n", i);
printf("exponential notation:%e\n", i);
printf("p notation:%a\n", i);
return 0;
} |
C | #include <stdint.h>
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
#include "gamma.h"
#include <stdbool.h>
#include <string.h>
int main() {
/*
scenario: test_random_actions
uuid: 559032029
*/
/*
random actions, total chaos
*/
gamma_t* board = gamma_new(8, 5, 5, 10);
assert( board != NULL );
assert( gam... |
C | #include <stdio.h>
#include <inttypes.h>
int main(void) {
int32_t me32;
me32 = 45933945;
printf("먼저, int32_t를 int형이라고 가정한다: ");
printf("me32 = %d\n", me32 );
printf("이제, 어떠한 가정도 하지 말자.\n");
printf("그 대신에, inttypes.h에 있는 \"macro\"를 사용한다: ");
printf("me32 = %" PRId32 "\n", me32);
return 0;
}
|
C | #include <pebble.h>
#include "weights_timer.h"
#define HEADER_MSG "Weights"
#define STOPPED_FOOTER_MSG "Select to start"
#define RUNNING_FOOTER_MSG "Select to stop"
#define SET_COUNT_MSG "Set %d"
#define REST_TIME_SEC 60
#define GET_READY_TIME_SEC 10
#define COOLDOWN_TIME_SEC 120
typedef enu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.