language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include "FilaComVetor.h" #include <stdio.h> #include <stdlib.h> #define TAM 10 struct fila { int ini; int n; Aluno* alunos[TAM]; }; Fila* InicFila(void){ Fila* f = (Fila*) malloc(sizeof (Fila)); f->ini = 0; f->n = 0; return f; } //insere fila (SEMPRE no final) void InsereFila(Fila* f, A...
C
#include "hx711.h" // function prototype int *get_int(int *num); int main(int argc, char **argv) { int err = 0; if (argc < 3) { printf("\nRequired 3 args."); printf("\nFirst arg is CLK pin, second arg is DATA pin (BMC numbering)."); printf("\nThird arg is number of samples."); return 1; } i...
C
/** * @mainpage * # Загальне завдання * **Створити** програму з використанням показчиків; * * # Індивідуальне завдання * **Підрахувати** кількість ділянок заданого масиву з N речовинних чисел, які утворюють безперервні послідовності чисел з незменшуваними значеннями. Максимальну ділянку переписати в інший м...
C
#include "holberton.h" #include <stdlib.h> /** * alloc_grid - function that returns pointer to a 2-D array of integers * @width: number or row to print * @height: number of column to print * Return: pointer value of grid */ int **alloc_grid(int width, int height) { int **dimension; int alto, ancho; if (width <...
C
/*A Program To find The sum Of Digits Of A Number*/ #include <stdio.h> main() { int bit,sum=0; long temp,m; clrscr(); printf("\nEnter A Digit :\n"); scanf("%ld",&m); temp=m; while(temp>0) { bit=(temp%10); sum+=bit; temp/=10; } printf("\nThe Sum Of The Digits Is=\n%d",sum); getch(); } 
C
////By Maxim Johansson #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <math.h> #include "functions.h" #include <crtdbg.h> #define HEIGHT 512 //Changable value #define WIDTH 1024 //Changable value int main () { _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); //Flag to check for mem...
C
//TODO test this thoroughly int path_parse(char* pathspec, MAILPATH* path){ //See http://cr.yp.to/smtp/address.html for hints on address parsing bool quotes = false, done_parsing = false, comment = false; unsigned out_pos = 0, in_pos = 0; //skip leading spaces for(; isspace(pathspec[0]); pathspec++){ } logprin...
C
#include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <errno.h> #include <string.h> #include <fcntl.h> #include <sys/dispatch.h> #include <sys/mman.h> #include <pthread.h> struct pid_data{ pthread_mutex_t pid_mutex; pid_t pid; }; int main(int argc, char *argv[]) { // Server int file_desc = shm_ope...
C
#include "holberton.h" #include <stdlib.h> /** * str_concat - Entry point * @s1: wopa * @s2: ea * * Description: Show a message blablabla * Return: Always 0 (Success) */ char *str_concat(char *s1, char *s2) { unsigned int larg1 = 0, larg2 = 0, larg3, cont = 0; char *aux; if (!s1) s1 = ""; while (s1[larg...
C
#include <stdio.h> #include <time.h> int main() { time_t tempo_local; time(&tempo_local); printf("Tempo local = %s", ctime(&tempo_local)); return 0; } /* DESCRIÇÃO: - A função char *ctime(const time_t *timer) retorna um string que representa a hora local com base no argumento temporizador DECLARAÇÃO: ...
C
// // Shaun Chemplavil U08713628 // shaun.chemplavil@gmail.com // C / C++ Programming I : Fundamental Programming Concepts // 146359 Raymond L. Mitchell Jr. // 05 / 08 / 2020 // C1A7E2_main.c // Win10 // Visual C++ 19.0 // // This program prompts the user to enter nutritional information for // LUNCH_QTY number of food...
C
/* * Digital.h * * Created: 2/8/2014 2:58:32 PM * Author: Nathan Hernandez */ #ifndef DIGITAL_H_ #define DIGITAL_H_ //Pin Voltage #define LOW 0x0 #define HIGH 0x1 //Pin Mode #define INPUT 0x0 #define OUTPUT 0x1 #define INPUT_PULLUP 0x2 //Digital Pins #define D0 0 #define D1 1 #define D2 2 #defi...
C
//#define LOG_DEBUG /** * Note: The returned array must be malloced, assume caller calls free(). */ void reverseArray(int* A, int ASize); int* addToArrayForm(int* A, int ASize, int K, int* returnSize); int* addToArrayForm(int* A, int ASize, int K, int* returnSize) { //check the max size of return array ...
C
#include <stdio.h> #include <math.h> #define W 386 #define H 320 #define SZ (W*H) unsigned char image[SZ*3]; void d(int R,int G,int B,int x,int y,int r) { while (r) { float dp=1/(6.3*r); float p; for (p=0;p<6.3;p+=dp) { int xo=r*cos(p); int offset=x+xo+floor(y+r*sin(p))*W; if ((x+xo<W)&&...
C
/* ** EPITECH PROJECT, 2019 ** my_compute_power_it ** File description: ** hello */ #include "../my.h" #include "../screen.h" void my_clear_buffer(framebuffer_t *buf) { int size = buf->width * buf->height*4/sizeof(long int); long unsigned int *bufy = (long int *)buf->pixels; long unsigned int lcolor = 0; ...
C
#include "../libft.h" #include <stdio.h> #include <string.h> int main(void) { char str1[] = "Hello world"; char str2[] = "42"; char str3[] = ""; char str4[] = "Found it!"; t_list *elem; t_list *elem_test; elem = ft_lstnew(str1); elem->next = ft_lstnew(str2); elem->next->next = ft_lstnew(str3); ft_lstadd_fro...
C
#include "bbs.h" /* Initialize the RNG NOTE: Only call this funtion once */ void bbs_init(uint32_t s, uint32_t p, uint32_t q, uint32_t l) { bbs_s = s; bbs_p = p; bbs_q = q; bbs_l = l; } /* Generate a new raw value */ uint32_t bbs_gen() { uint32_t n = bbs_p * bbs_q; uint32_t r = bbs_s % (n - 1); ui...
C
/* * autor..: EDUARDO DOS SANTOS SPAGNA * disc...: ESTRUTURA DE DADOS * * PILHA */ #include <stdio.h> #include <locale.h> #include <stdlib.h> typedef struct Idade{ int idade; struct Idade * prox; } Idade; typedef struct Pilha{ Idade * topo; } Pilha; Pilha* criar() { Pilha* q = (Pilh...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include "AM.h" #include "bf.h" #include "defn.h" #include "myfunctions.h" #include <math.h>// ceil function //===================================================GLOBAL VARIABLES ================================================================ int leaf_hea...
C
//旋转数组最小数字 #include <stdio.h> #include <malloc.h> int getMin(int *arr,int num) { int begin=0; int end=num-1; int mid=0; while(arr[begin]>=arr[end]) { mid=(begin+end)/2; if(arr[mid]>=arr[begin]) { begin=mid; } else if(arr[mid]<=arr[end]) { end=mid; } if(end-begin==1) { mid=end; retur...
C
/*Calculating the square root of a number*/ //Function to calculte the absolute value of a number #include<stdio.h> float absoluteValue (float x) //function definition { if (x < 0) x = -x; return (x); } //Function to compute the square root of a number float squareRoot (double x) { const double epsilon...
C
/*-------------------------------------------------------------------------* * File: Potentiometer.c *-------------------------------------------------------------------------* * Description: * Potentiometer driver that uses the RX62N's S12AD A/D input. *--------------------------------------------------...
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
//2.0999֮Сˮɻ //ˮɻָһλλֵȷõڸ磻153153 ? 153һˮɻ // // //УˮɻNarcissistic numberҲΪķ˹׳ķ˹Armstrong numberָһNλ֮Nη͵ڸ //153370371407λˮɻ֮͵ڸ //153 = 1^3 + 5^3 + 3^3 //370 = 3^3 + 7^3 + 0^3 //371 = 3^3 + 7^3 + 1^3 //407 = 4^3 + 0^3 + 7^3 // #define _CRT_SECURE_NO_WARNINGS 1 #include <stdio.h> #include <stdlib.h> int main() { int nu...
C
#include <stdio.h> int main() { // crash is possible here // char food[5]; // printf("Enter your favorite food: "); // scanf("%s", food); // printf("Your favorite food: %s\n", food); char food[5]; printf("Enter your favorite food: "); fgets(food, sizeof(food), stdin); printf("Your ...
C
#include <stdio.h> /*(segundos) -> h:m:s 556 -> 0:9:16 1 -> 0:0:1 140153 -> 38:55:53 */ int myminuts(int sec) {int tmp = sec / 60; if((sec/60) > 60) { return tmp % 60; } return tmp; } int main(void) {int seconds; scanf("%d", &seconds); printf("%d:%d:%d\n",((seconds / 60...
C
/* Run on OS X 10.8.4 */ /* $ gcc -O3 -o best_script best_script.c */ /* $ time ./best_script */ /* real 0m58.125 */ /* user 0m58.080s */ /* sys 0m0.042s */ #include <stdio.h> #include <stdlib.h> #include <...
C
/* print-prime.c By David Broman. Last modified: 2015-09-15 This file is in the public domain. max under 2s: 23920000 */ #include <stdio.h> #include <stdlib.h> #define COLUMNS 6 int check = 0; char * arr; void print_number(int p) { printf("%10d +", p); check++; if(check >= COLUMNS) { printf("\n...
C
/* * server FTP program * * NOTE: Starting homework #2, add more comments here describing the overall function * performed by server ftp program * This includes, the list of ftp commands processed by server ftp. * */ #include <sys/types.h> #include <netinet/in.h> #include <sys/socket.h> #include <n...
C
int main() { int n; scanf("%d",&n); getchar(); char a[50][10000]; int i; for(i=0;i<n;i++) { gets(a[i]); } for(i=0;i<n;i++) { int j; int len=strlen(a[i]); if(a[i][len-2]=='e' && a[i][len-1]=='r' || a[i][len-2]=='l' && a[i][len-1]=='y') { for(j=0;j<len-2;j++) putchar(a[i][j]);...
C
#include <stdio.h> int main(){ int t,i; scanf("%d\n",&t); char curso[100]; for(i=0;i<t;i++){ scanf("%s",curso); } printf("Ciencia da Computacao\n"); return 0; }
C
// f(x) = x^2의 대한 정적분 구하는 프로그램 작성. #include <stdio.h> float integral(float a, float b, float n) { int i; float fx; float area; float dx=(b-a)/n; float integral = 0; float x=a; for(i=1; i<=n; i++) { fx = x*x; area = dx * fx; integral += area; x = x+dx; //printf("%.3f",dx); } return integral...
C
#include "types.h" #include "user.h" // int main(void){ int i=0; int j=0; if(shmget(12,(char *)0x7FFF0000,20480)<0){ printf(1,"error\n"); } char *test = (char*) 0x7FFF0000; char *temp = test; for(;i<4096; i++){ *test = 'A'; test++; } for(;i<8192; i++){ *test = 'B'; test++; } ...
C
/* 4.c */ #include <stdio.h> /* x $B$N(B y $B>h$r5a$a$k(B */ int pow(int x, int y) { int i,n=1; for(i=1;i<=y;i++) n *= x; return n; } /* $B#2>h$NOB!J7+$jJV$79=B$!K(B*/ int sum2_rep(int n) { int answer=0,i; for (i = 0; i <= n; i++) answer += i * i; return answer; } /* $B#2>h$NOB!J8x<0!K(B*...
C
#ifndef CAMERAH_H #define CAMERAH_H #include <glm/vec3.hpp> #include <glm/mat4x4.hpp> struct Camera { glm::vec3 eye; glm::vec3 up; glm::vec3 target; glm::mat4 viewMatrix; glm::mat4 projMatrix; float zNear; float zFar; }; struct PerspectiveCamera : Camera { float fov; float aspect; }; struct OrthoCamera : ...
C
#include <stdio.h> #include <unistd.h> //Used for UART #include <fcntl.h> //Used for UART #include <termios.h> //Used for UART static int init_serial(void) { int fd; fd = open("/dev/ttyS0", O_RDWR | O_NOCTTY | O_NDELAY); //Open in non blocking read/write mode if (fd == -1) { //ERROR - CAN'T OPEN SERIAL ...
C
/* # Family Name: D'Aloia # Given Name: Philip # Section: E # Student Number: 213672431 # CSE Login: pdaloia */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include <pthread.h> typedef struct{ char threadFileName[101]; int fileNumber; } fileInfoForThread; typedef struct { char word[101]; ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* parser1.c :+: :+: :+: ...
C
/* fuction group about packet */ #include "packet.h" /* u_char* my_strncpy(u_char* d, const u_char* s, int len) { u_int i; d = malloc(sizeof(u_char) * (len + 1)); for (i = 0; i < len; ++i) d[i] = s[i]; d[len] = '\0'; return d; } //*/ ///* u_char* my_memcpy(u_char* d, const u_char* s, int len) { int i; //d = (u_ch...
C
//Cameron Cobb //CS135 //lab9_problem1.c #include <stdio.h> #define SIZE 15 int swap(int *a, int *b){ int temp = 0; temp = *a; *a = *b; *b = temp; } int main(){ int arr[SIZE]; printf("Enter 15 integers:\n"); for(int i=0; i<SIZE; i++){ scanf("%d", &arr[i]); } swap(&arr[0],&arr[7]); swap(&arr[8],&arr[3]...
C
/* Set floating-point environment exception handling. Copyright (C) 2000-2017 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of t...
C
#include <bits/stdc++.h> using namespace std; #define ll long long #define FOR(I,A,B) for(int I= (A); I<(B); ++I) #define REP(I,N) FOR(I,0,N) #define ALL(A) (A).begin(), (A).end() using namespace std; int main() { std::ios::sync_with_stdio(false); //I/O faster use'\n' in place of endl cin.tie(NULL);...
C
#include<stdio.h> void fun(int n,int *mon,int *day) { int a[12]={31,28,31,30,31,30,31,31,30,31,30,31},i=0,h=0,sum=0; if(h+a[i]>n) { *mon=1; *day=n-a[0]; } while(h+a[i]<n) { h=h+a[i]; sum=sum+a[i]; i++; } *mon=i+1; *day=n-sum; } int main() { int n,month,...
C
#include <unistd.h> int main(int argc, char *argv[]) { char n = '9'; while (n >= '0') { write(1, &n, 1); n--; } write(1, "\n", 1); return (0); }
C
#include <stdio.h> #include <timerms.h> #include <stdlib.h> #include <string.h> #include <stdlib.h> #include <arpa/inet.h> // Time htons etc etc #include "eth.h" #include "ipv4.h" #include "arp.h" /* Logitud máxmima del nombre de un interfaz de red */ #define IFACE_NAME_MAX_LENGTH 32 #define ARP_TABLE_SIZE 256 /* Núme...
C
#include <stdio.h> void swap_by_pointer(int* pvalue1, int* pvalue2) { if (NULL != pvalue1 && NULL != pvalue2) { int *temp = pvalue1; pvalue1 = pvalue2; pvalue2 = temp; printf("함수 내부(주소) : %p, %p\n",(void *) pvalue1,(void *) pvalue2); printf("함수 내부(가리키는 값) : %d, %d\n", *pvalue1,*pvalue2); } else { pr...
C
#define NO_JNZ #include "skeleton.h" static void emit_c() { instruction *inst = insts; value *val = vals; puts("#include <stdio.h>\n#include <inttypes.h>\n\n#define DEFAULT_TAPE_SIZE 4*1024*1024\n\ntypedef uint8_t cell;\n\nstatic cell tapebuf[DEFAULT_TAPE_SIZE] = {0};\n\nint main(int argc, char *argv[])\n{\n\tcell...
C
#include<unistd.h> void ft_putchar(char c) { write(1,&c,1); } char *ft_strncpy(char *dest, char *src, unsigned int n) { if(dest == '\0') { return '\0'; } char *point; *point = dest; while(*src && n--) { *dest = *src; dest++; src++; } *dest = '\0' ; ...
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <string.h> static int job_id_count = 0; struct test_struct { int job_id; int job_pid; char job_name[256]; struct test_struct *next; }; //struct test_struct * ptr; struct test_struct *head = NULL; struct test_str...
C
#ifndef FZRL_TILE_H #define FZRL_TILE_H #include "tile_types.h" /** * Public Tile Functions and Defines * * Tile Explanation: * - Tiles have a material type (e.g. dirt, grass, stone, wood, metal, water, fire, empty) * - Tiles have a form type (e.g. floor, path, paved, wall, empty) * - Material Types and Form Ty...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* cylinder.c :+: :+: :+: ...
C
#include "rtpersrc/pe_common.hh" /*********************************************************************** * * Routine name: pe_2sCompBinInt64 * * Description: This routine encompasses the rules to encode a * 2's complement binary integer as specified in * section 10.4 of the X.6...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> int SumRequiredSymbols(char *str) { int signs = 0, digits = 0, sum; char plus = 43, minus = 45, multiply = 42; for (int s = 0; str[s] != '\0'; s++) { if (str[s] == plus || str[s] == minus || str[s] == multiply) signs++; if (48 <= str[s]...
C
#include <assert.h> #include <stdlib.h> #include <string.h> #include "cstring.h" #include "calloc.h" static const char* const EMPTY_STRING = ""; void chess_string_init(ChessString* string) { string->size = 0; string->data = EMPTY_STRING; } void chess_string_init_assign(ChessString* string, const char* s) { ...
C
/* SPDX-License-Identifier: BSD-2-Clause * * Job definition/interface * * Copyright (c) 2018-2021, Marek Koza (qyx@krtko.org) * All rights reserved. */ /* * Various long running tasks in plumCore, whether one shot or recurring, * share some common attributes: * - execution time in the range of several secon...
C
#include <stdio.h> #include <stdlib.h> int populate_array(int, int *); int check_sin(int *); int main(int argc, char **argv) { // TODO: Verify that command line arguments are valid. if(argc != 2){ return 1; } // TODO: Parse arguments and then call the two helpers in sin_helpers.c // to verify the SIN...
C
#include<stdio.h> int main(void) { int i, t, a[10], j; long n; scanf("%ld", &n); for(i = 0; i < n; i++) { scanf("%d", &a[i]); } i = 0; j = n - 1; while(j > i) { t = a[j], a[j] = a[i],a[i] = t; i++; j--; } for(i = 0; i < n; i++) { ...
C
#include<stdio.h> #include<stdlib.h> #define random(x) (rand()%x) #include<time.h> #include<conio.h> #include<string.h> //ҽṹ int count=0; char enter; struct player{ char Name[10]; int win; int lose; int tide; int score; }; struct player p,player[100]; // int main() { char Exit,choice,Choic...
C
#include <gb/gb.h> #include "ct/sprA.h" #include "ct/sprB.h" #include "ct/sprC.h" #include "ct/sprD.h" #include "ct/sprE.h" #include "ct/sprF.h" #include "ct/sprG.h" #include "ct/sprH.h" void drawImage(unsigned char *tile, unsigned char *map){ wait_vbl_done(); // Load up the tile data set_bkg...
C
/*Programa que realizar el factorial de un número dado */ #include <stdio.h> int main(){ int n; int total = 1; printf("Indique el número del cual desea obtener el factorial: "); scanf("%d", &n); while(n>1){ total = total * n; n = n - 1; printf("%d\n", total); } printf("\n\n"); return 0; }
C
#include<stdio.h> int main(void) { char a; scanf("%c",&a); if((a>='a'&&a<='z')||(a>='A'&&a<='Z')) if(a=='a'||a=='e'||a=='i'||a=='o'||a=='u'||a=='A'||a=='E'||a=='I'||a=='O'||a=='U') printf("vowel"); else printf("consonant"); return 0; }
C
/* mesh_bi.c Copyright (C) 2012 Adapteva, Inc. Contributed by Wenlin Song <wsong@wpi.edu> 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 the Free Software Foundation, either version 3 of the License, or (at your option) any lat...
C
#include "nph.h" volatile sig_atomic_t is_sigstp = 0; volatile sig_atomic_t is_sigint = 0; extern char *back_ground[40]; extern int bp_id[40]; extern int bp_num[40]; extern int bp_count; extern int bpnum; void handler(int sig) { pid_t pid; int status; while ((pid = waitpid(-1, &status, WNOHANG)) != -1) ...
C
#include <stdio.h> #include "gpu_fft.h" #include "mailbox.h" #define FFT_WINDOW_SIZE_LOG2N 11 #define FFT_WINDOW_SIZE (1 << FFT_WINDOW_SIZE_LOG2N) struct GPU_FFT_COMPLEX *data_in_ptr; struct GPU_FFT *fft; struct GPU_FFT_COMPLEX *fft_out; /* Generates and saves the complex conjugate sample at the mirror ind...
C
#include <stdio.h> #include <openssl/rsa.h> #include <openssl/pem.h> #include <openssl/err.h> #include <openssl/rand.h> #include <string.h> #define RSAKEYLEN 2048 #define PUBLICXPONENT 3 unsigned char key[256/8], IV[16]; RSA *keypair; size_t priv_keylen; size_t pub_keylen; char *priv_key; char *pub_key; char *encrypt...
C
#include<stdio.h> //Print duplicate nums in array. int main(){ int n,count=1; printf("Enter the size: "); scanf("%d",&n); printf("Enter your number: "); int arr[n]; for(int i=0;i<n;i++){ scanf("%d",&arr[i]); } for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ if(i==j){ continue; } else if(arr[i]==ar...
C
#include <stdio.h> #include <pcap.h> #include <time.h> #include <errno.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include "ieee802_11_radio.h" /** * 根据标准时间转化为指定的时间格式 */ void convert_format_time(time_t rawtime,char* buffer){ struct tm * timeinfo; time (&rawtime); timeinfo = localtime (&raw...
C
#ifdef BLINKER_FRAMEWORK_PRESENT <% width = 2 #7 height = 2 #3 # up, right, down, left walls = (0...height).map { (0...width).map { [true, true, true, true] } } visited = (0...height).map { [false]*width } visited[0][0] = true stack = [[0,0]] until stack.empty? x, y = stack.pop choices = [[x,y-1,0],[x+1,y,1],[...
C
#include <stdio.h> // iteration 144 // sample size 20 // Good tutorial on median filter: http://www.librow.com/articles/article-1 // window size 5 const int signal[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; co...
C
#include <linux/init.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/sched.h> struct task_struct *task; void DFS(struct task_struct *task) { struct task_struct *child; struct list_head *list; printk(KERN_INFO "PID: [%5d] | Name: %s\n", task->pid, task->comm); list_for_each(list, &task->child...
C
#include "sum.h" #include "sub.h" void main(void) { printf("a + b = %d\n", sum(3, 4)); printf("a - b = %d\n", sub(3, 4)); }
C
/** * hellojni.c */ #include <string.h> #include <jni.h> #include <android/log.h> #define LOG_TAG "libhellojni" #define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__) #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__) jstring Java_com_example_appuidroid_JniC...
C
#ifndef _HASH_H #define _HASH_H #define BITS_PER_CHAR (2) // Number of bits used per nucleotide #define MAX_KMER_SIZE (((sizeof(unsigned int) * 8)/BITS_PER_CHAR) - 1) // Recommended max kmer size (15) #define A 0x0 // 0b00 #define C 0x1 // 0b01 #define G 0x2 // 0b10 #define T 0x3 // 0b11 // Hashes a kmer; h(x) = ...
C
/*********************************************************** > File Name: exec_ps.c > Author: Kwong > Mail: khheng0@gmail.com > Created Time: 2021年01月27日 星期三 13时51分44秒 > Modified Time:2021年01月27日 星期三 14时20分26秒 *******************************************************/ #include <stdio.h> #include <stdlib.h> ...
C
//Created by Rahul Goel #include <stdio.h> int main() { int n; scanf("%d", &n); int arr[100005] = {0}; int ans[100005] = {0}; for(int i=1; i<=n; i++) scanf("%d", &arr[i]); for(int i=1; i<=n; i++) ans[arr[i]]=i; for(int i=1; i<=n; i++) printf("%d ", ans[i]); printf("\...
C
/* envinit --- intialize the environment */ /* ** Initialize the environment a la Unix. ** Set up a bunch of strings of the form ** name=value ** sorted on name. The names and values ** are the user's shell variables. ** Make everything available through the ** variable environ and the getenv() routine. ** ** For use ...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<unistd.h> char str[100]; static char *ptr; char *tokenize(char* string) { char *p; if(string != NULL) { ptr=string; p=string; } else { if(*ptr == '\0') return NULL; p=ptr; } while(*ptr != '\0') { while((*ptr==' ' || *ptr=='\t')...
C
// Basic Console Output. #include <stdint.h> #include <string.h> #include <console.h> #define CONSOLE_HEIGHT 25 #define CONSOLE_WIDTH 80 #define MAX_PAGE_STORAGE 3 #define PAGE_SIZE CONSOLE_HEIGHT * CONSOLE_WIDTH #define CONSOLE_STORAGE PAGE_SIZE * MAX_PAGE_STORAGE #define DEFAULT_COLOUR 0x1F ...
C
#include <stdio.h> #include <stdlib.h> int main() { char firstn[20],lastn[20]; float creditM,gradeM,creditE,gradeE; printf("Enter first name : "); scanf("%s",firstn); printf("Enter last name : "); scanf("%s",lastn); printf("Mathematic : #credit #grade(0-4) : "); scanf("%f %f...
C
//MultiThreading #include<stdio.h> #include<pthread.h> #include <unistd.h> void* myturn(void * arg) { while(1) { sleep(1); printf("My Turn\n"); } return NULL; } void yourturn() { while(1) { printf("your Turn\n"); sleep(2); } } void main() { ...
C
//һֻdzһΣֶΡ // //дһҳֻһε֡ #include<stdio.h> //#include<string.h> ////char *strtok(char *str, const char *delim){ //// ////} // int main() { int a[] = { 1, 4, 6, 8, 0, 6, 3, 1, 4, 3, 5, 7, 8, 7, 5, 9 }; for (int i = 0; i < (sizeof(a) / sizeof(a[0])-1); i++){ if (a[i]!=-1) for (int j = i+1; j < sizeof(a)...
C
#include <stdio.h> #include <stdlib.h> #include "employe.h" typedef struct employe { char LastName[20]; char FistName[20]; int ID; int Age; char gender; int ph_num; char email; }; int dimension(); int menu(); void ajouter_emp(employe *E) void modifier_emp(employe *E) void supprimer_emp(employe *E) int...
C
#include<stdio.h> #include<string.h> struct Student{ int roll; char name[20]; }; void main(){ struct Student s1; s1.roll = 1997; strcpy(s1.name,"Pavan"); printf("\nRoll no.: %d\n",s1.roll); printf("\nname of student.: %s\n",s1.name); }
C
/************************************************************** Description : Implements an abstract data type representing a collection of Sale structs. Includes interface functions as well as functions to be used by the main. ********************************************...
C
#include <stdio.h> int main() { int cnt; scanf("%d", &cnt); getchar(); int pairs[cnt]; int array[cnt]; int max = 0; for (int i = 0; i < cnt; i++) { //array[i]=getchar()-'0'; scanf("%d", array + i); if (i == 0) pairs[i] = 1; els...
C
#include <stdio.h> #include <stdlib.h> #include<string.h> #include <errno.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/msg.h> #define PERMISSIONS 0777 // Definition of Message Buffer struct messageBuffer { long mtype; char data[1024]; }; // Global Declaration of Message Buffer Object struct mes...
C
/** * socket server (connectionless) * * Copyright (C) 2016 Jinbum Park <jinb.park7@gmail.com> */ #include "common.h" int main(int argc, char **argv) { char msg[MSG_SIZE_MAX]; struct sockaddr_un server_addr; int sock; ssize_t nread; struct sockaddr_storage sa; socklen_t sa_len; /* create socket */ if((s...
C
#include<stdio.h> int sumd(int); int main() { int n,s; printf("\nEnter num:"); scanf("%d",&n); s=sumd(n); printf("\nSum of digits:%d \n",s); return 0; } int sumd(int num) { int s; if(num>0) s=(num%0)+sumd(num/10); return s; }
C
#define N_RAND 1000000000 #include "randomRSA.h" /** This program generates N_RAND random uniform numbers using the KISS RNG. * Expects a seed as an argument, otherwise runs with a default seed. */ int main(int argc, char * argv[]) { long seed; long i; double k; seed = 77777777777777; /*if (argc == 1) {*/ ...
C
/* * Test Program for GA * This is to test GA_Create (is a collective operation) ...
C
//HR easy challenge: insertion sort (part 2, the full sorting!) // Insertion sort: // Input line 1: number of elements to be sorted. // Input line 2: elements to be sorted. // Output: each step of insertion sort #include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> #include <assert...
C
/***************************************************************************** * * Copyright (c) 2011, CEA * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code mu...
C
#include "linked_list.h" Node *concate(Node *, Node *); int main() { int n1, n2, i, data; Node *concatedList = NULL; Node *list1 = NULL; Node *list2 = NULL; printf("\nCreate 1st Linked List\n"); printf("\nEnter the no.of Nodes : "); scanf("%d", &n1); //list1 = (Node *)malloc(n1 * s...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ struct _Node; typedef struct _Node* Pos; typedef struct _Node { int el; Pos Next; }_NODE; Pos CreateNode(int); int ReadFromFile(Pos); int Unija(Pos,Pos,Pos)...
C
/* ** display.c for dante in /home/jacqui_p/rendu/IA/dante/generateur/src/ ** ** Made by Pierre-Emmanuel Jacquier ** Login <jacqui_p@epitech.eu> ** ** Started on Thu May 19 17:05:19 2016 Pierre-Emmanuel Jacquier ** Last update Thu May 19 17:05:19 2016 Pierre-Emmanuel Jacquier */ #include "generator.h" #include "gen...
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
#include "kernel/types.h" #include "kernel/stat.h" #include "user/user.h" int main(int argc, char *argv[]){ int i; int j = 0; int k; int pid; sett(); tc1(); //system call for testing for (i = 0; i < 30; i++) { pid = fork(); if (pid == 0) { //child j = (getpid()) % 2; // ensures independence from the fi...
C
#include "holberton.h" #include <stdio.h> /** * _strspn - gets the length of a prefix substring * @s: the string that we use for searching * @accept: the substring that we search for. * Return: return the number of bytes in the initial segment of s which consist * only of bytes from accept. */ unsigned int _strsp...
C
#ifndef LISTAREVISION_H_INCLUDED #define LISTAREVISION_H_INCLUDED #include "Revision.h" #include "Expediente.h" typedef struct nodoL{Revision revisiones; nodoL * sig; }nodoLista; typedef nodoLista * Lista; //Crea la lista void crearLista(Lista &l); //Verifica s...
C
/* * Config values, global constants, common functions. * * Copyright (C) 2018 Ben Burns. * * MIT License, see /LICENSE for details. */ #include <stdio.h> // recommended to include stdio before gmp #include <stdlib.h> #include <gmp.h> #include <assert.h> #include <stdarg.h> #include "console.h" #include ...