language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <stdbool.h> #include "include/util.h" //function to get the only the cpu temperature from lm-sensors. basically string treatment char* measureTemperature() { //calling installSensors function (util.c) installSensors(); //declaring variable...
C
#include<stdio.h> #include<string.h> int main() { int i, consonant=0,vowel=0; char str[60]; printf("enter the string:"); gets(str); for(i=0;str[i]!='\0';i++) { if((str[i]>='a' && str[i]<='z') || (str[i]>='A' && str[i]<='Z')) { if(str[i] =='a' || str[i]=='e' || st...
C
#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #define PIECE_NUM_MAX 50 int main() { int piece_num; int input_data[PIECE_NUM_MAX]; int i; int output; scanf("%d", &piece_num); for (i = 0; i < piece_num; i++) scanf("%d", &input_data[i]); //////////////////////////////////////// int prime[PIECE_NUM_MA...
C
#include <stdio.h> #include <stdlib.h> int main() { int a,b,n; printf("You want to find the prime from 0 to :"); scanf("%d",&n); for(b=2;b<n;b++) { for(a=2;b%a;a++); if(a==b)printf("%d\n",b); } return 0; }
C
#include "svdpi.h" #include "stdio.h" #include "stdlib.h" #include "opencv2/core/core.hpp" #include "opencv2/highgui/highgui.hpp" using namespace cv; static int WIDTH; static int HEIGHT; extern "C" void c_fun_printf(char * p_in) { printf("c function print:%s\n",p_in); } extern "C" unsigned long long allocFrame(...
C
/// @file spinlock.c /// @brief /// @copyright (c) 2014-2022 This file is distributed under the MIT License. /// See LICENSE.md for details. #include "klib/spinlock.h" void spinlock_init(spinlock_t *spinlock) { (*spinlock) = SPINLOCK_FREE; } void spinlock_lock(spinlock_t *spinlock) { while (1) { if (...
C
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> //#include <iostream> //using namespace std; int Max(int a, int b) { if (a > b) return a; return b; } int main(void) { int n; scanf("%d", &n); int stair[301]; int DP[301]; for (int i = 1; i <= n; i++) scanf("%d", &stair[i]); DP[0] = 0; ...
C
#include "atomic.h" void *atomic_fill_stack(void *stk) { int i; i = 0; while (i < MAXSIZE && atomic_push2((t_stack_ptr *)stk, i)) i++; return (NULL); } void *atomic_empty_stack(void *stk) { int i; atomic_int value; i = 0; while (i < MAXSIZE && atomic_pop2((t_stack_ptr *)stk, &value)) i++; return (N...
C
#include <stdio.h> void main() { float a,b,max; printf("һ:"); scanf("%f",&a); printf("ڶ:"); scanf("%f",&b); max=(a>b?a:b); printf(":%.3f\n",max); }
C
//b32.c - Lothwaite barrows. Circe 4/29/04 #include <std.h> #include "../lothwaite.h" inherit BARROWS; void create(){ ::create(); set_long( ::query_long()+"\n%^BLUE%^A large chamber opens up "+ "to the southwest, while the wide passageway goes back to "+ "the east.\n"); set_exits(([ "east" ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <stdbool.h> #include <time.h> /* The prime 41, can be written as the sum of six consecutive primes: 41 = 2 + 3 + 5 + 7 + 11 + 13 This is the longest sum of consecutive primes that adds to a prime below one-hundred. The longest sum o...
C
/*E5_60*/ #include<stdio.h> int main(void) { int i,m1,m2,m3,total,rno,maxtotal=0,maxrno,count; count=0; for(i=1; i<=10; i++) { do { printf("Enter roll number(1000-9999) : "); scanf("%d",&rno); }while(rno < 1000 || rno > 9999 ); printf("Enter marks of three subjects : "); scanf("%d%...
C
#include<stdio.h> int main() { int num1; printf("Enter the number = "); scanf("%d",&num1); printf("the result is = %d",squre(num1)); } int squre(int a) { return a*a; }
C
#include<stdio.h> struct student{ int ID; char name[100]; int age; char address[200]; }; int i; int main(){ struct student s[5]; printf("Enter Information of 15 students.\n"); for(i=0;i<15;++i){ printf("Enter %d student details:\n",i+1); printf("Enter Student Id Number:\n"); scanf("%d",&s[i].ID); p...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* split_path.c :+: :+: :+: ...
C
#include <sys/socket.h> #include <sys/types.h> #include <sys/poll.h> #include <stdlib.h> #include <netinet/in.h> #include <stdio.h> #include <string.h> #include <ctype.h> #include <glib.h> #include <arpa/inet.h> #include <time.h> #include <stdbool.h> #include <unistd.h> #include <sys/ioctl.h> #include <fcntl.h> #includ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* sort.c :+: :+: :+: ...
C
#include <stdlib.h> #include <stdio.h> #include <errno.h> #include <pthread.h> #include <sched.h> #include <signal.h> #include <iostream> #include <chrono> #include <cmath> #include <unistd.h> void *tau_1(void *); void *tau_2(void *); void *tau_3(void *); void *tau_mid(void *); void setSchedulingPolicy(int, int); voi...
C
int maxProfit(int* prices, int pricesSize){ if (pricesSize <= 1){ return 0; } int maxValue = *(prices), minValue = *(prices), max =0, value = 0, i; for(i=1; i < pricesSize; i++){ if(*(prices+i) > maxValue){ maxValue = *(prices+i); }else if(*(prices+i) < minValue){ ...
C
// // main.c // 作业6-8 平方根计算 // // Created by 谢 on 2019/11/1. // Copyright © 2019 谢. All rights reserved. // #include <stdio.h> #include <math.h> int main() { int i; double max,min=1.0,n = 0.0,mid=1.0; for (i=1; i<4; i++) { printf("测试数据%d\n",i); scanf("%lf",&n); max = n; ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> extern void suma(unsigned int *, unsigned int*, unsigned short ); // ejercicio 1a extern short int * sumaYresta(short int *, short int*, unsigned short ); // ejercicio 1b extern int prodInterno(short int *, char*, unsigned short); // ejercicio 1c exte...
C
#include <unistd.h> #include <stdio.h> #include <sys/types.h> #include <sys/wait.h> int main(void) { int status; pid_t pid = fork(); if (pid > 0) { printf("PID %d: Child created successfully\n", getpid()); } if (pid == 0) { printf("PID %d: I am the child process\n", getpid()); } wait(&status); if (pid > 0...
C
#include<stdio.h> int main() { int a,b,c,d; scanf("%d %d %d %d",&a,&b,&c,&d); printf("Sum = %d; Average = %.1f",a+b+c+d,(a+b+c+d)/4.0); return 0; }
C
// The 3pi include file must be at the beginning of any program that // uses the Pololu AVR library and 3pi. #include <pololu/3pi.h> // This include file allows data to be stored in program space. The // ATmega168 has 16k of program space compared to 1k of RAM, so large // pieces of static data should be stored in pr...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_display_u.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> struct dados{ int codigo; }; #include "arvore_binaria.h" Dados dados1; int main(){ dados1.codigo = 4; Arvorebin A4 = arvore(NULL, dados1, NULL); dados1.codigo = 5; Arvorebin A5 = arvore(NULL, dados1, NULL); dados1.codigo = 6; Arvorebin A6 = arvore(N...
C
/************************************************************************* >> File Name: 桶排序.c >> Author: chenjunjie >> Mail: 2716705056qq.com >> Created Time: 2019.01.21 桶排序也叫箱排序。工作的原理是将数组元素映射到有限数量个桶里,利用计数排序可以定位桶的边界,每个桶再各自进行桶内排序(使用其它排序算法或以递归方式继续使用桶排序)。 桶排序不是比较排序,不受到 O (nlogn) 下限的影响,它是鸽巢排序的一种归纳结果,当所要排序的数组值分散均匀的时候,桶排...
C
#include "libft.h" char *ft_strdup(const char *s) { size_t len; char *str; len = ft_strlen(s); str = (char *) malloc(sizeof(char) * (len + 1)); if (!str) return (NULL); str = ft_memcpy(str, s, len + 1); return (str); }
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <sys/types.h> #include <unistd.h> #include <elf.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/mman.h> int Currentfd; void *map_start; char* fileName=NULL; char str[100]; struct stat myStat; Elf32_Ehdr *myHeader; int debug=0; void quit(){ ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <mpd/client.h> #include <mpd/status.h> #include <mpd/entity.h> #include <mpd/search.h> #include <mpd/tag.h> #include "mpdinfo.h" #undef DEBUG MPDinfo init_mpdinfo(void) { /* connect to mpd */ struct mpd_connection * mpdconn = mpd_connection_new("l...
C
#include "9cc.h" int is_alnum(char c){ return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') || (c == '_'); } Token *new_token(TokenKind kind, Token *cur, char *str, int len){ Token *tok = calloc(1, sizeof(Token)); tok->kind = kind; tok->str=str; tok->len = len; cur->next = tok; ret...
C
/* * File: main.c * Authors: Gabriel Graells, Arnau Blanco, Asfandyar Abbasi. * * * * This file contains the "main" function which calls all other major functions, the "hanoiprint" which * prints the node thats is being passed and also clear memory function which frees the memory at the * end of the program...
C
#include<stdio.h> #define MS 5 int front=-1,rear=-1,e; struct priority_queue { int key; int element; } pq[MS],temp; void insert() { int i; if(front==-1&&rear==-1) { front=rear=0; } else rear++; printf("Enter Priority "); scanf("%d",&pq[rear].key); printf("Enter ...
C
#include <assert.h> #include <stdio.h> #include <stdbool.h> #include <CUnit/CUnit.h> #include <CUnit/Basic.h> #include "linkedlist.c" #include "hashtable.c" #include "ForwardingInformationBase.cpp" #include "Shaper.cpp" #include "FaceManager.cpp" /*prototypes*/ static int init(void); static int run_tests(void); static...
C
#include <helpers.h> #include <bufio.h> #include <stdio.h> #include <sys/wait.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> /*execargs_t construct_execargs(const char* const name, char* const * argv);*/ /*int runpiped(execargs_t** programs, size_t n); */ /*int exec(execargs_t* args)...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <windows.h> #pragma warning (disable:4996) void LibrarianADD(), LibrarianDELETE(int), LibrarianACC(int), LibrarianMENU(int), LibrarianLOGIN(), LibrarianSEARCH(), LibrarianDISPLAY(), SearchStudentRecord(); char ANSWER; int RESPONSE;...
C
#include <stdio.h> #include <cs50.h> #include <string.h> #include <ctype.h> int main(int argc, string argv[]) { /*int key = GetInt(); if (key == NULL || key < 0) { return 1; } string text = GetString(); key %= 26; */ int key; if (argc == 2) { key = atoi(argv[1])...
C
#include "libft.h" char *ft_strrchr(const char *str, int ch) { int i; char c; char *s; char *res; i = 0; c = (char)ch; s = (char *)str; res = NULL; if (c == '\0') return (s + ft_strlen(s)); while (s[i]) { if (s[i] == c) res = &s[i]; i++; } return (res); }
C
#include<stdio.h> #include<conio.h> void main() { int n, count = 0, max=0, min=0, sum = 0;; printf("enter numbers, enter 0 to stop:\n"); while (1) { scanf_s("%d", &n); if (n <= 0) break; sum += n; if (count == 0) { min = n; max = n; } count++; if (n < min) min = n; if (n > max) max ...
C
#include <stdlib.h> #include <string.h> #include <liboddl/liboddl.h> #include "tokens.h" #include "data_structure.h" #include "common.h" #include "string_utils.h" char* typeName[TYPE_TYPE+1] = { "NONE", "bool", "int8", "int16", "int32", "int64", "unsigned_int8", "unsigned_int16", "...
C
Syscall: #include <linux/kernel.h> #include <linux/init.h> #include <linux/sched.h> #include <linux/syscalls.h> #include <linux/errno.h> SYSCALL_DEFINE3(mysortFunc, const int __user *, arrptr1, int , length , int __user * , arrptr2) { printk("Entering system call\n"); int i,j,temp = 0; int *ker...
C
/* vi: set sw=4 ts=4: */ /* * linked list helper functions. * * Copyright (C) 2003 Glenn McGrath * Copyright (C) 2005 Vladimir Oleynik * Copyright (C) 2005 Bernhard Fischer * * Licensed under the GPL v2, see the file LICENSE in this tarball. */ #include <stdlib.h> #include "libbb.h" /* Add data to the start of...
C
#pragma once #include "vector3.h" struct mat3 { mat3() {} mat3(float a, float b, float c, float d, float e, float f, float g, float h, float i) { m[0][0] = a; m[0][1] = b; m[0][2] = c; m[1][0] = d; m[1][1] = e; m[1][2] = f; m[2][0] = g; m[2][1] = h; m[2][2] = i; } union { float m[3][3]; ...
C
#include <stdio.h> #include <stdlib.h> #include <os2.h> #include <string.h> #include <netinet\in.h> #include <sys\socket.h> #include <sys\types.h> #include <netdb.h> #include <utils.h> #include <stdarg.h> #include <sys\ioctl.h> // open a stream socket int sockOpen(PSZ pszHostname, ...
C
#include <stdio.h> #include <stdlib.h> #include "Dato.h" int main() { eDato dato; eDato* d; d=&dato; if(eDato_set_a(d,500)==1 && eDato_set_b(d,"hola")==1) { printf("%d--%s", eDato_get_a(d),eDato_get_b(d)); } else { printf("Verifique los datos"); } retu...
C
#include <stdio.h> #include <time.h> #include <stdlib.h> void printArray(int a[], int count) { int i; for (i = 0; i < count; i++) { printf("%d ", a[i]); } printf("\n"); } void selectionSort(int arr[], int MAX) { int indexMin, i, j; for (i = 0; i < MAX - 1; i++) { indexMin = i; for (j = i + 1; j<MAX; j...
C
#include "uart.h" FILE uart_output = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE); void uart_init (void) { UBRR0H = UBRRH_VALUE; UBRR0L = UBRRL_VALUE; #if USE_2X UCSR0A |= _BV(U2X0); #else UCSR0A &= ~(_BV(U2X0)); #endif UCSR0C = _BV(UCSZ01) | _BV(UCSZ00); // 8-bit data UCSR0B = _BV(RXEN0) ...
C
/****************************************************************************************************************************** * * NAME: format_conversion_display * * DESCRIPTION: This function converts the data in a presentable format and displays the same. * * GROUP DATE REFERENCE ...
C
/* This function should accept the amount needed in cash as input and return the number of notes per each of the following denominations: 2000, 500, 100, 50, 20, 10, 5, 1 The function can dispense a maximum of 15 notes per denomination. Each hexa digit represents the number of notes for that denominati...
C
/* * Project: Printf (The team project). * The team of; - Waython Yesse * and - Damiano */ #include "main.h" /** * itob - change int to binary * @list: int to change * Return: string with binary */ char *itob(va_list list) { int j = 0, twos = 1; int i, k; char *s; k = va_arg(list, int); i = k...
C
// Recursion #include<stdio.h> // Factorial long factorial(int n) { if (n == 0) return 1; else return (n*factorial(n-1)); } // Binary Search int BinarySearch(int ar[], int first, int last, int target) { int mid; if(first > last) return -1; mid = (first + last) / 2; if(...
C
#include "holberton.h" /** * rev_string - prints reversed string, followed by a new line * * @s: pointer to the string to print * * Return: void */ void rev_string(char *s) { int len, i, half; char temp; for (len = 0; s[len] != '\0'; len++) ; i = 0; half = len / 2; while (half--) { temp = s[len - i - 1]; s...
C
#include <stdio.h> #include <stdlib.h> #include <valgrind/mctracer.h> int main(int argc, char* argv[]) { double* m; int i, j, it; double sum = 0.0; int size = 1024; int iterations = 50; if(argc >= 2) size = atoi(argv[1]); if(argc >= 3) iterations = atoi(argv[2]); m = (double*) malloc(sizeof(double)*size*size...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <openssl/md5.h> //const char *string1="abcdefghijklmnopqrstuvwxyz1234567890"; //const char *s1 = string1[0]; //const char string={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4'...
C
#include "stm32f4xx_hal.h" #include "supporting_functions.h" #include "lis3dsh.h" #include <math.h> /*The function to read from the accelerometer The accelerometer should be configured first! See Accel_Config.c Accel_Config() for more details No inputs required Returns an array containing the raw x, ra...
C
#define PWM_FREQ 1000 #define DCMOTOR_POWER PORTC.B2 #define DCMOTOR_POWER_TRIS TRISC.B2 #define DCMOTOR_DIRECTION1 PORTC.B0 #define DCMOTOR_DIRECTION1_TRIS TRISC.B0 #define DCMOTOR_DIRECTION2 PORTC.B1 #define DCMOTOR_DIRECTION2_TRIS TRISC.B1 void DCMotorInit() { PWM1_Init(PWM_FREQ); DCMOTOR_POWER_TRIS = 0; ...
C
#include <stdio.h> int student,n,reg_number; double d,number; int main(){ scanf("%d",&student); while(student--){ scanf("%d%lf",&reg_number,&number); if(number > d) d = number, n = reg_number; } if(d < 8.0) printf("Minimum note not reached\n"); else printf("%d\n",n); return 0; }
C
#include<stdio.h> #include<math.h> int main(){ float a,b,c; a = 2.5; b =0.0005; c =3000.; printf("\n %f %f %f", a, b, c); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h>//tolower #define BOOKTILTE 50 #define NAME 25 void lowercase(char *str); void addbook(void); typedef struct date { int day, month, year; } date; typedef struct book { char title[BOOKTILTE]; char author[NAME]; char ISBN[18]; ...
C
/* * Using UART1 module * * Tested on: * Microstick + Microstick Plus Development Board * PIC24HJ64GP502 * * File name: uart1.h * Author: Jozsef KOPJAK * Info: info@microstickplus.com * Web: http://www.microstickplus.com * * Last modification: 10-04-2013 */ #ifndef _UART1_H #...
C
#include <inttypes.h> #include <stdatomic.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <pthread.h> #include <threads.h> #define TID_UNKNOWN -1 #define MAX_THREADS 128 typedef struct { void *next; uintptr_t key; } list_node_t; typedef struct { list_node_t *h...
C
/** * This is a timer */ #ifndef _ARDUINO_TIMER_H #define _ARDUINO_TIMER_H #pragma once #include "Arduino.h" // The number of milliseconds in each time period #define FAST_TIME_MILLIS 10 #define MEDIUM_TIME_MILLIS 100 #define LONG_TIME_MILLIS 1000 // This variables are 'volatile' as it changes in an ISR volatile ...
C
#include <stdio.h> #include <string.h> #include "list_struct.h" #include "list.h" void list_init(List *list, void (*destroy)(void *data)) { list->size = 0; list->destroy = destroy; list->head = NULL; list->tail = NULL; return; } void list_destroy(List *list) { void *data; while(list_size(list) > 0) { if(li...
C
#include <stdio.h> #include <unistd.h> #include <signal.h> #include <string.h> #include <stdlib.h> #include <ctype.h> void signalHendler(int sig){ char *sign; sign = strsignal(sig); printf("signal recived: %s\n", sign); signal(sig, SIG_DFL); if (sig ==SIGCONT) { signal(SIGTSTP, signalHendler); } if (sig ==SI...
C
/* * Mitchell Van Braeckel (mvanbrae@uoguelph.ca) 1002297 * 15/03/2018 * schedule.c creates a course and writes it to courses.bin Takes two command line arguments: first is a student ID number, second is a term. Binary search on the "students.bin" file to look up the student's information. ...
C
#pragma once // , entity // , , extern Fvector get_valid_position(const CEntity *entity, const Fvector &actual_position); // true, entity extern bool object_position_valid(const CEntity *entity); IC Fvector random_position(const Fvector &center, float R) { Fvector v; v = center; v.x += ::Ran...
C
/* tictactoe.c - tic-tac-toe reinforcement learning program */ #include <dstructs/treemap.h> #include <dstructs/dynarray.h> #include <stdlib.h> #include <stdbool.h> #include <stdio.h> #include <string.h> #include <time.h> #include <ctype.h> /* constants */ enum board_state { board_won, board_complete, boar...
C
#include<stdio.h> #include<limits.h> int main() { int j,n,m,a,b,i,min=INT_MAX; scanf("%d%d%d%d",&n,&m,&a,&b); for(i=n%m,j=n/m;i<=n;i+=m,j--) { int t=a*(i)+b*(j); if(t<min) { min=t; } } printf("%d\n",min); return 0; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* get_next_line.c :+: :+: :+: ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* history.c :+: :+: :+: ...
C
// Given three rods R1,R2,R3 // Given X number of disks on R1 with largest disk at bottom and smallest at top // The disks at R1 are sorted // Aim is to transfer these disks with this configiration to R3 // R2 can be used for help in the transfer, adhering to following rules- // 1. only one disk can be mov...
C
/* * Author : Gwendal Le Gall * Date 02/02/2010 * * * This file is part of Wallig Library and Drivers. * * Copyright (C) 2010 Gwendal Le Gall * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * ...
C
#include<stdio.h> #include<Windows.h> int main() { int a, b; for (a = 0; a < 4; a++) { b = a + 2; } printf("%d\n", b); /*char *str1 = "add"; char str[] = { 'a','c' };*/ /*printf("%s\n", str1); printf("%s\n", str);*/ system("pause"); return 0; }
C
#include "Debug.h" void Debug_print(unsigned char* start, unsigned char* end) { Debug_HEADER; puts("Literal Instructions:"); unsigned char* insPtr; printf("[ "); for(insPtr = start; insPtr != end; insPtr++) { printf("%u ", *insPtr); } put...
C
/* Jinoo Hong */ /* Write a program `posnums.c` that reads 2 positive integers from the user, and prints the average of the two (this should be printed as a floating point number.), whether each number is a prime number or not, and whether the two numbers are relatively prime or not (the only positive integer that divi...
C
#include "sys.h" #include "delay.h" #include "usart.h" #include "stmflash.h" #include "iap.h" #include "stdio.h" #include "string.h" iapfun jump2app; //תӦó //appxaddr:ûʼַ. void iap_load_app(u32 appxaddr) { if(((*(vu32*)appxaddr)&0x2FFE0000)==0x20000000) //ջַǷϷ. { jump2app=(iapfun)*(vu32*)(appxaddr+4); //ûڶΪʼַ(...
C
//_seal.c by Circe 6/19/04 //for use with signet rings //new sealing devices may be added, but they must have //int query_is_seal_device(){ return 1;} //new waxes must have //int is_sealing_wax(){return 1;} #include <std.h> inherit DAEMON; int help(); int cmd_seal(string str){ object wax, paper, ring; string...
C
#include <allegro5/allegro.h> #include <allegro5/allegro_image.h> #include <stdio.h> #include <allegro5/allegro_primitives.h> const int largura = 800; const int altura = 600; ALLEGRO_DISPLAY *janela = NULL; ALLEGRO_EVENT_QUEUE *fila= NULL; ALLEGRO_BITMAP *map=NULL; ALLEGRO_MOUSE_STATE click; ALLEGRO_EVENT...
C
#include <stdio.h> #include <stdlib.h> #include "Stack.h" void init_stack(struct Stack *stack) { stack->list = malloc(sizeof(struct LinkedList)); if (stack->list == NULL) { perror("Not enough memory to initialize the stack!"); return; } init_list(stack->list); } int get_size_stack(st...
C
#include<stdio.h> struct student{ int num; char name[20]; int score[5]; double avg; }; struct student Getavg(struct student); int main() { struct student s1 = { 315, "ȫ浿", { 82, 93, 74, 90, 65 } }; s1 = Getavg(s1); //Getavg(s1) ̷ ϸ XX printf("\n : %.1lf\n", s1.avg); } struct student Getavg(struct student s1...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* t_pidlist.c :+: :+: :+: ...
C
#include <stdlib.h> void ft_putchar (char c); void ft_printf (char *string); int size_of_matrix (char *matrix); int check_valid_matrix (int size, char *matrix) { while (*(matrix + 4 * 2)) { if (*matrix == ' ') { matrix++; continue ; } if (*matrix - '0' + (*(matrix + 4 * 2) - '0') > size + 1) return...
C
//conctenate the strings #include<stdio.h> #include<string.h> int main(){ char a[100], b[100]; printf("enter the value for a: "); gets(a); printf("enter value for b: "); gets(b); strcat(a,b); printf("string obtained is %s\n", a); return 0; }
C
#include "sync.h" int pair_capture(int semid, struct syncbuf self, struct syncbuf othr, int (*self_init) (int)) { struct sembuf sop_buf[4]; int sop_n = 0; /* Capture lock */ SOPBUF_ADD(self.lock, 0, 0); SOPBUF_ADD(self.actv, 0, 0); SOPBUF_ADD(othr.actv, 0, 0); SOPBUF_ADD(self.lock, 1, SEM_UNDO); if (SOPBUF...
C
/** * \file fonctionMenu.c * \brief Contient toutes les fonctions utiles pour les menus * \author Quentin Bellanger * \version 1 * \date 01 avril 2020 */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <time.h> #include "../lib/commun.h" #include "../lib/fonctionGrille.h" /** * \fn void Wo...
C
void printIdentityHex(FILE * ofp, char *identity, char *x, char *y, char *lh, double lht, char * rh, double rht){ char *rt=(char *)malloc(30*sizeof(char )); char *lt=(char *) malloc(30*sizeof(char )); double2hex(lht, lt); double2hex(rht, rt); fprintf(ofp,"%s,%s,%s,%s,%s,%s,%s\n",identity, x, y, lh, lt, rh, rt)...
C
/* * ======================================================================== * * Filename: console.c * * Description: Console processing * * Version: 1.0 * Date: 04/12/14 09:10:17 PM * Compiler: gcc-4.6.3 * * Author: Populus Huang * Email: thoughtso...
C
#include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include <sys/types.h> #include <sys/stat.h> #include <time.h> #include <math.h> extern FILE *fp_debug; int checkFileExist (char *fname, char *rootname, char *suffix, char *directory, char *filePath) { struct ...
C
/* * This package implements malloc, realloc, and free using segregated lists. * Each block contains a 1 word header, 1 word footer, which each consist of size | allocation bit. * */ #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <unistd.h> #include <string.h> #include <stdint.h> #include "mm...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* rush02.c :+: :+: :+: ...
C
/* erl_comm.c */ #include <stdio.h> #include <unistd.h> typedef unsigned char byte; int read_cmd(byte *buff); int write_cmd(byte *buff,int len); int read_exact(byte *buff,int len); int write_exact(byte *buff,int len); int read_cmd(byte *buf) { int len; if(read_exact(buf,2) != 2) return(-1); len = (buf[0] <<...
C
#include <stdio.h> int logb2(int n); unsigned rightrot(unsigned x, int n); unsigned getbits(unsigned x, int p, int n); int main() { unsigned x = 17; printf("%u", rightrot(x, 2)); return 0; } /* Rotates 'x' rightwise according to number 'n' */ unsigned rightrot(unsigned x, int n) { int i; unsigned au; au = x...
C
#include <stdio.h> #include <string.h> char *ft_strdup(char *src); int main(int argc, char **argv){ if(argc != 3){ printf("%s need 2 argv! ",argv[0]); return 0; } char *src_t_01 = argv[1]; char *dup_t_01 = ft_strdup(src_t_01); strcpy(src_t_01, "z"); printf("src_t_01:%s dup_t_01:%s\n",src_t_01,dup_t_01); }...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* fractals_mandelbrot.c :+: :+: :+: ...
C
#include<stdio.h> int reverse(int a,int N){ int rev = 0,rem=0; while(a != 0){ rem=a%10; rev=rev*10+rem; a=a/10; } return rev; } int main(){ int n; scanf("%d",&n); int arr[n]; for(int i=0;i<n;i++){ scanf("%d",&arr[i]); } for(int i=0;i<n;i++){ int rev_arr = reve...
C
/* Autor: Murillo Rodrigo Petrucelli Homem Departamento de Computação Universidade Federal de São Carlos Código ilustrativo (esboço) de uma pequena biblioteca gráfica tridimensional */ #include "cg2d.h" #include <math.h> #include <stdio.h> #include <stdlib.h> typedef struct Point3D { float x, ...
C
#include <stdio.h> #include <stdlib.h> int main() { int a; scanf("%d",&a); switch (a) { case 1: printf("january"); break; case 2: printf("febuary"); break; case 3: printf("march"); break; default : printf("month is not found"); ...
C
// enQueue and deQueue operations on an Circular Array based implementation of a Queue #include<stdio.h> #include<stdlib.h> #define SIZE 10 void enQueue(int); void deQueue(); void display(); int queue[SIZE], front = -1, rear = -1; void main() { int value, choice; while(1){ printf("\n***** MENU *****\n"...
C
/* AUTHOR: dushara bhasha EMAILID:bhasha_dusara@yahoo.COM DOC:21/07/2016 OBJECTIVE:SORT AN ARRAY USING BUBBLE SORT ALGORITHM WITH THE USE OF FUNCTIONS */ #include<stdio.h> #include<conio.h> #include<string.h> #define SIZE 5 #define CSIZE 10 void ascendingSort(); // function for Ascending order sorting of...
C
//#define DEBUG #ifdef DEBUG #define type int #endif #ifndef type #error "Must be define type!" #endif #include "../abc.h" #include "../AbcAlgorithm/algorithm.h" #include <stdbool.h> #define Concat(x, y) x##y #define UseType(x, y) Concat(x, y) #define Name(x) UseType(type, x) #define type_node UseType(type, _node)...