language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include "ruby_libxml.h" #include "ruby_xml_schema.h" /* * Document-class: LibXML::XML::Schema * * The XML::Schema class is used to prepare XML Schemas for validation of xml * documents. * * Schemas can be created from XML documents, strings or URIs using the * corresponding methods (new for URIs). * * Once...
C
#include "vx_resc.h" #include "vx_util.h" #include "vx_codes.h" #include <malloc.h> #include <assert.h> #include <string.h> #include "vx/math/matd.h" #define MAX_SHD_SZ 65355 // Free memory for this vr, and for the wrapped data: static void vx_resc_destroy_managed(vx_resc_t * r) { //printf("destroying resource %...
C
#include <stdio.h> #include <string.h> #define N 100 int map[100][100]; int dis[N], vis[N], p[N]; int m, n; void build() { int u, v, c; scanf("%d%d", &n, &m); memset(map, -1, sizeof(map)); while(m--) { scanf("%d%d%d", &u, &v, &c); map[u][v] = map[v][u] = c; } } i...
C
#include <json/json.h> #include <stdio.h> /* http://linuxprograms.wordpress.com/2010/05/24/json_object_object_foreach/ { "sitename": "joys of programming", "tags": ["c", "c++", "java", "PHP"], "author-details": { "name": "Joys of Programming", "Number of Posts": 10 } } -> string (sitena...
C
#include "thread_pool.h" #include <stdio.h> #include <pthread.h> #include <unistd.h> #include <stdlib.h> typedef struct taskqueue{ int head; int tail; threadpool_task_func_t *task_func; /* work func */ void **arg; }taskqueue_t; struct threadpool{ int max_thr_num; pthread_t *thread_id; /*如...
C
#include<stdio.h> int main( void ){ int i, j; printf( "Enter an integer : " ); scanf( "%3d%d", &i, &j ); printf( "%d %d", i, j ); return 0; }
C
void colorToNum(char option[], int* input, int* i, int* sel); // Codifica los colores en números char* numToNoun(int input); // Decodifica los números a sustantivos char* numToColor(int input); // Decodificar los números a colores void buscar(int matrix[3][8], int* input, int* output); // Busca coincidencias en la m...
C
#include <math.h> #include <stdio.h> void interp(double ***uf, double ***uc, int nf, int cubic) /* Coarse-to-fine prolongation by bilinear interpolation. nf is the fine-grid dimension. The coarsegrid solution is input as uc[1..nc][1..nc], where nc = nf/2 + 1. The fine-grid solution is returned in uf[1..nf][1..nf...
C
#include<stdio.h> main() { int loops, num1, num2, i, j, sum, q, arr1[30], arr2[30]; scanf("%d", &loops); while (loops != 0) { scanf("%d%d", &num1, &num2); sum = 0; for (i = 0; i < num1; i++) scanf("%d", &arr1[i]); for (i = 0; i < num1; i++) scanf("%d", &arr2[i]); for (i = 0; i < nu...
C
Offset appears to be off */ #include "apue.h" #include <fcntl.h> #include <errno.h> #include <sys/stat.h> #define NUMCOUNTRIES 239 typedef struct{ char code[3]; int offset; }indexC; indexC** countryIndex; //Prototypes void *GiveNode(int fd); int search(int numCountries, char* key); void UserInput(int numCo...
C
// 可以将输入的单词或者数字给保存到word中 int getword(char *word, int lim) { int c; char *w = word; // 跳过之前的空白字符 while (isspace(c = getch())) ; if (c != EOF) *w++ = c; if (!isalpha(c)) { *w = '\0'; return c; } for (; --lim > 0; w++) if (!isalnum(*w = getch())) { ungetch(*w); break; } *w = '\0'; return w...
C
#include <pal.h> #include <stdio.h> #include <string.h> #include <errno.h> #include "pal_base.h" #include "pal_base_private.h" /** * * Map device memory. Not all devices can implement this. * It is okay to return NULL. * * @param dev Device * @param address Device address * @param size Size * * ...
C
#ifndef _TIME_TEST_ #define _TIME_TEST_ #include <time.h> /* clock */ #include <sys/time.h> /* gettimeofday */ /* NOTICE! Change here to select the method you want */ #define USE_CLOCK 0 /* Using clock, calculate CPU time, cpu_time=user_time+sys_time */ clock_t _ct_start, _ct_end; #define TIME_START_CL() do { ...
C
/* \__\__\__\__\__\__\__\__\__\__\__\__\__\__\__\__\__\__\__\__\__\__\__ AO PREENCHER ESSE CABEÇALHO COM O MEU NOME E O MEU NÚMERO USP, DECLARO QUE SOU O ÚNICO AUTOR E RESPONSÁVEL POR ESSE PROGRAMA. TODAS AS PARTES ORIGINAIS DESSE EXERCÍCIO PROGRAMA (EP) FORAM DESENVOLVIDAS E IMPLEMENTADAS POR MIM SEGUIND...
C
#ifndef TableHeader #define TableHeader #include "Vector.h" #include "Common.h" /*Maximal size of the name column in a row*/ #define MAX_ROW_STR_SIZE 50 /*A row in the sGrowingTable*/ typedef struct sTableEntry { char rowName[MAX_ROW_STR_SIZE]; int rowAddress; } sTableEntry; struct sTableInternal { ...
C
#include<stdio.h> #include<string.h> int main() { int i, j, k, x;//Ƶѭı int n, len, count; char str[100000], temp[100000]; scanf("%s %d", str, &n); for(i = 1; i < n; i++) { x = 0; len = strlen(str); for(j = 0; j < len; j++) { //ÿĴ for(k = j, count = 0; k < len && str[k] == str[j]; k++) { ...
C
/* author:lzl date:2016-3-11 function:实现内存映射多线程大文件复制 */ #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/mman.h> #include <pthread.h> #include <errno.h> #include <string.h> #define BLOCKSIZE (1024*1024*2)//每个文件块大小2M //定义文件块结构信息,发...
C
#include <stdio.h> #include "traversals.h" void print_in_order(Node_ptr tree) { if (tree == NULL) return; print_in_order(tree->left); printf("%d ", tree->value); print_in_order(tree->right); } void print_pre_order(Node_ptr tree) { if (tree == NULL) return; printf("%d ", tree->value); print_pre_o...
C
typedef enum val_type { str, integer, dbl } val_type; typedef union value { char *str; int integer; double real; } value; struct configoption { char *name; val_type type; value val; }; typedef struct configoption configoption; struct configsection { char *name; unsigned int numop...
C
#include "stm32f4xx.h" #include "FreeRTOS.h" #include "task.h" #include <stdio.h> void helloTask1(void*); void helloTask2(void*); void setupUsart(); //#define USE_SEMIHOSTING #ifdef USE_SEMIHOSTING extern void initialise_monitor_handles(); #endif USE_SEMIHOSTING void sendMessage(char* msg); int...
C
/* * Escreva uma função para calcular e retornar a área de um círculo. * Esta função deverá receber o valor do raio como parâmetro e retornar o valor da área */ #include <stdio.h> #include <locale.h> #include <math.h> float calculaAreaCirculo(float tamanho); int main(void){ float raio, area; setlocale(...
C
/** File containing functions for best rational approximation to matrix exponential. * \file cf.c * * \author Kyle E. Niemeyer * \date 07/19/2012 * * Contains main and linear algebra functions. */ #include <stdlib.h> #include <stdio.h> #include <math.h> #include <string.h> /** Defined for pi */ #define _USE_MA...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<assert.h> void* my_memmove(void*dst, const void*src, size_t num) { assert(src&&dst); char*str_dst = (char*)dst; char*str_src = (char*)src; if (dst < src)//ǰãǰ { for (size_t i = 0; i < num; i++) { str_dst[i] = str_src[i]; } } else//ãӺǰ { ...
C
#include <stdio.h> #include <stdlib.h> typedef int ElementType; ElementType *ReadInput(int N); void solve(ElementType A[], ElementType ansArr[], int N); void PrintArr(ElementType A[], int N); void PercDown(ElementType A[], int p, int N); int Check_Insertion_Sort(ElementType A[], ElementType ansArr[], int N); void H...
C
#ifndef COMP_AST_H #define COMP_AST_H #include <stdlib.h> typedef enum { scope, call, constant, str_constant, variable, assign, add, sub, mul, divi, ret, dbg, ifo, eq } op_t; typedef struct { const char *name; char ext; char vaarg; char arg; } symbol_t; typedef struct node { op_t type; struct node **childr...
C
//Olá a todos! Estou adiantando a atividade Lista Duplamente Ligada, atividade dois do AVA //O QUE É? //Veremos que o uso da Lista Duplamente Ligada é indicada para situações que precise voltar, ou seja, navegar entre as posições. //Caso a necessidade seja apenas de avançar e nunca voltar, então o indicado é a Lista Si...
C
#include <stdio.h> #include <unistd.h> #include "printRoutines.h" // You probably want to create a number of printing routines in this file. // Put the prototypes in printRoutines.h /********************************************************************* Details on print formatting can be found by reading the man p...
C
#include <stdio.h> #include <malloc.h> #include <stdbool.h> #include <string.h> /* 执行用时:4 ms, 在所有 C 提交中击败了95.72% 的用户 内存消耗:5.7 MB, 在所有 C 提交中击败了75.55% 的用户 */ /* pre: 1. 从哪边遍历输入字符串?从小到大,处理起来比较高效与方便,只是需要逆序输出 2. 谨慎使用for,有时候状态不需要改变,没有while灵活 post: 1. */ int romanToInt(char * s){ char * sign = "IVXLCDM"; ...
C
/* computation of x^n */ #include <stdio.h> #include <stdlib.h> int exponentiate(int x, int n) { int m, z, power; if (n < 0) { printf("negetive power\n"); return -1; } m = n; power = 1; z = x; while (m > 0) { while ((m % 2) == 0) { m = m/2; z *= z; } m = m -1; power *= z; } return pow...
C
#include <stdio.h> #include <stdbool.h> #include "myBank.h" double bank[50][2]; int count = 0; void O(double amount){ if(amount <= 0) printf("Invalid Amount\n"); else if(count < 50){ int newNum = 0; while(bank[newNum][1] != false){ newNum++; } bank[newNum][0] = amoun...
C
#include <stdio.h> #include <string.h> #include <unistd.h> #include <asm/types.h> #include <sys/socket.h> #include <linux/netlink.h> #include "event.h" static int hyper_netlink_expect_dev(int fd, const char *dev) { int len; char buf[1024] = {0}; do { len = recv(fd, buf, sizeof(buf), 0); if (len < 0) break;...
C
/** Simple On-board LED flashing program - written in C by Derek Molloy * simple functional struture for the Exploring BeagleBone book * * This program uses USR LED 3 and can be executed in three ways: * makeLED on * makeLED off * makeLED flash (flash at 100ms intervals - on 50ms/off 50ms...
C
// Program takes candidates as arguments, then allows users to vote and calculates a winner #include <stdio.h> #include <cs50.h> #include <string.h> #include <ctype.h> int main(int argc, string argv[]) { // Check if more than 1 candidate has been passed as command line argument. Return usage instruction if incorre...
C
#include<stdio.h> #include<string.h> int main() { int i,n,a=0; char str[51]; scanf("%d",&n); scanf("%s",&str); for(i=0;i<n;i++) { if(str[i]==str[i+1]) { a++; } } printf("%d",a); return 0; }
C
/* sigaction1.c */ #include <stdio.h> #include <signal.h> #include <unistd.h> struct sigaction act_new; struct sigaction act_old; /* man sigaction struct sigaction{ void (*sa_handler)(int); void (*sa_sigaction)(int, ) }; */ void sigint_handler(int signo) { printf("\nCtrl-C 입력됨\n"); printf("다시 입력시 종료\n")...
C
/* mkindx.c -- make help/news file indexes */ #include "copyright.h" #include "autoconf.h" #include "help.h" char line[LINE_SIZE + 1]; int main(int argc, char *argv[]) { long pos; int i, n, lineno, ntopics, naliases, topic_indx; char *s, *topic; help_indx entry[1000]; FILE *rfp, *wfp; if (a...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <sys/socket.h> #include <sys/types.h> #include <netinet/in.h> #include <netinet/ip.h> void Error(const char * error) { perror(error); exit(EXIT_FAILURE); } __atribute__((inline)) void show_menu() { printf("Usage: server <port>\n"); exit(EX...
C
#include <stdio.h> void isolaCifra(int, int); int main(){ int n; scanf("%d", &n); isolaCifra(n, n); return 0; } void isolaCifra(int num, int starting){ if(starting == 0){ printf("0"); return; } if(num != 0){ printf("%d", num%10); isolaCifra(num/10, star...
C
#include<stdio.h> #include "conio.h" main() { int c=30; clrscr(); printf("%d\t%d\t%d\t%d\n",c,c<<1>>2,c&10,c|100); getch(); } // Output => 30 15 10 126
C
#include <stdio.h> void computeranks(int count, int freq[], int rank[], int topten[]) { int i, j; for(i = 0; i < count; i++) { for(j = 0; j < count; j++) { if(i != j) if(freq[j] < freq[i]) rank[i]++; } } for(i = 0; i < count; i++) { if(rank[i] >= count - 10) topten[count - rank[i] - 1] = i; }...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* load_level.c :+: :+: :+: ...
C
// // IVC Driver // // Copyright (C) 2016 Assured Information Security, Inc. All rights reserved. // #include <stdio.h> #include <stdlib.h> #include <privilege.h> #include <unistd.h> #include <string.h> #include <ringbuffer.h> #define MEM_SIZE 4096 * 2 static int passed = 0; static int failed = 0; static int signa...
C
#include "ejemplofcntl.h" void estadoarchivo(int archides) { int arg1, mudo; if((arg1=fcntl(archides,F_GETFL,mudo))==-1) { perror("\a estado archivo fallo\n"); exit(3); } printf("Descriptor de archivo %i:\n",archides); if(arg1 & O_WRONLY) { printf("Solo ...
C
#include <stdio.h> #include <fcntl.h> #include <stdlib.h> #include <string.h> #include <linux/i2c-dev.h> #include <errno.h> #include <linux/i2c.h> #include <sys/types.h> #include <sys/stat.h> #define DEVICE "/dev/i2c-0" #define DEVICE_I2C_ADDR 0x5d #define REG GOODIX_REG_VERSION #define GOODIX_READ_COOR_ADDR 0x814...
C
/************************************************************************* * All Rights yanbo Reserved * ************************************************************************* ************************************************************************* * Filename ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_srch_figure.c :+: :+: :+: ...
C
# include<stdio.h> void rec(int *p); void order(int *p); int main() { int list[25]; int i = 0; int *p = list; printf("ÊäÈë¾ØÕóÖеÄÊý"); for (i; i < 25; i++) { scanf_s("%d", &list[i]); } order(p); rec(p); system("pause"); } void rec(int *p) { int list[5][5]; int i, j; list[0][0] = *(p); list[0][4] = *(p +...
C
/* ** server.c -- a stream socket server demo */ #include "TCP.h" #include <stdio.h> #include <stdlib.h> #include <unistd.h> //Header file for sleep(). man 3 sleep for details. #include <pthread.h> // A normal C function that is executed as a thread // when its name is specified in pthread_create() // void *myThreadF...
C
/* Author: Ngoc Nguyen * Partner(s) Name: * Lab Section: 023 * Assignment: Lab 8 Exercise 1 * Exercise Description: [optional - include for your own benefit] * * I acknowledge all content contained herein, excluding template or example * code, is my own original work. * Demo link: https://youtu.be/ytGpVHrBGD...
C
#include <stdio.h> #include <time.h> int main() { int n, i, flag = 0; clock_t start, end; double total_cputime; start = clock(); printf("Enter a positive integer: "); scanf("%d", &n); for (i = 2; i <= n / 2; ++i) { if (n % i == 0) { flag = 1; bre...
C
#include "client.h" /* * Commands functions */ int cmd_inventory(struct command_s *cmd, int argc, char *argv[]) { int i; CAENRFIDTag *tag; int size; char *str; int ret; PDEBUG("%s", __func__); /* Check command line */ if (argc < 3) { PERR("%s %s", cmd->name, cmd->usage); return -1; } PDEBUG("%s: %s...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <limits.h> #include <stdbool.h> bool isPalindrome2(int x) { int s = 0, y; if (x<0) return 0; y = abs(x); x = y; while (x != 0) { s = s * 10 + x % 10; x = x / 10; } return s == y; } bool isPalindrome(int x) { if...
C
#include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include <sys/wait.h> #include <string.h> int main() { int n,status; //Creamos la variable que almacena el número de hijos y la que almacena el estado de salida del hijo pid_t pid, childpid; //Estas variables a...
C
/* P-wave Amplitude Elliptical Fitting * Authors: Jiashun Yu, Xiaobo Fu, Xinran Fan, Jianlong Yuan, Chao Han * College of Geophysics, Chengdu University of Technology * Contact us,E-mail:xiaobo_foo@126.com * 10/10/2014 * * File: swapbs.c * Version: 1.0.0 * */ #define _CRT_SECURE_NO_WARNINGS #...
C
#include <stdio.h> int main(int argc, char const *rgv[]) { int inputFirst,inputSec; printf("请输入两个整数\n"); printf("第一个整数\n"); scanf("%d",&inputFirst); printf("第二个整数\n"); scanf("%d",&inputSec); printf("这两个数的平均值是%.1f\n",((double)(inputFirst+inputSec))/2); }
C
#include <stdio.h> int main(void) { double mass_mol = 3.0e-23; double mass_qt = 950; double water_qt; printf("Enter the quarts of water: "); scanf("%lf", &water_qt); printf("The %lf water has %e mol of molecules\n", water_qt, water_qt * mass_qt / mass_mol); return 0; }
C
#include "register.h" // Function name : GetRegisterRes() // Input : 用户注册信息是否发送成功 // Output : 从服务器返回的注册结果信息 // Description : 获取从服务返回的注册结果信息 char *GetRegisterRes(int post_res){ char res[100]; if(post_res<0){ println("%s\n","向服务器POST发送信息失败"); exit(0); } return res; }
C
#include <stdio.h> #include <stdlib.h> #define N 100 typedef struct { int key; char *value; } symbol; static int count = 0; static symbol *st[N]; void put(int key, char *value); void delete(int key); char* get(int key); int contains(int key); int is_empty(); int size(); void print(); int main() { put(...
C
#include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #include <stdbool.h> #include <stdlib.h> #include <stdio.h> #include <fcntl.h> #include <string.h> void skipPipe(int* cmdIndex, bool* pipeIndxs) { while (pipeIndxs[(*cmdIndex)]) (*cmdIndex)++; (*cmdIndex)++; //the last cmd in pipe is with...
C
#include <stdio.h> float main(void) { int a,b; printf("a,b="); scanf("%d%d",&a,&b); printf("%f",1.0*a/b); return 0; }
C
#include<stdio.h> #include<string.h> #include<math.h> int main() { int n,a[100001]={0},k,jishu=0; int i,scan; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&scan); a[scan]++; } scanf("%d",&k); for(i=100000;i>0;i--) { if(a[i]!=0) jishu++; if...
C
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> #include <math.h> #include "util/xiwilib.h" #include "util/jsmnenv.h" #include "util/hashmap.h" #include "common.h" #include "category.h" #include "layout.h" typedef struct _json_data_t { int num_papers; paper_t *papers; hashma...
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
// Thanks: // - https://tobiasvl.github.io/blog/write-a-chip-8-emulator/ #include <stdlib.h> #include <signal.h> #include <string.h> #include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <time.h> #include "chip8.h" #include "termbox.h" #include "util.h" #define BLACK 16 #def...
C
/* Given an integer n, return the decimal value of the binary string formed by concatenating the binary representations of 1 to n in order, modulo 10^9 + 7. Example 1: Input: n = 1 Output: 1 Explanation: "1" in binary corresponds to the decimal value 1. Example 2: Input: n = 3 Output: 27 Explanation: In binary, 1, ...
C
/** * * Given an unsorted array of integers, find the length of longest * increasing subsequence. * Note: * There may be more than one LIS combination, it is only necessary * for you to return the length. * Your algorithm should run in O(n2) complexity. * =======================================================...
C
/* * Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. */ void moveZeroes(int* a, int numsSize) { int z = 0, nz = 0, n = numsSize,t; while (z < n && nz < n) { while(a[z] != 0 && z < n) { z++; ...
C
#include <stdio.h> #include <stdlib.h> #include <Evas.h> //typedef Evas_List *Ecore_DList; typedef struct _Ecore_DList { Evas_List *curr; Evas_List *first; } Ecore_DList; /*============================================================================* * Creating and initializing new list structures ...
C
#include <stdio.h> int main(){ int angka[10]={6,6,2,5,8,1,7,3,4,1}; int i,j; printf("angka sebelum diurutkan\n"); for(i=0; i<10; i++){ printf("%d ", angka[i]); } //looping sebanyak jumlah data for(i=0; i<10; i++){ int terkecil=i; //looping untuk mencari index/posisi angka yang terkecil //caranya adalah...
C
#include <stdio.h> #include <stdlib.h> typedef struct stack { int arr[10010], size; } Stack; Stack stack[1000]; int top = -1; int cmp_each(const void *a, const void *b) { return (*(int *)a - *(int *)b); } int cmp_all(const void *a, const void *b) { Stack c = *(Stack *)a, d = *(Stack *)b; return c.arr[0]...
C
/* Lab9, "Emiter" file for NASM generation Christian McGovern May 4, 2018 */ #include "emit.h" //calls what to print at the correct time void emitNASM(ASTnode *p, FILE *out){ if(p==NULL) return; fprintf(out, "%%include \"io64.inc\"\n\n"); ASTglobals(p, out); fprintf(out, "\nsection .data\n\n"); ASTstring...
C
/** * IEEE EUI-64 functions. * * Copyright Thinnect Inc. 2020 * @license MIT */ #include "eui64.h" #include <string.h> bool eui64_is_zeros(const ieee_eui64_t * eui) { uint8_t i; for (i=0;i<IEEE_EUI64_LENGTH;i++) { if (0 != eui->data[i]) { return false; } } return true; } void eui64_set_zeros(ieee...
C
#include <pebble.h> #include <stdio.h> #include <ctype.h> static char dots10[] = ". . . . . . . . . ."; static char dots9[] = ". . . . . . . . ."; static char dots8[] = ". . . . . . . ."; static char dots7[] = ". . . . . . ."; static char dots6[] = ". . . . . ."; static char dots5[] = ". . . . ."; static char dots4[] ...
C
#include <lasertag/speaker.h> #include <avr/io.h> /* The Timer0 prescaler. */ #define SPEAKER_PRESCALER 1024 /* * The frequency at which the speaker pin is toggled. The actual frequency of * the tone is half of the toggle frequency. */ #define SPEAKER_TOGGLE_FREQ (F_CPU / SPEAKER_PRESCALER) void speaker_init(void...
C
/* Copyright 2013-present Barefoot Networks, Inc. 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 License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in ...
C
#include <stdio.h> int main() { int a[100000]; int i; a[1] = 1; a[2] = 1; for (i=3; i<=30; i++) a[i] = a[i-1]+a[i-2]; printf("Fibonacci %d: %d\n", 30, a[30]); return 0; }
C
#include<stdio.h> #include<string.h> int max(int a, int b){return a>b?a:b;} int min(int a, int b){return a<b?a:b;} typedef long long LL; /* qsort(a, n, sizeof(int), tmp); bsearch(&key, a, n, sizeof(int), cmp); */ #define N 50010 int pa[N]; int findset(int u){ if(pa[u]!=u) pa[u] = findset(pa[u]); return pa[...
C
#include<stdio.h> main() { int i=10,j=20,k=30; int *p[3]; p[0]=&i; p[1]=&j; p[2]=&k; printf("%d %d %d\n",*p[0],*p[1],*p[2]); }
C
/* * mode.c * * Copyright 2012 James Cowgill * * 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 License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applica...
C
#ifndef PWM_ANALYZER_H #define PWM_ANALYZER_H /************ Include Files ************/ #include "xil_types.h" #include "xstatus.h" /************ Macro Definitions ************/ #define OFF_TIME_OFFSET 0 #define ON_TIME_OFFSET 4 #define PERIOD_OFFSET 8 /**************************** Type Definitions ********...
C
///file:evaluate.h ///description:interface for evaluating arithmetic and boolean expressions ///author: avv8047 : Azhur Viano #ifndef EVALUATE_H #define EVALUATE_H #include <string.h> #include <stdlib.h> #include <ctype.h> #include "stack.h" #include "symbolTable.h" #define INITIAL_SIZE 20 //Types for a token, ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* fractol_BurningShip.c :+: :+: :+: ...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> struct Product { char* name; double price; }; struct ProductStock { struct Product product; int quantity; }; struct Shop { double cash; struct ProductStock stock[20]; int index; }; struct Customer { char* name; double budget...
C
#include <ncurses.h> #include <stdlib.h> #include <time.h> #include <string.h> int main(int argc, char *argv[]) { int window_height = 20; int window_width = 60; char *text = "MOVE-ME TO SEE THE COLORS :D"; time_t t; srand((unsigned)time(&t)); initscr(); noecho(); WINDOW *win = newwin(window_height, window_...
C
#ifndef __ALGORITHM_H #define __ALGORITHM_H #ifdef __ALGORITHM_C #include <stdlib.h> #include <string.h> #include <stdint.h> #include <stdio.h> #include <limits.h> typedef uint8_t bool; #define true 1 #define false 0 #include "lib_export.h" #include "hashmap.h" #include "l...
C
#include <sys/file.h> #include <sys/mman.h> #include <assert.h> #include "blant.h" const char* _BLANT_DIR = DEFAULT_BLANT_DIR; // Given a TINY_GRAPH and k, return the integer ID created from one triangle (upper or lower) of the adjacency matrix. Gint_type TinyGraph2Int(TINY_GRAPH *g, int k) { int i, j, bitPos=0, ...
C
#include <stdio.h> #define maxSize 10 //STACK 1 int isFull_1(); void push_1(int); int isEmpty_1(); int pop_1(); void show_1(); int stack_1[maxSize]; int topOfStack_1 = 0; //STACK 2 int isFull_2(); void push_2(int); int isEmpty_2(); int pop_2(); void show_2(); int stack_2[maxSize]; int topOfStack_2 = 0;...
C
#include "general.h" #include <stdio.h> #include <stdlib.h> #include <math.h> #include <time.h> #include <unistd.h> double norma_cuadrado(double *vector, int N){//N es len(vector) double suma = 0; int i; for(i=0; i<N; i++) suma += pow(*(vector+i), 2); return suma; } double gaussiana(double mu, double sigma){ ...
C
#include <stdio.h> /* Write versions of the library functions strncpy , strncat , and strncmp , which operate on at most the first n characters of their argument strings. For example, strncpy(s,t,n) copies at most n characters of t to s . Full descriptions are in Appendix B. */ // strncpy: copy at most the fi...
C
/*Flores Fuentes Kevin Torres Verástegui José Antonio Fecha de elaboración: 20/Febrero/2020*/ /* Programa shell que se encarga de ejecutar el comando dado, puede ejecutar dos comandos en una sola linea gracias al pipe, el programa funciona a través de apuntadores para referirse a la linea del comando dado y poder ...
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 <stdio.h> #include <string.h> #include <stdbool.h> #include <stdlib.h> int main() { unsigned int w = 0x12345678; unsigned int z = 0; z = ((w >> 24) & 0xFF) | \ ((w >> 8) & 0xFF00) | \ ((w << 8) & 0xFF0000) | \ ((w << 24) & 0xFF000000) ; printf("0x%x and 0x%x \n",w,z); retu...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* check_square.c :+: :+: :+: ...
C
/* PMSIS includes */ #include "pmsis.h" /* --------- */ /* constants */ /* --------- */ #define NB_DEVICES (4) #define DATA_SIZE (100) /* --------- */ /* variables */ /* --------- */ static pi_device_t udma_datamove_device[NB_DEVICES] = {0}; static pi_udma_datamove_conf_t conf[NB_DEVICES] = {0}; static uint8_t src_...
C
#include<stdio.h> void Display() { int i = 0; for( i = 5 ; i>=1 ;i-- ) { printf("%d\n",i); } } int main() { Display(); return 0; }
C
#include <stdio.h> /**字符型数据相关处理**/ int main() { /**int c; c = getchar(); while(c != EOF) { putchar(c); c = getchar(); }**/ /**while((c=getchar()) != EOF) { putchar(c); }**/ long nc; nc = 0; while(getchar() != EOF) { ++nc; } printf("%ld\n", nc); return 0; } /** 输入输出按照字符流的方式处理 文本流由多行字符构成的字符序列,每行...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <stdbool.h> #include "def.h" int intArray[BufSize]; int front = 0; int rear = -1; int itemCount = 0; int peek(){ return intArray[front]; } bool isEmpty(){ return itemCount == 0; } bool isFull(){ return itemCount == BufSize; } in...
C
/* *ļ *ߣ *ڣ2020918 */ #define _CRT_SECURE_NO_WARNINGS 1 #include "game.h" int main() { srand((unsigned int)time(NULL)); int input = 0; /*char arr[ROW][COL] = { 0 };*/ do { Welcome(); printf("ѡ:>\n"); input = getch(); switch (input) { case '1':PlayGame(); break; case '0':printf("˳Ϸ\n"); br...
C
#include <stdio.h> #include <pthread.h> #include <stdlib.h> #include <string.h> #define N 2 struct v { int i;//Row int j;//Column }; int A[N][N] = { { 1,2 },{ 3,4 } };//Matrix 1 int B[N][N] = { { 2,3 },{ 4,5 } };//Matrix 2 int C[N][N];//Resulting Matrix static void * fnc(void *arg) { struct v ...
C
//Nome do programa: deithel.c //Nome do Autor: Eduardo Felizardo Cândido //Data de Criação: 29/06/2019 //Descrição ou Finalidade: /*Um jogador lança dois dados. Cada dado tem seis faces. Essas faces contêm 1, 2, 3, 4, 5 e 6 pontos. Depois que os dados param, a soma dos pontos nas duas faces voltadas para cima é calcul...