language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/* Data Declaration for sharing data in an array between processes Holds the process ID's of the forked process for inter- communication between different processes */ #define MESS_SZ 30 struct MemData { int childPid[5]; /* Array of size 5, will assign P1->[1], P2->[2] and so on (Not good practice but its e...
C
// Queue - using linked list, one way #include<stdio.h> #include<stdlib.h> typedef struct Node { int data; struct Node* next; }Node; Node * head; void addFront(Node* root, int data) { Node* new = (Node*)malloc(sizeof(Node)); new->data = data; new->next = root->next; root->next = new; } void removeFront(Node* ...
C
#include "holberton.h" /** * puts_half - prints half a string * @str: an string */ void puts_half(char *str) { int c, length = 0; while (str[c] != '\0') c++; length = c; if (length % 2 == 0) c = length / 2; else c = (length + 1) / 2; for (; c < length; c++) _putchar(str[c]); _putchar('\n'); }
C
#include "spc.h" void Page_Init_Program(Logger logger, PageEntity_t *page) { //logger("\r\nProgram\r\n"); if ((page == NULL) || (page->publisher == NULL)) return; SpcData_SetRefreshMask(DISABLE_REFRESH); strncpy((char *)(page->info.Title), "Program", MAX_INFO_LEN); strncpy((char *)(page->info.Cont...
C
#include <stdio.h> int nmatch(char *s1, char *s2); void print(char *s1, char *s2, int bool) { printf("%s / %s / %d !\n", s1, s2, bool); } int main(int argc, char **argv) { if (argc != 3 && argc != 1) { printf("Erreur\n"); return (0); } if (argc == 3) { int bool; bool = nmatch(argv[1], argv[2]); pri...
C
#include <stdio.h> #include <string.h> // strcmp() #include <stdlib.h> // srand() e rand() #include <time.h> // Para ser usado no srand() para o rand() gerar números pseudo-aleatórios void mostrar(int tamanhoVetor, int vetor[]); void trocar(int vetor[], int indiceA, int indiceB); void verificarArgumentos(int argc, c...
C
/* ** EPITECH PROJECT, 2020 ** PSU_tetris_2019 ** File description: ** win_info */ #include "tetris.h" void display_info(game_t *game, tetris_t *tetris) { print_in_middle(game->win->info, 30, "info"); box(game->win->info, 0, 0); mvwaddch(game->win->info, 2, 0, ACS_LTEE); mvwhline(game->win->info, 2, 1...
C
/* * The malelf library was written in pure C, with the objective to * provide a quick and easy way a set functions for programmers to * manipulate ELF files. With libmalelf can dissect and infect ELF * files. Evil using this library is the responsibility of the programmer. * * Author: Tiago Natel de Moura <t...
C
#include <stdio.h> #include <stdlib.h> typedef struct date { int orderid, stockid, quantity, bs; double price; struct date* next; } DATE, *PDATE; typedef struct stock { int stockid; struct stock* next; PDATE b, s; } STOCK, *PSTOCK; PDATE adress[10000]; PSTOCK ad[10000], home; int cnt; PDAT...
C
// Transport card record implementation ... Assignment 1 COMP9024 18s2 #include <stdio.h> #include "cardRecord.h" #define LINE_LENGTH 1024 #define NO_NUMBER -999 // scan input line for a positive integer, ignores the rest, returns NO_NUMBER if none int readInt(void) { char line[LINE_LENGTH]; int n; fgets(l...
C
/* Quick Sort is one of the most popular Sorting Algorithms out there in the field of Programming designed and implemented here in the C Programming Language demonstrating a Time Complexity of O(nlog(n)) in its Best Case while O(n^2) in it's worst case making it significantly faster than many popular Sorting Algorit...
C
#include <stdio.h> int main() { // 97 - 122 = a-z char ch; printf("Enter the charcter\n"); scanf("%c", &ch); if (ch <= 122 && ch >= 97) { printf("It is lower cause"); } else { printf("It is upper cause"); } return 0; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* actions.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <pthread.h> #include <time.h> void* worker(void* data){ printf("%d defer %lld ticks\n",pthread_self(),clock()-(clock_t)data); clock_t start=clock(); int sum=0; for(int i=0;i<10000000;i++){ sum+=i; if(i==5000){ // printf("%d sum ...
C
int main(){ int i,r1,r2,num=0,index=0; double n; char a[501],b[501]; scanf("%lf\n",&n); scanf("%s\n",a); scanf("%s",b); r1=strlen(a); r2=strlen(b); for(i=0;i<r1;i++){ if(a[i]=='A'||a[i]=='T'||a[i]=='C'||a[i]=='G')continue; else{ index=1; break; } } for(i=0;i<r2;i++){ if(b[i]=='...
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
/* Author: Calvin Todd Assignment: Open a file and display its' content backwards */ #include <stdio.h> #include <stdlib.h> int main() { //Initialize variables int len, i = 0; FILE *pFile = NULL; char ch; //Open file in read pFile = fopen("theEgg.txt", "r"); //Check that the pointer is n...
C
#include "dominion.h" #include "rngs.h" #include "dominion_helpers.h" #include <stdio.h> #include <assert.h> #include <math.h> int main() { struct gameState G; int randomSeed = rand(); int player = 0; int choice1, choice2, choice3; int handPos = 0; int *bonus; int i; ...
C
#include "interfaces/notification.h" #include <stdlib.h> #include <string.h> static char *getName(const Notification *self) { return self->name; } static void setBody(Notification *self, void *body) { self->body = body; } static void *getBody(const Notification *self) { return self->body; } static void ...
C
int numWays(int n){ long long a = 1, b = 0 , r = 1; for(; n; n--) { r = (a + b) % 1000000007; b = a; a = r; } return r; }
C
#include<stdio.h> void main() { int num[1000],i,j=1,L_A[1000]={0},n; float sum=0.0,average; printf("Enter how many numbers you want to input:\n"); scanf("%d",&n); printf("Enter your numbers\n:"); for(i=1;i<n;i++) { scanf("%d",&num[i]); sum+=num[i]; } average=sum/n; ...
C
#include "../include/sdata.h" //************ "SISTEMA" //para fazer assignment de uma thread de removeThread proceder assim: // *runningThread = removeThread(&list_ready); void scheduler() { getcontext(schedulerCtx); //printf("\nCONTEXTO DO ESCALONADOR.\n"); if(hasToBlock){ list_blocked = insertThread(list_bl...
C
#include<stdio.h> #include<string.h> #include<unistd.h> #include<sys/types.h> #include<stdlib.h> int parseCmd(char *cmd,char *argList[]); int main(int argc, char *argv[]) { char command[256]; char *argList[256]; int argCount = 0; int i =0; while(1){ printf("Input a command: ")...
C
#include "echo.h" int main(int argc, char *argv[]) { struct sockaddr_in serveradresse; int socketfd; int connection; int opt = 1; char string[MAXLEN]; socketfd = socket(AF_INET, SOCK_STREAM, 0); if (setsockopt(socketfd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) < 0) { per...
C
//13. Write a C program to count total number of notes in given amount. #include<stdio.h> int main() { int amt; printf("Enter a Amount (in Rupees only) :"); scanf("%d", &amt); printf("\nTotal Number of Notes for (%d) Rupees:-",amt); printf("\n2000 Rupees Notes = %d", amt/2000)...
C
#include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <fts.h> void indent(int i) { for (; i > 0; i--) { printf(" "); } } int compare(const FTSENT **one, const FTSENT **two) { return strcmp((*one)->fts_name, (*two)->fts_name); } int dir_lis...
C
#ifndef QUERA_Q279_H #define QUERA_Q279_H #endif //QUERA_Q279_H #include <stdio.h> /** * Integer power * https://stackoverflow.com/a/101613/4213397 * @param base The base of power * @param exp The exponent * @return The result */ long long ipow(long long base, int exp) { long long result = 1; for (;;) ...
C
#include <message.h> #include <stdlib.h> #include <stdio.h> #include <pio.h> #include "accelerometer.h" static void handle_pio_INT1(Task t, MessagePioChanged *pio); static void AccHandler(Task t, MessageId id, Message payload); static AccReadTask ReadAcc = {{ AccHandler }}; int main(void) { /* int l;*/ ...
C
#include "apue.h" #define BUFSIZE 1000000000 char buf[BUFSIZE]; void sig_alrm(int signo) { printf("SIGALRM caught"); } /* The os will blocks the signals from getting the process * until the 'fwrite' completes. Notice this is really what * happens rather than alarm firing before 'fwrite' is called. * */ int mai...
C
#include<stdio.h> #include<string.h> void swap1(int *x,int*y) { int temp=*x; *x=*y; *y=temp; } void swap2(void *vp1,void *vp2,int size) { char buffer[size]; memcpy(buffer,vp1,size); memcpy(vp1,vp2,size); memcpy(vp2,buffer,size); } void main1() { int x; int y; printf("X=\t"); ...
C
/** * @file ccsc_uart.h * @brief UART処理,リングバッファ * @author Keitetsu * @date 2016/12/18 * @copyright Copyright (c) 2016 Keitetsu * @par License * This software is released under the MIT License. */ #ifndef __CCSC_UART_H__ #define __CCSC_UART_H__ /** * @name リ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* start_print.c :+: :+: :+: ...
C
#include "fs.h" #include "global.h" #include "stdio.h" #include "ipc.h" #include "string.h" static struct Inode* createFile(char* path, int flags); static int allocSmapBit(int dev, int nrSectsToAlloc); static struct Inode* newInode(int dev, int inodeNr, int startSect); static int allocImapBit(int dev); static void new...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int Rod[20]; int N,M; int Sum,Avg; int TableIndex; char Used[20]; char Table[200000][20]; void MakeTable(int Index, int Value) { int I,J,K; if (Index<M && Value < Avg) { Used[Index]=1; MakeTable(Index+1,Value+Rod[Index]); ...
C
#include<stdio.h> char * strrev(char *str) { int i=0,j=0; char ch; while(str[i]) i++; str[i--]='\0'; for(j=0; j < i; j++,i--) { ch = str[i]; str[i] = str[j]; str[j] = ch; } return str; } int main() { int i; char str[20]; gets(str); strrev(str); pr...
C
/* Basic ESP8266 MQTT example This sketch demonstrates the capabilities of the pubsub library in combination with the ESP8266 board/library. It connects to an MQTT server then: - publishes "hello world" to the topic "outTopic" every two seconds - subscribes to the topic "inTopic", printing out any messages ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include "shellcode.h" #define TARGET "/tmp/target3" #define OVERFLOWSIZE 4900 #define NOP 0x90 int main(void) { char *args[3]; char *env[1]; args[0] = TARGET; args[1] = "hi there"; args[2] = NULL; env[0] = NULL; int bsize...
C
#include "../inc/ush.h" int mx_execute_builtin(char *command, char **params, char ***commands_arr, int i) { // EXIT if (!mx_strcmp("exit", command)) { int ext_val = 0; if (params[1] != NULL) ext_val = mx_atoi(params[1]); free(command); mx_del_strarr(&params); ...
C
/* Estrutura */ #include <stdio.h> #include <stdlib.h> // Estrutura1: struct ponto2D { int x,y; }; // Estrutura2: struct ponto3D { int x,y,z; }; int main (void) { struct ponto2D p2; struct ponto3D p3; p2.x = 10; p3.x = 12; printf("%d %d\n", p2.x, p3.x...
C
#include <stdio.h> int main() { int num, aux, soma=0; printf("Informe um nmero: "); scanf("%d", &num); if (num < 0 ){ printf("Esse Nuemro invalido!!"); }if (num > 0) { aux = num; while (aux > 0) { soma += aux % 10; aux /= 10; } printf("Soma dos algarismos de %d = %d\n", num, soma); } else printf("...
C
//读入不确定数目的整数:(以0为结尾) // int i = 0; // /* 初始化s[0] */ // scanf("%d",&s[i]); //如果用循环内部用break当然很简单. // for(;s[i++] != 0;) // { // scanf("%d",&s[i]); // } /* 利用指针读入二维数据 */ while (1) { int *pq; int n ; scanf("%d",&n); int size_int = sizeof(int); ...
C
#include <bits/stdc++.h> using namespace std; int n; int arr[5000]; int dpTable[5000][2]; inline int read() { register int c=getchar();int x=0; for(;c<48||c>57;c=getchar()); for(;c>47&&c<58;c=getchar()) x=(x<<1)+(x<<3)+c-48; return x; } int main() { while(scanf("%d",&n) == 1){ me...
C
#include <stdio.h> int main() { int n; scanf("%d", &n); double N1[n], N2[n], N3[n], media[n]; for (int i = 0; i < n; ++i) { scanf("%lf %lf %lf", &N1[i], &N2[i], &N3[i]); media[i] = (N1[i] * 2 + N2[i] * 3 + N3[i] * 5) / 10; printf("%.1lf\n", media[i]); } return 0; }
C
#include <stdio.h> int main(void){ int k, n; int _ignore; if (scanf("%d\n", &_ignore) != 1){ return -1; } while(scanf("%d %d\n", &k, &n) == 2){ int s1 = (n * (n + 1))/2; int s3 = s1 * 2; int s2 = s3 - n; printf("%d %d %d %d\n", k, s1, s2, s3); }; retu...
C
/************************************* * * sw_sequential_old.c * Author: Kevin English * University of Hawaii * ICS 632 * * This was the original program written for smith waterman ring implementation. It is kept around for reference. **/ /* sw_paralle.c */ #include <stdio.h> #include <unistd.h> #include ...
C
#include <stdlib.h> #include <stdio.h> /** * main - print all possible combinations of two two-digit numbers * Return: 0 if the program works */ int main(void) { int i; int n; for (i = 0; i < 100; i++) { for (n = 0; n < 100; n++) { int dizainei = i / 10; int unitei = i % 10; int dizainen = n / 10;...
C
/** * TinyOS - ghalex@gmail.com * Interrupt Request * * @author Ghiura Alexandru * @version 0.1.0 */ #include <kernel/types.h> #include <kernel/x86/registers.h> #include <kernel/x86/irq.h> irq_t interrupt_handlers[256]; /** * Add entreys to IDT. */ void init_irq() { /* Init the PICs and remap them * PIC1...
C
#define _CRT_SECURE_NO_WARNINGS 1 #include <stdio.h> #include <inttypes.h> int main(void) { uint32_t userInput = 0; uint32_t transNumber = 0; printf("Enter a number to be shifted: "); scanf("%u", &userInput); printf("Your number was %u (Hex: 0x%08X) \n", userInput, userInput); transNumb...
C
// extract.c // funtions and types used to extract x,y,z values from a // string containing a url of the form // "http://almondbread.cse.unsw.edu.au:7191/tile_x3.14_y-0.141_z5.bmp" // initially by richard buckland // 13 April 2014 // your name here: #include <stdio.h> #include <stdlib.h> #include <string.h> #include ...
C
#include "stdio.h" #include "common/problem_info.h" #include "common/prime.h" int main(){ info("Largest prime factor",3); unsigned long long int test_case=600851475143, divisor, factor; for(divisor=test_case; divisor > 0; divisor--){ if(test_case%divisor == 0){// check if divisor is a factor or not printf(" i...
C
#define ERROR -1 typedef bool MODE; int ledpin=13;//定义数字接口13 void setup() { // 设置的代码放这, 运行一次: pinMode(ledpin,OUTPUT); } const int Moers[36][5]={{0,1,3,3,3}, {1,0,0,0,3}, {1,0,1,0,3}, {1,0,0,3,3}, {0,3,3,3,3}, {0,0,1,0,3}, {1,1,0,3,3}, {0,0,0,0,3}, {0,0,3,3,3}, {0,1,1,1,3}, ...
C
#if !defined(TEMP) #define TEMP #include <stdint.h> #include "Arduino.h" #include "pins_arduino.h" #include <LiquidCrystal.h> #define TEMP_SENSOR_PIN A0 #define TEMP_HEATER_PIN 13 #define _MIN_POWER 0x0 // LOW #define _MAX_POWER 0x1 // HIGH #define MAX_TEMP_WATER 60.0 // *C #define MINUTO_MS 1000 // apenas pra t...
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <math.h> float stupidPower(double basis, int power) { int firstIterPower = basis; if (power < 0) { for (int i = 1; i < abs(power); i++) { basis = basis * firstIterPower; } return 1 / basis; } if (power == 0) { return 1; } else {...
C
/** * Linux Kernel Development * * Syscall Demo * 04 July 2012 */ #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/types.h> #include <asm/uaccess.h> #include <linux/proc_fs.h> #include <linux/sched.h> #include <linux/utsname.h> #define MODULE_VERS "1.0" #define MODULE_...
C
#include "netbuffer.h" #include "mailuser.h" #include "server.h" #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/utsname.h> #include <ctype.h> #define MAX_LINE_LENGTH 1024 static void handle_client(int fd); int main(int argc, char *argv[]) { if (argc != 2) { fprintf(stderr, "Invali...
C
/* * account.c * * Created on: 2016616 * Author: 04153009_ */ #include "Account.h" #include "EntityKey.h" #include "../Common/list.h" #include "../Persistence/Account_Persist.h" #include <string.h> #include <stdlib.h> extern account_t gl_CurUser; int Account_Srv_Logout(){ account_t data={0, USR_ANOMY, "An...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strsplit.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include "xrzlib\debug.h" #include "utils.h" #define SKIPSPACE(s) while(isspace(*s)) s++; void unescape_argv(int argc,char** argv) { int i; char* tmp; for(i=0;i<argc;i++) { tmp = unescape(argv[i],NULL); ...
C
////////////////////////////////////////////////////////////////////////////////////// // WEK TORY // //create, add, destroy, destroy_array, create_array, dot_product, length(dla tablic / wektorw). ////////////////////////////////////////////////////////////////////////////////////// #include "vector.h" #inc...
C
/******************** Lab : Network Lab Name : Abhinav Kumar Enroll no.: 510817075 Assignment : 02(Q.02) *********************/ #include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <sys/types.h> #include <sys/time.h> #include <time.h> #include <unistd.h> #include <netinet/in.h> int main() { tim...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> int num1, num2, f; //declareing the two input variables and the result variable int logicChoice; //declaring the selecting AND/OR variable char boollogic = 1; //declaring a boolean variable void main(void) { while (1) { //display user inst...
C
// test for global functions int a; void fun(int a, int *b, char c, float d); char **c; int f[10]; int main() { float c[5][6]; for(i=0;i<4;i++) { if(c[i]<c[i+1]) { printf("f is great"); } } c[0][1] = 45; while(i<5) { while(j<5) { c[i][j] = i+j; } } return 0; }
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <time.h> #define VISUAL_UNOPEN ('?') #define VISUAL_BOMB ('x') #define VISUAL_FLAG ('f') #define BOMB (-1) #define OPENED (10) #define SPACE (0) #define TRUE (1) #define FALSE (0) int g_col; int g_row; int g_max_bomb; int ...
C
#include <cstdlib> #include <iostream> using namespace std; int main(int argc, char const *argv[]) { int filas,columnas = 0; cout << "Ingrese la cantidad de filas \t -> \t "; cin >> filas; while(filas>5) { cout << "Ingrese un valor valido (Menor a 5)\n"; cout << "Ingrese la cantidad de filas \t -> \t "; ci...
C
#include<stdio.h> int main() { int n = 507; int *ptr; ptr = &n; *ptr = *ptr + 1; printf("%d\n", n); printf("%d\n", *ptr); return 0; }
C
#include <iostream.h> #include <fstream.h> #include "mpmod.H" extern "C" { #include <assert.h> #include <time.h> #include <stdlib.h> #include <stdio.h> #include <math.h> } extern void mppslq(const int, const double, const int, const int, mp_real*, int&, mp_real*); extern void initmp(const int,...
C
#include "libmx.h" void *mx_memrchr(const void *s, int c, size_t n) { const char *sstr = (const char *)s ; size_t len = mx_strlen(sstr); while(*sstr && n > 0) { if(sstr[len] == c) return (void *)&sstr[len]; len--; n--; } return NULL; }
C
#include <stdio.h> int main() { int start, pw1, pw2, pw3, sum, curr_no, add; while (fscanf(stdin, "%d %d %d %d", &start, &pw1, &pw2, &pw3)) { if (start==0 && pw1==0 && pw2==0 && pw3==0) break; curr_no = start; sum = 120; /* step 1 */ add = curr_no - pw1; add...
C
/* ** EPITECH PROJECT, 2020 ** init_maps.c ** File description: ** initialize maps */ #include "navy.h" maps_t init_maps(maps_t maps) { int i = 0; int j = 0; maps.p1_map = malloc(sizeof(char *) * 8); maps.visible_p1 = malloc(sizeof(char *) * 8); while (i < 8) { maps.p1_map[i] = malloc(siz...
C
# define _CRT_SECURE_NO_WARNINGS 1 # include <stdio.h> # include <stdlib.h> # include <string.h> int my_strlen1(char* str)//淽 { int count = 0; while (*str != '\0') { str++; count++; } return count; } int my_strlen2(char* str)//ݹ { if (*str == '\0') { return 0; } else return 1 + my_strlen2(str+1); } int...
C
#include <stdio.h> int main(){ int horasTrabalhadas = 0; float valorHoraAula = 0.0, percentualDesconto = 0.0; printf("Digite as horas trabalhdas: \n"); scanf("%d",&horasTrabalhadas); printf("Digite o valor da hora aula: \n"); scanf("%f",&valorHoraAula); printf("Digite o percentual de desco...
C
#include <stdio.h> int main(){ int porcentaje_correcto; char calificacion; char modificador; char line[100]; printf("Escriba el porcentaje correcto: "); fgets(line, sizeof(line), stdin); sscanf(line, "%d", &porcentaje_correcto); modificador = ''; if (porcentaje_correcto > 100) { printf("Error: fuera de ...
C
#define NULL (void *) 0 typedef struct { int x; int y; void * z; } st_t; st_t * st_alloc(int x, int y){ st_t * t = (st_t *) malloc(1 * sizeof(st_t)); if ( x > 0 && y > 0){ t -> x = x; t -> y = y; t -> z = NULL; } else { t -> x = 0; t -> y = 0; t -> z = (void *) malloc (100 * s...
C
#include<stdio.h> int main() { int n1,n2,sqr1=0,sqr2=0,rem1=0,rev1=0,rev2=0,rem2=0; scanf("%d",&n1); sqr1=n1*n1; while(n1!=0) { rem1=n1%10; rev1=(rev1*10)+rem1; n1/=10; } sqr2=rev1*rev1; while(sqr2!=0) { rem2=sqr2%10; rev2=(rev2*10)+rem2; sqr2/=10; } if(rev2==sqr1) printf("A...
C
/* * systick.c * * Created on: 4 mai 2016 * Author: Nirgal */ #include "systick.h" #include "stm32f4xx_hal.h" #define MAX_CALLBACK_FUNCTION_NB 16 //Tableau de pointeurs sur fonctions qui doivent tre appeles priodiquement (1ms) par l'IT systick. static callback_fun_t callback_functions[MAX_CALLBACK_FUNCTI...
C
#ifndef MONTY_H #define MONTY_H #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <unistd.h> /** * struct stack_s - doubly linked list representation of a stack (or queue) * @n: integer * @prev: points to the previous element of the stack (or queue) * @next: points to the next...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <mpi.h> #define TOPOLOGY_TAG 1 #define SOBEL_TAG 2 #define MEAN_TAG 3 #define TERMINATION_TAG 4 typedef struct { int rank; int parent; int *children; int children_count; }Process; typedef struct { int max_value; int width; ...
C
#include <stdio.h> #include <stdlib.h> int main() { int numeroUno; int numeroDos; int resultado; char operacion; printf("Seleccione la operacion : suma (+), resta (-), multiplicacion (*), division (/): \n"); scanf("%c",&operacion); printf("Ingrese los números a operar\n"); scanf("%d", ...
C
/* Chapter A9 Example 2 */ #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int i; char i_str[3], sentence[20]; FILE *outfile; outfile = fopen("X:\\Output.txt", "w"); for(i = 1; i <= 10; ++i){ strcpy(sentence, "This is line no. "); itoa(i, i_str, 10); ...
C
#include<stdio.h> int main() { double sum = 0; int a = 1; for (int i = 1; i <= 100; i++){ sum = sum + a*(1.0 / i); a = -a; } printf("Ϊ%f\n", sum); }
C
// A simple library for creating a native launcher for a java app // // Copyright (c) 2006 Antti Karanta (Antti dot Karanta (at) hornankuusi dot fi) // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in // compliance with the License. You may obtain a copy of the ...
C
#include <stdint.h> #include "uart.h" static volatile uint8_t *uart; void uart_init() { uart = (uint8_t *)(void *)NS16550A_UART0_CTRL_ADDR; uint32_t uart_freq = UART0_CLOCK_FREQ; uint32_t baud_rate = UART0_BAUD_RATE; uint32_t divisor = uart_freq / (16 * baud_rate); uart[UART_LCR] = UART_LCR_DLAB;...
C
#include <malloc.h> #include <stdlib.h> #include <stdio.h> #include "OptimizedFibonacci.h" static ull_t *s_fibonacciArray = NULL; static size_t s_fibonacciArraySize = 0; ull_t Fibonacci(size_t n) { if (!s_fibonacciArray) { InitFibonacci(); } if (s_fibonacciArraySize <= n) { size_t...
C
#include <cv.h> #include <highgui.h> int main(int argc, char **argv) { CvCapture* cap = 0; IplImage* frame = 0; // (1)open the default camera cap = cvCaptureFromCAM(0); /** == cap = cvCreateCameraCapture(0); **/ cvNamedWindow("capture", CV_WINDOW_AUTOSIZE ); while(1) { // (2)get a new frame from ca...
C
/** * @file strtab.c * @brief 񒆂̋󔒃^uϊs * * @author kj<NBB00541@nifty.com> * @date 2001`2004-01 */ #include <stdlib.h> #include <string.h> #include "cmisc.h" #ifdef __cplusplus using namespace std; #endif #ifdef __cplusplus // c++̂Ƃ́Al[Xy[XCMISC ɕ荞 namespace CMISC { #endif // -----------------------...
C
#include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #include <signal.h> #include <fcntl.h> #include <errno.h> #include <string.h> #include <limits.h> #include <math.h> #include <time.h> int readVal(int idx, int pipe1[], int pipe2[]) { int store = ...
C
#include<stdio.h> #include<stdlib.h> #include"Member.h" #include"BinTree.h" static BinNode *AllocBinNode(void) { return malloc(1 * sizeof(BinNode)); } static void SetBinNode(BinNode *n, const Member *x, const BinNode *left, const Member *right) { n->data = *x; n->left = left; n->right = right; } BinNode *Sea...
C
#include <stdio.h> int main(){ int n,i,j,count=0; printf("Enter the amount of numbers : "); scanf("%d",&n); int array[n]; int max,temp; printf("Enter numbers:\n"); for(i=0;i<n;i++){ scanf("%d",&array[i]); } for(i=0;i<n;i++){ for(j=0;j<n;j++){ if(array[i]>a...
C
#include <stdio.h> #include <assert.h> #include <stdlib.h> #include <stdbool.h> #include "priority_queue.h" #include "graph.h" #include "heap.h" priority_queue_t priority_queue_empty(unsigned int max_size) { priority_queue_t pq = heap_empty(max_size); return (pq); } priority_queue_t priority_queue_destroy(...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "schedule.h" #include "linkedList.h" /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int argc, char *argv[]) { int exit_flag = 0; FILE *fp; char name[200]; char place[100], typeNam...
C
#include <stdio.h> #include <errno.h> #include <stdlib.h> #include <string.h> int main(void) { char *end; printf("\" 999999999999999999999999999999999999999999999\" em decimal --> %ld - ", strtol(" 999999999999999999999999999999999999999999999", &end, 10)); printf("Erro: %s\n", strerror(errno)); printf("...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #define DEBUG 1 #define DEL_CHAR '\1' #define DEL_EOD '\2' char* canonicalize(const char *pathname, char *buf) { if (DEBUG) fprintf(stderr, "canon: %s\n", pathname); if (buf == NULL) { buf = strdup(pathname); } else { strcpy(buf, pathn...
C
#include <stdio.h> #include <stdlib.h> /* Tipo Tamanho Intervalo --------------------------------- char 8 -128 a 127 int 16 -32768 a 32767 float 32 3,4E-38 a 3.4E+38 double 64 1,7E-308 a 1,7E+308 void 0 sem valor */ int main(int argc, char *argv[]) { int numero01 = 15; ...
C
/* Условие задачи Вывести числовую пирамидку на total строк. Порядок строк – обратный. В каждой строке числа идут от единицы до номера строки через пробел. Пример ввода 3 Пример вывода 1 2 3 1 2 1 */ #include <stdio.h> int main() { int total; scanf("%d", &total); for ( int row = total; row > 0; row-...
C
#include "../include/libft.h" int ft_atoi(const char *nptr) { if (!nptr) return ~0; char *ptr = (char *)nptr; while (ft_isspace(*ptr)) ptr++; char sign = 0; if (*ptr == '-') { sign = 1; ptr++; } int n = 0; while (ft_isdigit(*ptr)) { n = 10 * n + (int)(*ptr - '0'); ptr++; } return (sign ? -n : n); }
C
/* * C Program to Find Area of Parallelogram */ #include <stdio.h> int main() { float base, altitude; float area; printf("Enter base and altitude of the given Parallelogram: \n "); scanf("%f%f", &base, &altitude); area = base * altitude; printf("Area of Parallelogram is: %.3f\n", area); ...
C
#include "ft_printf.h" #include <stdio.h> #include <unistd.h> int ft_printf(const char *format, ...) { t_printf env; ft_init_flags(&env); va_start(env.args, format); ft_parse_format(format, &env); va_end(env.args); return(env.nombretotal); } void ft_init_struct(t_printf *env) { env->nombretotal = 0; } void ...
C
#include <stdio.h> /* Inicio del main */ int main(){ int a = 1; int b = 2; int c = 3; int d = 4; printf("1234\n"); printf("%d%d%d%d\n", a, b, c, d); printf("1"); printf("2"); printf("3"); printf("4"); return 0; } /* main */
C
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> //Header file inclusion #define MAX_NAME 30 //Macro definition typedef struct database { char name[MAX_NAME]; long int rollNo; char year[2]; int div; char dept[4]; long int mob; }database;// structure to hold contents of database void...
C
#include "transport_tcp.h" static const char *TAG = "tcp"; typedef struct test_t { uint8_t a; uint32_t b; uint16_t c; } test_t; int main() { init(); const char *server_ip = "192.168.0.201"; Transport_t *tcp = transport_tcp(); tcp_set_server(tcp, server_ip, 2222); int res = tcp->connect(tcp); if (r...