language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/* * team.c * * Created on: 15 Feb 2010 * Author: David Tyler */ #include "dt_logger.h" #include "team.h" /* * create_team * * Allocates the memory required for a team * * Returns: A pointer to the newly created memory */ TEAM *create_team() { /* * Local Variables */ TEAM *team; /* * ...
C
#include <stdio.h> #include "dataTypes.h" #include "tools.h" #include "instructions.h" // vloží hodnotu do EAX, čte zvlášt vysoký a nízký byte int moveEax(REG *regs, byte *memory) { if (regs->prefix == 0) { regs->al = memory[regs->ip +1]; // nízký byte regs->ah = memory[regs->ip +2]; // vysoký byte ...
C
/* * eComputer.c * * Created on: 16 dic. 2019 * Author: lorena */ #include "eComputer.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include "utn.h" #include "LinkedList.h" static int isValidDescripcion(char* descripcion); static int isValidPrecio(int precio); static int isValidIdTipo(int...
C
#include <stdio.h> struct Ponto { int x; int y; }; void preencheponto(struct Ponto* p) { printf("x = "); scanf("%d", &p->x); printf("y = "); scanf("%d", &p->y); }; struct Personagem { int identidade; int pontuacao; struct Ponto localizacao; }; void preencheperso(struct Personagem* p) { printf("Identidade:...
C
#ifndef __ELI_BUFFER_H__ #define __ELI_BUFFER_H__ #include <stdbool.h> #include <stddef.h> struct Line; struct Buffer { char *name; struct Buffer *prev, *next; struct Line *line, *beg, *end; size_t size; size_t row, col; }; struct Buffer* buf_new(const char *name); void buf_free(struct Buffer *b...
C
// SPDX-License-Identifier: BSD-3-Clause /* Copyright 2018, Intel Corporation */ /* * util_is_zeroed.c -- unit test for util_is_zeroed */ #include "unittest.h" #include "util.h" int main(int argc, char *argv[]) { START(argc, argv, "util_is_zeroed"); util_init(); char bigbuf[3000]; memset(bigbuf + 0, 0x11,...
C
#include <stdio.h> int main (void) { float N1,N2,N3,N4,MD; printf("entre com N1\n"); scanf("%f",&N1); printf("entre com N2\n"); scanf("%f",&N2); printf("entre com N3\n"); scanf("%f",&N3); printf("entre com N4\n"); scanf("%f",&N4); MD = (N1+N2+N3+N4)/4; if (MD <= 5) printf("O aluno foi reprovado...
C
//4- Desenvolva um programa em C que leia uma matriz 3 x 6 com valores reais. //( a ) Imprima a soma de todos os elementos das colunas mpares, ( b ) Imprima a mdia aritmtica dos elementos da segunda e quarta colunas. //( c ) Substitua os valores da sexta coluna pela soma dos valores das colunas 1 e 2,( d ) Imprima a ...
C
#include <stdio.h> void printWord(char *word); void printAllStrings(char ***allStrings) { char **next_list = *allStrings; int i = 0; do { char *next_word = *next_list; int j = 0; do { printWord(next_word); printf(" "); j++; next...
C
#include <linux/init.h> #include <linux/module.h> #include <linux/kobject.h> #include <linux/slab.h> /*kzalloc, kmalloc*/ #include <linux/sysfs.h> /*optional: has been included in kobject.h */ /* * Another special macro (MODULE_LICENSE) is used to tell the kernel that this * module bears a free license; without s...
C
#include <stm32f10x.h> /* SPI-1 PINs setup PA4 NSS PA5 SCLK PA6 MISO PA7 MOSI */ void systick_init(void); void delaymillis(void); void delayms(unsigned long t); void spi1_init(void); void spi1_char(char tx_char); void spi1_string(char str[]); void spi1_init(void) { // alternate funtion RCC -> APB2ENR |= RCC_APB...
C
/* problem-> Check_Mirror_in_N-ary_tree(good) Given two n-ary tree's the task is to check if they are mirror of each other or not. Example 1 1 / \ / \ 2 3 3 2 Output: 1 1 1 / \ / \ 2 ...
C
/** KMI string functions. */ #include "kmi.h" static const char KMI_char_mask[] = { 0xff, 0xc0, 0x30, 0xc, }; /** Comprare the prefix of two strings in binary form. * Note the prefix_len is the original string length. * Because both the prefix and the read are stored in binary form, * so a simple ...
C
/******************************************************************************/ #include "TFila.c" /******************************************************************************/ void Povoar( TFila *Fila ){ info Nome; char Finalizar; do{ printf( "\n\n Digite um nome: " ); scanf( "%s", Nom...
C
#include "heap.h" /** * heapify_down - restores the min heap property from root down * @heap: pointer to heap struct */ void heapify_down(heap_t *heap) { binary_tree_node_t *node = heap->root, *child; void *tmp; while (1) { if (!node->left) break; if (!node->right) child = node->left; else child...
C
#include<stdio.h> int main (void) { int n,sum=0,term; printf("Enter n:\n"); scanf("%d",&n); while(n>0) { term=n%10; sum+=term; n=n/10; } printf("sun is %d\n",sum); return 0; }
C
/* -*- mode:c -*- */ #pragma once /* \file include/meggface-c/tracker_context.h * \brief This file defines the functions to track faces. */ #include <stddef.h> #include <stdint.h> #include "megface-c/image.h" #include "megface-c/landmark.h" #include "megface-c/macro.h" #include "megface-c/misc.h" #include "megface...
C
/* P1.9_seed Function: Force Computation (force()) Contributor: Luis Leon Dependencies: - Struct: mdsys_t - Constants: mvsq2e, kboltz */ #include "ljmd.h" void ekin(mdsys_t *sys) { int i; sys->ekin = 0.0; for (i = 0; i < sys->natoms; ++i) { sys->ekin += 0.5 * mvsq2e * sys->mass * ...
C
#include <stdio.h> #include <pthread.h> #define NUM_THREADS 10 pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; pthread_barrier_t barrier; int glob; pthread_t thread[NUM_THREADS]; void *child(void *t) { // Increment glob by 1, wait for 1 second, then increment by 1 again. printf("Child %d entering. Glob i...
C
#include <cs50.h> #include <stdio.h> int main(void) { long long n; //ask user for valid input do { printf("Number:\n"); n = get_long_long(); } while (n<0); long long m=n; int product=0; int even_sum=0; //multiply every second digit by two, starting from ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* list_staff.c :+: :+: :+: ...
C
#ifndef DYNAMIC_ARRAY_H #define DYNAMIC_ARRAY_H typedef struct NODE { void* value; struct NODE* next; } Node; typedef struct LINK_LIST { /* data */ Node* head; int size; } LinkList; typedef void(*PRINTLINKNODE)(void*); // 1. 初始化 LinkList* init_LinkList(); // 2. 插入 void insert_LinkList(LinkList...
C
#include <stdio.h> int length, width; long area; struct coord { int x; int y; }; struct rectangle { struct coord top; struct coord bottom; }box; int main(void) { printf("Top x: "); scanf("%d", &box.top.x); printf("Top y: "); scanf("%d", &box.top.y); printf("Bottom x: "); scanf("%d", &box.bottom.x); printf...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { char *stu[3] = {"tom","jack","rose"}, temp[5]; int n, i, j, Max = 0; int s[3] = {0}; printf("Input the number of electorates:"); scanf("%d",&n); while(getchar() != '\n'); for(i = 0; i < n; i++) { ...
C
#include<stdlib.h> #include<stdio.h> #include<string.h> #include "stack.h" /* returns an empty stack. */ stack * build_stack() { /* allocate stack memory */ stack * s = (stack*)malloc(sizeof(stack)); /* initial values */ s->front = 0x00; s->back = 0x00; s->size = 0; return s; } /* destroys a stack */ void de...
C
/* * Author: Isaiah Mann * Desc: Reads in file of ints. Finds min and max */ #include <stdio.h> #include <stdlib.h> // Gets min value in an int array int min(int* arr, int len) { int index; int minVal = arr[0]; for(index = 1; index < len; index++) { if(minVal > arr[index]) {...
C
#include "game.h" /*INTRO PARAGRAPH For this mp, we implemented the game 2048. To do this, we used dynamically allocated arrays to store the game data. The current game is a structure of rows and columns and a pointer to cells. We had to implement making the game and remaking the game which clears the board and sets a...
C
#include <stdio.h> char *ft_strlcpy(char *str1, const char *str2, size_t size) { size_t i; i = 0; // str1 != 0 && str2 != 0 && while (i < size) { str1[i] = str2[i]; i++; } str1[i] = '\0'; return (str1); } int main() { char a[10] = {0}; char *b = "12364"; printf("%s\n",a); printf("%s\n",ft_strlcpy(a...
C
#include<stdio.h> main() { int num,rem,b=0,i=1,x; printf("enter a decimal number:"); scanf("%d",&x); num=x; while(num!=0) { rem=num%2; num=num/2; b=b+rem*i; i=i*10; } printf("Binary of the decimal number %d is %d",x,b); }
C
int directions[8][2] = {{-2, 1}, {-1, 2}, {1, 2}, {2, 1}, {-2, -1}, {-1, -2}, {2, -1}, {1, -2}}; //跑25 100 0 0会超时 dp只用到8ms/4ms //跑25 10 0 0 408ms dp会降到4ms // double knightProbability(int N, int K, int r, int c){ // if(K<0||N<=0){ // return -1; // } // if(r<0||r>=N||c<0||c>=N){ // return 0; /...
C
/* Neural Net X * AUTHORS: * Behan Remoshan * Nicolas Last Modified: Today */ #ifndef NEURAL_NET_H #define NEURAL_NET_H /* Neural network like class*/ typedef struct { /* Basic constants*/ int NumInTrainSet; int NumInputs; int NumHidden; int NumOutputs; int NumBias; /* Arrays for storing neuron...
C
#include <stdio.h> #include <stdbool.h> int main() { for (int i = 0; i < 10; i++) { printf("%i\n", i); for (int j=0; j<10; j++) { printf("\t%i\n", j); for (int j=0; j<10; j++) { printf("\t\t%i\n", j); } } } }
C
#include <stdio.h> #include <stdlib.h> #include <locale.h> int main(int argc, char const *argv[]) { int a, b; setlocale(LC_ALL, ""); printf("ENTRE COM UM NMERO PARA A: "); scanf("%d", &a); printf("ENTRE COM UM NMERO PARA B: "); scanf("%d", &b); if(a == b) { printf("VALORES SO IGUA...
C
#include<stdio.h> int merge(int a1[], int l1, int a2[], int l2) { int l = l1+l2; int i, j, a3[100]; for (i=0;i<l1;i++) { printf("%d ",a1[i]); } printf("\n"); for (i=0;i<l2;i++) { printf("%d ",a2[i]); } for(i=0; i<l1;i++) { a3[i]=a1[i]; } printf("%d\n",i); for(i=l1, j = 0;i<20 && j<=l2;i++,i++) { ...
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <assert.h> #include <string.h> #include "gc.h" #include "env.h" #include "eval.h" #include "prim_ops.h" #include "tests.h" #include "reader.h" FILE *in_file; bool is_whitespace(char c) { return (c == ' ') || (c == '\n') || (c == EOF); } char peek...
C
#include "LinkedList_quicksort.h" #include <time.h> static bool list_is_ordered(node_t *list) { bool first = true; int value; while (list) { if (first) { value = list->value; first = false; } else { if (list->value < value) ret...
C
/* You would like to make dessert and are preparing to buy the ingredients. You have n ice cream base flavors and m types of toppings to choose from. You must follow these rules when making your dessert: There must be exactly one ice cream base. You can add one or more types of topping or have no toppings at all. Ther...
C
#include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h> #include "include/mem.h" uint8_t mem_array[0x1000]; void init_mem() { memset(&mem_array, 0x00, sizeof(mem_array)); } void mem_store(uint16_t addr, uint16_t data, uint8_t len) { if (len == 0 || len > 2) { printf("Error: l...
C
#include<stdio.h> int main() { float F,C; printf("Enter Frnht="); scanf("%f",F); C=(F-32)/1.8; printf("This is Celcious=%f",C); return 0; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_itoa.c :+: :+: :+: ...
C
#ifndef _DISK_H_ #define _DISK_H_ #include "common.h" typedef struct DISK_OPERATIONS { int ( *read_sector )( struct DISK_OPERATIONS*, SECTOR, void* ); //디스크에서 읽는 동작 연결 필요. 첫번째 인자가 읽을 곳, 두번 째 인자가 읽을 크기, 세번째 인자가 읽어서 저장할 곳으로 예상 읽기 전에 공간 초기화 필요 int ( *write_sector )( struct DISK_OPERATIONS*, SECTOR, const void* ); /...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_set_com.c :+: :+: :+: ...
C
#include <stdio.h> #include "tcpip.h" int main() { tcp_connection_t tcpConn = tcp_create(); tcp_connection_t tcpAccepted= tcp_create(); unsigned int commSock = 0; char data; tcp_listenToPort(tcpConn, 12345); tcp_acceptConnection(tcpConn, tcpAccepted); while(1) { tcp_receiveData(tcpAccepted, (uin...
C
#include<stdio.h> #include<stdlib.h> int main(int argc,const char* argv[]) { int arr[90]; for(int i=0;i<argc;i++) { arr[i]=atoi(argv[i]); } for(int i=argc-1;i>=0;i--) { printf("%d",arr[i]); } return 0; }
C
//================================================================ // Week 4 Shorts //================================================================ // // line CONTENTS //================================================================ // 017 - Hexadecimals // 071 - Poin...
C
#include<stdio.h> int main() { int a=10,b=20,c=30,tot; float avg; total = a+b+c; avg=total/3; printf("total is",tot); scanf("%d%d%d",&a,&b,&c) printf("avg is",avg) scanf("%f",avg) }
C
#include "graph.h" #include "comm.h" #include "wtime.h" #include <fstream> #include <omp.h> #include <math.h> using namespace std; //function BS is only used in further partition, it searches the position satisfy that A[n]+2n < x. vertex_t BS(index_t x, index_t*A, vertex_t bot, vertex_t top){ // for(int i=bot;i<=top...
C
#include "xs.h" void timer_callback(xs_ev_time_t* tev) { tev = tev; xs_logd("timeout"); } int main(int argc, char** argv) { #if 0 xs_server_init(4, NULL, argc, argv); /* start server with 4 thread */ xs_ev_add_time_ev(1000, timer_callback, NULL); /* set timer 1 second */ xs_se...
C
#include <stdio.h> #include <stdlib.h> int main() { int a,b; printf("digite um numero: "); scanf("%i",&a); a += 0b0100; printf("%i",a); return 0; }
C
#include <setjmp.h> #include <allegro5/allegro.h> #include <allegro5/allegro_native_dialog.h> #include "allegro-shell/Display.h" #include "allegro-shell/EventQueue.h" #include "allegro-shell/FileDialog.h" #include "shell/io_utils.h" #include "core/constants.h" #include "core/Scenario.h" #include "core/Menu.h" #include...
C
#include <stdio.h> #include <math.h> int main() { /* int m = 4453, n = 5767; int a = 5767, b = 4453; int c = a % b; */ int m, n, a, b, c; while (scanf("%d %d", &m, &n) == 2 && m > 0 && n > 0) { a = m > n ? m : n; b = m > n ? n : m; c = a % b; ...
C
#include "unpipc.h" #include "../lib/wrappthread.c" #include "../lib/wrapsem.c" #include "../lib/wrapstdio.c" #define NBUFF 8 struct { struct { char data[BUFFSIZE]; ssize_t n; }buff[NBUFF]; sem_t mutex,nempty,nstored; }shared; int fd; void * produce(void *), *consume(void *); int main(int argc,char **argv) ...
C
#include <stdio.h> int merge_sort(int arr[], int low, int high) { int mid; if(low < high) { mid = (low + high) / 2; merge_sort(arr, low, mid); merge_sort(arr, mid + 1, high); merge(arr, low, mid, high); } } int merge(int arr[], int low, int mid, int high) { int i, j, k; int n1 = mid - low + 1; ...
C
//WHITE LINE FOLLOWER --CYBERBREAKIN-- int rm1=7; int rm2=6; int lm1=4; int lm2=5; void switchoff(); void forward(); void reverse(); void left(); void right(); void powerLeft(); void powerRight(); void setup() { pinMode(rm1,OUTPUT); pinMode(rm2,OUTPUT); pinMode(lm1,OUTPUT); pinMode(lm2,OUTPUT); Serial...
C
#include "binary_trees.h" /** * binary_tree_rotate_right - rotate binary tree node to the right, making * it's left child it's parent. * @tree: node to rotate * * Return: pointer to node that has taken the place of `tree`, or NULL if * rotation is not possible. */ binary_tree_t *binary_tree_rotate_right(binary_...
C
/* ----------------------------------------------------------------- * Programmer(s): Cody J. Balos @ LLNL * ----------------------------------------------------------------- * SUNDIALS Copyright Start * Copyright (c) 2002-2022, Lawrence Livermore National Security * and Southern Methodist University. * All right...
C
#include "sender.h" file_buffer_t *file_buffer; packet_t *packet_buffer; callback_event_t callback_list[MAX_CALLBACK_LIST_SIZE]; u_int32_t max_sequence_no; int sender_state; int *send_flag; // 0 no touch, 1 in window, 2 ACKed timeval default_timeout; timeval zero_timeout; struct sockaddr_in remote_addr; int window_s...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_algo.c :+: :+: :+: ...
C
// Copyright (c) 1992 - 1997 Microsoft Corporation. All Rights Reserved. #ifndef _CHECKBMI_H_ #define _CHECKBMI_H_ #ifdef __cplusplus extern "C" { #endif // Helper __inline BOOL MultiplyCheckOverflow(DWORD a, DWORD b, __deref_out_range(==, a * b) DWORD *pab) { *pab = a * b; if ((a == 0) || (((*pab) / a) ...
C
#include "unp.h" int main(int argc, char **argv) { int sock_fd; struct sockaddr_in servaddr; struct sctp_event_subscribe evnts; int echo_to_all=0; if(argc < 2) //如果命令行参数小于1个,则出错退出 err_quit("Missing host argument - use '%s host [echo]'\n", argv[0]); if(argc > 2) { //如果命令行参数大于1个,打印提示消息,重置标志量 printf("...
C
// // Created by hubin on 2019/9/19. // #include <stdio.h> #include "yuv_rgb.h" void rgb24ToYuv420p(uint8_t *RGB, uint8_t *YUV, uint32_t width, uint32_t height) { const YCbCrType yuv_format = YCBCR_601; // const YCbCrType yuv_format = YCBCR_709; //const YCbCrType yuv_format = YCBCR_JPEG; rgb24_yuv420_s...
C
#include <cstdio> #include <bitset> using namespace std; bitset<1000003> p; void sieve(int upto){ p.set(); p[0] = 0; p[1] = 0; for(int i=2; i*i<=upto+1; i++)if(p[i]){ for(int j=i*i; j<=upto+1; j+=i) p[j] = 0; } } int digitSum(int n){ if(n==0)return 0; return (n%10)+digitSu...
C
#include <stdio.h> #include <ulib.h> int main(void) { int pid, exit_code; if ((pid = fork()) == 0) { cprintf("fork ok.\n"); int i; for (i = 0; i < 10; i++) { yield(); } exit(0xbeaf); } assert(pid > 0); assert(waitpid(-1, NULL) != 0); assert(waitpid(pid, (void *)0xC0000000) != 0); assert(waitpid(pid...
C
#include <stdio.h> #include <ctype.h> #include <stdlib.h> #include <stdbool.h> #include <string.h> #include "lex.h" #include "state_table.h" char* token_names[] = {"ERROR", "IDENT", "INTTYPE", "DBLTYPE", "NUMLIT", "PLUS", "MINUS", "MULT", "DIV", "MOD", "EXP", "NOT", "AND", "OR", "XOR", "ASSIGN", "LT", "GT", "S...
C
#include<stdio.h> #include<stdlib.h> /* Count essay characters number then save in essayct file. */ int main(void) { char ch; int ct = 0; FILE * fp; fp = fopen("essay", "r"); while (getc(fp) != EOF) ct++; printf("%d", ct); return 0; }
C
#ifndef PONG_H #define PONG_H #define TRUE 1 #define FALSE 0 #define HEIGHT 109 #define WIDTH 137 #define PI 3.14159265359 // Different play modes #define SINGLE 1 #define DOUBLE 2 #define COMPUTER 3 // Difficulties #define EASY 1 #define MEDIUM 2 #define HARD 3 #define STARTLENGTH 1...
C
#include "lattice.h" #include <stdio.h> #include <stdlib.h> #include <time.h> #include <math.h> /* --- LLENAR PROBA--- */ double llenar_proba(double *prob, int n){ int i; for(i=0;i<n;i++){ prob[i]=0; } for(i=0;i<n;i++){ prob[i]=0.3; } } /* ---NUEVA RED --- */ int fill_new_lattic...
C
#include <stdlib.h> #include <stdio.h> #include <dirent.h> #include <string.h> // definition of the structure (global scope) typedef struct s_file { char *file_name; struct s_file *next; } t_file; int static counter = 0; void sort_alpha(t_file **begin_list) { t_file *list; ...
C
#include <stdio.h> #include <stdbool.h> #include <stdlib.h> static bool hasAlternatingBits(int n) { int b = n&0x1; while (n) { if (b^(n&1)) { return false; } b ^= 1; n >>= 1; } return true; } int main() { int x; bool r; puts("Please ...
C
#include <stdlib.h> #include <stdio.h> int main(int argc, char const *argv[]) { int a[] = {1, 2, 3, 4}; printf("%ld\n",sizeof(a)); printf("the length of array a is %ld\n", sizeof(a)/sizeof(a[1])); return 0; }
C
#ifndef __AST_H #define __AST_H /** * This contains all of the nodes, enums, etc * related to the AST. It's all in a separate file * because if you haven't noticed, there are fucking * loads. * * The node types represent every type of node that there * is in the language, including macros. */ #include "util.h...
C
#include<stdio.h> #include<stdlib.h> int main(){ char nombre[50]; printf("Ingresa tu nombre: "); fgets(nombre, 50, stdin); printf("Hola %s", nombre); /* for (int i = 1; i <= 5; i++) { printf("numero: %i\n", i); } */ return 0; }
C
#include<reg52.h> #include<intrins.h> #include<string.h> #define uint unsigned int #define uchar unsigned char /*****************************/ //˿ں /*****************************/ sbit IO = P1 ^ 0; sbit SCLK = P1 ^ 1; sbit RST = P1 ^ 2; sbit RS = P2 ^ 0; sbit RW = P2 ^ 1; sbit EN = P2 ^ 2; /**************...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strtrim.c :+: :+: :+: ...
C
#include <ctype.h> #include "game.h" int are_valid_game_digits(int game_size, char *game_digits) { const char zero = '0'; char game_digit; char game_size_char = game_size + zero; for (int i = 0; i < game_size; i++) { game_digit = game_digits[i]; if (!game_digit || !isdigit(game_di...
C
#include "controller_task.h" #include <stddef.h> #include "../../headers/tm4c123gh6pm.h" #include "sampler_tasks.h" #include "../libs/PID.h" #include "../libs/print.h" #include "../drivers/UART.h" #include "../drivers/leds.h" #define MAX_OUTPUT_OUTER_1 (318/20.) #define MAX_OUTPUT_OUTER_2 (175/20.) xTaskHandle contr...
C
//--------------------------------------------------------------------------------------- // Smile Programming Language Interpreter // Copyright 2004-2019 Sean Werkema // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You ma...
C
#include<stdio.h> int main() { int i,age; for(i=0;i<10;i++) {/* printf("%d\n",i); printf("Enter your age\n"); scanf("%d",&age); if(age>18) { break; }*/ if(i==4) { continue; } printf("%d\n",i); } // kilogram in ...
C
#include<stdio.h> void sortArray(int*, int); int main() { int arr[12] = {4, 11, 6, 27, 84, 53, 39, 45, 122, 99, 113, 2}; int size = sizeof(arr) / sizeof(int); sortArray(arr, size); printf("["); for (int i = 0; i < size; i++){ printf("%d, ", arr[i]); } printf("\b\b]\n"); return 0; } void sortArr...
C
// // main.c // StringAndFunction // // Created by JSB_02 on 16/5/25. // Copyright © 2016年 JSB_02. All rights reserved. // #include <stdio.h> #include <string.h> #include <stdlib.h> /* char[][] *char[] */ int mylen(const char*s){ int cnt = 0; int inx = 0; while (s[inx] != '\0') { cnt...
C
#ifndef ARRAY_H_INCLUDED #define ARRAY_H_INCLUDED #include <stdarg.h> #include "common.h" typedef struct Array Array; struct Array { void **items; size_t size; size_t allocated; free_function_t free_item_func; }; Array *array_new(free_function_t free_item_func); void array_free(Array *arr); void array_reser...
C
#include <stdio.h> struct employee { char name[30]; char date[15]; float salary; }; int main(void) { struct employee emp = {"Mike", "7/16/2015", 76909.00f}; printf("Name: %s\n", emp.name); printf("Hire Date: %s\n", emp.date); printf("Salary: $%.2f\n", emp.salary); return 0; }
C
#include<TM4C123GH6PM.h> #define KEY 0x4C4F434B void SYSTEM_Setup(void) { /*------------------------------------------------------/ GPIOF ------------------------------------------------/ /------------------------------------------------------*/ /* GPIO Run Mode Clock Gating Control (RCGCGPIO), see pg.340 Enable...
C
/* * The MIT License (MIT) * * Copyright (c) 2017 Johan Kanflo (github.com/kanflo) * * 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 limitatio...
C
#include <stdio.h> #include <stdlib.h> void multiplo_de_dois(int a) { if (a%2==0) printf("E multiplo de dois\n" ); else printf("Nao e multiplo de dois\n" ); } int main(int argc, char const *argv[]) { int a , b; scanf("%d %d",&a,&b ); multiplo_de_dois(a); multiplo_de_dois(b); return 0; }
C
//=====================================================================// /*! @file @breif ファイル入出力関係 @author 平松邦仁 (hira@rvf-rc45.net) */ //=====================================================================// #include <avr/io.h> #include <avr/pgmspace.h> #include <avr/interrupt.h> #include <stdio.h> #incl...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main_strjoini.c :+: :+: :+: ...
C
#include <stdio.h> #include <err.h> #include <errno.h> /* ./a.out EACCES: Permission denied ./a.out: No such file or directory */ int main(int argc, char *argv[]) { // strerror将errnum(通常就是errno值)映射为一个出错信息字符串,并返回此字符串的指针 fprintf(stderr, "EACCES: %s \n", strerror(EACCES)); // 强制更改errno err...
C
#include<stdio.h> #include<time.h> int main() { int num=0; clock_t start=0,finish=0; start=clock(); for(num=0;num<1000;num++) printf("1"); printf("\n"); finish=clock(); printf("程序运行时间:%lf\n",(double)(finish-start)/CLOCKS_PER_SEC); return 0; }
C
//--------------------------------------------------------------------------- float log(float x) { #define SQRT_05 0.7071067811865475 #define MS 8.429369702178806e-8 // mantissa scaling = sqrt(2)/2^24 #define LN_TWO 0.6931471805599453 double m, s, r, rp; unsigned int u; int e, i; u = *(unsigne...
C
#include <project.h> #include <stdio.h> #include "pwmTask.h" #include "global.h" // Range of pulses for Servo Motor in uS #define MIN_US 1000 #define MAX_US 2000 // Parameters of PWM... must be same as schematic #define PWM_CLK 4000000 #define PWM_DIV 4 #define US_PER_SEC 100...
C
/******************************************************** * * * a`rhb@sn@b@gX[^@ * * * * o`rrQ WJ * * * * author : s.aizawa * * creation date : 87.03.18 * * file name : expr.c * * update : * * * ********************************************************/ ...
C
#include <stdio.h> #include <math.h> int main(){ int a = 0; int b = 0; int c = 0; int det = 0; int bNeg = 0; float raiz = 0.0; float resultado1 = 0.0; float resultado2 = 0.0; printf("programa que calcula la chicharronera\n"); printf("ingresa a:"); fflush(stdin); scanf("%d", &a); printf("\n ingresa b:"); ...
C
// ch15_01.c #include <stdio.h> struct st_record{ // 이 곳에 필요한 멤버 데이터를 정의한다. }; #define MAX 100 void create_data(struct st_record* p[], int size); void read_data(struct st_record* p[], int size); void update_data(struct st_record* p[], int size); void delete_data(struct st_record* p[], int size); int main(){ struct s...
C
#include <stdio.h> // ╯﹏╰腰好疼吖 int main(void) { int m, n, i, x, y, tmp; while (scanf("%d %d", &m, &n) != EOF) { x = 0; y = 0; if (m > n) { tmp = m; m = n; n = tmp; } for (i = m; i <= n; i++) { if (i % 2 == 0) { x = x + i * i; } if (i % 2 == 1 || i % 2 == -1) { y = y + ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_split.c :+: :+: :+: ...
C
/** * @file runtime.c * @brief Purpose: main entrance of the runtime * @version 1.0 * @date 04.16.2017 * @author Xiangyu Guo */ #include <stdio.h> #include <ctype.h> #include <errno.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include "storage.h" #i...
C
#include<stdio.h> int yun(int year); int main(void) { int month[12]={31,28,31,30,31,30,31,31,30,31,30,31}; int year=0, mon=0, total=0; int i=0; printf("input year : "); scanf("%d",&year); printf("input month : "); scanf("%d",&mon); total=(year-1)*365; // 전년까지 날짜수 //윤년체크 for(i=1; i<year; i++...
C
#include<stdio.h> int main() { int num1,num2,num3,sum,average; printf("Enter the value of num1 , num2 and num3 :"); scanf("%d%d%d",&num1,&num2,&num3); sum=num1+num2+num3; printf("\nthe sum is %d+%d+%d=%d",num1,num2,num3,sum); average=sum/3; printf("\nqthe average is %d/3=%d",sum...
C
// // Created by serge on 22.12.2019. // #include <stdio.h> #include <stdlib.h> #include <string.h> #include "game.h" int** createField(BMP* startImage) { int** field = calloc(startImage->infoHeader->Width, sizeof(int)); for (int i = 0; i < startImage->infoHeader->Width; ++i) { field[i] = calloc(s...