language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stddef.h> #include <string.h> int diffsum(const int *arr, size_t n) { size_t i = 0, j = 0; int swap = 0, sum = 0; int tab[n]; memset(tab, 0, sizeof(tab)); while (i < n) { tab[i] = arr[i]; i++; } i = 0; while (i < n) { j = i + 1; while ...
C
#include <dict/dict_pp.h> #include <stdio.h> #define DICT_KEY_TYPE void* #define DICT_VALUE_TYPE void* #include <dict.h> static int dict_key_allocator_pp(void* key, void** key_dup) { *key_dup = key; return 0; } static int dict_value_allocator_pp(void* value, void** value_dup) { *value_dup = value; return 0; }...
C
#include <sys/socket.h> #include "nodearray.h" #include "tcp_rs232.h" #include "fun_msgpack.h" #include "send_list.h" zbnodearray g_zbnodearray; int g_initflag = 1; int g_testindex = 0; pthread_mutex_t nodearraymutex = PTHREAD_MUTEX_INITIALIZER; int addNewzbNode(pzbnode pnode )//µzbڵ { int i; printf("*****addNew...
C
/* ** get_mouse_pos.c for sdloop in /home/chaix_a/Personal_Work/SDLoop ** ** Made by Adrien Chaix ** Login <chaix_a@epitech.net> ** ** Started on Sat Mar 12 14:09:44 2016 Adrien Chaix ** Last update Sat Mar 12 14:10:23 2016 Adrien Chaix */ #include "sdloop.h" t_pos get_mouse() { t_pos mouse; SDL_GetMouseState...
C
/* Programming Exercise 8-5 */ // Modify the guessing program of Listing 8.4 so that it uses a more intelligent guessing // strategy. For example, have the program initially guess 50, and have it ask the user // whether the guess is high, lower, or correct. If, say, the guess is low, have the next guess // be halfway ...
C
#include <stdio.h> #include <stdlib.h> // 4 Familia: NO recibe nada y NO devuelve nada , solo hay q hacer el LLAMADO a la funcion void sumar(); int main() { sumar(); // proba comentando este codigo -- siempre hay q hacer el LLAMADO a la funcion-- return 0; } void sumar() { int num1; int num2; i...
C
#include <stdio.h> #include <stdlib.h> #include <sys/time.h> #include "kahoot.h" #include "utils.h" #include "list.h" #include "listElem.h" typedef unsigned long long timestamp_t; static timestamp_t get_timestamp(); int main(){ //Calculate time taken by a code segment printf("Timer starts\n"); timestamp...
C
/*39. Left shift an integer variable initialized to 1, eight times. Observe the output after each single shift.*/ #include<stdio.h> int main() { int b=1,i=0,a=0; while(i<=8) { a=b<<i; printf("a=%d b=%d\n",a,b); i++; } } /*here moving bits to left ex:1-----0000 0001 10000 0000 shift 1 by 8 tim...
C
#include <stdio.h> #define diff(x,y,z) (z = y,y = x,x = z) int main () { int a = 1; int b = 2; int c; diff(a,b,c); printf("%d,%d",a,b); return (0); }
C
#include "holberton.h" /** * my_reverse - function that reverse string * * @str: array to reverse * @len: lenght of arrays * * Return: Nothing * **/ void my_reverse(char str[], int len) { int start, end; char temp; for (start = 0, end = len - 1; start < end; start++, end--) { temp = *(str + start); *...
C
#include <stdio.h> char *strrev(char *string) { char *original = string; char *forward = string; char temp; while (*string) string++; while (forward < string) { temp = *(--string); *string = *forward; *forward++ = temp; } return(original); } ...
C
#include <stdio.h> #include <stdlib.h> int nextToken(char const * str, int* from, int* len); #define TAILLE_MAX 1024 int nextToken(char const* str, int* from, int* len) { int result = 0; for (int i = *from; i < strlen(str); ++i) { if(str[i] == '\0') return result; else { } } return result; } int main(vo...
C
/* -------------------------------------------------------------------------- \ CToR Provides some functions to transform C variables to R variables. \ -------------------------------------------------------------------------- */ #include "CToR.h" #include "PythonInR.h" SEXP c_to_r_boolean(int c_boolean){...
C
#include<stdio.h> #include<stdlib.h> #include<pthread.h> #include<semaphore.h> #include<unistd.h> sem_t lock,pap,tob,mat; int num=0; void* agentcode(void* arg){ do{ sem_wait(&lock); //printf("Agent thread created\n"); printf("\n"); num = (rand() % 3 + 1); if(num==1){ sem_post(&pap); printf("match a...
C
/* ** EPITECH PROJECT, 2019 ** pipe_and_redir_manager ** File description: ** manage all pipe and redirections */ #include "minish.h" void redirect_function(int i, char **env, separators_t *sep, instruction_t *instruct) { int fd; if (sep->separators[i] == REDIR) fd = open(instruct->commands[i+1][...
C
/* ================================== Born2DEV : C-programming zero2one [Section 3] Assignment 12 : มากกว่า หรือ น้อยกว่า ? ================================== Problem: ให้จำนวนเต็ม 2 จำนวน หาว่าตัวไหนมากกว่ากัน? inp: 80 90 out: MAX : 90 MIN : 80 ----------------------------------- inp: 90 100 out: MAX : ...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> int rolldice(){ int dice1 = 1 + (rand()%6); int dice2 = 1 + (rand()%6); int sumof = dice1 + dice2; return sumof; } int main(){ int balance; printf("Enter Balance to Start the game : \n" ); scanf("%d", &balance); srand(time(NULL));...
C
#include <stdio.h> #include "moduloFuncoes.h" #define PI 3.14 #define COUNT 18 void menu(){ printf("\t\t-----------------------------------\n"); printf("\t\t\t LISTA LÓGICA PARTE 1\n"); printf("\t\t\t%d de 29 questões respondidas\n", COUNT); printf("\t\t-----------------------------------\n"); pri...
C
#include <stdio.h> void TOH(int n,char S,char M,char D){ if(n==1){ printf("Move %d numbered disc from %c to %c\n",n,S,D); }else{ TOH(n-1,S,D,M); printf("Move %d numbered disc from %c to %c\n",n,S,D); TOH(n-1,M,S,D); } } void main(){ int n = 3; TOH(n,'S','M','D'); }
C
#include "demo_head.h" int open_ts() { //1.打开触摸屏设备 int tsfd = open("/dev/input/event0",O_RDWR); if(tsfd == -1) { printf("打开设备错误\n"); return -1; } return tsfd; } int ts_main_choice(int tsfd) { struct input_event xy; int x,y; int x0,y0; int touch; while(1) {...
C
#include <unistd.h> #include <stdlib.h> #include <fcntl.h> #include <stdio.h> #include "holberton.h" /** * create_file - creates a file. * @filename: name of the file to create. * * @text_content: string to write to the file * * Return: 1 success, -1 failure */ int create_file(const char *filename, char *text_co...
C
#include "map.h" #include<stdio.h> unsigned char map[MapH][MapW]; void FillMapArea(Uint32 x1,Uint32 y1,Uint32 x2 , Uint32 y2,Uint8 value) { if(x1>=MapW) x1 = MapW-1; if(x2>=MapW) x2 = MapW-1; if(y1>=MapH) y1 = MapH-1; if(y2>=MapH) y2 = MapH-1; for(int i= y1;i<=y2;i++) for (int e = x1;e<=x2;e++) map[i][e] = value...
C
#include "operation.h" /* LIMIT OPERATION: operation whose result is the first N results of another source operation */ typedef struct { int limite; int contador; operation_t * operation; } operation_limit_args_t; void operation_limit_reset(void* vargs) { operation_limit_args_t *args = vargs; ope...
C
#include <stdio.h> #include <stdlib.h> #define M_WAY 3 typedef struct BTNode { int n; int isLeaf; int isRoot; int keys[M_WAY]; struct BTNode* childs[M_WAY + 1]; }BTNode; BTNode* initBTNode(); BTNode* BTInsert(BTNode* root, int key); BTNode* splitChild(BTNode* root); void inorderTraversal(BTNode* root); BTNode...
C
/* * Copyright 2016 The Emscripten Authors. All rights reserved. * Emscripten is available under two separate licenses, the MIT license and the * University of Illinois/NCSA Open Source License. Both these licenses can be * found in the LICENSE file. */ #include <stdio.h> #include <errno.h> #include <fcntl.h> #...
C
#include<stdio.h> int first_set_bit(int n) { int pos=1; while(n>0) { if((n&1)==0) return pos; n=n>>1; pos++; } } int main() { int n,pos; scanf("%d",&n); pos=first_set_bit(n); printf("%d",pos); } /* 1000 0001 ---- */
C
/** * @author Bruno Masci * @brief Inline functions for processor IO operations. */ #ifndef __ARCH_IO_H__ #define __ARCH_IO_H__ #include <brunix/stddef.h> // Write a byte out to the specified port. inline static void outb(uint16_t port, uint8_t value) { asm volatile("outb %1, %0"::"dN"(port), "a"(value)); } ...
C
//External #include <string.h> #include <stdlib.h> //EM_LIB #include "em_chip.h" #include "em_cmu.h" #include "vddcheck.h" #include "segmentlcd.h" //GPIO_LIB #include "GPIO_lib/timer.h" #include "GPIO_lib/led.h" #include "GPIO_lib/uart.h" #include "GPIO_lib/i2c.h" #include "GPIO_lib/i2c_soft.h" //PROGRAM #include "D...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> /* returns num of lines in given file */ unsigned int fileLines(FILE *file) { char c; unsigned int lines = 0; while ((c=fgetc(file))!=EOF) if (c=='\n') lines++; rewind(file); return lines; } /* copies each line of fil...
C
#include<stdio.h> int main() { int num,m=20,n=40; print("print odd numbers in a given range m to n:\n"); scanf("%d",&num); for(num=m;num<=n;num++) { printf("%d",num); } return 0; getch(); ]
C
#include<stdio.h> #include<time.h> int main() { timer_t timer; struct itimerspec ts; int ret; ret=timer_gettime(timer,&ts); if(ret) perror("timer_gettime"); else{ printf("current sec=%ld nsec=%ld\n",ts.it_value.tv_sec,ts.it_value.tv_nsec); printf("next sec=%ld nsec=%ld\n",ts.it_interval.tv_sec,ts.it_inte...
C
//this code deiscretizes a heat/diffusion equation with defined ICs and BCs. (for the cylinderical case //numerical and exact solutions for some specified BC and IC have been compared //The current 2-D code has been parallelized in one dimension of z. //Author: Mohammad Reza Ghanbari // z.main.c #include "m...
C
/****************************************************** ** Program: driver.c ** Author: McKenzie Calvert ** Date: 06/11/2017 ** Description:THis is the driver for the first part of the assignment aka the push ** pop stuff on the linked list ** Input:takes in nothing from the user ** Output:strings that show what...
C
// Tencent的一个题目:开始一头奶牛,至第四年开始产崽,之后每年产一崽,计算n年后一共有多少奶牛 #include <stdio.h> int calCow(int year) { int cowNum = 1, i; for(i=1; i<= year; i++) { if(i<4) cowNum = 1; else cowNum = cowNum + calCow(year-i); // 使用递归解决,从年份的角度;calCow(year-i)可以看作最后奶牛总数中第i年新生奶牛极其后裔数 } return cowNu...
C
//README //Wai Lwi Phyo //CRUZID: wlphyo //pa2 //Exported Type typedef struct MatrixObj* Matrix; typedef struct ListObj* List; //constructor-destructor Matrix newMatrix(int n); void freeMatrix(Matrix* pM); // Access functions // Return the size of square Matrix M. int size(Matrix M); // Return the number of non-zero...
C
#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> //int main() //{ // int i = 1; // for (i; i <= 100; i++) // { // if (i % 3 == 0) // printf("%d ", i); // } // return 0; //} int main() { int a=0, b=0, c=0; int p=0; scanf("%d %d %d", &a, &b, &c); if (b>a) { p = a; a = b; b = p; } if (c>a) { p = a; ...
C
/* SplitBregmanROF.c (MEX version) by Tom Goldstein * This code performs isotropic ROF denoising using the "Split Bregman" algorithm. * This version of the code has a "mex" interface, and should be compiled and called * through MATLAB. * *DISCLAIMER: This code is for academic (non-commercial) use only. Also...
C
#include <stdio.h> #include <stdlib.h> #include "../lista_encadeada_com_cabeca.h" int contagem(celula *lista1) { int numeroDeCelulas = 0; while (lista1->proximaCelula != NULL) { lista1 = lista1->proximaCelula; numeroDeCelulas += 1; } return numeroDeCelulas; } int main(in...
C
#ifndef URI_H_ #define URI_H_ //================================================================================================= #include "../bajoNivel/tipos.h" #include <tcpip/tcpip.h> // IP_ADDRESS_TYPE //================================================================================================= // Repres...
C
#include <stdio.h> #include <string.h> char FindFirstVowel(char *s); int main(){ char string[50], c; scanf("%s", string); c = FindFirstVowel(string); printf("%c", c); return 0; } char FindFirstVowel(char *s){ char *c; if((c=strpbrk(s,"AaEeIiOoUu"))!=NULL){ return *c; } return 0; }
C
#include <stdio.h> int main(){ float notas[5]; notas[4] = 0; for (int i = 0; i < 4; i++){ printf("Digite a nota %d:",i+1); scanf("%f",&notas[i]); notas[4] += notas[i]; } notas[4] = notas[4] / 4; printf("Sua media = %.2f\n",notas[4]); return 0; }
C
#include <stdio.h> // cf // http://gradot.wordpress.com/2012/09/10/initialisation-tableaux-et-structures-en-c/ struct s { int a; int b; int c; int d; }; struct s sg; // contenu vaut zero int tg[5]; // idem int main(void) { struct s s1 = {12, .c=17}; // pas de warning struct s ...
C
#include "../corsair.h" static char encoding_table[] = {'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', 'a', 'b', 'c', 'd', 'e', 'f', ...
C
/****************************************************************** * File Name : heap_sort.c * Description : 构造了大顶堆。大顶堆:能找出最小的k个数;小顶堆: 找出最大的k个数。 * * Copyright (C) 2016 Yangguang Li * Mail : liyggyj@163.com * Author : Yangguang Li * Created time : 2017-01-20 07:35:07 PM * Last mod...
C
// // Created by Ming Hu on 8/5/17. // #include "myrmit_parser.h" CourseList * myrmit_parse_course(char * raw_json, char * cookie_path) { // Convert raw json to root object cJSON * root_object = cJSON_Parse(raw_json); // Parse week starting timestamp and student ID, and also weekly timetable cJSON * ...
C
#include "declaration.h" #include"lexhc.h" //TabDecla tabDecla[DECLARATION_MAX]; int debut_decla = 4; //comme pour la table lexico, les 4 premiers sont ddis aux types de base int debordement = DEBUT_DEBORDEMENT; int tab_representation[MAX]; int taille_struct(){ return 0; } in...
C
#include "socket.h" #include <arpa/inet.h> #include <fcntl.h> #include <netdb.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/select.h> #include <sys/socket.h> #include <sys/types.h> #include <unistd.h> struct timeval tv; int cidr_to_in_addr(char* cidr, struct in_addr** all_ips, uint32_t* ...
C
#include <stdio.h> int sumSimple(int x){ int result; asm( //schiebe input in register 3(Laufindex) "mov r3, %[out];" //schreibe 0 in register 4(Ergebnis) "mov r4, #0;" //label loop_anfang "loop_anfang:" /*register 5 = asl 2 um so viele stellen wie in register 3 als wert steht*/ "mov r5, #1;" "lsl r5, r5,...
C
/* ** free_tab.c for free_tab in /home/gogo/rendu/PSU_2015_minishell2/src/clean ** ** Made by Gauthier Cler ** Login <cler_g@epitech.eu> ** ** Started on Sat Apr 2 20:38:21 2016 Gauthier Cler ** Last update Wed Apr 13 13:59:57 2016 Gauthier Cler */ #include <stdlib.h> #include "mysh.h" void free_tab(char **tab) ...
C
#include <stdlib.h> #include <assert.h> #include <math.h> typedef struct {int n; double *x,*y,*b,*c,*d;} cspline; /* We want different functions: * One for building the spline, * one for freeing the memory holding the spline, * one for evaluating the spline, * one for differentiating the spline * and one for integ...
C
#include "driver_common.h" dmem_section_t* ReadDmemInitFile(char fname[], int sec_size[], int n) { FILE* dm_file = fopen(fname, "r"); if (dm_file == NULL) { printf("ERROR: fail to open dmem file %s\n", fname); return NULL; } dmem_section_t* res = malloc(sizeof(dmem_section_t)*n); ch...
C
/** @file */ #include "enumsStructsMacros.h" #include "draw.h" #include <GLFW\glfw3.h> #include <stdlib.h> #include "mapMemAndGen.h" void initGrid(tile** bitmap, int gridSize, int howManyBoxes, int howManyUpgrades) { generateMap(bitmap, gridSize, howManyBoxes, howManyUpgrades); } void resetDrawStatics() { drawPort...
C
#include <stdio.h> #include <unistd.h> #include <sys/types.h> int main(void) { printf("L0\n"); fork();//creando un nuevo proceso printf("L1\n"); wait(NULL);//padre espera al hijo return 0; }
C
#include<stdio.h> #include<unistd.h> #include<sys/wait.h> #include<sys/types.h> int main(int argc,char *argv[]) { int status; pid_t pid; if(fork() == 0) { printf("Child process1 running -------- Parent of Process 2\n"); if(fork()==0) { printf("Child process2 running -------- Parent of Process 3\n"); ...
C
#include <sys/socket.h> #include <netinet/in.h> #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <sys/select.h> #define TAM 64 int main(int argc, char *argv[]) { int i, s, s_conec, lido, ndesc; unsigned int tam_dir; struct sockaddr_in dir, dir_cliente; char buf[TAM]; int opcion=1; fd_set desc...
C
/** @file functions.h The function header file. */ #ifndef FUNCTIONS_H #define FUNCTIONS_H #include <Windows.h> #include <stdbool.h> #include "main.h" #include "data.h" #define XDIM 5 /* define x-dimension */ #define YDIM 5 /* define y-dimension */ #define ARR_LEN(a) (sizeof(a) / sizeof(a[0])) /* used to det...
C
//#include "includes/drivers/uart.h" /* * Note [6] * Send character c down the UART Tx, wait until tx holding register * is empty. */ //#include "common.h" #include "config.h" int uart_putchar(char c, FILE *unused) { if (c == '\n') uart_putchar('\r', 0); loop_until_bit_is_set(UCSR0A, UDRE0); UDR0 = c; ...
C
#include <stdio.h> int main(void) { /* playing with pointers */ int a = 6789; int* p = &a; printf("value of 'a' : %d\n",a ); printf("address of 'a' where 'p' points to also the content of 'p' : %d\n",p); printf("address of 'a' by '&' : %d\n",&a ); printf("address of 'p' : %d\n",&p ); printf("the value where 'p...
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
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* position_to_circle.c :+: :+: :+: ...
C
#include "holberton.h" /** * print_binary - prints the binary representation of a number * @n: decimal number to be represented as binary * * Return: Nothing */ void print_binary(unsigned long int n) { int count = 0; unsigned long int res = n; while ((res >> 1) > 0) { count++; res = res >> 1; } res = ...
C
#include "holberton.h" /** * _print_rev_recursion - entry point * Return: array * @s: string */ void _print_rev_recursion(char *s) { if (*s == '\0') { return; } s++; _print_rev_recursion(s); s--; _putchar (*s); }
C
/* * This test runs a fairly exhaustive test on the key loading functionality * * It runs 3000 parallel working keys of the same private key; working key i * will be loaded at step i, and then generate signatures from that point; * for example, at step 3, we'll have three working keys; one which was loaded * at i...
C
#include <stdio.h> #include <stdbool.h> bool is_equal(unsigned int a, unsigned int b) { return (unsigned)((a^b)) == 0; } int main() { unsigned int a = 2, b = 2, c = 3; printf("a == b: %u, a == c: %u", is_equal(a, b), is_equal(a, c)); }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_printf_utils.c :+: :+: :+: ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_substr.c :+: :+: :+: ...
C
/* Sample implementation of a custom SCSI command with opcode 0xc8. With this command other computers can read data from the main memory of a TT or Falcon. The 12 byte command block looks like this: Byte Meaning 0 Opcode 0xc8 1 Reserved 2 Memory address (MSB) 3 Memory address ...
C
#include <stdio.h> #include <string.h> int main() { char str[] = "I Love China"; char *p = str + 7; puts(str); // 从p位置开始到尾(\0)0位置 puts(p); // 操作的是字符数组,用"world"覆盖数组内的内容 strcpy(str, "world"); puts(str); puts(p); char *str1 = "hello"; printf("sizeof(str1) = %lu, strlen(str1) = %lu\n", sizeof(str1), strlen(...
C
/** * @file plat_arm.c * @author Pradeepa Senanayake (pradeepa.kck@gmail.com) * @date 31 Jan 2016 * @brief File contains arm compiler specific file access implementation. * * This file contains generic functions to do file manipulation using * FAT file system version R0.11a. * * The file can be easyly ported t...
C
#include <stdio.h> #include <stdlib.h> #include <windows.h> #include <time.h> #include "print_words.h" struct player { char name[100]; int cur_level; double score; struct player *next; }; struct word { char word[100]; int id; struct word *next; }; void DoTheGame(str...
C
/** * Projet compilation - Polytech' Paris-Sud 4ième année * Février - Mai 2011 * * Rémi Lacroix, Aliénor Latour, Nathanaël Masri, Loic Ramboanasolo */ #ifndef ARBRE_H #define ARBRE_H #include "utils.h" #include "structures.h" /* Pour éviter les dépendances cylindriques */ #ifndef arbre_t typedef struct arbre ...
C
#include <string.h> #include <stdlib.h> #include <stdio.h> #include "ami_bmp.h" #include "float_utils.h" #include "aan_propagacion.h" #define NITER 200 #define DT 0.25 #define K 0.9 float* calcular_f_p1 (float *v, int width, int height, float k) { int i, j; float *f_p1 = (float*)malloc (sizeof(float) * widt...
C
#include <stdio.h> #include <stdlib.h> struct list//定义链表结构 { int data; struct list *next; }; struct list *creat_list()//创建单个链表空间 { return calloc(1, sizeof(struct list)); } void traverse(struct list *ls)//遍历链表 { struct list *p = ls; while (p) { printf("%d\n", p->data...
C
// // Created by serge on 16.11.2019. // #include "coords.h" #include <math.h> double sqare(struct coords triangle) { return 0.5 * fabs((triangle.x_B - triangle.x_A) * (triangle.y_C - triangle.y_A) - (triangle.x_C - triangle.x_A) * (triangle.y_B - triangle.y_A)); } double perimeter(struct coords triangle) { r...
C
/* The following design decisions have been made : 1. For any escape sequence that is not recognized, for example \a, the backslash has been dropped and simply 'a' is printed. 2. Operators such as +/- have been considered separate from integers and floats themselves. Therefore something like -123 would be considered...
C
#include "HAL_conf.h" #include "HAL_device.h" #include "stdio.h" void HSE_Pll_test(unsigned int pllmul); /******************************************************************************************************** **Ϣ int main (void) ** ARMLED ** ** *******************************************...
C
// metodo de euler modificado - kaio alan littike - algoritmos numricos - 2019/1 #include <stdio.h> #include <stdlib.h> #include <math.h> double wx(double Ca,double vy,double vx,double m,double m1); double wy(double Ca,double vy,double vx,double g,double m,double m1); int main(){ double k11, k12, k13,k...
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
// // Aladin Sidahmed U08614258 // aladin.sidahmed@gmail.com // C/C++ Programming II // Section 145010 Ray Mitchell // 23 FEB 2020 // C2A6E3_DisplayClassStatus.c // Operating System: Windows 7 // Visual Studio Community 2019 Version 16.3.2 // // Implements Compare function used by qsort and bsearch // I...
C
#ifndef __DEFINED_COLLISION_H #define __DEFINED_COLLISION_H #include "defs.h" #include "map.h" #include "object.h" #include "timer.h" #include "signal.h" #include <math.h> enum Rectangle_Sides {RECT_TOP, RECT_RIGHT, RECT_BOTTOM, RECT_LEFT}; enum Point_Collided_Values {L1P1, L1P2, L2P1, L2P2}; /* Coordinates are in i...
C
/// MC548 - PROJETO E ANALISE DE ALGORITMOS II - 1s2010 /// Prof. Flavio Keidi Miyazawa /// --------------------------------------------------------------- /// PROJETO PRATICO: PROBLEMA DA MOCHILA COM RESTRICOES DE CONFLITO /// Haraldo Sergio A. Pereira Filho (003059) #include <stdio.h> #include <stdlib.h> #include <...
C
#include "task.h" int run_task(pthread_startroutine_t task, int *ret_value) { pthread_t thread; int r = pthread_create(&thread, 0, task, 0); if(r != 0) return r; pthread_addr_t exit_code = 0; pthread_join(thread, &exit_code); *ret_value = (int)exit_code; return 0; } int run_task_nowait(pthread_startrout...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #define N 1000 #define MAX(a, b) (a >= b) ? a : b struct cashe{ int number1; int number2; int number3; int number4; }cashe[N]; int main(void){ FILE *fp; FILE *cashe1; FILE *cashe2; int i = 0; int j = 0; int count = 0; int count1 = ...
C
#include <p18f1220.h> char c_a, c_b; unsigned char uc_a, uc_b; void main(void) { c_a = PORTB; c_b = PORTA; uc_a = PORTB; uc_b = PORTB; PORTA = c_a + c_b; PORTA = uc_a + uc_b; PORTB = c_a - c_b; PORTB = uc_a - uc_b; if (c_a > 0) PORTA = c_b; if (uc_a > 0) PORTA = uc_b; if (c_a > -3) ...
C
/* move alle active ghosts preferably, ghosts should continue their movement in the current direction if impossible, they randomly choose one of the possible directions */ #include "../lib/defines.h" #include "../lib/move_ghosts.h" #include <stdlib.h> void move_ghosts(char board[FIELD_HEIGHT][FIELD_WIDTH], int nr_gho...
C
#include "delay.h" volatile unsigned long time_delay; // ????,????????? //??n_ms void delay_ms(volatile unsigned long nms) { //SYSTICK??--1ms??????? if (SysTick_Config(SystemFrequency/1000)) { while (1); } time_delay=nms;//?????? while(time_delay); SysTick->CTRL=0x00; //????? ...
C
#include <stdio.h> #include <stdlib.h> #include <stdint.h> typedef uint8_t BYTE; typedef unsigned char bool; int main(int argc, char *argv[]) { if (argc != 2) { printf("Usage %s image\n", argv[0]); return 1; } char *forensic = argv[1]; FILE *forensic_img = fopen(forensic, "r"); ...
C
#include "qnet_threads_pool.h" #include "qnet_os.h" QNetThreadsPool * qnet_tpool_create_pool() { QNetThreadsPool * pool = qnet_alloc(sizeof(QNetThreadsPool)); if (pool == NULL) goto fail0; if (pool->stop_event = qnet_create_event(FALSE /* not auto reset.*/) != QSuccess) { goto fail1; } qnet_set_event(pool->sto...
C
#ifndef COMPRESSION_H_ #define COMPRESSION_H_ #include "../bitio/bit.h" #include "math.h" // ------------------------ // Move-to-front transform // ------------------------ void mtf_encode8(uint8_t* input, uint8_t* output, unsigned n) { if (n <= 0) return; uint8_t symbols[256]; for (unsigned i = 0; i < 25...
C
/* Programming with Persistent Data DT228/1 Assignment Andrejs Lahs C13766231 Program for managing employee records in a binary file. User can see how many employees there are in total/active/deleted. Menu allows user to add new records, delete records (by marking the record with a star), search record by name, surn...
C
//----------------------------------------------------------------------------- // Program code for CS 415/515 Parallel Programming, Portland State University. //----------------------------------------------------------------------------- // Queue representation // typedef struct queue_ queue_t; struct queue_ { ...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <time.h> #include <sys/time.h> #define INFINITY 1000000 int main( int argc, char**argv){ time_t t = time(NULL); struct timeval tm; gettimeofday(&tm,NULL); int start = tm.tv_usec; int i = 0, loop = 0; for( i; i <INFINITY; i...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* walker_00.c :+: :+: :+: ...
C
/** * Database */ #ifndef DB_H #define DB_H #include <stdint.h> #include <stdbool.h> // Database Types Sizes #define COL_VARCHAR_SIZE 139 #define COL_INT_SIZE 32 #define COL_ID_SIZE 16 // Table #define TABLE_MAX_PAGES 100 #define PAGE_SIZE 4096 // Column Type struct ColType_t { char* name; int size; }; type...
C
#include<stdio.h> #include<stdlib.h> void selection_sort(int *array, int length); void swap(int* x, int* y); void display(int array[], int length); int main() { int length; printf("How many element will be in the array:- "); scanf("%d", &length); int array[50]; for (int i = 0; i < length; i++) { ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* pointer.c :+: :+: :+: ...
C
#include<stdio.h> #define FLAG 8 int main(void) { int a=20,b=4; #if FLAG>=3 printf("Values of FLAG is grater then or equal to 3\n"); a=a+b; b=a+b; #else printf("Values of FLAG is less then 3\n"); a=a-b; ...
C
/** Soubor: steg-decode.c * Reseni IJC-DU1, priklad b) * Datum: 26. 3. 2015 * Autor: Nikola Valesova, xvales02, FIT * Prelozeno: gcc 4.8 * Definice funkce, ktera rozlusti tajnou zpravu **/ #include "bit-array.h" #include "eratosthenes.h" #include "error.h" #include "ppm.h" static void steg_decode(const char * filen...
C
#include <stdio.h> int main(void) { int t,k=1,m=0; scanf("%d",&t); while(t!=0) { k=t%10; m=m*m+k*k; t=t/10; } printf("%d",m); return 0; }
C
#include <stdio.h> int main(void){ int age, height, weight; double bov_m, bov_f; char m,f,pol; scanf("%c %i %i %i",&pol, &age, &height, &weight); switch(pol) { case 'm' : printf("| BMR |\n"); printf("%c%.2lf%c",'|',(double)(10*weight + 6.25*height - 5*age + 5),'|'); ...