language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/* 141043 ո HW#11.C4 SparseMat.c 2014.05.18 21 06 Ϸ */ #include "H11.C4_SparseMat.h" #define MAX_ROW 6 #define MAX_COL 6 #define MAX_NUM ((6*6)+1) // (MAX_ROW * MAX_COL) + 1 ִ #include <stdio.h> int main(void) { puts("==matrix transpose test=="); sparse_matrix_t a[MAX_NUM] = { { MAX_ROW, MAX_COL, 8 }, ...
C
/** @file sched.c * * @brief Top level implementation of the scheduler. * * @author Kartik Subramanian <ksubrama@andrew.cmu.edu> * @date 2008-11-20 */ #include <types.h> #include <assert.h> #include <kernel.h> #include <config.h> #include "sched_i.h" #include <arm/reg.h> #include <arm/psr.h> #include <arm/exc...
C
/* kill.c - kill */ #include <xinu.h> /*------------------------------------------------------------------------ * kill - Kill a process and remove it from the system *------------------------------------------------------------------------ */ syscall kill( pid32 pid /* ID of process to kill */ ) { intma...
C
/* * data_upload.c * * Created on: Jul 29, 2014 * Author: root */ #include "master.h" #include "amodem.h" #include <stdio.h> #include <unistd.h> #include <string.h> #define BUFSIZE 32 int main(int argc,char *argv[]){ FILE *fp; char buf[BUFSIZE]; char fname[BUFSIZE]; /* input check */ if (argc<2){ pri...
C
#include <msp430.h> #include <stdio.h> #include <stdlib.h> #include <string.h> // *************** // **************** // SET LCD!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // RS: P1.0 // R/W: P1.1 // E: P1.2 // *************** // **************** #define CS1 P1OUT |= BIT0 // RS #define CS0 P1OUT &= BIT0 #de...
C
// // Created by zhangyangshuo on 2021/1/4. // #include <stdio.h> #include <stdlib.h> struct TreeNode { int val; struct TreeNode* left; struct TreeNode* right; }; struct TreeNode* helper(int* preorder, int preStart, int preEnd , int* inorder, int inStart,int inEnd){ if(preStart>preEnd || inStart > inE...
C
#include <stdio.h> #include <cs50.h> int main(void) { long long cc; do { printf("Number: "); cc = get_long_long(); } while (cc < 0); if (cc < 1E12) { printf("INVALID\n"); return 0; } int checksum = 0; for (long long i = 10; i < cc;...
C
#include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> // 문제점? // : fork() 목적은 동시성이다. // 아래처럼 사용하면 동시성(병행성)을 사용할 수 없다. // 리눅스는 자식 프로세스의 종료를 비동기적으로 처리할 수 있는 방법을 // 제공합니다. // => 시그널 // => 자식 프로세스는 자신이 종료되는 시점에 부모 프로세스에게 자신의 // 죽음을 시그널을 통해 ...
C
#include <stdio.h> #include <string.h> #include <math.h> #pragma warning (disable:4996) typedef struct { int xpos; int ypos; }Point; /* Point addpoint(Point pos1, Point pos2) { Point pos = { pos1.xpos + pos2.xpos, pos1.ypos + pos2.ypos }; return pos; } */ // call by reference type1: ڿ ּҰ Ѱ // : ڿ ޸ ī ۾ Ͼ ʾƼ // ...
C
/* shelldriver.c */ #include "darshell.h" int main(int argc, char **argv, char **envp){ char line[BUFSIZ], command[BUFSIZ], *args[MAXARGS], prompt[MAXPATHLEN]; int comlen, status; pid_t pid, cpid; struct sigaction act; //int fdout, fd[2]; //char buf[BUFSIZ]; /* Set home as default path */ sethome(envp...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #define MAXBIT 100 #define MAXVALUE 10000 #define MAXLEAF 30 #define MAXNODE MAXLEAF*2 -1 //----------结构体定义---------- //节点结构体 typedef struct HNodeType{ int weight; //权值 int parent; //父节点 int lchild; //左子树节点 int rchild; //右子...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "p_e1_util.h" /* 1. define a person struct with id and ssn in .h 2. malloc a person var and assign id and ssn 3. make print function, prototype it in .h and print person var 4. make an init person function, prototype it in .h 5. use init person funct...
C
#include <stdio.h> #include <stdlib.h> typedef struct bst { int elem; struct bst *left; struct bst *right; }BST; BST* addNode(int elem, BST *root) { BST* temp= (BST*) malloc(sizeof(BST)); temp->elem=elem; temp->left=NULL; temp->right=NULL; if(root==NULL) { root=temp; } else { if(root->elem>elem) r...
C
/* Given a linked list, remove the nth node from the end of list and return its head. Note: Given n will always be valid. Try to do this in one pass. */ struct ListNode { int val; struct ListNode *next; }; struct ListNode* removeNthFromEnd(struct ListNode* head, int n) { struct ListNode *curr, *fast,...
C
#include <ctype.h> #include <cs50.h> #include <stdio.h> #include <string.h> #include <math.h> //Prototype int count_letters(string text); int count_words(string text); int count_sentences(string text); int readability(int letters, int words, int sentences); int main(void) { string text = get_string("Text: "); ...
C
// final project*********************************************** // // author: Alexander McGinnis, Parshva Vora // //description: This uses the stm32 nucleo f401re MCU to output a tone on a passive buzzer depending on the user's hand //distance from a ultrasonic sensor. It will output the note being played to a serial...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* print_dir2.c :+: :+: :+: ...
C
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> int Primenum(int x) { for (int i = 2; i < x - 1; i++) { if (x % i == 0) return 0; } return 1; } void main() { int a = 0; scanf("%d", &a); if (Primenum(a) == 1) { printf("是素数\n"); } else { printf("不是素数\n"); } system("pause")...
C
/* // 1/ * linux/kernel/blk_drv/ramdisk.c // 2/ * // 3/ * Written by Theodore Ts'o, 12/2/91 ...
C
#include "engine_render.h" #include <utils_matrix.h> #include <utils_quaternion.h> #include <GL/glew.h> /* engine_render - 3D mesh generation and manipulation functions */ mesh_t *_selectedMesh = NULL; face_t *_selectedFace = NULL; float _cursorPos[3] = {0.0f, 0.0f, 0.0f}; float _localAxis[3][3] = {{1.0f, 0.0f, 0....
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <string.h> #include "funciones.h" #include "utn.h" EMovie* movie_new() { return malloc(sizeof(EMovie)); } EMovie* movie_newP() { EMovie* this = movie_new(); int retorno = -1; char titulo[20]; char genero[20]; int duracion; ...
C
#include <linux/string.h> #include <linux/slab.h> #include "ui_file.h" static struct ui_file * file_list[NB_FILES]; static const char NAMES[][128] = {"play", "playlist", "add"}; void init_ui_file(void) { size_t i; for(i = 0; i < NB_FILES; i++) { file_list[i] = NULL; } } void exit_ui_file(void) { size_t ...
C
#include <stdio.h> #include <stdlib.h> int main() { int i = 0; int posicion; int vector[5] = {10, 100, 50, 80, 40}; printf("Ingrese la posicion"); scanf("%d", &posicion); vector[posicion-1] = 0; }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <getopt.h> #include <ctype.h> #include "helper.h" #include "opt.h" Options* newOptions(char* inputFile, char* outputFile, char* text, unsigned xPos, unsigned yPos, uint8_t hasDate, unsigned char* color){ Options* newOptions = (Options*)calloc(1, s...
C
#include "opcodeFile.h" #include "trie.h" #include <assert.h> #include <errno.h> #include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> // TODO update all enums with // http://stackoverflow.com/questions/1102542/how-to-define-an-enumerated-type-enum-in-c enum classId{ BENIGN=0, MALWARE=1, UNKNO...
C
float viewportWidth; float viewportHeight; // Calculate the 2D screen position of a 3D position float2 postProjToScreen(float4 position) { float2 screenPos = position.xy / position.w; return 0.5f * (float2(screenPos.x, -screenPos.y) + 1); } // Calculate the size of one half of a pixel, to convert // between texels...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* p_specifier.c :+: :+: :+: ...
C
#include "holberton.h" /** * *_strncpy - copies a string from src to dest * * @dest: where to copy string to * @src: string to copy * @n: most amount of bytes to use * Return: copied string at dest * */ char *_strncpy(char *dest, char *src, int n) { int i = 0; for (; i < n && src[i] != '\0'; i++) { dest[...
C
#include<stdio.h> #include<windows.h> #include<string.h> #include<stdlib.h> #include"list.h" void delete(void)//Ϣɾ { FILE * fp; int Id,i = 0,k =0; int ch,j; char NAME[TSIZE]; system("cls"); if((fp = fopen(data,"wb+")) == NULL) { printf("ܴļ%s\n",data); exit(EXIT_FAILURE); } if (ListIsEmpty(&pstudent)) pu...
C
// Path Sum III (medium) // Runtime: 24 ms, faster than 37.50% of C online submissions for Path Sum III. // Memory Usage: 8.1 MB, less than 87.50% of C online submissions for Path Sum III. /** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeN...
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> void filter(bool(*function)(int), int* array, int* newarray, int len, int counter) { if(len > 0) { if(function(*array)) { *newarray = *array; counter++; printf("%d ", *newarray); } r...
C
/*scrivere un programma che riceve da riga di comando la lunghezza di due sequenze di interi e un intero che vale 1 o 0 per indicare se verrà fornita una sequenza di pesi, il programma chiama poi il sottoprogramma distanza e visualizza il risultato */ #include <stdio.h> #include <math.h> #include <string.h> #include ...
C
#ifndef __HAVE_CACHE_H__ #define __HAVE_CACHE_H__ #include "spectre_archs.h" #include "spectre_intrinsics.h" #include "timer.h" /* FLUSH CACHE */ #if defined(__ARCH_POWERPC__) #define /* void */ __flush_cache(mloc) __dcbf(mloc, 0); #elif defined(__ARCH_X86__) /* intrinsic for clflush instruction */ #define /* void *...
C
#include<stdio.h> #include<stdlib.h> #include<time.h> int main() { int i,a[10]; srand((unsigned)time(NULL)); for(i=0;i<10;i++) { a[i]=rand();// 10 printf("%d\n",a[i]); } return 0; }
C
#include <stdio.h> #include <string.h> int main(int argc, const char *argv[]) { int cas; /* case */ scanf("%d", &cas); /* printf("cas: %d\n", cas); */ while (cas > 0) { int height, fre; /* height < 9 */ getchar(); scanf("%d", &height); /* total: 2*height - 1 */ scanf("%d...
C
#ifndef STP_ATOMIC_H #define STP_ATOMIC_H #include<stdio.h> typedef volatile int stp_atomic_t; /* * if (*lock == old){ * *lock = set; * return 1; * } * return 0 */ inline stp_atomic_t stp_atomic_cmp_set(stp_atomic_t* lock, stp_atomic_t old,stp_atomic_t set); /* * temp = *value; * *value += add; * ...
C
#include <stdio.h> #include <string.h> #include <unistd.h> #include <fcntl.h> #include <stdlib.h> /* Min number of blocks - 64 [262144 B] Max number of blocks - 2056 [8421376 B] 1 - Super Block 2 - Inode Bitmap 3 - Data Bitmap 4..8 - Inodes [256*80] 9..N - User_Data */ typedef struct _inode { int inode_number; lo...
C
#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int a = 3, b = 6, c = 9, *ptr; printf(" expression (address) = content\n"); printf(" ========== ========= ========\n"); printf(" &a (%d) = %d\n", &a, a); printf(" &b (%d) = %d\n", &b, b); printf(" &c (%d) =...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include "obwody.h" #include "pole.h" #include "pole3d.h" #include "objetosc.h" int main(){ int wybor, podwybor, podwybor2; printf("Menu:\n"); printf("1.Obwody figur plaskich.\n2.Pola figur plaskich.\n3.Pola figur przestrzennych.\n4.Objetosc figur przestr...
C
#include "klee/klee.h" int popcnt(unsigned int i ) { i = ( i & 0x55555555) + ((i >> 1) & 0x55555555); i = ( i & 0x33333333) + ((i >> 2) & 0x33333333); i = ( i & 0x0f0f0f0f) + (( i >> 4) & 0x0f0f0f0f ); i = ( i & 0x00ff00ff) + (( i >> 8) & 0x00ff00ff ); int output = ( i + ( i >> 16)) & 0xffff ; for(int k = 0; k...
C
#pragma once #include "./base.h" #define MAX_WIDTH 3840 #define MAX_HEIGHT 2160 #define PIXEL_SIZE 4 #define RENDER_SIZE Megabytes(8 * PIXEL_SIZE) typedef struct Dimensions { u16 width, height; u32 width_times_height; f32 height_over_width, width_over_height, f_height, f_width, h...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int strcmp(const char* chaine1, const char* chaine2); int strcmp2(const char* chaine1, const char* chaine2); int main(){ char *chaine = "coucou"; char *chaine2 = "coucou"; if (strcmp(chaine, chaine2) == 0) printf("les chaine sont identi...
C
/* ************************************************************************** */ /* */ /* :::::::: */ /* parsing.c :+: :+: ...
C
/** @addtogroup gpio_file @author @htmlonly &copy; @endhtmlonly 2009 Uwe Hermann <uwe@hermann-uwe.de> */ /* * This file is part of the libopencm3 project. * * Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de> * * This library is free software: you can redistribute it and/or modify * it under the terms of the...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* get_next_line.c :+: :+: :+: ...
C
#include <system.h> #define MAX_NAME_PROCESS 35 #define INTERRUPT_BIT 8 /* ************************************************************ */ /* Definicao do BCP = Bloco de Controle de Processo (Descritor) */ /* ************************************************************ */ typedef struct pcb { char name[MAX_NAME_...
C
#define nl 5 #define nc 6 struct matrizEsp { int lin,col,valor; struct matrizEsp *pc,*pl; }; typedef struct matrizEsp MatEsp; void verificaOcupado(MatEsp *vetlin[],int lin,int col,MatEsp **aux) { MatEsp *p = vetlin[lin]; while(p != NULL && col>p->col) p = p->pl; if(p!= NULL && col==p->col) *aux = p; else ...
C
#include "myfunctions.h" int pow2(int p) { if (p > 0) return (2<<(p-1)); else if (p < 0) return (2>>p); // ???? else if (p == 0) return 1; // return (int) (2<<p); not correct }
C
#ifndef job_scheduler_H_ #define job_scheduler_H_ #include "header.h" typedef struct job{ void (*function)(void* argument); void* argument; size_t size; int* barrier; struct job *next; }Job; typedef struct queue{ struct job *head; struct job *tail; int length; }Queue; typedef struct jo...
C
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> typedef struct { int x; int y; int e[4]; }vet; vet concatenar(vet *vet1, vet *vet2) { vet *vet3 = malloc(sizeof(vet)); vet3->e[0] = (vet1->x); vet3->e[1] = (vet1->y); vet3->e[2...
C
#include<stdio.h> main(){ char *arreglo_str[] = {"Hola\n", "este es un\n", "ejemplo\t", "de un arreglo de apuntadores\n" }; printf("arreglo_str[0] : %s\n", arreglo_str[0...
C
#include<stdio.h> int a[5][5],b[5][5]; int main(){ int i,j; for(i=0;i<3;i++) for(j=0;j<3;j++) scanf("%d",&a[i][j]); for(i=0;i<3;i++) for(j=0;j<3;j++) scanf("%d",&b[i][j]); for(i=0;i<3;i++) for(j=0;j<3;j++) if(a[i][j]!=b[i][j]){ ...
C
/* * circular_queue.h * * Created on: Apr 9, 2021 * Author: joels */ #define QUEUE_SIZE 10000 #include <stdint.h> #include <stdbool.h> int write_index; int read_index; char queue[QUEUE_SIZE]; void enqueue(char x); char dequeue(void); void queue_init(); bool isEmpty(); int queue_count();...
C
#include <stdio.h> #pragma pack(1) typedef struct Character { float power; char *name; } Enemy; int main(void) { Enemy enemy_list[] = { {200, "Ork"}, {500, "Ogre"}, {300, "Trol"}, }; unsigned long int length = sizeof enemy_list / sizeof(enemy_list[0]); unsigned long int counter; for(counter = 0; count...
C
#include<stdio.h> #include<unistd.h> #include<string.h> #include<stdlib.h> int main() { int pipefd[2]; char msgsnd[24] = "Hello pipe"; char msgrcv[24]; if(pipe(pipefd) == -1) { perror("pipe"); return (EXIT_SUCCESS); } printf("readend of pipe = %d\n",pipefd[0]); printf("writeend of pipe = %d\n",pipefd[...
C
#include <stdint.h> extern char fake_uart; void _putchar(char character) { // send char to console fake_uart = character; }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int n, v, p, i = 0, remain, lenofbin, result = 0, j; int binary[100] = { 0 }; scanf("%d", &n); do{ scanf("%d", &v); }while(v != 0 && v != 1); do{ scanf("%d", &p); }while(p < 0 && p > 7); remain = n...
C
# include <stdlib.h> # include <stdio.h> # include <math.h> # include <time.h> # include "hyperball_integrals.h" /******************************************************************************/ double hyperball01_monomial_integral ( int m, int e[] ) /*****************************************************************...
C
#include <stdio.h> #include <stdlib.h> #include <pthread.h> #include <unistd.h> #include <semaphore.h> #include <string.h> int res[1000][1000]; int a[1000][1000]; int b[1000][1000]; int v1; int v2; void *calcula_multiplicacao(){ int i, j; long int aux = 1; for(i = v1; i <= v2; i++){ aux = 1; ...
C
#include<string.h> #include<stdlib.h> #include"doll.h" Doll *newDoll(char top, char bottom){ Doll *doll; doll = (Doll*)malloc(sizeof(Doll)); doll->top = top; doll->bottom = bottom; doll->interior = NULL; return doll; } void package(Doll *outer, Doll *inter){ outer->interior = inter; re...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "macros_correcoes.h" /* Recebe duas strings e concatena em uma terceira */ char *mystrcat(char *str1, char *str2) { return NULL; } int main(int argc, char *argv[]) { # define teste1 "str1" # define teste2 "str2" # define teste3 "0 s...
C
#include<stdio.h> #include<conio.h> #include<stdlib.h> int main() { FILE *fp; char ch[50]; char open[200]; gets(open); if((fp=fopen(open,"r"))==NULL) exit(EXIT_FAILURE); fgets(ch,5,fp); printf("***\n%s***",ch); getch(); return 0; }
C
/*---------------------------------------------------------------------------- * Name: test_led.c * Purpose: LED test file * Note(s): Tested. *---------------------------------------------------------------------------- * * *----------------------------------------------------------------------------*/ #incl...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "getlines.h" int main(int argc, char *argv[]) { if (argc < 2) { fprintf(stderr, "usage: %s [PATH] [MAX LINE LENGTH]\nmaximum line legth is optional and the default is 4096 bytes.\n", argv[0]); return 1; } if (access(ar...
C
#include<stdio.h> #include<stdlib.h> typedef struct tree { int data; int l; int r; struct tree*left; struct tree*right; } node; void print(node*a); node*insert(node*a,int r); int posi; int main() { int t,k; int a,b,c,n; scanf("%d",&t); while(t--) { posi=0; int d,s...
C
#include "holberton.h" int _isdigit(int); int _pow(int, int); /** * binary_to_uint - converts a binary number to an unsigned int * * @b: binary number to convert * Return: Unsigned int representation on success, otherwise 0 */ unsigned int binary_to_uint(const char *b) { int i = 0, j = 0, sum = 0; if (b == NUL...
C
#include <stdio.h> int main(int argc, const char *argv[]) { int a; int b; scanf("%d%d", &a, &b); if (b % a != 0) { printf("-1"); } else { int d = b/a; int result = 0; while ( d%2 == 0) { d = d/2; result += 1; } while ( d%3 ...
C
#include<stdio.h> #include<windows.h> #pragma warning (disable:4996) int binarysearch(int *arr, int len, int toFind);//ַҺ void printNum(int n);//ӡÿһλĺ int factor(int n);//nĽ׳˵ĺ,ݹ鷨 int infactor(int n);///nĽ׳˵ĺ,ǵݹ鷨 void multi(int n);//x*x˷ھĺ void exchangeNum(int *x, int *y);//ĺ void isLeapyear(int n);//жĺ void isPrimer(...
C
#include <stdio.h> #include <stdbool.h> #include <stdlib.h> #include <string.h> #include "stack_head.h" /******************** initialize stack *********************/ void init_stack(stack *ptop) { *ptop = NULL; } /******************* is empty or not ********************/ bool is_empty(stack ...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> int main(){ int t, inputs, r_val; #if 0 FILE *fp=NULL; fp = freopen( "input.in", "r", stdin ); if (!fp){ printf("Could not open input file\n"); return 0; } #endif scanf("%d\n", &inputs); ...
C
#include <stddef.h> #include <stdlib.h> #include <stdbool.h> #include "SemiLockFreeQueue.h" #include "../Common/SynchronizationPrimitives.h" typedef struct { void *next; void *data; unsigned long dataSize; } SemiLockFreeQueueNode; SemiLockFreeQueueNode *allocateSemiLockFreeQueueNode(void *data) { ...
C
/** Author: rcarlini@gmail.com */ #include "cmdtw.h" #include <math.h> #include <stdlib.h> /* Global Variables Used to work with some distance functions, the idea is to preserve the signature of functions */ double *dist_mapped_aux = NULL; /* When using mapped distances */ int *dist_mapped_len_aux = NULL; /* the ...
C
#include <stdio.h> #include <stdlib.h> #include <ctype.h> typedef struct { int dia; int mes; int ano; }data; typedef struct{ char cargo[30]; int codigo; float salario; } trabalho; typedef struct{ char nome[50], cpf[13]; int idade; char sexo; data nascimento; } dados; int main() { struc...
C
#include "amount_set.h" #include <stdlib.h> #include <assert.h> typedef struct node_t { ASElement element; double amount; struct node_t *next; } *Node; struct AmountSet_t { CopyASElement as_copy; FreeASElement as_free; CompareASElements as_compare; Node head; Node iterator; } ; static Node getElementN...
C
//Bibliotecas #include <stdio.h> #include <locale.h> // Função int contadorNome(char nome[]) { int cont = 0; while (nome[cont] != '\0') { cont++; } return cont; } int main() { // Regionalização (Desbuga palavras com acento) setlocale(LC_ALL, "Portuguese_Brazil"); // Declaraç...
C
#include <stdio.h> #include <unistd.h> #include <string.h> #include "validate/validate.h" #include "readline/readline.h" //Prototypes for functions to add in link stage extern int qsolve(float a, float b, float c, float* x1, float* x2); extern int foutput(char* buf, int stream); int main(int argc, char* argv[]){ cha...
C
/** * Video test suite */ #include <stdio.h> #include <string.h> /* Visual Studio 2008 doesn't have stdint.h */ #if defined(_MSC_VER) && _MSC_VER <= 1500 #define UINT8_MAX ~(Uint8)0 #define UINT16_MAX ~(Uint16)0 #define UINT32_MAX ~(Uint32)0 #define UINT64_MAX ~(Uint64)0 #else #include <stdint.h> #endif #incl...
C
/** Test buffer cache's ability to write full blocks to disk * without reading them first. * @author Jiarui Li */ #include <syscall.h> #include <random.h> #include "tests/lib.h" #include "tests/main.h" #include "tests/filesys/seq-test.h" #define FILE_SIZE 102400 static char buf[FILE_SIZE]; void test_main (void...
C
/* ** printf_board_game_in_a_pretty_fram.c for a in /home/soucan_d/soucan_d/Bootstrap/CPE_2015_allum1_bootstrap ** ** Made by Dimitri ** Login <soucan_d@epitech.net> ** ** Started on Tue Feb 9 11:12:35 2016 Dimitri ** Last update Fri Feb 26 18:23:59 2016 Dimitri */ #include <stdio.h> #include <stdlib.h> #include "...
C
#include <stdio.h> #include <math.h> #include <float.h> #define fun(X) pow((X),2) - 2*X //Root finding numerically with the Newton Method int main() { double tol = .01,left,right,xguess,x,deriv,x0; //Tol is going to help us get the Numerical Derivative int iter,count = 0; printf("What is you\'re guess...
C
/////////////////////////////////////// // // // Autor: Diego S. Seabra // // Matricula: 0040251 // // // /////////////////////////////////////// #define n 3 #include <stdio.h> #include <string.h> void add(int A[n], int B[n...
C
#ifndef __UTIL_H__ #define __UTIL_H__ /** * Flip the byte order in a double-precision float. * @param double A double-precision float. * @returns A double-precision float with the bytes flipped. */ double double_flip(double); /** * Flip the byte order in a single-precision float. * @param float A single-precisi...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<math.h> int main(void) { long long int n,k,t; char *str; long long int i,j,count=0; int flag=0; char temp; scanf("%lld %lld %lld\n ",&n,&k,&t); // fflush(stdin); str=malloc((n)*sizeof(char)); scanf("%s",str)...
C
/* Management Hotel Room management. */ #include <stdio.h> #include <conio.h> #include <string.h> #include <stdlib.h> #define TRUE 1 #define FALSE 0 char *filename = "hotellog.txt"; char *fileout = "summary.txt"; void OpenFile() { FILE *f = fopen(filename, "r"); if (f == NULL) { fflush(stdin); ...
C
#include "admin_action.h" #include "user_action.h" int user_menu(int sock, int type){ int opt = 0; if(type == 1 || type == 2){ system("clear"); printf("-------OPTIONS -------\n"); printf("1. Book Ticket\n"); printf("2. View Bookings\n"); printf("3. Update Booking\n"); printf("4. Cancel booking\n"); pr...
C
#include "queue.h" queue * make_queue(int mutex_number) { queue * q = malloc(sizeof(queue)); q->owner = mutex_number; q->start = malloc(sizeof(node)); q->start->next = NULL; return q; } void enqueue(queue *q, int number) { node *temp = q->start; while(temp->next != NULL) temp = temp->next; node *n = malloc(...
C
/* help.c * Simple program to introduce some basics about our team and briefly discription about the sort and acsii program. */ #include "syscall.h" int main() { PrintString("!!!!!!!This is our NachOS 4.0 project!!!!!!!\n"); PrintString("Our team members: Nguyen Cao Thien Long - ID: 19127203\n"); PrintString(...
C
#ifndef GRAPH_H #define GRAPH_H #include <stdio.h> typedef struct node_ { char* label; // label of a node int nb_succ; // number of successors struct node_ ** succ; // array of pointers to the successor nodes int nb_pred; // number of predecessors struct node_ ** pred;...
C
#ifndef __COMMON_H__ #define __COMMON_H__ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> #include <math.h> /* Let's pretend C has a boolean type. */ #define TRUE 1 #define FALSE 0 #define boolean int #define bool char #define AllocVar(pt) (pt = needMem(sizeof(*pt))) /* Shortcut to all...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct { char name[40]; unsigned short phone[10]; unsigned int seatNo; } seat; typedef struct list list; //in order to make pointer of this struct to itself //the connected list struct list { seat s; list *next; }; //This function...
C
#include <m68kboard.h> struct mc68681wfm * uartw = (struct mc68681wfm *) 0x00B00003; struct mc68681rfm * uartr = (struct mc68681rfm *) 0x00B00003; void puts (char * string) { while (*string) { mon_putc (*string); string++; } } void realhex (unsigned char value) { if (value < 10) mon_putc ...
C
#include <stdio.h> /*Saya Azis Ramdhan Darojat tidak melakukan kecurangan seperti yang telah dispesifikasikan pada mata kuliah Algoritma dan Pemrograman I dalam mengerjakan Tugas Praktikkum 2, jika saya melakukan kecurangan maka Allah/Tuhan adalah saksi saya, dan saya bersedia menerima hukumanNya. Aamiin*/ int main(...
C
/* Functions to convert RAD50 to or from ASCII. */ /* Copyright (c) 2001, Richard Krehbiel All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: o Redistributions of source code must retain the above copyrig...
C
#include <stdio.h> #include <string.h> #include <conio.h> #include <stdlib.h> #include <locale.h> int main() { int M,i; float N,media = 0,somaMedia; setlocale(LC_ALL, "Portuguese"); system("color 17"); printf("Digite quantas vezes quer repetir on nmeros: "); scanf_s("%i", &M); for (i = 0; ...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <errno.h> #include "bstree.h" #include "../Queue/LinkedQueue/linkedqueue.h" bstree_t* new_bstree() { bstree_t *tree = (bstree_t*) malloc(sizeof(bstree_t)); tree->root = NULL; return tree; } bool empty(node_t *tree) { return tree == NU...
C
#include<stdio.h> int main() { char a,b,c; printf("A: %d", &a); printf("B: %d", &b); printf("C: %d", &c); return 0; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* transformation.c :+: :+: :+: ...
C
/******************************************************************* FileName: proslic.c Dependencies: See INCLUDES section below Processor: PIC18 Compiler: Microchip C18 Copyright: (C) Angelos Varvitsiotis 2009 License: GPLv3 *******************************************************************/ /** I...
C
#include <stdio.h> #include <string.h> void display(term); int coef(char s[]); int degree(char s[]); int toInteger(char st[]); int power(int n); typedef struct{ int cofnt,exp; } term; int main(){ term num1,num2,prod; char s1[64],s2[64]; // x 4x^3 // 45 2x^3 int t,size; sc...
C
// // main.c // EjemploColas // // Created by Josué Carlos García Puig on 01/10/15. // Copyright © 2015 Avtelyes. All rights reserved. // #include <sys/msg.h> #include <sys/ipc.h> #include <sys/types.h> #include <unistd.h> #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_TE...