language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_putpiece.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdint.h> #include "../include/index.h" void main(void){ //Iniciaando a memória sb(0, 0, 0x04); sb(0, 1, 0x03); sb(0, 2, 0x02); sb(0, 3, 0x01); sb(4, 0, 0xFF); sb(4, 1, 0xFE); sb(4, 2, 0xFD); sb(4, 3, 0xFC); sw(12, 0, 0xFF); sw(16, 0, 0xF...
C
// // Created by Hood on 5/17/2019. // #include <assert.h> #include <ctype.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include "combinatorics.h" #include "FpVector.h" #include "MilnorAlgebra.h" // Private functions uint get_profile_name(char *buffer, Profile P); uint Profil...
C
#include <stdio.h> #include <ctype.h> #include <stdlib.h> char* CorrectMistakes() { char input[255], ch, toCap = 0, prevCh = 0; int len = 0; printf("Enter text:\n>> "); while (1) { if (prevCh == 0 && len < 253) ch = getchar(); else ch = prevCh; if (ch == '\n') break; switch (ch) { case '.': case '!'...
C
#include "menu.h" // /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\ * init() is an interface that initializes the game. * * * * @param time The time played sofar in Hangman the game. * * ...
C
#include <stdio.h> #include <stdlib.h> #include "koolplot.h" #define OFFSET 0.1 int main () { FILE *fp; int m=0, i; double temp1, temp2; fp = fopen ("pontos.txt", "rt"); if (!fp) return NULL; // Contando pontos... while (!feof(fp)) { fscanf(fp, "%lf %lf", &temp1, &temp2); m++; } fclose (fp);...
C
#define _GNU_SOURCE #include <stdio.h> #include <sys/types.h> #include <unistd.h> #include <wait.h> #include <stdlib.h> #include <sys/shm.h> #include <sys/mman.h> #include <fcntl.h> /* Child Processes1 */ int ch1task(int *X, int N, int sleeptime) { usleep(sleeptime); int i; for(i=0;i<N;i++) (*X)++; // = *sh_data_...
C
#include <stdio.h> #include <stdlib.h> #include "QueueList.h" #include "../../02-Linked-List/ListNode.h" QueueList* createQueueList() { QueueList *temp=(QueueList*)malloc(sizeof(QueueList)); temp->rear=NULL; temp->front=NULL; return temp; } int isEmpty(QueueList *queue) { if(!queue->front) { ...
C
/* The program demonstrates a new version of the static detector used in the IMU calibration procedure, see @article{Tedaldi2014, archivePrefix = {arXiv}, arxivId = {ISSN 1476-2986}, author = {Tedaldi, David and Pretto, Alberto and Menegatti, Emanuele}, doi = {10.1109/ICRA.2014.6907297}, eprint = {ISSN 1476-2986}, ...
C
#include <stdint.h> #include <stdbool.h> #include "tm4c123gh6pm.h" #define RED_LED_MASK 2 #define BLUE_LED_MASK 4 #define GREEN_LED_MASK 8 //----------------------------------------------------------------------------- // Hardware Target //----------------------------------------------------------------------------...
C
/* * hBridge_mega168p.c * * Created: 2017/01/12 13:56:51 * Author : Someone's Garden */ #include <avr/io.h> #include <util/delay.h> #include <avr/interrupt.h> #include "../lib/USART.h" #include "../lib/pinDefines.h" static inline void setBridgeState(uint8_t bridgeA, uint8_t bridgeB){ if(bridgeA...
C
/** * ex0702.c * solution to ex0702 */ #include <stdio.h> #include <ctype.h> #define MAX_LINE 128 /* max number of chars in one line */ #define OCT_LEN 6 /* length of an octal value */ int inc( int p, int n ); int main( int argc, char **argv ) { int hexal = 0; int octal = 1; /* by default, we use octal to pri...
C
#ifndef PAGING_H #define PAGING_H #include "common.h" #include "mm.h" #define PAGE_MASK (~(PAGE_SIZE-1)) /* pte_t represents l1 directory Flags bits: only * are used for now *0 - present bit *1 - R/W bit 2- U/S 3- PWT 4-PCD 5- Access bit 6- Dirty bit (ignored for 4k page) *7- Page size 0-for 4k 1-for 2M *...
C
/* * cc3000_event_handler.c * * Created on: 05.09.2013 * Author: Johannes */ #include "cc3000_event_handler.h" #include "cc3000_platform.h" #include "cc3000_general.h" #include "cc3000_hci.h" #include "cc3000_spi.h" // the desired state (is beeing increased after a command has been sent) volatile uint32 cc...
C
#include<stdio.h> #include<stdlib.h> struct NODE { int data; struct NODE* next; }; struct NODE *newNode(int data){ struct NODE *new_node = (struct NODE *)malloc (sizeof(struct NODE)); new_node->data = data; new_node->next = NULL; return new_node; free(new_node); } void push (struct NODE ** head_ref ,int val...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* read_options.c :+: :+: :+: ...
C
/*--------------------------------------------------------------*/ /*Inclusin de archivos /*--------------------------------------------------------------*/ #include <stdio.h> #include <conio.h> /*--------------------------------------------------------------*/ /*Declaracin de constantes y macros /*-------------------...
C
#ifndef MERGER_H #define MERGER_H #include <stdint.h> #include <stdbool.h> #include "Utility.h" #define DEBOUNCE_INTERVAL (100) #define GLOBAL_TIMEOUT (100) #define SEARCH_MATCH 1 #define SEARCH_UNMATCH 0 typedef enum SensorState { SensorStateIdle = 0, SesnorStateDownPending, SensorStateDown, SensorS...
C
#include<stdio.h> #include<string.h> int main( void ) { printf( "Kelime Uzunlugu: %d\n", strlen("Merhaba") ); return 0; }
C
#include <stdio.h> #include <inttypes.h> #include <string.h> #include <libgen.h> #include "ism.h" #include "mainview.h" static char *dirpath; static void tileset(char *codept, char *name, int sx, int sy) { terminal_setf("%s: %s/../Resources/%s-%dx%d.png, size=%dx%d, resize=%dx%d," "resize-filter...
C
#include<stdio.h> int main(){ //declare variables char sString[1000], dCounter, dLength, dMax; //promt the user printf("\n Please insert the string: \n"); scanf("%s", sString); dLength = strlen(sString); dCounter=1; dMax=dCounter; //for loop for(int i=0; i<dLength; i...
C
#include<stdio.h> #include<string.h> void trimLeft(char s[]){ int i=0, j; while(s[0]==' '){ for(j=0;j<strlen(s)-1;j++){ s[j]=s[j+1]; } s[strlen(s)-1]='\0'; } } void trimRight(char s[]){ int i=strlen(s)-1; while(s[i]==' '){ s[i--]='\0'; } } void trimMiddle(char s[]){ int i=0,j; w...
C
#ifndef _SPI_IMPL_H #define _SPI_IMPL_H #ifndef F_CPU #define F_CPU 16000000UL #endif /** * MOSI , MISO , SCK and SS PORT can be changed using this macros in * the Makefile */ #ifndef #define DDR_SPI DDRB #endif #ifndef #define PORT_SPI PORTB #endif #ifndef #define DD_MOSI DDB3 #endif #ifndef #define DD_SC...
C
#include <string.h> #include "jmalloc.h" #include "jarray.h" #define _JAP(ja) ((struct _j_array*)(&ja[0]-sizeof(struct _j_array))) size_t jarrLen(ja_t arr){ return _JAP(arr)->len; } size_t jarrUnused(ja_t arr){ return _JAP(arr)->unused; } size_t jarrCap(ja_t arr){ return _JAP(arr)->len + _JAP(arr)->u...
C
#include <stdio.h> #include <ctype.h> #include <string.h> #include <math.h> int main(){ int i, numero; printf("entre com um numero:"); scanf("%d",&numero); for(i=1; i<=numero/2; i++) if(primo(i)&&primo(numero-i)) printf("%d + %d\n", i, numero-i); return 0; } int primo(int numero...
C
/* Provides C functions: imageinterp_get_roi, imageinterp_get_roi_corners. For Python extension module, compile with -DPYTHON_EXTENSION. Author: Pearu Peterson Created: June 2011 */ #include <math.h> /* imageinterp_get_roi function returns a subimage (roi) of an image using interpolation. Input para...
C
#include <stdio.h> int main() { char a[11]; void rank(char a[11]); gets(a); rank(a); return 0; } void rank(char a[11]) { int i,m,n; char b[10]={0},max='0'; for (m=0;m<=9;m++) { for (i=0;i<=9;i++) if (max<=a[i]) {max=a[i]; n=i;} b[m]=max; a[n]='0'; max='0'; } puts(b); }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct { char nachname[30]; float note; } student; int main(int argc, char const *argv[]){ int N; printf("Wie viele Daten einlesen? N = "); scanf("%i", &N); student **studArg = malloc(sizeof(student) * N); char name[30]; float note; for(size...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_int_type.c :+: :+: :+: ...
C
#include <stdio.h> #include "semver.h" int main(void) { semver_t v; semver_bump (&v); const char ver[] = "1.0.0"; const int valid = semver_is_valid(ver); printf("%s is valid: %d\n", ver, valid); return 0; }
C
#include <stdio.h> #include <dos.h> void main(void) { struct fatinfo fat; getfatd(&fat); printf("Sectors per cluster %d\n", fat.fi_sclus); printf("Clusters per disk %u\n", fat.fi_nclus); printf("Bytes per cluster %d\n", fat.fi_bysec); printf("Disk type %x\n", fat.fi_fatid & 0xFF); } ...
C
#include <stm32f10x.h> void delay(void); int main(void){ int n = 0; int button; // Enable the GPIOA (bit 2) and GPIOC (bit 4) // See 6.3.7 in stm32f100x reference manual RCC->APB2ENR |= (0x10 | 0x04); // Set GPIOC Pin 8 abd Pin 9 to outputs // 7.2.2 in stm32f100x refer...
C
/********************************************************* * From C PROGRAMMING: A MODERN APPROACH, Second Edition * * By K. N. King * *********************************************************/ #define THIS_FILE "ch13ex06.c, page 309" #define PRINT_FILE_INFO \ printf("C Programming, A Modern Approach: %s\n", ...
C
/* ** EPITECH PROJECT, 2018 ** get_next_line.c ** File description: ** my function getline */ #include "include/my.h" char *str_dup_gnl(char *str) { char *result; int index = -1; while (str[++index]); result = malloc(index + 1); if (!result) return (NULL); result[index] = '\0'; in...
C
//////////////////////////////////////////////////////////////////////////////// // Comments // Solution to ex. 3-2. // // Reads & prints input, with two possible contingencies: // //// 1) If it reads a newline or tab character before a literal '\n' or '\t', //// then it prints this newline or tab--and all subsequent...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> int Main(int argc, char *argv[]) { int first_iteration; int index; int temp_index; FILE *input_file_ptr; FILE *output_file_ptr; int verbose_level = 1; char *input_file_name_default = "input.txt"; char *input_file_name = 0; ch...
C
#include <stdio.h> #include <stdlib.h> #include <cs50.h> int main() { // instruction on how to play games printf("Welcome to treasure hunt, please enter direction and steps you would like to go and the computer will guide you to the treasure you want.\n"); char d; int x, y, d1; //getting random number ...
C
#include <stdio.h> #include <time.h> #include <stdlib.h> void quick_sort(int a[], int l, int r){ if (l >= r) return; //this kinds of intervals are already sorter, no need to consider them int rand_index = rand() % (r - l + 1) + l; //picking random index from our interval int rnd_num = a[rand_index]; //extr...
C
#include "stack.h" #define STACK_SIZE 3 // Backing store int StackStore[STACK_SIZE]; // Pointers to stack elements for adding and retrieving int* topPtr; int* bottomPtr; int* currentPtr; // LIFO Stack is Empty if currentPtr == 0; // LIFO Stack is Full if currentPtr == topPtr (points to top element in the Stack); //...
C
/* demo-udp-03: udp-send: a simple udp client send udp messages sends a sequence of messages (the # of messages is defined in MSGS) The messages are sent to a port defined in SERVICE_PORT usage: udp-send Paul Krzyzanowski */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <netdb.h> #include <sys...
C
#include<stdio.h> #include<math.h> int ispal(long double num) { long double r=0,n=num; printf("%Le ",r); while(n>0) { r*=10; r+=fmod(n,10); n/=10; } if(num==r) return 1; return 0; } int main() { long double a,b,i,fk; int t,c,k=1; scanf("%d",&t); while...
C
#include <stdio.h> #include <sys/stat.h> #include <string.h> #include <stdlib.h> void print_usage(FILE *stream, char progname[]); int main(int argc, char *argv[]) { long int accessmode; if(argc != 3) { print_usage(stderr, argv[0]); return 1; } /* check for octal numbers */ if...
C
#include <sys/syscall.h> #include <unistd.h> #define msg_stdout "output to stdout\n" #define msg_stderr "output to stderr\n" int __attribute__((__weak__)) asm_syscall(int nr, ...) { (void)nr; return 0; } int __attribute__((__weak__)) asm_fork(void) { return asm_syscall(__NR_fork); } int __attribute__((__weak__)...
C
// main_c.c #include <stdio.h> //直接使用cpp的标识符 extern int _Z3maxii(int,int); int main(void){ //直接使用cpp的标识符 int i = _Z3maxii(11,12); printf("max value:%d", i); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include "listDEC.h" List *list_new() { //creamos la estructura y pedimos memoria para la estructura List *list = (List *)malloc(sizeof(list)); if (list == NULL) return NULL; //seteamos la cabeza y la cola list->head = NULL; li...
C
/*! * @file pksav/math/base256.h * @ingroup PKSav * @brief Conversions between Base-10 and Base-256 numbers. * * Copyright (c) 2016 Nicholas Corgan (n.corgan@gmail.com) * * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt * or copy at http://opensource.org/licenses/MIT) */ #ifnde...
C
#include <unistd.h> #include <stdio.h> #include <sys/socket.h> #include <sys/types.h> #include <stdlib.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> #include <string.h> #include <inttypes.h> #include <time.h> int main(int argc, char *argv[]) { srand(time(NULL)); // setting the seed of ...
C
#include <assert.h> #include <stdlib.h> #include <stdio.h> #include "singly_linked_list.h" int test_create_singly_linked_list() { SinglyLinkedList* list = create_singly_linked_list(); if ( NULL == list ) { return -1; } free( list ); return 0; } int test_get_head_singly_linked_list() { SinglyLinkedList...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.c :+: :+: :+: ...
C
#include "errors.h" #include <stdio.h> // Return an error message. static const char *error_message(error err) { switch (err) { case SUCCESS: return "success"; case ERR_PARSE_INT_INVALID: return "can't parse integer (invalid argument)"; case ERR_PARSE_INT_OVERFLOW: return "can...
C
#include "stm32f10x_it.h" #include "stm32f10x.h" #include "user_msgheap.h" #include "user_uart.h" #include "user_global.h" static int heap_sp = 0; static u8 heap_msg[HEAP_SIZE][MSG_MAX_LENGTH]; static int heap_sp_send = 0; static u8 heap_send_msg[HEAP_SIZE][MSG_MAX_LENGTH]; u8 pushMsg(u8 msg[],u8 len) { int i=0; u8 ...
C
#include "holberton.h" /** * leet - finds a sepsifc letter and replace it by an intger *@s: string *Return: a string */ char *leet(char *s) { int counter, sec = 0; char uppercase[] = {'a', 'e', 'o', 't', 'l'}; char lowercase[] = {'A', 'E', 'O', 'T', 'L'}; int numbers[] = {'4', '3', '0', '7', '1'}; for (counter =...
C
/** * @file lv_txt_ap.c * */ /********************* * INCLUDES *********************/ #include <stddef.h> #include "lv_bidi.h" #include "lv_txt.h" #include "lv_txt_ap.h" #include "lv_mem.h" #include "../draw/lv_draw.h" /********************* * DEFINES *********************/ /********************** ...
C
#include <unistd.h> #include <stdio.h> #include <stdlib.h> int etages_par_block(int size) { int nombre_ligne_par_etage = size + 3; return nombre_ligne_par_etage; } int nombre_etoiles_derniere_ligne(int size) { int block; int nombre_etoiles_derniere_ligne = 7; int decrementation_par_block = 2; ...
C
/* ************************************************************************** */ /* LE - / */ /* / */ /* algo.c .:: .:/ . .:: ...
C
#include <stdio.h> #include "comments.h" #include "stopif.h" #define NAME_LENGTH 20 void printAuthors(const char *authorName, const char *anonName) { printf("\"%s\" is now \"%s\"\n", authorName, anonName); } char* anonymizeAuthor(binn *anonAuthors, const xmlChar *authorName) { static int authorsCount = 0; char *...
C
/* * ByteHelpers.h * * Created: 4/3/2013 4:00:36 PM * Author: Jonas */ #ifndef BYTEHELPERS_H_ #define BYTEHELPERS_H_ // most significant and least significant byte helper functions inline char msb (uint16_t twoByteVal) { return (twoByteVal >> 8); } inline char lsb (uint16_t twoByteVal) { return twoByteVal ...
C
#include<stdio.h> #include<string.h> #include<stdlib.h> #include<ctype.h> #include<math.h> int main(){ int i = 0,len = 0,j = 0,a = 0; char line[1024]; scanf("%s",line); for(i = 0;i<5;i++) { if(i<4) { printf("%c ",line[i]); }else{ printf("%c\n",line[i]); } } }
C
#ifndef UNORDERED_SET_H #define UNORDERED_SET_H #include <stdlib.h> #include <stdbool.h> #ifdef __cplusplus extern "C" { #endif typedef struct unordered_set_entry { void* key; size_t hash_value; struct unordered_set_entry* chain_next; str...
C
/* * File: led.c * Author: simpspr * * Created on August 27, 2015, 3:15 PM */ #include "led.h" void initLEDs() { //Enables the three LEDs on the PIC32 starter kit as OUTPUTs TRISDbits.TRISD0 = OUTPUT; turnOffLED(1); TRISDbits.TRISD1 = OUTPUT; turnOffLED(2); TRISDbits...
C
#include <stdio.h> int main()//Main method { char county[ 30 ];//Variable for holding county name char voting_station[ 50 ];//Variable for holding the name of the voting station char over70remark[30]="Success";//Remark if the percentage turnout is over 70% char below70over50remark[30]="More Civic Education";//...
C
#include "libcrypt.h" unsigned char a[1000000]; main() { int i; SHS_CTX context; for (i=0; i<1000000; i++) a[i] = 'a'; i = 0; shsInit(&context); while (i<1000000) { shsUpdate(&context, a, 4); i += 4; } shsFinal(&context); printf("totlen = %d\n", context.totalLength); for (i=0; i<5; i++) printf("%...
C
#include <stdio.h> #include <stdlib.h> #define maxsize 100 typedef int datatype; typedef struct { datatype data[maxsize]; int rear,front; }CSeQueue; CSeQueue* Init(CSeQueue *q) { q = malloc(sizeof(CSeQueue)); q->front = q->rear = 0; printf("ʼɹ"); return q; } // void InQueue(CSeQueue *q, int x) { if(q->fr...
C
#include "ficheros.h" const char *nombre_archivo; int ninodo; int permisos; int main (int argc, char **argv){ if(argc < 3){ fprintf(stderr, MSG_ERROR("permitir.c") "Sintaxis: permitir <nombre_dispositivo> <ninodo> <permisos>\n"); return(-1); }else{ nombre_archivo = argv[1]; nin...
C
#include<stdio.h>//STD I/O #include<stdlib.h>//LIB OPERATIONS #include<string.h>//STRING OPERATIONS #include<sys/types.h>//DIFFERENT TYPES OF DATA TYPES #include<sys/socket.h>// #include<arpa/inet.h> //MICRO DEFINE OR FUNCTION DEFINE #include <sys/socket.h>//SYSTEM CALLS #include<netinet/in.h>/* Provides support for ...
C
/* * string.c * * Created on: 09.07.2018 * Author: Dominik */ #include <stdio.h> #include "string2.h" int strcmp(char *s1, char *s2) { for(int i = 0; s1[i] != 0 && s2[i] != 0; i++) { if(s1[i] > s2[i]) { return 1; } if(s1[i] < s2[i]) { return -1; } } return 0;...
C
/* *ַеӢַдСдת */ #include <ctype.h> #include <stdio.h> /*---ַеӢַתΪдĸ---*/ void str_toupper(char str[]) { unsigned i = 0; while (str[i]) { str[i] = toupper(str[i]); i++; } } /*---ַеӢַתΪСдĸ---*/ void str_tolower(char str[]) { unsigned i = 0; while (str[i]) {...
C
/*------------------------------------------------------------------ Name: Ranjan Mishra Roll Number: 1519 Date of Submission: 15th oct 2015 Deadline date: 16th Oct 2015 Program description: 2dimensional tree and range search on it. Acknowledgements: ------------------------------------------------------------------...
C
/** @file * Interfejs klasy obsługującej tryb interaktywny (interactive mode). * * @author Michał Orzyłowski <mo418334@students.mimuw.edu.pl> */ #ifndef INTERACTIVE_MODE_H #define INTERACTIVE_MODE_H #include "gamma.h" /** @brief Obsługuje interactive mode (tryb interaktywny). * Główna funkcja zarządzająca dział...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* major_minor.c :+: :+: :+: ...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> typedef struct hash_buckets_s { char* key; void* value; struct hash_buckets_s* next; } hash_buckets_t; typedef struct hasht_s { hash_buckets_t** buckets; size_t size; } hasht_t; hasht_t* hasht_create(size_...
C
#include <stdio.h> int main() { int a, b; printf("Input height:"); scanf("%d", &a); printf("Input width:"); scanf("%d", &b); for(int i=1; i<=a; i++) { for(int j=1; j<=b; j++) //In the lecture you said possibly two nested loops, an extra for loop made it complicated so i used an...
C
#ifndef _DISPATCHER_CLASS_H_ #define _DISPATCHER_CLASS_H_ // DEFINITIONS // #if (1) #define BIT(n) (0x01<<(n)) #define IRQ_TM 0 #define IRQ_KB 1 #define IRQ_COM2 3 #define IRQ_COM1 4 #define IRQ_RTC 8 #define IRQ_MS 12 #define SP_ADDR_COM2 0x2F8 #define SP_ADDR_COM1 0x3F8 #endif // LOCAL INCLUDES // #...
C
#include "example_config.h" #if COMPILE_CONNECTOR_TIMEOUT #include "knet.h" /* ͻ - ص */ void connector_cb(channel_ref_t* channel, channel_cb_event_e e) { if (e & channel_cb_event_connect_timeout) { /* ӳɹ */ channel_ref_close(channel); /* ӳʱ˳ѭ */ loop_exit(channel_ref_get_loop(channel)); ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* drawing.c :+: :+: :+: ...
C
#include "LCD.h" #include "timing.h" #include "subroutine.h" void init_lcd() { ms_delay(15); //Start up delay cmd(0x38); //Function set (8 bit, 2 line, 5x7) lcdDelay(); cmd(0x06); //Entry mode (Left to right, inc) lcdDelay(); cmd(0x0C); //display (Display on, cursor off) lcdDelay(); cmd(0x06); //Entry m...
C
/* * tclIndexObj.c -- * * This file implements objects of type "index". This object type is used * to lookup a keyword in a table of valid values and cache the index of * the matching entry. Also provides table-based argv/argc processing. * * Copyright (c) 1990-1994 The Regents of the University of California. ...
C
// // Created by 苏汉宇 on 17/6/27. // #include "hashTable.h" #include <stdlib.h> #include <string.h> static int hashcode(const char *s) { int len = strlen(s); const unsigned char *name = (const unsigned char *)s; unsigned long h = 0, g; int i; for(i=0;i<len;i++) { h = (h << 4) + (unsign...
C
#include<stdio.h> int main(){ int a[100],l, n,i,j,k,max,nextmax,temp; printf("\n Enter n: "); scanf("%d",&n); l = 2*n-1; printf("\n Enter %d numbers: ",n); for(i=n;i<(2*n);i++) scanf("%d",&a[i]); i=l; while(i>1){ if(a[i]>a[i-1]){ a[i/2] = a[i]; } else { a[i/2] = a[i-1]; } i=i-2; } for(i=1; i<2*n;i++) printf("%d ",a[i]...
C
/**************************************************************************** * A SIMPLE MATCHING ALGO WITH SUPPORT FOR INDELS * * Author: H. Pag\`es * ****************************************************************************/ #includ...
C
#include "acc.h" #define NLOOP 1000 int counter; /* this is incremented by the threads */ void *doit(void *); int main(int argc, char **argv) { pthread_t tidA, tidB, tidC; pthread_create(&tidA, NULL, &doit, NULL); pthread_create(&tidB, NULL, &doit, NULL); pthread_create(&tidC, NULL, &doit, NULL); /* 4wait ...
C
// 总体思路:依次判断每个身份证号,若有郊,将索引值赋予acceess数组,index为代表无效身份证的个数 #include <stdio.h> int main() { int n; scanf("%d", &n); int access[100], index=0; char numble[100][19]; char M[12] = "10X98765432"; int X[17] = {7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2}; for(int i=0; i<n; i++) scanf("%s", numble[i]); int sum; //加权求和 char ...
C
// // main.c // aufgabe_5 // // Created by Niklas Stöhr on 02/11/17. // Copyright © 2017 Niklas Stoehr. All rights reserved. // // // code mainly taken from http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html /* ** server.c -- a stream socket server demo */ #include <stdio.h> #include <stdlib.h> #incl...
C
#include <stdio.h> #include <math.h> int x[13]; float data[13][3]; const float PI = 3.14159f; void temp(); void deg(); float trigonometri(); float radian(); main() { printf("\n =|------------------------|=\n"); printf(" ==| Azis Jabbar Susetio |==\n"); printf(" ===| 4210141021 |===\...
C
#include "buzzmsg.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <arpa/inet.h> #include <math.h> /****************************************/ /****************************************/ static int32_t MAX_MANTISSA = 2147483646; // 2 << 31 - 2; /****************************************/ /********...
C
#include <stdlib.h> #include <stdio.h> #include <limits.h> #include <omp.h> #include <dijkstra.h> #include <floyd.h> /** * Programa principal */ int main(int argc, char **argv) { // Algoritmos // 0 dijkstra // 1 floyd-warshall int algorithm = 0; // Quantidade padrao de threads // 0 default // n for para...
C
#include <stdio.h> int main(void){ int peopleNum, pizzaNum, pieceNum; int leftover, personGetsPiece; printf("How many people?"); scanf("%d", &peopleNum); printf("How many pizzas do you have?"); scanf("%d", &pizzaNum); printf("How many pieces a pizza has?"); scanf("%d", &pieceNum); ...
C
/* * mjime051_lab8_part1.c * * Created: 5/1/2019 10:28:19 AM * Author : matt_ */ #include <avr/io.h> void ADC_init() { ADCSRA |= (1 << ADEN) | (1 << ADSC) | (1 << ADATE); // ADEN: setting this bit enables analog-to-digital conversion. // ADSC: setting this bit starts the first conversion. // ADATE: setting ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include "AUTOCELL.h" AT* init_random_table(int w, int h, int* r, int* n, int nn) { printf("Creating table...\n"); printf("Performing mallocs\n"); AT* at = (AT*) malloc(sizeof(AT)); int* new_cells = (int*) malloc(w * h * sizeof(int))...
C
// Esercizio2 // // Creato da Alberto Giunta il 26/09/2013 // Matricola: 0000691428 #include <stdio.h> int main () { /* solitamente non è richiesto, ma in questo esercizio lascio uno spazio tra la sequenza di escape e il resto della stringa per migliorare la leggibilità del codice */ puts("Stampo stringhe...
C
/* * ???? * Created on: 2013-1-13 * ?? * Author: ??? */ int main() { int r = 0, c = 0; cin >> r >> c; int mountain[r + 2][c + 2]; for (int i = 0; i < r + 2; i++) for (int j = 0; j < c + 2; j++) { if (i == 0 || j == 0 || i == r + 1 || j == c + 1) mountain[i][j] = 0; else cin >> mo...
C
#include <stdio.h> #include <signal.h> #include <stdlib.h> #include <netinet/in.h> #include <string.h> #include <sys/socket.h> #include <unistd.h> #include <dirent.h> #include <sys/types.h> #include <time.h> #include <sys/stat.h> #include <fcntl.h> #include <errno.h> static int main_socket_fd; int isNumber(char *str) /...
C
#include<stdio.h> #include<math.h> int main() { int i, j, n, arr[10][10], sum = 0, sum1 = 0, a = 0, normal; printf("Enter the number of rows (columns ) of the matrix: \n"); scanf("%d",&n); printf("\nEnter the %d elements of the first matrix: \n", n*n); for(i=0; i<n; i++) { for(j=...
C
#include "../machine.h" /* checks if all entries of a vector are finite */ extern int finite __PARAMS( (double v)); int C2F(vfinite)(int *n, double *v) { int i; for (i=0; i < *n; i++) if (finite(v[i])==0) return 0; return 1; }
C
#include <stdio.h> #include <stdlib.h> #include "3-calc.h" /** * op_add - Add two integers * * @a: First integer. * @b: Second integer. * Return: The result of the opration */ int op_add(int a, int b) { int res; res = 0; res = a + b; return (res); } /** * op_sub - substract two integers * * @a: The opera...
C
#include<stdio.h> #include<stdlib.h> #include<time.h> #define MAX 100 #define MAXNUMBER 20 void create_random(int *tab); void count_frequency(int *tab, int *freq); void draw_histogram(int *freq); int main ( void) { int table[MAX]; int frequency[MAXNUMBER]; /* INIT RANDOM TABLE */ printf("\n\t - NUMBERS -\n\n");...
C
#include<stdio.h> #include<math.h> #define _USE_MATH_DEFINES #define N 320 #define PI 3.1415 FILE *fin; FILE *forigin_spec; FILE *flow_time_env; FILE *fhigh_time_env; FILE *flog_spec_env; FILE *flow_lifter; void n_dft(double* signal, double* spec_mag, int N_PT); void read_data(FILE *fp, double* signal, int N_PT, sho...
C
#ifndef v1beta2_deployment_TEST #define v1beta2_deployment_TEST // the following is to include only the main from the first c file #ifndef TEST_MAIN #define TEST_MAIN #define v1beta2_deployment_MAIN #endif // TEST_MAIN #include <stdlib.h> #include <string.h> #include <stdio.h> #include <stdbool.h> #include "../extern...
C
/************************************************************************* * Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * * All rights reserved. All use of this software and documentation is * * subject to the License Agreement located at the end of this file below.* ********************...
C
#include "types.h" #include "stat.h" #include "user.h" int main(int argc, char *argv[]) { char buf[128]; uint bufsize = sizeof(buf); if(argc != 2){ printf(2, "Usage: ln old new\n"); exit(); } if(readlink(argv[1], buf, bufsize) == 0){ printf(1, "%s\n", buf); } else{ printf(2, "readlink fa...