language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/* * Adelie.c * * Created: 6/6/2019 6:03:19 PM * Author: Joey */ #include <stdint.h> #include "Adelie_v0.1.h" #define ADELIE_INST_ALU_BR 31 #define ADELIE_INST_REG_IMM 30 #define ADELIE_INST_OP 26 #define ADELIE_INST_RD 21 #define ADELIE_INST_R1 16 #define ADELIE_INST_BR_IMM 0 #d...
C
/* Navn: Rune Bohnstedt Email: rbohns18@student.aau.dk Gruppe: a400B Studieretning: Software */ #include <stdio.h> #include <stdlib.h> #include <math.h> void run_calculator(void); double scan_data(double *operand, char *operator); double do_next_up(double *akkumulator, double *operand, char *operator); /* Main som k...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> char* read_line(FILE *p); int FINarchivo; /*Lee una linea del archivo*/ char* read_line(FILE *p){ char *linea=(char*)malloc(sizeof(char)*101); int iT=0,i=0; char caracter; char* buftmp; FINarchivo=1; while((caracter=getc(p)) != EOF){ FINarchivo=0; i...
C
#include <stdio.h> #include "ra_dec_string.h" #include "slalib.h" /* -------------------------------------------------------------------- * Convert RA (rad) to string; return pointer to (static) string * -------------------------------------------------------------------- */ char *ra_string(double ra) { static ch...
C
#define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sched.h> #include <fcntl.h> #include <errno.h> #include <dlfcn.h> #include "PerfServiceNative.h" #define LIB_FULL_NAME "/system/lib/libperfservicenative.so" void (*perfBoostEnable)(int) = NULL; void (*perfBoostDisable)(int) = NU...
C
#include <stdio.h> int main () { char value; /*this program was done using Ali's brains*/ printf("\n\nEnter letter: "); scanf("%c", &value); if ((value=='a') || (value=='e') ||(value=='i') ||(value=='o') ||(value=='a')) { printf("Vowel\n"); } else if ((value=='b') || (value=='c') || (value=='d') ||...
C
#include "binary_trees.h" /** * binary_tree_height - measures the height of a binary tree * @tree: pointer to the root node of the tree to measure the height * Return: height of tree or 0 if is NULL */ size_t binary_tree_height(const binary_tree_t *tree) { size_t res; if (!tree) return (0); if (!tree->left ...
C
#include<stdio.h> main() { int a[' '],b[' '],i,n,j,k; printf("Enter the numberb of elements : "); scanf("%d",&n); printf("enter the elements : "); for(i=0;i<n;i++) scanf("%d",&a[i]); for(i=0;i<n-1;i++) { for(j=i+1;j<n;j++) { if(a[i]==a[j]) { for(k=j;k<n;k++) { a[k]=a[k+1]; } n--; j--; } } } printf("After removing dupli...
C
#include "checks.h" t_bool ft_check_up_cols(int **sudoku, int x, int size) { int capacity; int y; int i; y = 1; capacity = 1; i = 1; while (y + i <= size) { if (sudoku[x][y] < sudoku[x][y + i]) { capacity++; y += i; i = 1; } else i++; } if (capacity == sudoku[x]...
C
float getFloat /*brief Pedir y validar un dato flotante ** ** ** */ float fPedirYValidarDato(char leyendaPedirDato[], char leyendaDatoInvalido[], char vValidaciones[], float min, float max, float distinto, float igual) { printf("%c",leyendaPedirDato); scanf("%f",&dato); if ( vValidacion...
C
#include<stdlib.h> #include<stdio.h> #include<pthread.h> #include<unistd.h> pthread_mutex_t lock; int seconds = 50, minutes = 59, hours = 23; void* print_hr(void* pString) { pthread_mutex_lock(&lock); if(minutes > 59){ hours++; minutes = 0; seconds = 0; } pthread_mutex_unlock(&...
C
#pragma once // assign() 给list赋值 // back() 返回最后一个元素 // begin() 返回指向第一个元素的迭代器 // clear() 删除所有元素 // empty() 如果list是空的则返回true // end() 返回末尾的迭代器 // erase() 删除一个元素 // front() 返回第一个元素 // get_allocator() 返回list的配置器 // insert() 插入一个元素到list中 // max_size() 返回list能容纳的最大元素数量 // merge() 合并两个list // pop_back() 删除最后一个元素 ...
C
#define LOCAL #include<stdio.h> #include<string.h> #define MAXN 1000 char buf[MAXN]; int main() { int i; #ifdef LOCAL freopen("data.in", "r", stdin); freopen("data.out", "w", stdout); #endif while(fgets(buf, sizeof(buf), stdin)) { for(i = 0; i < strlen(buf); i++) { if(buf[i] != '\n') buf[i] -= 7; else...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strjoin.c :+: :+: :+: ...
C
#ifndef __Queueing_LINKEDLIST_H__ #define __Queueing_LINKEDLIST_H__ #define TRUE 1 #define FALSE 0 #define SIMUL_MAX 100 typedef struct employee { int cheese; int bulgogi; int bigmag; } Employee; typedef int Data; typedef struct _node { Data data; struct _node* next; } Node; typedef struct _CLLQueue { Node...
C
/* * TASK 1: Scalable Vector Graphics (SVG) * * Example: * * 53,10 * 53,10,23,30 * 23,30 * * GUEST LANGUAGE: This is my attempt to translate ch-1.pl and MySVG.pm into C */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> #include <ctype.h> #include <assert.h> #include "MySV...
C
#include <pthread.h> #include <unistd.h> #include <stdio.h> void* worker (void* unusued) { // pthread_detach(pthread_self()); // Do nothing } int main() { pthread_t thread_id; for(int i=0; i < 200000; i++) { if (pthread_create(&thread_id, NULL, &worker, NULL) != 0) { fprintf(stde...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #define MAXLINE 1000 int main(int argc, char *argv[]) { FILE *fp = fopen("test.ini", "r"); if (fp == NULL) { perror("Error opening file"); exit(1); } FILE *destfp = fopen("test.xml", "w"); if (destfp == NULL) { perror("Error opening file"); exi...
C
struct LTable { char *name; int addr; struct LTable *next; }; struct LTable *LThead, *LTtail; void append_table(char *label, int addr) { struct LTable *temp; temp = (struct LTable *)malloc(sizeof(struct LTable)); temp->name = label; temp->addr = addr; if (LThead == NULL) { LThead = temp; LTtail = temp; ...
C
#include <stdio.h> #include <string.h> #include <unistd.h> #define BUFSIZE 0x0FFF // show stdin string. int main() { int retval = 0; char buf[BUFSIZE]; memset(buf, 0, sizeof(buf)); retval = read(STDIN_FILENO, buf, sizeof(buf)); if (retval < 0) goto out; printf("GET: %s", buf); ...
C
#ifndef _CENGINE_UI_LAYOUT_VERTICAL_H_ #define _CENGINE_UI_LAYOUT_VERTICAL_H_ #include "cengine/types/types.h" #include "cengine/collections/dlist.h" #include "cengine/renderer.h" #include "cengine/events.h" #include "cengine/ui/ui.h" #include "cengine/ui/components/transform.h" #define VERTICAL_LAYOUT_DEFAULT_SCR...
C
/* ** get_buff.c for get_buff in /home/Max/Documents/delivery/PSU_2016_tetris/src ** ** Made by fourrier maxence ** Login <maxence.fourrier@epitech.eu> ** ** Started on Mon Jul 24 10:55:15 2017 fourrier maxence ** Last update Mon Jul 24 12:37:58 2017 fourrier maxence */ #include <fcntl.h> #include "my.h" char ...
C
/* * @Author: TD21forever * @Date: 2018-10-11 22:20:56 * @Last Modified by: TD21forever * @Last Modified time: 2018-10-12 00:19:01 */ #include<stdio.h> #include<stdlib.h> int main(int argc, char const *argv[]) { int m; scanf("%d", &m); long long int array[100]; array[0] = 0; array[1] = 3; a...
C
#include <stdio.h> #include <stdlib.h> #include "funrecursiva.h" int main(int argc, char *argv[]) { int N=20; system("mode 100,120"); system("color 70"); printf("%i!=%d\n",N,factorial(N)); int n=20,m=3; printf("20P3=%d\n",nPm(n,m)); system("PAUSE"); return 0; }
C
#include<stdio.h> #include<stdlib.h> //ABеݽһ void Fun(char arr1[], char arr2[]) { int i = 0; for (i=0; i<4; i++) { //򵥽 int tmp = arr1[i]; arr1[i] = arr2[i]; arr2[i] = tmp; } } int main() { char arr1[] = {"abcd"}; char arr2[] = {"dcba"}; Fun(arr1, arr2); //ַ%s printf("arr1 = %s arr2 = %s", arr1, arr...
C
/********************************************************************************************* * Programmer: Manuel Berrueta * * WSU ID: 011585195 * * ...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<unistd.h> #include<wait.h> #include<sys/types.h> #include "execute.h" #include "parse.h" int execute(char *command, int prevStatus) { int operation = STANDARD, operation2 = STANDARD, status1, builtin = 0, status; char *cmdArgv[INPUT_SIZE], *ne...
C
/****************************************************/ /* File: symtab.h */ /* Symbol table interface for the TINY compiler */ /* (allows only one symbol table) */ /* Compiler Construction: Principles and Practice */ /* Kenneth C. Louden ...
C
/* ** manip_tab1.c for in /home/darkmark/rendu/PSU_2015_minishell2/env ** ** Made by Marc Lallias ** Login <lallia_m@epitech.net> ** ** Started on Sun Apr 3 23:11:29 2016 Marc Lallias ** Last update Sun Jun 5 18:44:43 2016 Marc Lallias */ #include "../../inc/minishell2.h" int my_tab_len(char **tab) { char **f...
C
/* * * * Implements Queues and CountQueues in MACROs. * * The Queue operations are: * * QUEUE(t) q; declare q as a queue of type t * ClearQueue(q); initialize queue to empty * EnQueue(q, pElement); enqueue an element * Queue(q, pElement); (same as EnQueue()) *...
C
inherit "/players/persephone/closed/thingys.c"; #include "/players/persephone/rooms.h" string unlocked; string openning; reset(arg){ if (!arg) { unlocked="no"; openning="no"; short_desc="Hotel Corridor"; long_desc="This is the end of the third floor corridor which continues to the west\n" + "There is a ...
C
#define NDEBUG 1 #include "debug.h" #include <stdlib.h> #include <stdio.h> #include <sys/stat.h> #include <math.h> struct Genome { int *sequence; int count; }; int get_line(char **line, size_t *size, FILE *file) { int bytesRead = getline(line, size, file); if (bytesRead > 0 && **line == '>') { bytesRead = get_l...
C
#include <stdio.h> int main() { int num1, num2, num3, num[3]; FILE *inf; inf = fopen("output.txt", "w"); num1 = 10; num2 = 20; num3 = 30; num[0] = 10; num[1] = 20; num[2] = 30; fprintf(inf,"num1 = %d, num2 = %d, num3 = %d\n", num1, num2, num3); fprintf(inf,"Num[0] = %d\n", num[0]); ...
C
#include "hash_tables.h" /** * key_index - function to get the index of a key * @size: size of hash table * @key: Key to get space in table * Return: Index number which key and value should be store in hashtable */ unsigned long int key_index(const unsigned char *key, unsigned long int size) { unsigned long int i...
C
#include <stdint.h> int main() { volatile int a = 0; volatile int b = 1; if (a > 0xff) { b++; } while (a < 10) { a++; } for (a = 0; a < 10; a++) { b++; } return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <windows.h> /* 사과를 학교에 배정한다. 배정된 사과 개수는 학교마다 다를 수 있고, 학생수도 학교마다 다를 수 있다. 각 학교에서는 배정된 사과를 똑같이 나누어 주되, 남는 사과의 개수를 최소로 한다. (서로 다른 학교에 속한 학생이 받는 사과 개수는 다를수 있다.) 학교의 수는 5개이다. 각 학교의 학생수와 사과 개수가 주어졌을 때, 학생들에게 나눠주고 남는 사과의 총 개수를 구하는 프로글매을 작성하시오.*/ int main(int argc, char *argv[]...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* opers2.c :+: :+: :+: ...
C
#include<stdio.h> #include<conio.h> void main() { int i; clrscr(); printf("Enter number for the day = "); scanf("%d",&i); if(i == 1) { printf("%d - Sunday\n",i); } else if(i == 2) { printf("%d - Monday\n",i); } else if(i == 3) { printf("%d - Tuesday\n",i); } else if(i == 4) {...
C
#include <stdio.h> #include <math.h> double function(double x) { double y,Z,a,p,b,c,e; Z=0.02; a=0.004; p=0.00019; b=(Z*pow(10,x)+a)/p; c=Z*pow(10,x)/0.43429444819; e=exp((-pow(Z*pow(((10,x)+a),2),2)-a*a)/2*p); y=b*c*e; return y; } void main() { double nrbins; double i, initialpt, finalpt, bsize, result; ...
C
#include<stdio.h> #include<stdlib.h> #include<pthread.h> #include<semaphore.h> #include<unistd.h> #include<stdlib.h> #define NUM 128 #define PRODUCTSUM 3 #define CONSUMESUM 3 sem_t datasem;//数据信号量 sem_t blanksem;//空闲空间信号量 pthread_mutex_t mutex;//互斥锁 int ring[NUM];//循环队列 int index1 = 0;//生产者index int index2 = 0;//消费者...
C
/* * main.c * * this is the main blinky application (this code is dependent on the * extra shu libraries such as the pinmappings list and the clock configuration * library) * * author: Dr. Alex Shenfield * date: 01/09/2017 * purpose: 55-604481 embedded computer networks : lab 101 */ // include the ...
C
#include <stdio.h> #include "Sequential_Linear.h" #define COORD3D(V, AXIS) COORD(V.x, V.y, V.z, AXIS) #define COORD(X, Y, Z, AXIS) ( (Z+AXIS/2) * ((long int) AXIS*AXIS) + (Y+AXIS/2) * ((long int) AXIS) + (X+AXIS/2)) /* Documented in header file */ int count_collisions(ElfInt3d *vector, int size, AXISTYPE *space3d, i...
C
#include "params.h" #include <math.h> #include <string.h> #include <stdio.h> #include <stdlib.h> //************************************************************************ // set_params() function // - Set simulation parameters. // - Arguments: // - len_jo: struct containing lennard jones interaction parame...
C
#include <stdio.h> #include <string.h> #include <stdint.h> #include <stdlib.h> #include <unistd.h> #include <wchar.h> #include "config.h" void* __xpac(void* ptr); int __pacga(long val, long sizeid); void* __pacia(void* ptr,unsigned long id); void* __autia(void* ptr,unsigned long id, char type); #if INLINEFUNCTIONS ...
C
#include "dominion.h" #include "dominion_helpers.h" #include "rngs.h" #include <assert.h> #include <getopt.h> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> char testname[] = "unittest1"; // tests the isGameOver function int main (int argc, char** argv) { struct ga...
C
#include <stdio.h> #include <time.h> #include <stdlib.h> #include "Vetores.h" int main (void) { int vet[10], i=0, somamenor=0, somamaior=0, contI=0, contM=0; float M=0; char op; do { somamaior=0; somamenor=0; contM=0; contI=0; M=0; ...
C
/** ============================================================================ Nome : 2137.c Autor : Taylor Klaus Cantalice Nobrega - 20200004268 Versao : 1.0 Descricao : 2137 - A Biblioteca do Senhor Severino ============================================================================ */ #include...
C
#include "holberton.h" /** * print_last_digit - This function use a di * @a: the character to print * * Return: On success 1. * On error, -1 is returned, and errno is set appropriately. */ int print_last_digit(int a) { int b; if (a > 0 || a == 0) { b = a % 10; _putchar('0' + b); return (b); } else if...
C
#include <stdio.h> int main() { int a,b,c; printf("삼각형의 3변을 입력하시오: "); scanf("%d%d%d",&a,&b,&c); if(a <= 0 || b <= 0 || c <= 0) printf("세 각은 양수여야 합니다.\n"); else { if(a + b + c == 180) printf("올바른 삼각형\n"); else printf("세 각의 합은 180도여야 합니다\n"); } return 0; }
C
/* * in addition to the weightunion , every time search the root * of one node , put every node in path to a child of the root(root()); * or put every other node's parent to its origin grandparent(root2()) */ #include <stdio.h> #include <string.h> #include <stdlib.h> #define ISUNION(p,q) (root(p) == root(q)) st...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* get_next_line.c :+: :+: :+: ...
C
#include<stdio.h> int main() { float a,h,b; scanf("%f",&h); scanf("%f",&b); a=0.5*b*h; printf("The Area of triangle= %.2f",a); return 0; }
C
#include <iostream> void f(int i, int j) { std::cout << "f(int, int)" << std::endl; } void f(long i, long j) { std::cout << "f(long, long)" << std::endl; } int main() { f(5, 5); f(5l, 5l); //f(5, 5l); f(5, 5.0); }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_printf_print.c :+: :+: :+: ...
C
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //FUNZIONE PER VISUALIZZARE UNA MATRICE (overloading) //const int LUN=100; void inizializza_matrice(int vet[][LUN], unsigned int &righe, unsigned int &colonne) { do{ cout<<"inserisci il n...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strsplit.c :+: :+: :+: ...
C
/** * main- void * description: prints alphabet except e and q * Return: 0 */ #include <stdio.h> int main(void) { char c; for (c = 'a'; c <= 'z'; c++) { if (c != 'e' && c != 'q') putchar(c); } putchar('\n'); return (0); }
C
#ifndef STDIO_H #define STDIO_H #include <stdarg.h> #include <string.h> #define EOF 0x04 //ascii EOT character #ifndef NULL #define NULL (void*)0 #endif #define FILENAME_MAX 256 typedef size_t fpos_t; typedef struct _internal_FILE FILE; extern FILE* stdin; void clearerr(FILE* stream); FILE* fopen(const char* file...
C
// What happens when & is not used in scanf ? #include <stdio.h> main() { int x; printf("Enter an integer input : "); scanf("%d" , x); printf("x : %d \n " , x); // skipped printf("Hello\n"); // skipped } /* There are 2 problems when & is missing in scanf 1) scanf does not read i...
C
#include "binary_trees.h" /** * binary_tree_nodes - count the number of internal nodes in a binary tree * @tree: tree to count internal nodes of * * Return: number of internal nodes */ size_t binary_tree_nodes(const binary_tree_t *tree) { if (tree == NULL) return (0); if (tree->left == NULL && tree->right == ...
C
#pragma once /* ITS kernel standard library string functions. */ /* INCLUDES */ #include <stdbool.h> #include <stdint.h> /* TYPES */ /* DECLARATIONS */ // Returns the length of the given string. int strlen(const char *str); // Reverses the given string. // Returns str on success. char *strrev(char *str); //...
C
/* ************************************************************************** */ /* LE - / */ /* / */ /* handle.c .:: .:/ . .:: ...
C
#include <stdio.h> int main() { //code int t,i; scanf("%d", &t); for(i=0;i<t;i++) { // code here int N,j,ar[1000]; scanf("%d", &N); for(j=0;j<N;j++) { scanf("%d", &ar[j]); } for(j=0;j<N;j+=2) { printf("%d ", ar[j]); } printf("\n"); ...
C
/** * @file xdmf_routines_2d_par.c * @brief Internal routines to generate XML schema for reading hdf5 files with paraview * * @author Nicole Beisiegel * @date 06/02/2016. ...
C
/******************************************************************************************* *Title: logger.c *Author: Glenn Upthagrove *Date: 01/01/2018 *Description: A grogram that logs incoming telemetry data to a file. *******************************************************************************************/ #de...
C
#include<stdio.h> int main(void) { int num; scanf("%d",&num); int i,j,k; for(k = 0;k < num;k++) { int n; scanf("%d",&n); int ar[n][n]; for(i = 0;i < n;i++) for(j = 0;j < n;j++) ar[i][j] = 0; for(i = 0;i < n;i++) { for(j = 0;j <= i;j++) scanf("%d",&ar[i][j]); } for(i = n-1;i >= 0;...
C
#include "console.h" static unsigned int count; #define INPUT_LEN 128 static char input[INPUT_LEN]; static float distance; static float lower, upper; static unsigned int sleepDur; static unsigned int cpuLoad; static g_xyzf_t _g_xyzf; static g_xyzf_t* g_xyzf = &_g_xyzf; static parsed_g_code_t _pgc; static parsed_...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_sort_params.c :+: :+: :+: ...
C
// // main.c // 9 // // Created by Kingsley on 2018/10/27. // Copyright © 2018 Kingsley. All rights reserved. // #include<stdio.h> #include<stdlib.h> #include<time.h> #include<math.h> int main() { long int n,max,min; scanf("%ld",&n); long int arr[n]; int i,t,r; srand((unsigned)time(NULL)); ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* colorgrad.c :+: :+: :+: ...
C
/* Ejercicio 3 - Práctica 4 - Sistemas Operativos Implementar un programa en lenguaje C, que simule al algoritmo RR (Round Robin). Tener en cuenta: quantum = 3. */ #include <stdio.h> #include <string.h> #define PROCESOS 5 //Número de procesos. #define QUANTUM 3 //Quantum de ejecución de cada proceso. typedef struc...
C
#include <stdio.h> #include <stdint.h> /* EL identificador typedef es una forma de cambiar el nombre a otros identificadores de tipo int, char, entre otros. typedef int entero -> Esto hace el int x -> entero x Se pueden crear valores de tipo "int", pero con otro nombre llamado "entero" */ typedef int entero; typ...
C
#include <stdio.h> void swap(int, int); int main(void) { int a = 5, b = 3; swap(a, b); printf("a: %d, b: %d\n", a, b); return 0; } void swap(int a, int b) { int temp = a; a = b; b = temp; printf("a: %d, b: %d\n", a, b); }
C
/********************************************************/ /* mjd.c */ /* */ /* convert gregorian date to julian day number */ /* */ /* algorithm from the Explanatory supplement to the */ /* Astronomical Almanac */ /********************************************************/ /***** description * ...
C
#include <stdio.h> int main(void) { // Hello World! Ͻÿ. printf("Hello World!"); // ٿ "ģ " ٿ Ѵ. printf("\n"); printf("ģ \nģ "); // Ʒ ̸ Ͻÿ. printf("\n"); printf("\\ /\\\n ) ( \')\n( / )\n \\(__)|"); // Ʒ Ͻÿ. printf("\n"); printf("|\\_/|\n|q p| /}\n( 0 )\"\"\"\\\n|\" ^ \"` |\n||_/=\\\\__|...
C
/* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2014 Frediano Ziglio * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2...
C
#include <math.h> /* Blink Turns on an LED on for one second, then off for one second, repeatedly. This example code is in the public domain. */ // Pin 13 has an LED connected on most Arduino boards. // give it a name: int red = 3, green = 5, blue = 6, i=0; double angle = 0.0; // the setup rou...
C
/* Test 1, uninitialized variables. */ #include <stdio.h> void main() { /* int k; float f; printf("%d %f\n", k, f); return 0; */ int a=5; int c=1; if(c>a) { c=c+c; } else { a=c-a; } c=0; }
C
/* * $Id: page.c,v 1.19 2011/01/29 03:41:59 ralf Exp $ * * page.c :- This file contains implementation of C function to * Instanciate paging. More detailled information * can be found on Intel site and more precisely in * the following book : * * Pentium Processor familly * Developpe...
C
/* * rules.c * Isaac_Agent * * Created by erix on 04/12/11. * Copyright 2011 __MyCompanyName__. All rights reserved. * */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <time.h> #include "../include/rules.h" #include "../include/errlib.h" #define GOT_BALL_THRES 1 ...
C
int expects(short a, short b) { if (!(a == b)) { printf("Failed\n"); printf(" %d expected, but got %d\n", a, b); exit(1); } } int expectl(long a, long b) { if (!(a == b)) { printf("Failed\n"); printf(" %ld expected, but got %ld\n", a, b); exit(1); } } ...
C
#include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h> #include <strings.h> int main() { unsigned long i; scanf("%ld", &i); unsigned long n, m, x; unsigned long res; while (i-- > 0) { scanf("%ld %ld %ld", &n, &m, &x); res = (x % m) * m + (x / n); ...
C
#ifndef TYPES_IO_H #define TYPES_IO_H #include <errno.h> #include <stdbool.h> #include <stdio.h> typedef struct { FILE *file; const char *filename; bool standard_stream; } myfile_t; #define MYFILE_NULL { NULL, "(no file)", false } extern const myfile_t MYFILE_NULL_C; inline static bool is_open(const myf...
C
#include "holberton.h" #include <stdio.h> /** * print_to_98- print 98 * @n: integer 1 * Return: 0 */ void print_to_98(int n) { if (n > 98) { for (; n != 98; n--) printf("%i, ", n); } if (n < 98) { for (; n != 98; n++) printf("%i, ", n); } if (n == 98) printf("%i", n); printf("\n"); }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <dbus/dbus.h> static void abort_on_error(DBusError *error); static DBusMessage *create_property_get_message(const char *bus_name, const char *path, const char *iface, const char *propname); static double extract_double_from_variant(DBusMessage *reply,...
C
#include "holberton.h" /** * flip_bits - flip bits * Description: Returns the number of bits you would need to flip to get * from one number to another * @n: First number * @m: Second number * Return: Number of bits require to flip */ unsigned int flip_bits(unsigned long int n, unsigned long int m...
C
// Copyright 2018 (c), Neven Sajko. All rights reserved. // Use of this source code is governed by a BSD-style license that can be found in the // LICENSE file. #include "../buffer/buffer.h" buffer * fixedXor(const buffer *in1, const buffer *in2) { if (in1->l != in2->l) { return NULL; } buffer *out = bufferAllo...
C
#include<stdio.h> int main() { // int arrays[5] = { 1,2,3,4,5 }; //ʵʳȡ㿪ʼ int len = sizeof(arrays) / sizeof(arrays[0]); int j = 1; // for (int i = 0; i < len; i++) { printf("%d\t", arrays[i]); } printf("\n"); // for (int i = 0; i <= len / 2; i++) { int temp = arrays[i]; arra...
C
#include "./funciones.h" int Teorema(int x){ int y; int z; //printf("Ingrese un numero\n"); //scanf("%d", &x); while(x > 1){ if(x%2 == 0){ printf("par\n"); z = x/2; x = z; printf("%d", x); } else{ printf("impar\n"); z = ((3*x)+1); x = z; printf("%d", x); } } }
C
int main() { char s[10000]; int a,b,k,d,i,j,c,n; k=0; scanf("%d %s %d",&a,s,&b); for(i=strlen(s)-1;i>=0;i--) { if(s[i]>='a'&&s[i]<='z') d=10+(int)(s[i]-'a'); if(s[i]>='A'&&s[i]<='Z') d=10+(int)(s[i]-'A'); if(s[i]>='0'&&s[i]<='9') d=(int)(s[i]-'0'); n=strlen(s)-1-i; c=...
C
// Ces programmes sont sous licence CeCILL-B V1. #include <stdio.h> int a; void f (int x) { printf("%d\n",2 * x); a = 2 * x; } int main() { int n; a = 3; n = 4; f(a + n); }
C
/* * Part of the GalaxySim project * by J. Klemm * * Provides an implementation for a tree of bodies as used * in the Barnes-Hut algorithm for N-body simulation. */ #ifndef TREE_H #define TREE_H 1 #include "bodies.h" typedef struct UniverseSize { double min_x; double max_x; double min_y; double max_y; ...
C
#include "RThreads.h" #include "RService.h" #include "Referee.h" #pragma region Referee Entry void* Thread_ReceiveEntryRequests(void* _param) { TParam_ReceiveEntryRequest* param = (TParam_ReceiveEntryRequest*)_param; EntryRequest entryRequest; int fdQnARequest_Read; bool closed = true; while (1) { if ...
C
#include <stdlib.h> #include <stdio.h> /** * @author Sadie Henry * @date 11/4/14 * @details This program prints a 16-bit decimal number * that is input by the user. */ void printDigit(int digit){ switch(digit){ case 0: printf("%c", '0'); break; case 1: printf("%c", '1'); break; case 2: printf("%c", '2'); bre...
C
#include <stdio.h> #include <stdlib.h> typedef struct cel { int conteudo; struct cel *prox; } celula; /* Recebe um elemento y e uma pilha t e insere y no topo de t */ void empilha_enc_C(int y, celula *t) { celula *nova; nova = (celula *) malloc(sizeof (celula)); nova->conteudo = y; nova->prox = t->prox; ...
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
#ifndef TLB_H #define TLB_H #include <time.h> #define TLB_size 16 int TLB_hit_times; typedef struct { int page_number; int frame_number; } TLB_entry; /* * to_be_replaced points to the entry which will be moved if a TLB miss happens */ struct { TLB_entry TLB_array[TLB_size]; int to_be_replaced; }...
C
#include <stdlib.h> #include <stdio.h> #include <xmlrpc-c/base.h> #include <xmlrpc-c/server.h> #include <xmlrpc-c/server_abyss.h> static xmlrpc_value* transfer(xmlrpc_env* const envP, xmlrpc_value* const paramArrayP, void* const serverInfo) { xmlrpc_value* array; unsig...
C
int print_char(char c); void print_string_2(char *str) { int i; /* counter i */ i = 0; while (*str != '\0') { if (i % 2 == 0) /* for every 2nd character */ print_char(*str); /* print char */ i++; str++; } }
C
/************************************************************************* * File Name : 83.c * Author : unasm * Mail : unasm@sina.cn * Last_Modified: 2015-05-17 01:23:55 ************************************************************************/ #include<stdio.h> struct ListNode { int val; st...