language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <ruby.h> #include "ast.h" VALUE rb_cVar; VALUE rb_cAnd; VALUE rb_cOr; VALUE rb_cNot; VALUE rb_eParseError; /** * Transforms the C AST to a Ruby AST. */ static VALUE transform(Node *node) { switch (node->type) { case eVAR: return rb_funcall(rb_cVar, rb_intern("new"), 1, rb_str_new2(((Var*)no...
C
#include "hwinfo_config_ini_parser.h" #include "ini_builder.h" #include "ini_parser.h" #include "ini_builder_list.h" #include "dlist.h" #include "iterator.h" #include "dlist_iterator.h" #include "hwinfo.h" #include <string.h> #include <stdio.h> #define COMMENT_CHAR '#' #define DELIM_CHAR '=' typedef struct { INIBuil...
C
#include <stdio.h> #include <stdlib.h> long int power(long int x,long int m){ if(m!=1){ return x*power(x,(m-1)); } } int main(void){ int t,i; long int x,m,n,sum=0; scanf("%d",&t); while(t){ t--; scanf("%ld %ld %ld",&x,&m,&n); for(i=1; i<=m; i++){ sum += power(x,i); } sum++; sum = sum%n; printf...
C
/* ================================================== Workshop #6 (Part-1): ================================================== Name :Justin Hoang ID :021569132 Email :jhoang11@myseneca.ca Section:NCC */ #define MAX_PRODUCT 3 #define SUGGESTED_SERVING 64 // ------------------------------------...
C
#include<stdio.h> #include<conio.h> void main(int argc, char const *argv[]) { char ch; printf("Enter any alphabet"); scanf(" %c",&ch); if (ch=='a' ||ch=='A' || ch=='e' ||ch=='E' || ch=='i' || ch=='I'|| ch=='o' ||ch=='O'|| ch=='u' ||ch=='U') { printf("%c is a vowel", ch); } ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* draw_fractol.c :+: :+: :+: ...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> int locating(char * location){ int i, result=0; char station[50]; char *cmp[100] = {'\0'}; char p[20]={'\0',}; FILE *f; strcpy(station,location); /* printf("station : "); gets(station); */ strcat(station, "\n"); f=fopen(...
C
#include<stdio.h> #include<string.h> void bubblesortstring(char arr[][100],int n) { char temp[20]; for(int i=0;i<n-1;i++) { for(int j=0;j<n-i-1;j++) { if(strcmp(arr[j],arr[j+1])>0) { strcpy(temp, arr[j+1]); strcpy(arr[j+1],arr[j]); strcpy(arr[j], temp); } } } } int main() { char arr[10...
C
#include "../../../lv_examples.h" #if LV_USE_ARC /** * An `lv_task` to call periodically to set the angles of the arc * @param t */ static void arc_loader(lv_task_t * t) { static int16_t a = 270; a+=5; lv_arc_set_end_angle(t->user_data, a); if(a >= 270 + 360) { lv_task_del(t); re...
C
#define _BSD_SOURCE #include <stdio.h> #include <stdlib.h> #include <err.h> #include <math.h> #include <limits.h> #include <unistd.h> #include <sys/syscall.h> #include <sys/types.h> #include <signal.h> #include "tools/vectors.h" #include "tools/color.h" #include "shapes/material.h" #include "ray/ray.h" #include "shape...
C
/** @file Main.c * Display light patterns on the leds. * @author Adrien RICCIARDI */ #include <system.h> //-------------------------------------------------------------------------------------------------- // Microcontroller configuration //-------------------------------------------------------------------...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <conio.h> #include "../lib.h" void copy_element(HEAD* head) { if (head->first != NULL) { HEAD* new_head = NULL; new_head = malloc(sizeof(head)); new_head->count = 0; new_head->first = NULL; new_head->last = NULL; NODE* new...
C
// Implements a dictionary's functionality #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "dictionary.h" #define CHAR_TO_INDEX(c) ((int)c - (int)'a') // Represents number of children for each node in a trie #define N 27 // const int CASE = 'a'; // Represents a node in a tr...
C
/* getfloat.c - parse float array */ #include <ctype.h> #include <stdio.h> int getch(void); void ungetch(int c); int getfloat(double *pn) { int c, sign; int power; while (isspace(c = getch())) /* skip white space */ ; if (!isdigit(c) && c != EOF && c != '+' && c != '-') { ungetch(c); return 0; } sign = (...
C
/* * This program explores and discusses arrays and strings :) * written by Helena Kertesz * 06/04/2016 * compile with gcc-o arrays arrays.c (it's bad but it means it should complile on both you home computer and on cse) * There are questions for you to answer next to some lines in the code to test your knowledge ...
C
#include <stdio.h> #include <stdlib.h> #include<string.h> #include<math.h> int main() { int cont,temp; double vetor[100]; for(cont=0;cont<100;cont++) scanf("%lf",&vetor[cont]); for (cont=0;cont<100;cont++) if (vetor[cont]<=10.0){ temp = vetor[cont]; if ((vetor[cont]-temp)!=0) pr...
C
#include <stdio.h> int main() { char s1[100],s2[100]; int i,c1=0,c2=0; printf("Enter the string1 \n"); scanf("%[^\n]s",s1); printf("Enter string 2 \n"); scanf("%[^\n]s",s2); for(i=0;s1[i]!='\0';i++) { c1=c1+1; } for(i=0;s2[i]!='\0';i++) { c2=c2+1; } ...
C
/* 网新恒天2014校园招聘 * Sep 06, 2013 * * Problem Description: * 已知memcpy的函数为: void* memcpy(void *dst , const void* src , size_t n) * 其中dst是目的指针,src是源指针。不调用c++/c的memcpy库函数,请编写memcpy。 * */ #include <assert.h> void *memcpy(void *dst, const void *src, size_t n) { /* special cases */ if(n == 0 || dst == src...
C
#include "HC_SR.h" #include "sys.h" #include "includes.h" uint32_t US_Count = 0; //ÿһζʱжUS_Countһ void US_AddCount() { US_Count++; } uint32_t US_GetCount() { return US_Count; } void US_ClearCount() { US_Count=0; } void HC_SR_Configuration(void) { GPIO_InitTypeDef GPIO; NVIC_InitTypeDef MyNVIC; EXTI...
C
#ifndef STACK_LIST_H #define STACK_LIST_H struct Node; typedef struct Node *PtrNode;//声明了一个名为PtrNode的类型,该类型是指向结构体Node的指针 typedef PtrNode Stack; int IsEmpty(Stack S); Stack CreateStack(void); void MakeEmpty(Stack S); void Push(int x, Stack S); void pop(Stack S); int Top(Stack S); #endif
C
#include "libprintf.h" int ft_printf(char *format, ...) { va_list arg; unsigned int i; i = 0; va_start(arg, format); while(*format) { if(*format == '%') i += ft_lookup(arg, *++format); else i += ft_putchar(*format); format++; } va_end(arg); return(i); } int ft_lookup(va_list arg, char c) { in...
C
/* -- PCF Operating System -- * See [docs\COPYRIGHT.txt] for more info */ /** @file include\system\kernel\x86\paging.h @brief PCF paging */ #ifndef INCLUDE_SYSTEM_KERNEL_X86_PAGING_H #define INCLUDE_SYSTEM_KERNEL_X86_PAGING_H #include <kernel\x86\irq.h> /** @brief Bit position. Used in the bitset algorithms */ #...
C
/* * libgit2 "checkout" example - shows how to perform checkouts * * Written by the libgit2 contributors * * To the extent possible under law, the author(s) have dedicated all copyright * and related and neighboring rights to this software to the public domain * worldwide. This software is distributed without an...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <stdbool.h> #include <string.h> #ifndef FUNCTIONS_H_INCLUDED #define FUNCTIONS_H_INCLUDED enum blocks { Energy = 1, Mitosis, Forbidden, Normal }; typedef struct cell{ char name[11]; char owner; int x; int y; int cel...
C
/** * recover.c * * Computer Science 50 * Problem Set 4 * * Recovers JPEGs from a forensic image. */ #include <stdint.h> #include <stdio.h> // prototype void safe_close(FILE* file); int main(int argc, char* argv[]) { // forensic image filename static const char * filename = "card.raw"; // open f...
C
#include<stdio.h> #include<string.h> #include<stdlib.h> typedef struct _S_ITEM{ char m_szName[32]; int m_nType; int m_nValue; }_S_ITEM; _S_ITEM item_list[]={ {"short sword",0,10}, {"wood shield",0,5}, {"dagger",0,6}, {"sling",0,3}, {"staff",0,7} }; unsigned long getHashCode(const char *szStr) { int nLengt...
C
/*Program 4 :- WAP to print a given Number but without last digit.*/ #include<stdio.h> int main() { int a,x; printf("Enter Value of A:\n"); scanf("%d",&a); x=a/10; printf("Given Number is without last Digit:-\n"); printf("%d\n",x); }
C
// // Created by student on 11.02.2020. // #include <fcntl.h> #include "log_maker.h" int _log_maker_desc=-1; int create_log(char* name) { char path[256]; sprintf(path,"logs/name.%i",getpid()); _log_maker_desc = open(path,O_CREAT|O_TRUNC|O_WRONLY,0666); return _log_maker_desc; } int print_time(char ...
C
/* ============================================================================ Name : Worksheet4.c Author : Christine Pace Version : Copyright : Your copyright notice Description : Hello World in C, Ansi-style ============================================================================ */ #i...
C
#include <math.h> #include <stdio.h> #include <string.h> #include <ctype.h> #include <stdbool.h> #include <stdlib.h> #include "bibliotecaStruct.h" #include "bibliotecaFreq.h" // Main para execução ! // Alunos : Laerte Souza e Gustavo de Oliveira. // Professor Dr: Alexander Robert Kutzke. int main(int argc, char *ar...
C
#include <stdio.h> #include <string.h> #include <signal.h> #include <pthread.h> #include <math.h> pthread_mutex_t mx1=PTHREAD_MUTEX_INITIALIZER; int st; int vec; int vec2[10000]; void *f1(void *arg) { int i,j; while(st) { pthread_mutex_lock(&mx1); // Monitor j=0; for(i=0;i<10000;i++) ...
C
struct Node{ int value; struct Node* left; struct Node* right; }; struct Node* newNode(int value){ struct Node* node = (struct Node*) malloc(sizeof(struct Node)); node->value = value; node->left = NULL; node->right = NULL; return (node); } int maxSum(struct Node* temp){ if (temp == NULL) return 0; int lef...
C
/*----------------------------------------------- ƣ99ʱ ˾ϺӿƼ޹˾ վwww.doflye.cn дʦ ڣ2009.5 ޸ģ ݣͨʱʱ ------------------------------------------------*/ #include<reg52.h> //ͷļһҪĶͷļ⹦ܼĴĶ code unsigned char tab[]= {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}; // 0-9 unsigned char Dis_...
C
#include<stdio.h> int main(void) { printf("a 빮ڷ ǥϸ %c Դϴ. \n", 'A'); printf("%s %c Դϴ. \n", "a 빮ڷ ǥϸ", 'A'); printf("%s %d %s \n", "2 ϱ 3", 2*3, "Դϴ."); system("pause"); return 0; }
C
#include <sys/types.h> #include <unistd.h> #include <stdio.h> int main() { uid_t uid = getuid(); uid_t euid = geteuid(); printf("UID real -> %d\nUID efectivo -> %d\n", uid, euid); if (uid == euid) { printf("El bit setuid está activado, porque uid y euid coinciden\n"); } else { pr...
C
/* * @lc app=leetcode.cn id=142 lang=c * * [142] 环形链表 II */ // @lc code=start /** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */ struct ListNode *detectCycle(struct ListNode *head) { struct ListNode* fast = head; struct ListNode* slow...
C
#include<stdio.h> #include<string.h> int main() { char str[50]; printf("enter the string:"); scanf("%s",str); if(strrev(str[50])=str) printf("isomorphism"); else printf("not isomorphism"); return 0; }
C
#include <stdio.h> #include <stdlib.h> int main(){ int x,ano,mes,mes2,dia; scanf("%d", &x); ano=x/365; mes=x-(ano*365); mes2=mes/30; dia=mes-(mes2*30); printf("%d ano(s)\n",ano); printf("%d mes(es)\n",mes2 ); printf("%d dia(s)\n", dia); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <Largeint.h> int main(void) { largeInt l1, l2,sum,diff,product; div_result divi; int x; printf("Enter 1st number:"); readint(&l1); printf("Enter 2nd number:"); readint(&l2); printf("\nThe 1st number is :\n"); showI(l1); printf("\n"); prin...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.c :+: :+: :+: ...
C
/* Program to extract a last digit from a given number */ /* Author:Sravanthi_Yachareni */ #include<stdio.h> #include<conio.h> void main() { int number,digit; printf("Enter a number"); scanf("%d",&number); digit=number%10; printf("Last digit is:%d",digit); }
C
#ifndef _Move #define _Move #include <avr/io.h> #include <avr/interrupt.h> void MotorsInit() { sei(); DDRD = 0xFF; DDRB = 0xFF; TCCR0A = 0xA3; TCCR0B = 0x04; TCNT0 = 0x00; } void Forward(int duty) { OCR0B = duty; OCR0A = duty; PORTD = 0b11100000; PORTB = 0b00001000; } void Backward(int duty) { OCR0B = ...
C
/* colorConv - Color conversion program. */ #include "common.h" #include "linefile.h" #include "hash.h" #include "options.h" #include "memgfx.h" #include "portable.h" static char const rcsid[] = "$Id: colorConv.c,v 1.1 2009/06/19 19:14:42 mikep Exp $"; void usage() /* Explain usage and exit. */ { errAbort( "colorCo...
C
#include <stdlib.h> #include <stdio.h> int **matrix_create(int n) { int i, j; int **m; m = (int **)calloc(n, sizeof(int *)); for(i=0; i<n; i++) { m[i] = (int *)calloc(n, sizeof(int)); for(j=0; j<n; j++) scanf("%d", &m[i][j]); } return m; } int check_rows(int **m, int n, int *row_sum) { int i, j; int *su...
C
//this is a program designed for project 0 part B //by Yanfei Li //last edited at 9/7/2021 #include <stdio.h> #include <string.h> #include <stdlib.h>//gcc -o wzip wzip.c -Wall -Werror FILE* fp=NULL; char str[100],ch,in; int Counter=1; size_t size; int main(int argc, char* argv[]){ switch (argc) { case 1:...
C
// **** Include libraries here **** // Standard libraries //CMPE13 Support Library #include "BOARD.h" // Microchip libraries #include <xc.h> #include <plib.h> // User libraries #include "Stack.h" // **** Set macros and preprocessor directives **** // **** Define global, module-level, or external var...
C
/* 문제3. for 반복문을 사용하여 1부터 입력한 숫자까지의 합계를 구하는 C프로그램을 작성하여 보시오. - 출력예 - 정수를 입력하세요 : 50 1부터 50까지의 합계는 1275입니다. */ #include <stdio.h> void main() { int sum = 0; int n; printf("1에서 n까지 더할 값을 입력하세요 n: "); scanf("%d", &n); for (size_t i = 1; i <= n; i++) { sum += i; } printf("1 ~ %d까지의 합계는 %d입니다.\n", n, ...
C
// motors.h // Contains all code required to initialize and update PWM signals used to // control twelve motors. // This file is part of Dreamer Head v0.1. // Travis Llado, travis@travisllado.com // Last modified 2016.06.18 //////////////////////////////////////////////////////////////////////////////// // m...
C
/* * setZero.h * * Created on: 2014-04-30 * Author: frye */ #ifndef SETZERO_H_ #define SETZERO_H_ void setZeroes(vector<vector<int> > &matrix) { int height = matrix.size(); int width = matrix[0].size(); bool firstRowZero = false, firstColZero = false; for(int i=0;i<height;i+...
C
#include <stdio.h> #include <string.h> char *rtrim(char *str){ int n = 0; n = strlen(str); for( ;n>=0; n--){ if(str[n] == ' ' || str[n] == 0 || str[n] == -1 || str[n] == '\t' || str[n] == '\r' || str[n] == '\n') { str[n] = '\0'; }else{ break; } } return str; } ...
C
#include <stdio.h> #include <stdlib.h> #include "queue.h" int Que_create(QueHndl *hndl, uint32_t maxLen) { pthread_mutexattr_t mutex_attr; pthread_condattr_t cond_attr; int status=QUE_OK; hndl->curRd = hndl->curWr = 0; hndl->count = 0; hndl->len = maxLen; hndl->queue = malloc(sizeof(int32_t)*hndl->l...
C
/* * Exercise 18: http://c.learncodethehardway.org/ * * Use pointers to functions to implement Bubble sort with custom comparison * callbacks. */ #include <stdio.h> #include <stdlib.h> #include <string.h> void print_array(int *arr, int count, const char *caption) { printf("%s:\n", caption); int j = 0; for...
C
#include <stdio.h> #include <stdlib.h> #include <stdarg.h> #include <string.h> #include "btree.h" int maxHeight; int nNodesIns; int nNodesDel; int nKeysIns; int nKeysDel; int nDiskReads; int nDiskWrites; int bErrLineNo; static hNode hList; static hNode *h; #define error(rc) lineError(__LINE__, rc) static bErrType ...
C
/* * File: parallel_quicksort_module.h * * Purpose: Implement parallel quicksort. * */ #include <omp.h> void quicksort(int arr[], int first, int last); void parallel_quicksort(int arr[], int n, int thread_count); int partition(int arr[], int first, int last); void swap(int* i, int* j); /*-----------------...
C
// #include <codecvt> // #include <string> // #include <iostream> // #include <string> // #include <locale> // #include <iomanip> // #include <stdexcept> // #include <bitset> // using namespace std; #include <stdio.h> #include <stdlib.h> #include <wchar.h> #include <uchar.h> #include <locale.h> #include <wchar.h> /* ...
C
/* * Interval abstract domain * - we represent intervals as pairs of 64bit signed numbers, * which should be safe for our NTT */ #ifndef INTERVALS_H #define INTERVALS_H #include <stdint.h> typedef struct interval_s { int64_t min; int64_t max; } interval_t; /* * Constructors: all allocate and return a po...
C
#include <stdio.h> #include <stdlib.h> typedef struct chunkdata { char c; int offset; }chunkdata; int main(int argc, const char * argv[]) { chunkdata data1; FILE *file1; char c; file1 = fopen("crypt.bin","rb"); if (file1 == NULL) { printf("File not found!\n"); return...
C
/* -------------------------------------------------------------------- Project: PAL: Palmtop Application Library Module: <The name of the module - usually the filename> Author: <The name(s) of the autor(s)> Started: <Date when started> Subject: <What does it do, what is it there for ?> ------...
C
#include <stdio.h> #include <sys/socket.h> #include <stdlib.h> #include <netinet/in.h> #include <unistd.h> pthread_t tid[20]; void *counting(void *faktorial) { pthread_t id=pthread_self(); int i,j,k=1; int a=(int)faktorial; if (a<0) { printf ("Error\n"); } else ...
C
// // main.c // LRU // // Created by Liam van Leynseele on 11/4/18. // Copyright © 2018 Liam van Leynseele. All rights reserved. // #include <stdio.h> #include <stdlib.h> int main(int argc, const char * argv[]) { int available=atoi(argv[1]); //takles in the number available frames from command line int ...
C
#include <stdio.h> int main(void) { int a, b, c; printf("Input 3 numbers: "); scanf("%d %d %d", &a, &b, &c); int mx; if (a > b) { if (a > c) { mx = a; } else { mx = c; } } else { if (b > c) { mx = b; } else { mx = c; } } printf("\n%d\n", mx); return 0; }
C
#include<stdio.h> int main(){ int a, b, count; count = 0; scanf("%d%d", &a, &b); while (a<=b){ a*=3; b*=2; count++; } printf("%d", count); return 0; }
C
#include "shell.h" /** * add_history - adds a node to the hist_t list * @count: pointer to hist_count * @head: pointer to first node in hist_t list * @cmd: command line added to history * Return: the added history node */ hist_t *add_history(int *count, hist_t **head, char *cmd) { hist_t *new_node; hist_t *tem...
C
#include <unistd.h> #include <signal.h> #include <pthread.h> #include <stdbool.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #if 0 int pthread_mutex_lock(pthread_mutex_t *mutex); int pthread_mutex_trylock(pthread_mutex_t *mutex); int pthread_mutex_unlock(pthread_mutex_t *mutex); #endif // 0 static pth...
C
#include <stdio.h> #include <fcntl.h> #include "get_next_line.h" int main(void) { int fd; int return_num; char **output; char *files[10] = {"empty.txt", "1char.txt", "single_line.txt", "60_lines.txt", "3000chars_1line.txt", "3000x300lines.txt", "long.txt", "l...
C
#include<stdio.h> int main() { int a=20; int b=40; printf("Enter the values of swaping a,b"); a=a^b; b=a^b; printf("values of swaping a,b"); return 0; }
C
main() { int input; syscall_print_string("Please enter a non-negative integer: "); input = syscall_read_int(); if (input < 0){ printf("The integer you entered is negative.\n"); exit(1); } int result = 0; for (int i = 1; i * i < input || i * i == input; i++){ result = ...
C
#pragma once /* * Dependencies : must be included right at the top */ //Dimension of health bar #define LENGTH_OF_BAR 5 #define WIDTH_OF_BAR 0.5 //Dimension of inventory bar #define HEIGHT_OF_INV 1 #define HEIGHT_OF_INFO 1.5 #define LENGTH_OF_INFO 5 //Initializer for UI int screen_width, screen_height;...
C
// ¥ D-Day ϰ D-Day Ҵ ϴ α׷ ۼϼ. #include <stdio.h> #include <time.h> #pragma warning(disable:4996) #define DAYSEC 86400L void main(void) { time_t now; struct tm t, dday = { 0,0,0,8,8,2020 }; //2005 8 8 int n1, n2, nDday; now = time(NULL); localtime_s(&t, &now); dday.tm_year -= 1900; dday.tm_mon -= 1; t.tm...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <string.h> void printArray(int arr[], int n) { printf("Orignal array:-\n"); for (int i = 0; i < n; i++) { printf("%d\t", arr[i]); } printf("\n"); } //Question 1 int count_sort_MP(int arr[], int n) { int max = arr[0]; ...
C
#include "printflib.h" #include <stdio.h> void clean_printing_format(printing_format *formated_str) { formated_str->flag = '\0'; formated_str->width = '\0'; formated_str->id = '\0'; formated_str->precision = 0; formated_str->zero_fill = false; formated_str->validity = false; } void print_printing_format(printi...
C
#include <stdio.h> union U { struct s { char c; int p; } s; struct t { char c; double p; } t; struct v { char c; char* p; } v; }; int main() { union U u; char c = 'c'; u.v.c = '*'; u.v.p = &c; printf("%u\n", u.s.p); printf("%lf\n", u.t.p); printf("%u\n", *(u.v.p)); printf("%c\n", u.s.c); printf("%c\...
C
/* criterion(1) * criterion(1) is a tools that can be used by manager of the organization * to made a decision under uncertainty environment. * * Please see README.md for the details. * * Copyright 2015 Bayu Aldi Yansyah <bayualdiyansyah@gmail.com> * * Licensed under the Apache License, Version 2.0 (the "Lice...
C
#include "gds.h" void register_mod_fileds(struct module *mod, char *opt, char *usage, struct mod_table *table, struct mod_info *info, int n_item, int n_col, void *data_collect) { sprintf(mod->opt_line, "%s", opt); sprintf(mod->usage, "%s", usage); mod->table = table; mod->info = inf...
C
#include <stdio.h> #include <stdbool.h> int main() { int n, m; scanf("%d %d", &n, &m); int clock = 0; // last clock int current_clock; // clock of the current reference int page_id; // id of referenced page int hits = 0; // count of hits happened int misses = 0; // count of misses happened ...
C
#include <include.h> #include BINARY_SEARCH_TREE_H void Execute_Tree(void) { int Option; MyBTree* Bin_Tree = GetMyBTree(); while (1) { printf_s("1. Insert Element\n2. In Order Traversal\n3. Pre Order Traversal\n"); printf_s("4. Post Order Traversal\n5. Find Element\n6. Delete Element\n"); switch (Option)...
C
#include<stdio.h> int main() { int i,j,a=1; //~ scanf("%d",&n); for(i=1;i<=5;i++) { for(j=1;j<=7;j++) { if(a>31) { break; } else if(a%2==0) { printf("** "); } else if(a==17||a==31) { printf("$$ "); } else { printf("%02d ",a); } a++; } printf("\n"); } ...
C
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward d...
C
// // Created by bear on 2021-03-30. // #ifndef ECS_BITWISE_H #define ECS_BITWISE_H #include <stdio.h> #include <stdint.h> #include <stdbool.h> typedef uint64_t bits64; #define BITWISE_IS_COVER(bits,b) ((bits | b) == bits) #define BITWISE_SET_TRUE_AT(bits,index) (bits | (((bits64)1) << index)) #define BITWISE_SE...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* realloc.c :+: :+: :+: ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_t_string_concat.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> //input shouldn't be longer than 1024 characters #define MAX 1024 int main(){ //Open file with strings FILE * letter; letter = fopen("letter.txt", "r"); //declare and initialize n int n = 0; //prompts user for input printf("Enter a number for n: "); //...
C
#include <stdio.h> int main() { printf("Hello World\n"); printf("This is change\n"); printf("This is second change\n"); return 0; }
C
/******************** * CPE 101 Section 9 * * Dr. Campbell * * Shiva Empranthiri * * Quad Tests * * 1/13/2014 * ********************/ #include <stdio.h> #include <math.h> #include "checkit.h" #include "functions.h" int main() { checkit_double(quad(10.0), 3024); checkit_double(quad(9.0), 168...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* flags_ast.c :+: :+: :+: ...
C
//programm for structure performance #include<stdio.h> #include<string.h> typedef struct employee { int emp_id; char emp_name[100]; char dept_name[10]; float b_sal; }emp; void sort1(emp *m,int num) { int i,j,temp; emp s; printf("\n\tTo sort the records according to the emp-ID:\n"); for(i=0;i<num-1;i++) for...
C
#include<stdio.h> #include<stdlib.h> #include<unistd.h> #include<string.h> #include<fcntl.h> #define MAX_INDEX 16 struct _chunk { long pointer; long length; } chunk[MAX_INDEX]; int chunk_idx = 0; int std_read(unsigned char *buf, unsigned int count) { int idx = 0, i = 0; unsigned char c_in; for (i = 0; i <= co...
C
/*Program 4.1 : Program to display array elements with their addresses.*/ #include<stdio.h> #include<conio.h> void main() { int a[3]={5,4,3}; printf("\n a[0] ,value=%d : address=%u",a[0],&a[0]); printf("\n a[1] ,value=%d : address=%u",a[1],&a[1]); printf("\n a[2] ,value=%d : address=%u",a[2],&a[2]); getch(); } /*...
C
#include <stdio.h> int main(void) { char a[100],i,b=0; scanf("%s",a); for(i=0;a[i]!='\0';i++) b++; a[b/2]='*'; for(i=0;a[i]!='\0';i++) printf("%c",a[i]); return 0; }
C
#include "cpu.h" void enable_irq (int irq) { /* Make sure that the IRQ is an allowable number. Up to 32 is * used. * * NOTE: If you are using the interrupt definitions from the header * file, you MUST SUBTRACT 16!!! */ if (irq > 32) { //printf("\nERR! Invalid IRQ value pass...
C
int compare(const void *a, const void *b){ return strcmp((char*)a, (char*)b); } bool isAnagram(char * s, char * t){ qsort(s, strlen(s), sizeof(char), compare); qsort(t, strlen(t), sizeof(char), compare); if (strcmp(s, t)) return false; return true; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* get_next_line.c :+: :+: :+: ...
C
#include<stdio.h> // ANSI-Cores #define F_VERMELHO "\033[41m\033[37m" #define F_VERDE "\033[42m\033[30m" #define F_LARANJA "\033[43m\033[30m" #define F_AZUL "\033[44m\033[37m" #define F_ROSA "\033[45m\033[37m" #define F_CIANO "\033[46m\033[30m" #define F_BRANCO "\033[47m\03...
C
#include <assert.h> #include <stdbool.h> #include <ctype.h> #include <stdio.h> // pomocna funkce // obecny prevod znaku na hodnotu cislice (az do zakladu 36) int char2digit(int c) { c = toupper(c); if (isdigit(c)) return c - '0'; if (isalpha(c)) return c - 'A' + 10; else return 99; // neni cislice ...
C
/** ****************************************************************************** * @file pack_deal.c * @author qsunj * @date 21-5-26 * @brief ****************************************************************************** */ #include "pack_deal.h" /******************ݸʽ****************** ֡ͷ ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* filo_one.c :+: :+: :+: ...
C
#include<stdio.h> void swap(int *,int *); int main() { int a,b; printf("enter the number"); scanf("%d%d",&a,&b); printf("number is before swapping %d%d",a,b); swap(&a,&b); printf("number after swapping %d%d",a,b); } void swap(int *a,int *b) { *a=*a+*b; *b=*a-*b; *a=*a-*b; printf(...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include "./headers/interpretador.h" #include "./headers/auxiliares.h" #include "./headers/comandos.h" void erro_sintaxe(int tipo) { switch (tipo) { case 1: printf("Erro no comando\n"); break; case 2:...
C
//--------------------------------------------------------------------------- #include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> #include <sys/stat.h> #include <sys/types.h> #include <regex.h> #include "WMMHeader.h" //--------------------------------------------------------------------------...
C
/* mem.c */ /* These functions manage the standard C library functions malloc(), realloc() and free() to automatically reclaim unused memory. They do not impose an "all your pointers are belong to us" regime. If you bypass them at your own risk, use tools such as valgrind to check for leaks. The algorithms are dist...