language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/** * @file byte_code.c * @brief Purpose: byte code operation * @version 1.0 * @date 04.18.2017 * @author Rundong Zhu */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include <errno.h> #include "utils/link_list.h" #include "utils/symbol_table.h" #include "utils/parsing_tree.h" #include "utils/erro...
C
/* * modgpio.h * * Created on: May 5, 2014 * Author: quangng */ #ifndef MODGPIO_H_ #define MODGPIO_H_ #define GPIO_IOC_MAGIC 'k' typedef enum {MODE_INPUT=0, MODE_OUTPUT} PIN_MODE_t; typedef enum {DIRECTION_IN = 0, DIRECTION_OUT} PIN_DIRECTION_t; struct gpio_data_write { int pin; char data; }; struct g...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #define BUF 512 #define MBUF 128 #define N 10 long long hashMe(unsigned char *str) { long long h = 1; int i; unsigned char magic_number = 0x5F; for (i = 0; i < 8 && i < strlen((char *)str); i++) { str[i] ^= magic_number; h *= str[i]...
C
#include <stdio.h> #include <stdint.h> #include <string.h> //#define POLY 0x8408 #define POLY 0x1021 /* // 16 12 5 // this is the CCITT CRC 16 polynomial X + X + X + 1. // This works out to be 0x1021, but the way the algorithm works // lets us use 0x8408 (the reverse of th...
C
#include <cs50.h> #include <stdio.h> #include <string.h> #include <ctype.h> int main(int argc, string argv[]) { //make sure command line argument number is 2 if (argc==2){ //check argv[1] is number for(int i=0,len=strlen(argv[1]);i<len;++i){ if(isdigit(argv[1][i]) ){ ...
C
#include <queue.h> /* Create a oddpair_XY variable */ struct oddpair_XY createOddpair_XY(int16_t OX, int16_t OY, int8_t sign) { struct oddpair_XY XY; XY.OX = OX; XY.OY = OY; XY.sign = sign; return XY; } /* Initialize a stack */ Queue_XY initQueue_XY() { Queue_XY queue; queue.head = queue.tail...
C
/* https://stackoverflow.com/questions/342409/how-do-i-base64-encode-decode-in-c */ #ifndef BASE64_H_ #define BASE64_H_ #include <stdint.h> #define BASE64_OUTPUT_LEN(len) (4u * (((len) + 2) / 3)) void b64_init(void); void b64_encode(const uint8_t *data, uint32_t input_length, ...
C
#include <stdio.h> #include <stdlib.h> #include <float.h> #include <math.h> #define INF INT32_MAX //#define Test 1 /* * Check strict math settings * We rely on the assumption that we store the vertices in an order where there is an edge from vertex i to i + 1 * If slope is infinity c is in the form x - c = 0 * Ma...
C
#include "Search_Engine.h" int main() { char c; char word[100]; char fileName[9][100]; int word_num_sum = 0; int comparison_sum = 0; strcpy(fileName[0], "document1.txt"); strcpy(fileName[1], "document2.txt"); strcpy(fileName[2], "document3.txt"); strcpy(fileName[3], "document4.txt"); strcpy(fileName[4], "doc...
C
#ifndef __EEPROM__H #define __EEPROM__H #define EEPROM_ADDRESS 0xA2 #define EEPROM_SIZE 32768 /* EEPROM : addr , size , buf . */ extern bit ReadEEPROM(unsigned short address, unsigned char xdata *buf, unsigned short length); /* EEPROM : addr , size , ...
C
#include<linux/module.h> #include<linux/init.h> #include<linux/fs.h> #include<linux/cdev.h> MODULE_LICENSE("GPL"); // GPL license used by linux kernel developer..module stacking..some driver might not compatible with non GPL MODULE_AUTHOR("DU"); /*things need for char device * 1.device numbe:dev no. is used by linu...
C
#include <stdio.h> int main() { int c, v, hun, fif, twe, ten, fiv, two; scanf("%d", &v); c=v; hun=c/100; c=c-(hun*100); fif=c/50; c=c-(fif*50); twe=c/20; c=c-(twe*20); ten=c/10; c=c-(ten*10); fiv=c/5; c=c-(fiv*5); two=c/2; c=c-(two*2); printf("%d\n", v); ...
C
#include <cogo/cogo_await.h> // should be invoked through CO_AWAIT() void cogo_await_await(cogo_await_t* const thiz, cogo_await_t* const co) { COGO_ASSERT(thiz && thiz->sched && co); #ifndef NDEBUG // no loop in call chain for (cogo_await_t const* node = thiz; node; node = node->caller) { COGO_ASSERT(co != ...
C
#include <lpc214x.h> void delay(unsigned int time) { unsigned int i,j; for(i=0;i<time;i++) for(j=0;j<1000;j++); } int main() { unsigned int period=1000, i; PINSEL1 &= 0xFFFFF3FF; // Pin 0.21 as PWM5 pin PINSEL1 |= 0x00000400; PWMPR = 0x00; PWMMCR = 0x00000002; PWMMR0 = period; PWMMR5 ...
C
#ifndef OSPFSFIX_H #define OSPFSFIX_H #include <errno.h> #include <stdint.h> #include "ospfs.h" #define MAX_FILENAME_LEN 1024 //Define Error Messages #define ERROR(msg) printf("%s in %s, Line:%d\n", msg, __FILE__, __LINE__) #define UNFIXABLE(msg) printf("Error Unfixable: %s\n", msg) //Define success message #define ...
C
#ifdef _WINDOWS #define _CRTDBG_MAP_ALLOC #include <crtdbg.h> #endif #include "mjson.h" #include <assert.h> /* assert() */ #include <errno.h> /* errno, ERANGE */ #include <math.h> /* HUGE_VAL */ #include <stdio.h> /* sprintf() */ #include <stdlib.h> /* NULL, malloc(), realloc(), free(), strtod() */ #include <s...
C
#include<stdio.h> void main() { int i,sum=0,size; int num[]={}; printf("Enter the number of Array size\t"); scanf("%d",&size); printf("Array size is = %d\n",size); for(i=0; i<size; i++){ scanf("%d",&num[i]); sum=sum+num[i]; } printf("Total number is = %d",sum); }
C
#include "backtracking.h" //Matriz com as possibilidades de cores de cada vértice. //Cada linha i corresponde ao id vértice i //e cada coluna j (j > 0) corresponde à cor j. //A posição [i][0] indica quantas cores o vértice i pode assumir. int **possibilidades; //Inicializa a matriz de possibilidades. void inicializa_...
C
/* Pam'Console'logger by wC Description: Thiz enables you to log a tty to a file! =) According to a advisorie at www.securityfocus.com: A vulnerability exists in the pam_console PAM module, included as part of any Linux system running PAM. pam_console exists to own certain devices to...
C
#include <stdio.h> #define MOD 1000000007 unsigned long long int apow(unsigned long long int,unsigned long long int); int main(){ unsigned long long int t,n,ans,q,p; scanf("%llu",&t); while(t--){ scanf("%llu",&n); ans = ((n%MOD)*apow(2,(n-1)))%MOD; printf("%llu\n",ans); } } unsigned...
C
#include <stdio.h> using namespace std; int count(string s, int K) { int n = s.length(); for (int i = 0; i < n; i++) { { c=c+; } } return C * K + (K * (K - 1) / 2) * c1 * c2; } int main() { string S = "abcb"; int k = 2; cout << countOccurrences(S, k) << endl; return 0; ...
C
#include <stdio.h> #include <stdlib.h> int main() { typedef struct { int i; char c; } foo; foo s; foo* t = (foo*) malloc(sizeof(foo)); s.i = 53; s.c = 'w'; (*t).i = 64; // t->a = 75; printf("s.i = %d, s.c = %c, t.a = %d\n", s.i, s.c, t->i); return 0; }
C
// test.opt.c #include <stdio.h> #include <stdlib.h> long kmul_o_s32_p_23 (long x) { long t0; long t1; long t2; long t3; long t4; long t5; long t6; long t7; long t8; long t9; long t10; long t11; long t12; long t13; long t14; long t15; long y; t0 = x; t1 = t0 << 1; t2 = t1 + x; ...
C
/* * adsr.h * * Created on: Oct 10, 2020 * Author: Zac */ #ifndef INC_ADSR_H_ #define INC_ADSR_H_ #include <stdint.h> #include <stdbool.h> #define SAMPLE_FREQ 40000 typedef enum { ENV_INIT = 0, ENV_ATTACK, ENV_DECAY, ENV_SUSTAIN, ENV_RELEASE }ADSR_STATE; typedef struct { ...
C
/* ============================================================================ Name : clase7.c Author : Version : Copyright : Your copyright notice Description : Hello World in C, Ansi-style ============================================================================ */ #include <stdio.h> #...
C
#include <stdio.h> #include <stdlib.h> int input(){ /* This function asks for the card name to be enetered and change the value of the card value depedning on the entry*/ char card_name[3]; { puts("Enter the card_name: "); scanf("%2s", card_name); int val = 0; switch(card_name[0]) { ca...
C
#include <stdio.h> #define BITS_PER_LONG 32 unsigned long __fls(unsigned long word) { int num = BITS_PER_LONG - 1; #if BITS_PER_LONG == 64 if (!(word & (~0ul << 32))) { num -= 32; word <<= 32; } #endif if (!(word & (~0ul << (BITS_PER_LONG-16)))) { num -= 16; word <<= 16; } if (!(word & (~0ul << (BITS_PER...
C
//实验一 词法分析器 #include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> char *Key[8]={"begin","integer","function","if","then","else","read","write"}; //定义保留字(关键字) char ch; //新读入字符 char token[20]; //已读入字符 int letter(char c){ //判断字母的函数 if(...
C
#include "binlog.h" #include <stdio.h> #include <errno.h> #include <string.h> #include <unistd.h> #define LEN 1024 int readlog(void) { char buf[LEN]="BUF"; int ret=0; ret = binlog_read(buf,LEN,0); printf("ret=%d,err=%s\n",ret,strerror(errno)); if(ret>0) { buf[ret]=0; printf("buf=%s\n",buf); } return...
C
#include <assert.h> #include "account.h" int main() //@ requires true; //@ ensures true; { account_t* my_account = create_account(-100); account_deposit(my_account, 200); int w1 = account_withdraw(my_account, 50); assert(w1 == 50); int b1 = account_get_balance(my_account); assert(b1 ...
C
void printBlock(unsigned long long int *block) { for(int i = 0;i < 64;i ++){ printf("%lld",(*block>>i)&1ULL); if((i & 7) == 7) printf("\n"); } } void initialize(unsigned long long int *block, int row, int column, int size) { *block = 0; unsigned long long add = (1ULL << size) -1; ...
C
#include <arpa/inet.h> #include <netinet/in.h> #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <unistd.h> #include <ctype.h> #include <stdlib.h> #include <string.h> #include <pthread.h> #define total_minions 3 //use this to define total no. of receiving minions int indicator =1; int number=0;...
C
// Structure1.cpp : ܼ α׷ մϴ. // #include "stdafx.h" struct Student { // Student ̸ ڷ char name[10]; // ̸ char address[20]; // ּ int Year; // г }; int main() { int a = 10; Student s; // struct Student s; system("pause"); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <time.h> typedef struct { //graphe représenté par une matrice d'adjacence int nombre_sommet; int ** matrice_adjacence; } graphe; void affiche_graphe(graphe G){ int i,j; printf("Graphe avec %d sommets \n",G.nombre_sommet); for(i = 0; i<G.nombre_sommet; i++){ ...
C
// 2.2堆栈 #include "stdio.h" #include "stdlib.h" //堆栈的链表实现 typedef int ElemType; typedef struct Snode *PtrlToSNode; struct Snode { ElemType data; PtrlToSNode next; }; typedef PtrlToSNode Stack; Stack createStack(){ Stack s; s=(PtrlToSNode)malloc(sizeof(Snode)); s->next=NULL; return s; } //判空 bool Empty(Stack ...
C
/* * Disk testing utility. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <fcntl.h> #define BLOCKSZ 1024 char *progname; int verbose; int fd; void block_write (unsigned bn, unsigned char *data) { unsigned addr = bn * BLOCKSZ; int ret, i; if (verbose) { ...
C
#include "block.h" int main(int argc, char ** argv) { if (stdout_is_piped()) // other wise you don't see the seg fault setup_segfault_handling(argv); assert_stdin_is_piped(); assert_stdout_is_piped(); //assert_stdin_or_out_is_piped(); static char column_name[1000] = ""; static int sort_that_colu...
C
const double EPSI = 1E-8; double sqr(double x) { return x * x; } int sgn(double x) { if (x > EPSI) return 1; if (x < -EPSI) return -1; return 0; } struct Point { double x, y; Point() { } Point(double _x, double _y) : x(_x), y(_y) { } void read() { scanf("%lf%lf", &x, &y); } Point operator +(Point p) const { ...
C
// Snipe event handling. Free and open source. See licence.txt. // TODO: detect shift-click for select, ctrl-click for add cursor // TODO: touch scroll #include "settings.h" // Event code constants represent keyboard, mouse, window and timer events. // These constants are intended to be independent of the graphics lib...
C
/* Assignment name : ft_strdup Expected files : ft_strdup.c Allowed functions: malloc -------------------------------------------------------------------------------- Reproduce the behavior of the function strdup (man strdup). Your function must be declared as follows: char *ft_strdup(char *src); */ #include ...
C
/* Ken Sheedlo * Simple circularly linked list implementation */ #include "tuple.h" #include "error_handling.h" struct _ll_t; /*Forward declaration*/ typedef struct _ll_node { void *data; struct _ll_t *list; struct _ll_node *next; struct _ll_node *prev; } node_t; typedef struct _ll_t { node_t...
C
#include "uchat.h" char *my_itoa(long long number) { char *str = (char *)malloc(21); int count = 0; unsigned long long num; int flag = 0; if(number & 0x8000000000000000) { flag = 1; str[count++] = '-'; num = (number ^ 0xFFFFFFFFFFFFFFFF) + 1; } else num = (unsigned long long) number; if(nu...
C
#include "holberton.h" /** *_memcpy - Copy characters for one array and paste in other, *@dest:Is the array where are going to be paste the characters. *@src:Is the array from is going to be copied, *@n:Mount of characters that are going to be copied. *Return:The array dest. */ char *_memcpy(char *dest, char *sr...
C
#include "rpnStack.h" #include "Stack.h" #include "TokenType.h" void initrpnStack(rpnstack* st) { init(&(st->data)); init(&(st->type)); } void rpnpush(int data, etype e, rpnstack* st) { push(data, &(st->data)); push((int)e, &(st->type)); } rpndata rpnpop(rpnstack* st) { rpndata rv; rv.data = ...
C
// Copyright (c) 2020, devgo.club // All rights reserved. #include <stdlib.h> #include <unistd.h> #include <stdio.h> #include <stdint.h> #include <errno.h> #include <string.h> #include <pthread.h> void th_cleanup_func(void *arg) { char *msg = (char *)arg; printf("[%ld] cleanup: msg = %s\n", pthread_self(), ms...
C
#include <stdio.h> void split_time ( long int tot_sec, int *h, int *m, int *s ); int main(void){ int h,m,s,tot_sec; scanf("%d", &tot_sec); split_time(tot_sec, &h, &m, &s); printf("%d sono %d h %d m %d s\n", tot_sec,h,m,s); } void split_time ( long int tot_sec, int *h, int *m, int *s ){ *h = tot_s...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* get_next_line.c :+: :+: :+: ...
C
int main(void) { int a[100],n; cin >>n; for (int i=0;i<=n-1;i++) { cin >>a[i]; } for (int i=n-1;i>=0;i--) { cout <<a[i]; if (i!=0) cout <<" "; } return 0; }
C
#include<stdio.h> int main(){ int n, rev=0,remainder; printf("Enter an integer:"); scanf("%d",&n); while(n!=0){ remainder = n%10; rev = rev*10+remainder; n=n/10; } printf("Reverse of a number=%d",rev); return 0; }
C
/* ** diff_way.c for main in /home/blanch_p/rendu/Semestre2/Infographie/ ** ** Made by Alexandre Blanchard ** Login <blanch_p@epitech.net> ** ** Started on Wed Apr 13 14:06:34 2016 Alexandre Blanchard ** Last update Sun Apr 17 22:32:26 2016 Alexandre Blanchard */ #include "adventure.h" int check_first(int dep, t...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* get_next_line.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> int main() { int n, i,r, min_elem_ind = 0, max_elem_ind = 0 ; printf("Enter the length of massive\n"); scanf("%d", &n); int a[n]; for (i = 0; i<n; i++){ scanf("%d", &a[i]); } for (i = 0; i<n; i++){ printf("%d ", a[i]); } fo...
C
#include <stdio.h> #include <math.h> #include "cs50.h" int main(void) { float change; int coin = 0, converted; //user's input do { printf("How much change do you have?\n"); change = GetFloat(); } while (change < 0); //convertation into cents change *...
C
#include <stdio.h> #include <stdlib.h> #include <libgen.h> #include <dirent.h> #include <unistd.h> #include <string.h> #include <errno.h> #include <fcntl.h> #include <ctype.h> #include <locale.h> #include <wchar.h> #include <wctype.h> #include <x86_64-linux-gnu/sys/types.h> #include <x86_64-linux-gnu/sys/stat.h> #incl...
C
/* * idshow.c * * Created on: May 16, 2021 * Author: cory */ #include "../lib/9_hdr.h" #include <unistd.h> #include <sys/fsuid.h> #include <limits.h> #include "8_hdr.h" #include "tlpi_hdr.h" #define SG_SIZE (NGROUPS_MAX + 1) #define DISPLAY_USERNAME(user) user == NULL ? "???" : user #define DISPLAY_GROUPN...
C
#include <msp430.h> #include <Output.h> #include <Authenticator.h> //output #define MOTOR BIT2 //input #define BUTTON BIT3 /* *Our driver. * */ void setup(){ WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer setupOutput((MOTOR)); //Declare OUTPUTS setupInput(BUTTON); //Declare INPUTS setOu...
C
/* * 此程序演示算术运算符的使用 * 作者:豫让 日期:20190525 */ #include <stdio.h> int main() { double A=18; // 定义变量A,赋值18 double B=5; // 定义变量B,赋值5 printf("A的值是:%lf\n",A); printf("B的值是:%lf\n",B); printf("A+B的值是:%lf\n",A+B); printf("A-B的值是:%lf\n",A-B); printf("A*B的值是:%lf\n",A*B); printf("A/B的值是:%lf...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> int main() { char data[] = "D2BCD2BCD2BCD2BCD2BCD2BCD2BCD2BCD2BCD2BCD2BCD2BCB7A1B7A1B7A1B7A1B7A1B7A1B7A1B7A1B7A1B7A1B7A1B7A1C8FEC8FEC8FEC8FEC8FEC8FEC8FEC8FEC8FEC8FEC8FEC8FECBC1CBC1CBC1CBC1CBC1CBC1CBC1CBC1CBC1CBC1CBC1CBC1CEE9CEE9CEE9CEE9CEE9CEE9CEE9CEE9CEE9...
C
//--------------------------- // Name: Natalie Petrosian // UserID: npetrosi // Assignment: PA2 //--------------------------- #include "List.h" #define UNVISITED 0 #define INPROGRESS 1 #define ALLDONE 2 #define FOUND 3 #define NOTFOUND 4 #define MAX_ARRAY_SIZE 256 typedef struct GraphObj { int...
C
/* Define a student structure with University Seat Number (USN), name (FirstName, LastName), and marks in 3 subjects as members of that structure with nesting. Write a C program to read the information for one student and print the same. */ #include <stdio.h> #include <string.h> #include <stdlib.h> typedef struct m...
C
#include <stdio.h> #include <unistd.h> #include <pthread.h> //线程函数 /* 线程除了自己私有的堆栈和寄存器以外其他的都是共享的! */ void* pthreadone(void *num) { //将本线程设置为分离线程 pthread_detach(pthread_self()); printf("I am pthread one!\n"); pthread_exit("exit"); } void* pthreadtwo(void *num) { //创建的线程默认为绑定线程 printf("I am pthread two!\n"); } int ...
C
#include <stdio.h> #include <pthread.h> #include <stdlib.h> #include <semaphore.h> #define LIMIT 1000 sem_t sem1,sem2; void* function1(void *p) { int expected = *(int *)p; while(expected < LIMIT) { sem_wait(&sem1);{ printf("Even %d\n", expected); expected += 2; ...
C
#include <stdio.h> #include <assert.h> // f(n + 1) = f(n) + f(n - 1) int fibo_loop(int index){ if(index < 2){ return 1; } else { int value = 1, value_before = 1; //define f(0) and f(1) int tmp = 0; while(index > 1){ tmp = value; value += value_before; value_before = tmp; ind...
C
#ifndef __LAB8_GLOBAL__ #define __LAB8_GLOBAL__ enum{ //32 terminals //ս1ʼʷķֵͻ IF=1, ELSE, WHILE, DO, BREAK, TRUE, FALSE, INT, BOOL, AND, OR, NOT, EQ, NE, GT, GE, LT, LE, SET, ADD, SUB, MUL, DIV, SC, LP, RP, LB, RB, LSB, RSB, ID, NUM }; enum{ // non-terminals & auxiliaries PRO, BLO, DECLS, DECL, TYP, TYPP, BASIC...
C
/* ** my_putnbr_base.c for my_putnbr_base in /home/lblanchard/PSU_2016_my_printf ** ** Made by Leandre Blanchard ** Login <lblanchard@epitech.net> ** ** Started on Wed Nov 9 11:32:20 2016 Leandre Blanchard ** Last update Sun Apr 30 17:16:24 2017 Léandre Blanchard */ #include "my_printf.h" int part_of_base(c...
C
/* * @Brief: * This file is for extracting picture from mp3 file. * @References: * http://blog.csdn.net/ydtbk/article/details/9258651 * http://magiclen.org/mp3-tag/ */ #include <stdio.h> #include <stdlib.h> #include <memory.h> #include "extractPic.h" // id3v2 header tag structure typedef str...
C
#ifndef GAME_FONT_H #define GAME_FONT_H #include "Texture.h" struct Font { Texture texture; int charWidth[256]; int startChar; int fontHeight; int cellWidth; int cellHeight; int imageWidth; int imageHeight; int numRows; int numCols; }; /** ...
C
/* * This file is part of the OpenMV project. * * Copyright (c) 2013-2021 Ibrahim Abdelkader <iabdalkader@openmv.io> * Copyright (c) 2013-2021 Kwabena W. Agyeman <kwagyeman@openmv.io> * * This work is licensed under the MIT license, see the file LICENSE for details. * * Common data structures. */ #include "iml...
C
/** * \addtogroup apps * @{ */ /** * \defgroup special_server Special webserver * @{ * * This example shows a simplified webserver that always responds with the same information. */ /** * \file * Implementation of the HTTP client. * \author Eñaut Muxika <emuxika@eps.mondragon.edu> */ #i...
C
#include <stdio.h> //printf #include <sys/socket.h> #include <netdb.h> //hostent #include <arpa/inet.h> #include <string.h> //#include "hle_url_prase.h" typedef struct _url_info_t { char*protocol; //协议 char*host; //域名 char*port; //端口 char*path; //路径 char*query; //询问 c...
C
/* Lab 1 CSE 2320 - Lab 1 Created By Atafo Abure 1001442575 This program is going to help you predict the outcome of a mergesort using binary search. It will required the inputs for the two arrays and the number of probes Feb 6 2018 How to run To compile and run use the following commands gcc lab1.c a.out < ...
C
#include <limits.h> #include <stdio.h> #include <string.h> #include <errno.h> #include "error.h" #include "log.h" int main(int argc, char* args[]) { int status; if (log_init(args[0])) { perror("log_init()"); status = 1; } else { ErrorObj* err; (void)log_set_level(LOG_...
C
#include <stdio.h> #include <string.h> #include <assert.h> //递归,字符串的全排列 void Swap(char *s1,char *s2) { char tmp = *s1; *s1 = *s2; *s2 = tmp; } int IsSwap(char *begin,char *end) { assert(begin != NULL && end != NULL); char *p = begin; for(p; p < end; p++) { if(*p == *end) { ...
C
#include<stdio.h> void main() { float a, b; clrscr(); a = 10; b = 3; printf("%f", a/b); getch(); }
C
// $Id: nsort.c,v 1.1 2011-04-29 19:46:42-07 - - $ #include <assert.h> #include <libgen.h> #include <stdio.h> #include <stdio_ext.h> #include <stdlib.h> #include <stdbool.h> #include <unistd.h> #include <string.h> #define OPTION "d" typedef struct node node; struct node { double item; node *link; }; int exit_...
C
/* * This program finds the lowest common ancester in a BST * * Author: @pyav */ #include <stdio.h> #include <stdlib.h> #define SUCCESS 0 #define FAILURE 1 /* Node structure */ struct node { int data; struct node *left; struct node *right; }; /* Create a new node */ struct node *new_node(int data) { st...
C
\\program to print the arrangemet of the string... when repitation is not allowed in the program #include <stdio.h> void recursion(int arr[], int data[], int start, int end, int index, int r) { if (index == r) { if(data[0]+data[1]+data[2]==0) { for (int j=0; j<r; j++) p...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> /** *Finite Machine Matcher Preprocess */ //character set is a-z //character mapping function int charvalue(char c){ return c-'a'; } //check a is b suffix int is_suffix(char *a, char *b,int length_a,int length_b){ if (length_a > length_b){ return 0; } i...
C
#include <map> #include <set> #include <list> #include <cmath> #include <ctime> #include <deque> #include <queue> #include <stack> #include <string> #include <bitset> #include <cstdio> #include <limits> #include <vector> #include <climits> #include <cstring> #include <cstdlib> #include <fstream> #include <numeric> #inc...
C
#include<stdio.h> void main() { int n,i,j,temp; printf("enter the number of values"); scanf("%d",&n); int a[n]; for(i=0;i<n;i++) scanf("%d",&a[i]); for(i=0;i<n;i++) { temp=a[i]; for(j=i;j>0;j--) { if(a[j-1]>temp) { ...
C
#include <assert.h> #include "grid.h" #define SIZE_X 3231 #define SIZE_Y 1234 int main() { grid_t* grid1 = grid_create(SIZE_X, SIZE_Y, 0); assert(grid1 != NULL); assert(grid1->data != NULL); assert(grid1->width == SIZE_X); assert(grid1->height == SIZE_Y); assert(grid1->padding == 0); asse...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/stat.h> #include <linux/stat.h> #include <fcntl.h> #include <string.h> #define SERWERFIFO "serwerfifo" #define KLIENTFIFO "klientfifo" #define PERM 0777 int main(int argc, char const *argv[]) { FILE *input; int output, licz=20; char liczba[7...
C
#include "main.h" void main() { getNumber(); printFib(); getch(); } void getNumber() { printf("Enter your number: "); scanf_s("%d", &number); } int calcFib(int count) { if (count < 2) return 1; else return calcFib(count - 1) + calcFib(count - 2); } void printFib() { printf("%d Fibonacci number is %d", numbe...
C
#include <stdlib.h> #include <stdio.h> #include <assert.h> #include "mtree.h" #include "cursor.h" #include "error.h" #include "utils.h" #include "_tree.h" #define CHILD(tree, depth, node, i) _TREE_CHILD(tree, depth, node, i, MTreeNode) #define ROOT(tree) _TREE_ROOT(tree, MTreeNode) #define TREE(node) _TREE_TREE(node...
C
/******************* Problem definition **********************************/ /* Implement a program that it shows the message "Hello World" on screen. */ /*************************************************************************/ /* Here, you must include the required libraries */ #include <stdio.h> void main( ...
C
#include <stdio.h> #include <stdlib.h> const int RED = 0; const int BLACK = 1; typedef struct rb_node rb_node; struct rb_node{ rb_node* lchild, *rchild, *parent; int key, colour; }; rb_node* root; rb_node* get_node(rb_node* parent, int key); void rb_insert(int key); rb_node* rb_search(int key); void rb_dele...
C
/* * EEPROM_INT.c * * Created: 28/04/2020 23:37:28 * Author: sony */ #include "EEPROM_INT.h" #include "EEPROM_INT_CFG.h" #include "avr/io.h" #define IDLE 1 #define BUSY 2 #define DONE_WR 3 #define DONE_RD 4 static uint8_t EEINT_SM1; static uint8_t EEINT_SM2; void EEINT_Init(void) { EEINT_SM1 = IDLE; EEI...
C
#define F_CPU 8000000 #include <avr/io.h> #include <util/delay.h> #include <avr/interrupt.h> #define sbi(x,y) x |= _BV(y) //set bit #define cbi(x,y) x &= ~(_BV(y)) //clear bit #define tbi(x,y) x ^= _BV(y) //toggle bit #define is_high(x,y) ((x & _BV(y)) == _BV(y)) typedef struct { unsigned char data; unsigned int d...
C
#include <stdio.h> #include <stdlib.h> int ordemCrescente_PAR(int N); int main (){ int N = 10; ordemCrescente_PAR (N); } int ordemCrescente_PAR(int N){ if ( N < 0 ){ return 0; } else { ordemCrescente_PAR( N - 1 ); printf("%d\n", N); } return 0; }
C
// SPDX-License-Identifier: BSD-2-Clause-Views /* * Copyright (c) 2023 The Regents of the University of California */ #include "mqnic.h" #include <stdio.h> #include <stdlib.h> struct mqnic_res *mqnic_res_open(unsigned int count, volatile uint8_t *base, unsigned int stride) { struct mqnic_res *res = calloc(1, s...
C
#include<stdio.h> void main(){ int x,y; printf("Enter amount:"); scanf("%d", &x); y= x/500; printf("500: %d\n", y); x = x - (y*500); y = x/100; printf("100: %d\n", y); x = x - (y*100); y= x/50; printf("50: %d\n", y); x = x - (y*50); y = x/20; printf("20: %d\n", y...
C
/* ˻Ʈ α׷(ҽ) */ #include <stdio.h> #include <stdlib.h> #include "Member.h" #include "BinTree.h" /*--- ˻ ---*/ BinNode* Search(BinNode* p, const Member* x); /*--- ---*/ BinNode* Add(BinNode* p, const Member* x); /*--- ---*/ int Remove(BinNode** root, const Member* x); /*--- 带 ---*/ void PrintTree(const BinNode...
C
#include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/msg.h> #include <fcntl.h> #include <signal.h> #include <errno.h> #include "structs.h" #include "parser.h" ServerEnv serverEnv; int loadFromFile() { int i; ServerEnv* env = &serverEnv; FILE*...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* push_swap.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <conio.h> #include <math.h> int punto1(); int punto2(); int punto3(); int punto4(); int punto5(); int punto6(); int punto7(); int punto8(); int punto9(); int punto10(); int punto11(); int punto12(); int punto13(); int ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "queue.h" //构建一个队列 bool init_queue(s_queue *queue, int ele_size, void (*free_data)(), void (*visit_data)()) { if (queue == null) { return false; } queue->ele_size = ele_size; queue->free_data = free_data; queue->visit_data = visit_data; queu...
C
/* * Challenge 111 * Find the binary tree min depth */ #include <stdio.h> int main(int argc, char const *argv[]) { /*Solution */ /* Definition for a binary tree node.*/ struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; }; int minDepth(struct Tre...
C
#include <stdlib.h> #include <stdio.h> #include "binary_trees.h" /** * binary_tree_leaves - counts the leaves of a binary tree * @tree: is a pointer to the root node of the tree * Return: the leaves count of tree, otherwise 0 */ size_t binary_tree_leaves(const binary_tree_t *tree) { size_t lleft = 0, lright = 0; i...
C
#include <stdio.h> int ok() { // ok if (0) { goto ONE; goto ONE; } printf("did not go to one\n"); return 0; ONE: printf("went to one\n"); return 1; } int main(int argc, char *argv[]) { // ruleid:double_goto if (0) goto ONE; goto ONE; printf("did not go to one\n"); return 0; ONE: printf("w...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* parsing_objects3.c :+: :+: :+: ...