language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <stdbool.h> #include <string.h> char* sub_exp(char * expression, int i); int fork_num(char* temp_str); int parse_and_calc(char * expression); int fork_expr(char* subexpr); int find_operands(char * expression); char* sub_exp(char * express...
C
/* Given a string, find the first non-repeating character in it and return it's * index. If it doesn't exist, return -1. * * Examples: * * s = "leetcode" * return 0. * * s = "loveleetcode", * return 2. * * Note: You may assume the string contain only lowercase letters. * **/ int firstUniqChar(char* s)...
C
#include <stdio.h> #include <math.h> int main(void) { int Chomem = 0, Cmulher = 0, i, mani = 0; float salario, sh = 0, maior = 0, total = 0; char sexo[1], mc[1]; for(i = 0; i < 10; i++){ scanf("%f\n%c", &salario, &sexo[0]); total += salario; switch(sexo[0]){ case 'm': Chomem++; sh +=...
C
/* ** EPITECH PROJECT, 2021 ** my_defender ** File description: ** handle_events */ #include "defender.h" void handle_game_event(all_t *all) { sfEvent event; sfVector2i mvector = sfMouse_getPositionRenderWindow(all->window); if (all->game->once == true) { all->game[3].tower = malloc(sizeof(game_o...
C
#include "Graph.h" #include <malloc.h> #include <string.h> #include <stdio.h> Edge *New_Edge(Vertex ep1, Vertex ep2, int weight) { Edge *edge = 0; edge = (Edge *)malloc(sizeof(Edge)); edge->ep1 = ep1; edge->ep2 = ep2; edge->weight = weight; return edge; } Vertex Edge_AnOther(Edge *edge, Vertex pt) { if (strcmp(e...
C
#include <stdio.h> struct person { char *name; int age; char *work; void (*printf_info)(struct person *per); //函数指针 }; void printf_info(struct person *per) { printf("name = %6s, age = %2d, work = %s\n", per->name, per->age, per->work); } int main(int argc, char **argv) { struct person p...
C
/*Աʵ*/ #include "JosephRing.h" JosephRing* createRing(){ JosephRing* pList; pList = (JosephRing*)malloc(sizeof(JosephRing)); init(pList); return pList; } //ʼΪ0 void init(JosephRing* pList){ pList->head = NULL; pList->len = 0; } //һڵ Node* createNode(int number){ Node *p = (Node*)malloc(sizeof(Node)); p->valu...
C
#include <stdlib.h> #include <stdio.h> void quicksort(int arr[], int start , int end); int partition(int arr[], int start , int end); int partition(int arr[], int start , int end) { int pivot = arr[end]; int i =0; int temp =0 ; int pindex = start; for(i = start ; i < end ; i++) { i...
C
#include "tim5.h" void timer5_init() { init_pa2_timer(); // Enable TIM5 in the APB1 clock enable register 1 RCC->APB1ENR1 |= RCC_APB1ENR1_TIM5EN; TIM5->PSC = 80; // Set prescaler value for TIM5 TIM5->EGR |= TIM_EGR_UG; // Trigger an update event for timer 5 TIM5->CCER &= ~(TIM_CCER_CC3E); // Disable ...
C
/** A gpio library for easier usage of GPIO ports Refreshed in F4 by Rex Cheng */ #include "gpio.h" const GPIO /*** GPIOA ***/ PA0 = {GPIOA, GPIO_Pin_0}, PA1 = {GPIOA, GPIO_Pin_1}, PA2 = {GPIOA, GPIO_Pin_2}, PA3 = {GPIOA, GPIO_Pin_3}, PA4 = {GPIOA, GPIO_Pin_4}, PA5 = {GPIOA, GPIO_Pin_5}, P...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <conio.h> #include <ctype.h> #include "inputs.h" #include "Referi.h" //0-MENU void mostrarMenuR() { printf("-----Elija una opcion-----\n\n"); printf("1-Dar de alta\n"); printf("2-Dar de baja\n"); printf("3-Modificar\n"); printf("4...
C
/* * A wrapper around printf. Not thread-safe due to the global variable * DEBUG. */ #include <stdio.h> #include <stdarg.h> #include <stdbool.h> bool DEBUG = false; void debug_enable(bool enable) { DEBUG = enable; } int debug_printf(char *format, ...) { if (!DEBUG) { return 0; } va_l...
C
#include <unistd.h> #include <stdio.h> #include <string.h> /* Given a filename, retrieve its extension (everything after the last '.') */ char* get_extension(char* str) { char* file = strrchr(str, '/'); if (!file) file = str; else file += 1; char* ext = strrchr(file, '.'); if (!ext)...
C
#include <foo.h> #include <stdio.h> int main (int argc, char * argv[]) { int value = power_level (); if (value < 9000) { printf ("Power level is %i\n", value); return 1; } printf ("IT'S OVER 9000!!!\n"); return 0; }
C
#include <stdio.h> #include <math.h> int main() { int n,i; float x[1000], total=0, rata, rata_2=0, sd; printf ("jumlah data (maksimum 1000 buah) : "); scanf("%d",&n); printf("\n"); for (i=0;i<n;i++){ printf("nilai data ke %d ? ",i+1); scanf("%f", &x[i]); total = total + x[i]; } rata...
C
/* * Leonardo Wistuba de França <leonardowistuba@gmail.com> */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "quickSort.h" /* * O Quicksort é o algoritmo mais eficiente para uma grande variedade de situações. * Entretanto, é um método bastante frágil no sentido de que qualquer erro de implem...
C
#include<stdio.h> #include<string.h> int find(char str[100][100],char st[50],int lr); int find(char str[100][100],char st[50],int lr) { char sup[50]; int flag=0; for(int i=0;i<lr;i++) { for(int j=0;j<strlen(st);j++) sup[j]=str[i][j]; if(strcmp(st,sup)==0) { ...
C
/*************************************************************************** * Manipulando Imagens TIFF (Tag Image File Format) * autoras: Lissa Pesci * Miriam Yumi Peixoto * compile: gcc -o ex_imagem ex_imagem.c imagem.c -lm -ltiff *************************************************************************...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include "ssu_employee.h" int main(int argc, char *argv[]) { struct ssu_employee record; int fd; //shell에서 파일을 입력받음 if(argc < 2) { fprintf(stderr, "usage : %s file\n", argv[0]); exit(1); } //쓰기 전용 모드로 파일을 open //파일이 없을 ...
C
/* Check whether the tree is complete or not For this, check if a tree has either 0 or 2 nodes. If a tree has one child for any of the nodes, then the tree is not complete! */ #include <stdio.h> #include <stdlib.h> struct node { int data; struct node *left, *right; }; struct node * createNode(int data) { struct ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* asm_helper_2.c :+: :+: :+: ...
C
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. #include "runtime.h" #include "stack.h" enum { maxround = sizeof(uintptr), }; uint32 runtime·panicking; void (*runtime·destroylock)(Lock*); /* * We assume ...
C
#ifndef SQL_H #define SQL_H #define CREA_JUGADORES "CREATE TABLE jugadores ("\ "nombre VARCHAR(12) NOT NULL,"\ "passwd VARCHAR(12) NOT NULL,"\ "email VARCHAR(150) NOT NULL,"\ "codreg CHAR(13) NOT NULL,"\ "estado INT NOT NULL DEFAULT 0,"\ "INDEX login (nombre, passwd),"\ "CONSTRAINT pk_nombre_ju...
C
#ifndef KRR_util_h_ #define KRR_util_h_ #include <SDL2/SDL_rwops.h> #ifdef __cplusplus extern "C" { #endif /// /// Print callstack up to this point of calling this function. /// Stack size is 32. /// /// Only supported on Linux, Unix, and macOS. It will be no-op for Windows and other platforms. /// extern void KRR_u...
C
#include <stdio.h> void add(char*, char*); void add1(char*, char*); void add2(char*,char*); int main(int argc, char *argv[]) { char inp1[20], inp2[20]; printf("\nEnter the 1st number :"); scanf("%s", inp1); printf("\nEnter the 2nd number :"); scanf("%s", inp2); printf("\n"); add2(inp1, inp2); } void add2(char in...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <windows.h> int main(int argc, char const *argv[]) { clock_t t_start, t_end; t_start = clock(); int second = 0, minite = 0; while (1) { int s, m; t_end = clock(); s = (t_end - t_start) / CLOCKS_PER_SEC; m ...
C
#include"stack.h" void greate_memory(int **p) { *p= malloc(SIZE*sizeof(int)); if(NULL==*p) { printf("sorry malloc fail\n"); exit -1; } } void init_stack(pStack pS) { greate_memory(&pS->bottom); pS->top=0; } int push(pStack ps,int mod) { if(ps->top==50) { printf("FULL\n"); return FULL;...
C
#include<stdio.h> #include<string.h> #include<stdlib.h> struct linkedlist *initialize(); void add(struct linkedlist* list, int value); void print_list(struct linkedlist *list); struct node{ int data; struct node *next; }; struct linkedlist{ int size; struct node *head; }; struct linkedlist *initiali...
C
#include<stdio.h> int sum(int num); int main(int argc, char const *argv[]) { int n, result; printf("Enter range of how many natural number sum you want"); scanf("%d",&n); result=sum(n); printf("sum=%d",result); return 0; } int sum(int n) { if(n!=0) return (n+ sum(n-1)); ...
C
#include <stdio.h> #include <stdlib.h> #include "LinkedList.h" #include "Controller.h" #include "Employee.h" #include "menu.h" /**************************************************** Menu: 1. Cargar los datos de los empleados desde el archivo data.csv (modo texto). 2. Cargar los datos de los empleados desd...
C
#include "statistic_descriptive.h" // Variation /* * Variation = xi - Av * */ void variation (double *vector_data, double *vector_freq, double *vector_variation, int lenght) { // Require average_ari_pond int i; // For Loop Variable double Av; // Average Of Vector_Data's Elements Av = average_ari_pond (vector...
C
/* * 合并两个有序的数组,使之成位一个有序的数组 */ #include <stdio.h> void merge_array(int *a, size_t a_len, int *b, size_t b_len, int *c) { while ((a_len != 0) && (b_len != 0)) { if (*a < *b) { *c++ = *a++; a_len--; } else { *c++ = *b++; b_len--; } if (a_len == 0 && b_len != 0) { while (b_len) { ...
C
#include <stdio.h> int main(void){ int a,i,b=1; scanf("%d",&a); for(i=1;i<=a;i++){ b*=i; } printf("%d ",b); return 0; }
C
#include <time.h> #include <stdio.h> int main() { clock_t t1, t2; t1 = clock(); int i; for(i=0; i<1000000; i++) printf(""); t2 = clock(); double f = (double)(t2 - t1); printf("%lf\n", f); return 0; }
C
/* * ڰ 2014 ܿб * Ǵ 2009190021 UIC а * * 2015 1 3 Ͽ Visual Studio 2010 ۼϿϴ. * α׷ ΰ : X, Y (Y 0 ƴ) a, s, m, d ϳ ڸ argument * double · ݴϴ. * ڰ a Է X + Y , * ڰ s Է X - Y , * ڰ m Է X * Y , * ڰ d Է X / Y ְ ˴ϴ. * * Է ÿ ޼ Բ α׷ ˴ϴ. * X, Y ƴ Է‰ ޼ α׷ ˴ϴ. */ #include <stdio.h> // ...
C
#include<stdio.h> #define SIZE 50 void string(char str[]); int sum_number(int a, int b); int ymnozh(int k,int l); int cube(int x); int main() { int res_sum,a,b; int res_ymnozh; int k; int l; int cu; int x; printf("You can add two numbers and our function will count sum value\n"); scanf("%d%d", &a, &b); char ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <unistd.h> #include <netdb.h> // for getnameinfo() // Usual socket headers #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include "response.h" #include "request.h" ...
C
/** * @file * @brief servo/motor information */ #ifndef __SERVOS_H__ #define __SERVOS_H__ /** * @brief choose whether to use fuzzy logic or use hardset values */ #define MOTORCTRL_FUZZY /** * @brief defines the largest value a motor can have * * This is the maximum value that a motor can get, * i.e. forward*...
C
/* 1. Prompt by using CS50 library fx: get_int() 2. Validate that User Input is bw 0-23 by using a do-while loop 3. Draw the half pyramid.*/ #include <cs50.h> #include <stdio.h> int main(void) { int h = 0; do { printf("Height (1-23): "); h = get_int(); if (h == 0) ...
C
#include "../../Permutation/ascon.h" #include "../../kat.h" #include "../crypto_aead.h" #define RATE (64 / 8) #define PA_ROUNDS 12 #define PB_ROUNDS 6 #define IV \ ((u64)(8 * (CRYPTO_KEYBYTES)) << 56 | (u64)(8 * (RATE)) << 48 | \ (...
C
/* \file classic_mode.c \brief This source file contains the implementation for the frequency guessing game. \authors: César Villarreal Hernández, ie707560 Luís Fernando Rodríguez Gutiérrez, ie705694 \date 03/05/2019 */ #include "classic_mode.h" static uint8_t buffer_sequence[BUFFER_SIZE]; stat...
C
#include <stdio.h> //Biblioteca de tratamento de entrada/sada. #include <stdlib.h> //Biblioteca de implementao de Funes para diversas operaes. #include <locale.h> //Biblioteca que especifica constantes de acordo com a localizao especfica, como moeda, data, etc. int main()//Incio da funo int main (). { setlocale(LC_...
C
/* * Here are all the Data Structures needed in the project * @author : Ebrahim Gomaa (HmanA6399) */ #pragma once #include <stdio.h> #include <stdlib.h> #include <string.h> #include <limits.h> #include "safeExit.h" /** * Enumerating process state */ typedef enum pstate { RUNNING, STOPPED, FINISHED, ...
C
#include <msp430.h> //By Bryan Regn //Last updated 10/7/17 /** * main.c */ int main(void) { WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer //needed when using msp430 processors used to reset device to previous state unsigned int i=0; P1SEL = 0x00; //sets P1 to GPIO P4SEL = 0x00; //sets P4 to GPI...
C
#include <stdio.h> #define NUM 5 char cData[NUM] = {0x11, 0x22, 0x33, 0x44 ,0x55}; short sData[NUM] = {0x1111, 0x2222, 0x3333, 0x4444, 0x5555}; long lData[NUM] = {0x11111111, 0x22222222, 0x33333333, 0x44444444, 0x55555555}; int main(void) { char *pc; short *sc; long *lc; pc = cData; sc = sData; lc = l...
C
#include <stdio.h> #include <string.h> #include "MEM.h" #include "DBG.h" #include "diksamc.h" static DKC_Compiler *st_current_compiler; DKC_Compiler * dkc_get_current_compiler(void) { return st_current_compiler; } void dkc_set_current_compiler(DKC_Compiler *compiler) { st_current_compiler = compiler; } void...
C
#include<stdio.h> int main() { int ara[100]; int i,j,n,max,min; printf("Enter the element number of array : "); scanf("%d", &n); printf("\nEnter the elements :\n"); for(i=0; i<n; i++) scanf("%d", &ara[i]); for(i=0; i<n-1; i++) { if(ara[i]>ara[i+1]) { ...
C
#include<stdio.h> #include "conio.h" void mergesort(int x[],int y[],int m,int n); void accept(int x[],int n); void print(int x[],int n); main() { int m,n,a[10],i,b[10],k,c[20]; clrscr(); printf("\nHow many numbers in first array :"); scanf("%d",&m); accept(a,m); print(a,m); printf("\nHow many numbers in second...
C
#include "mach0.h" int main(int argc, char **argv) { if (argc != 2){ printf("Usage: %s <n_iterations>\n", argv[0]); } int n = atoi(argv[1]); double result = mach0(n); printf("Result: %.17f\n", result); }
C
#include "stdio.h" #include "stdlib.h" #include "string.h" #include "time.h" int main() { clock_t start, finish; start = clock(); char *p = (char *)malloc(sizeof(char)*10); char *q; int i = 0; strcpy(p,"hello"); for(; i<100000; i++) { q = (char *)malloc(sizeof(char)*4096); ...
C
/*--@̺--*/ /*--2017/12/25--*/ /*--ң۰--*/ #include<stdio.h> #include<stdlib.h> #define MAXSIZE 100 typedef int KeyType; typedef int FieldType; /*--źԱ--*/ typedef struct Record { KeyType key; FieldType others; }Record; Record* Create_Array(Record *array) { int i; array = (Record*)malloc(MAXSIZE*sizeof(Record));...
C
#include <stdio.h> int main() { printf("hello, world\n"); printf("carriage return demo\n"); printf("Beethoven is my favorite composer\rMozart\n"); printf("Multiple\nlines\nwith\ncarriage\nreturn\n\r\r\r\r1\n2\n3\n4\n"); printf("%d", gety()) }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "netlist.h" #include "entree_sortie.h" int main(int argc, char** argv){ Netlist* n = NULL; char s1[100]; char s2[15] = ".balayAVL.int"; if ( argc != 2) { printf ( "Erreur format: %s <NomFichier>\n", argv[0]); return 1; } print...
C
#pragma once //Enum specifying the kind of title a card has. enum CardTitleType { //The normal title position NormalTitle = 1, //The card is split an as such has the titles on the side. SplitCardTitle = 2, //The card is an Amonkhet split card, with one title in the regular place and one title in a split card h...
C
#include "trie.h" #include "code.h" #include <stdio.h> #include <stdlib.h> // Constructor for a TrieNode ADT // TrieNode *trie_node_create(uint16_t code) { TrieNode *n = malloc(sizeof(TrieNode)); if (!n) { return NULL; } n->code = code; for (int sym = 0; sym < ALPHABET; sym++) { ...
C
//calculates a broker's commission #include <stdio.h> #include <stdlib.h> #include <conio.h> int main() {float commission,value; printf("enter value of trade\n"); scanf("%f",&value); if (value<2500.00f) commission=30.00f+(value*.017f); else if (value<6250.00f) commission=56+(value*.0...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include "carta.h" #include "cartas.h" #include "jugador.h" #include "jugadores.h" #include "jugada.h" #include "jugadas.h" #include "partida.h" #include "preguntas.h" #include "colores.h" /* *conf==TRUE-->Muestra la carta c. *conf==FALSE-->Muestra |UNO|. */ void...
C
#include <stdio.h> int main() { int data[68][5]={0}; int n,i,j,s,d,da; while(1) { printf("Enter 1 to insert sales figure\nEnter 2 to update sales figure\nEnter 3 to delete sales figure\nEnter 4 to display the data base\nEnter 5 to Close Programme\n"); scanf("%d",&n); if(n==1||n==2) { if(n==1) print...
C
// // problem32.c // LeetCode // // Created by apoptoxin on 2018/8/5. // Copyright © 2018年 micronil.com. All rights reserved. // #include "problem32.h" #include "bool_define.h" int longestValidParentheses(char* s) { int length = strlen(s); int total = 0; int *a = malloc(sizeof(int) * length); //用a...
C
/** @file */ /** * \file * \brief API of the libparanut. */ /** * \mainpage libparanut Documentation * * \section ParaNut Software Library Documentation * Welcome to the libparanut documentation! This is a hardware abstraction * library you can use to program a ParaNut processor without ha...
C
#include <stdio.h> // global var int g; int scopeDemo() { // local var int a, b; a = 10; b = 20; g = a + b; // int g = 50; if local var and global var has a same name, local var is preferred printf("Value of a = %d, b = %d and g = %d\n", a, b, g); return 0; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* precision_width.c :+: :+: :+: ...
C
#include <stdio.h> int sumArray(int * array, int size) { int sum = 0; int i; for(i=0;i<size;i++) { sum += *(array+i); } return sum; } void block(int n, char a, char b) { char current = a; int height; int row; for(height = 0; height<n;height++) { for(row=0;row<n;row++) { printf("%c",current); ...
C
#include <stdio.h> #include <fcntl.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/ioctl.h> #include <sys/sysmacros.h> #define KEYPAD_MAJOR_NUMBER 505 #define KEYPAD_MINOR_NUMBER 105 #define KEYPAD_DEV_PATH_NAME "/dev/keypad_dev" int output0 =-1; int output1 =-1; int outp...
C
#include <complex.h> #include <stdio.h> int main(void){ double complex z = 0.5 + 0.5I; double complex w = 0.5 - 0.5I; double complex s = z + w; double complex p = z * w; double complex q = z / w; fprintf(stderr, " z = %f + %fi\n", creal(z), cimag(z)); fprintf(stderr, "|z| = %f\n", cabs(z...
C
#include <iostream> using namespace std; int main(){ float aloha[10], coisas[10][5], *pf, value = 2.2; int i=3; aloha[2] = value; scanf("%f", &aloha); aloha = "value"; // Erro de tipo, enquanto aloha é um número flutuante "value" é uma string do tipo char. printf("%f", aloha)...
C
#include <avr/io.h> #include <avr/interrupt.h> //256 count = 64 us >> 4 count for each us so we need 4*13 = 52 for 13us // global variable to count the number of overflows volatile uint8_t tot_overflow; // initialize timer, interrupt and variable void timer0_init() { // set up timer with prescaler = 1...
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <string.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <sys/types.h> #include <arpa/inet.h> #include <unistd.h> #define BUFSIZE 1024 int main(int argc, char* argv[]){ fd_set fds; int i; ...
C
#include <stdio.h> #include <unistd.h> int my_strlen2(char const *str) { int len = 0; while((*str++)) { len++; } return len; } int my_compute_power_rec(int nb, int p) { int res; if (p==0) res = 1; if (p < 0) res = 0; if (p > 0) { res = my_compute_power_rec(nb,p-1)*nb; } return res; } int my_put...
C
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include <math.h> #include <time.h> #include "spn.h" const unsigned int crackKey = 0x3a94d63f; typedef struct { char x[sNum], y[sNum]; int keyNum; int pairNum; double bias; spn_Text in; }chain; char approxTable[16][16]; char bitXor(char nu...
C
#include "stdc.h" void *memset(void *str, int c, size_t n){ unsigned char* buffer = (unsigned char *) str; for (size_t i = 0; i < n; i++){ buffer[i] = c; } return buffer; }
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> int main() { char *arg_list[] = { /* ~{ѼƦC (tXr v) */ "ls", /* argv[0] Y{W */ "-l", "/tmp", NULL }; /* H NULL */ execvp("ls", arg_list); /* b PATH |M~{ */ printf("The end of ...
C
/* This program removes wtmp entries by name or tty number */ #include <utmp.h> #include <stdio.h> #include <sys/file.h> #include <sys/fcntl.h> #define WTMP_PATH "/var/log/wtmp" void usage(name) char *name; { printf("Usage: %s [ user | tty ]\n", name); exit(1); } void main (argc, argv) int argc; char *argv[]; {...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.c :+: :+: :+: ...
C
/* * prob7.c -- Problem 7 of column 9 */ #include <stdio.h> #include <stdlib.h> #include <time.h> #include <assert.h> int bits(unsigned char byte) { int count = 0; while (byte) { ++count; byte &= byte-1; } return count; } int countbits(const unsigned char *p, int n) { static i...
C
//waitpid函数的使用 #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> int main(void) { //创建2个子进程 pid_t pid = fork(); if(-1 == pid) { perror("fork"),exit(-1); } pid_t pid2; if(0 != pid)//父进程 { pid2 = fork(); } if(0 == pid) //子进程1 { printf("子进程一开始运行,PID =...
C
/* LMINIM.C - Calculate the minimum intensity for an input image. Author: Mike Wall Date: 9/14/2017 Version: 1. */ #include<mwmask.h> int lminim(DIFFIMAGE *imdiff) { size_t r, c, n=0, index = 0; IMAGE_DATA_TYPE minval; struct rccoords rvec; minval = imdiff->ignore_tag; fo...
C
typedef struct node_st { int external; struct node_st *bparent; int rank; int weight; //external nodes only //wt(v) = size(v) if no solid edge enters v (ergo, bparent(v) == null) // size(v) - size(w) if the solid edge (w,v) enters v //internal nodes only //prolly should be in a separate structure but I'm so l...
C
#include <stdio.h> #include <stdlib.h> #include <windows.h> FILE *file; typedef struct tower_seg { int size; struct tower_seg *seg_under; }Tower; Tower* create_tower(int seg_amount) { Tower *hanoi_first,*hanoi_last; hanoi_first=(Tower*)malloc(sizeof(Tower)); int i=1; ...
C
#include "Notify.h" void notify(char* PATH_CONFIG) { int length; int i = 0; char buffer[BUF_LEN]; int fileToWatch = inotify_init(); if( fileToWatch < 0) { logError("[NOTIFY/MEMORIA]: Error al iniciar el notifier."); return; } int watchDescriptor = inotify_add_watch(fileToWatch, PATH_CONFIG, IN_CREATE | I...
C
/* * dv_ext_irq.c * * Created: 11/14/2019 11:25:45 AM * Author: liu */ #include <asf.h> #include "dv_ext_irq.h" /** * \brief De-assert start pin when shutdown pin is asserted */ static void handler_shdn(long unsigned int unused0, long unsigned int unused1) { /* Disable front-end DC-DC converter on PoEM boa...
C
#include"list.h" int main() { char** head_node = NULL; StringListInit(&head_node, "First"); StringListPrint(head_node); StringListInit(&head_node, "Second"); StringListAdd(head_node, "hello"); StringListAdd(head_node, "hello2"); StringListAdd(head_node, "hello"); StringListAdd(head_node, "wo...
C
#include <cstdio> #include <cstdlib> typedef int val_t; typedef val_t * val_array; typedef int index_t; typedef struct { val_array data; int size; int data_length; } heap_t; typedef heap_t * heap; heap build_max_heap (val_array A, int size); void max_heapify (heap h, index_t i); void destroy_heap (heap h); val...
C
#include <sys/types.h> #include <sys/event.h> #include <sys/time.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include "mruby.h" #include "mruby/compile.h" #include "mruby/string.h" // gcc `mruby/bin/mruby-config --cflags --ldflags --libs --ldflags-before-libs` watchFile.c // // File.dirname(File.rea...
C
#include<GL/gl.h> #include<GL/glut.h> #define width 640 #define height 480 // Fixing the height and width of the screen. #include<stdio.h> #include<math.h> const char* ch; // Input arguments are saved in this character pointer. float xi,xf,yi...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> int main() { int integer = 0, i = 0, intchange = 0, ii = 0, k = 0; int j = 1, sum = 0, rem = 0, sign = -1; int remm = 0, summ = 0; printf("Enter an integer >= 0: "); while(scanf("%d", &integer) != EOF) { //****** Upper ...
C
#include <stdio.h> #include <stdlib.h> #include <assert.h> //ַѹ //磺"xxxyyyyz"ѹַΪ"3x4yz" //"yyyyyyy"ѹΪ"7y" //һŻ //ʱֻ1-99 void CutStringP(char* str){ assert(str); char* p1 = str; char* p2 = str; while (*p2){ int count = 1; if (*p2 == *(p2 + 1)){ while (*p2 == *(p2 + 1)){ count++; p2++; } if (cou...
C
/* * The MIT License (MIT) * * Copyright (c) 2015 Wang Jian * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, co...
C
#include <stdio.h> int main() { int A[10]; int B[10]; int C[10]; printf("Preecha o vetor A[10].\n"); for (int i = 0; i < 10; i++) { printf("Digite o %d° valor: ", i + 1); scanf("%d", &A[i]); } printf("Preencha o vetor B[10].\n"); for (int j = 0; j < 10; j++) ...
C
#include<stdio.h> #include<string.h> #include"digit.c" #include"orerator.c" int main() { int i,j=0; char str[100],ch; printf("Enter the string to be test :"); scanf("%s" ,str); for(i=j;str[j]!='\0';i++) if(str[i]>='0'&& str[i]<='9') { j=digit(str,j);} else if(str[j]=='+'|| str[j]== '=') { j=operator(str,j); } else { p...
C
// // main.c // client // // Created by 고상원 on 2020/04/21. // Copyright © 2020 고상원. All rights reserved. // #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <arpa/inet.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/ioctl.h> #include <net/if.h> #define BUFF_S...
C
#include <stdio.h> #include <stdlib.h> #define N 5 /* !!!!!! Düğüm sayısı burada elle değiştirilmeli. !!!!!*/ int n,m; int cal[100],indis=0; struct Queue { int front, rear, size; unsigned capacity; int* array; }; struct Queue* createQueue(unsigned capacity) { struct Queue* queue = (struct Queue*) mallo...
C
#include "virtual_machine.h" #include "instructions_info.h" // 00 - HALT - Parada void halt(){ if(DEBUG_MODE) printf("HALT\n"); exit(0); } // 01 - LOAD R M - Carrega Registrador void load(int r, int m){ if(DEBUG_MODE) printf("LOAD %d %d\n", r, m); GENERAL_REGISTERS[r] = MEMORY[m + P...
C
#include "shoveler/component/tilemap_sprite.h" #include "shoveler/component/material.h" #include "shoveler/component/tilemap.h" #include "shoveler/component.h" #include "shoveler/sprite/tilemap.h" const char *const shovelerComponentTypeIdTilemapSprite = "tilemap_sprite"; static void *activateTilemapSpriteComponent(S...
C
#include <stdio.h> #include <stdlib.h> typedef struct locality{ float latitude; float longitude; float elevation; char* sitename; int siteID; } locality; union coord_point { float flt_x; int int_x; };//allows type flexibility, works similar to struct but cant simultaneously assign void re...
C
include <stdio.h> int main() { int Number, Sum = 0; printf("\n Please Enter any positive integer \n"); scanf(" %d",&Number); Sum = (Number * (Number + 1) * (2 * Number + 1 )) / 6; printf("\n The Sum of Series for %d = %d ",Number, Sum); }
C
//Referred various sites for socket programming and then came up with this code. #include <stdio.h> #include <string.h> #include <stdlib.h> #include <sys/socket.h> #include <sys/types.h> #include <arpa/inet.h> #include <netinet/in.h> #include <unistd.h> #include <pthread.h> #define LOOPS 100000 //Defining Thread St...
C
#include "t_token.h" #include "exec.h" #include <stdio.h> struct s_token_to_prompt g_token_to_prompt[] = { {TK_PIPE,"pipe"}, {TK_AND_IF,"cmdand"}, {TK_OR_IF,"cmdor"}, {TK_IF, "if"}, {TK_THEN,"then"}, {TK_ELSE,"else"}, {TK_ELIF,"elif"}, {TK_CASE,"case"}, {TK_WHILE,"while"}, {TK_UNTIL,"until"}, {TK_FOR,"for"}...
C
/*==============================================================================================================*/ /* Nom : lecture.c */ /* Auteur : Joseph CAILLET */ /* Desc : Lit des donnes depuis un fichier pour simuler la carte. */ /*==========================...
C
/* * \brief MTZ model with lazy constraints. * \authors Francesco Cazzaro, Marco Cieno */ #include <errno.h> #include <limits.h> #include <math.h> #include <stddef.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <time.h> #include <cplex.h> #include "tsp_solvers.h" #include "logging.h" #inc...