language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> unsigned int combine(unsigned int x, unsigned int y){ unsigned int maskedx = 0xffff0000 & x; /*Since we would like to extract byte's 3 and 2 from x, I want to get rid of the bytes 0 and 1, which can be done by combining the given x and using the AND operation with my created bitmask 0xffff0000. ...
C
#define _CRT_SECURE_NO_WARNINGS #include <SDL.h> #include <SDL_ttf.h> #include <stdio.h> #include "Game.h" static SDL_Window* gWindow; static SDL_Renderer* gRenderer; static TTF_Font* gFont; static SDL_Texture* background; static SDL_Texture* player; static SDL_Texture* ownerBanner; static SDL_Texture* diceSheet; s...
C
double myPow(double x, int n){ if (n == 0) return 1; if (n == 1) return x; long long N = n; if (N <= 0) { N = -N; x = 1/x; } double half = myPow(x, N/2); if (n % 2 == 0) { return half * half; } else { return half * half * x; } }
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> int main() { for(int i = 2;i < 101;i++){ bool prime = true; for(int x = 2;x < i;x++){ if(i % x == 0){ prime = false; break; } } if(prime == true){ prin...
C
#include <stdio.h> #include <string.h> typedef int bool; //Definicion del tipo booleano en C. #define true 1 // #define false 0 // // ---------------------------------ESTRUCTURAS------------------------------------------------------ struct tupla_catalogo {int identificador_unico; int numero_columna; char dato[25...
C
#include "searchFunctions.h" #include <stdio.h> #include <stdlib.h> /* * This does a linear search from bottom floor to top * If you for some reason think that the average is high * if you are doing a search with the average kind of low * and a variance high it will be above the average because * for it to be drug...
C
//this program is to find the solution of function //using bisection method #include<stdio.h> #include<stdlib.h> float Fun(float x) { float y; y = (x*x)+(2.1*x)-8.82; return y; } void bisection(double a, double b) { if (Fun(a) * Fun(b) >= 0) { printf("You have not assumed right a and b...
C
/* inimgrGetBool.c */ #include "inimgr_types.h" int inimgrGetBool( InimgrUID uid, const char *name, const char *key, bool *res ) { int ret; char *value; if( ( ret = __inimgr_get_value( (struct inimgr_params *)uid, name, key, &value ) ) == CG_ERROR_OK ){ if( strcasecmp( value, "ON" ) == 0 ){ *res = true; }...
C
/**************************************************************************** Title: Watchdog Timer Interrupt Author: Elegantcircuits.com File: $Id: watchdog_interrupt.c Software: AVR-GCC 3.3 Hardware: Atmega328P AVR Description: This example shows how to drive an LED periodically using the watchdog ...
C
#include <stdio.h> unsigned long Fibonacci(unsigned long n); int main(void) { unsigned long n; printf("Please enter your Fibonacci number(q for exit): "); while(scanf("%lu", &n) == 1) { printf("Answer for your Fibonacci number: %lu", Fibonacci(n)); putchar('\n'); printf("Pl...
C
#pragma once inline int ieo_min_i(int const x, int const y) { return y < x ? y : x; } inline unsigned ieo_min_u(unsigned const x, unsigned const y) { return y < x ? y : x; } inline long ieo_min_l(long const x, long const y) { return y < x ? y : x; } inline unsigned long ieo_min_ul(unsigned long const x, unsig...
C
#include <stdio.h> #include <conio.h> #include <stdlib.h> int main() { char K1, K2; printf("Masukkan Karakter Pertama : "); K1 = _getch(); printf("\n"); printf("Masukkan Karakter Kedua : "); K2 = _getche(); printf("\n"); printf("Karakter yang dimasukkan adalah : %c dan %c \n\n", K1, K2); _...
C
#include "fmacros.h" #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h> #include <stdarg.h> #include <limits.h> #include <sys/time.h> #include "dict.h" #include "zmalloc.h" #include <assert.h> /* ------------------------------- Benchmark ---------------------------------*/ #define DICT_...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <pthread.h> #include <semaphore.h> #define QTLeitores 3 #define QTEscritores 2 sem_t rmutex; // sem_t db; //controla o acesso a base da dados (Rc) int rc = 0; //número de processos lendo ou querendo ler void *leitor(void *arg); void *escritor...
C
/* * @lc app=leetcode.cn id=10 lang=c * * [10] 正则表达式匹配 * * https://leetcode-cn.com/problems/regular-expression-matching/description/ * * algorithms * Hard (30.81%) * Likes: 1915 * Dislikes: 0 * Total Accepted: 148K * Total Submissions: 479.1K * Testcase Example: '"aa"\n"a"' * * 给你一个字符串 s 和一个字符规律 p...
C
#include "nu/peripheral/flash.h" #include "nu/wdt.h" #define CONST_FLASH_SIZE_WORDS (((CONST_FLASH_SIZE_BYTES)-1)>>2)+1 /* Note that: * "bytes" needs to be a multiple of BYTE_PAGE_SIZE (and aligned that way) * if you intend to erase * "bytes" needs to be a multiple of BYTE_ROW_SIZE (and aligned that way...
C
# shanmugapriya #include<stdio.h> #include<math.h> int main() { int num,a,r=0,rem; scanf("%d",&num); a=num; while(num!=0) { rem=num%10; r=r*10+rem; num=num/10; } if(a==r) { printf("\n %d is palindrome",r...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <string.h> static char GPS_output[] = "$GPRMC,173202.000,A,3722.8899,N,12159.5208,W,0.04,215.36,121017,,,A*7F"; typedef unsigned char bool; static bool false = 0; static bool true = 1; /// ------------------------------------------------------------...
C
#include "status_types.h" #include "Shlwapi.h" #pragma comment(lib, "Shlwapi.lib") #pragma comment(lib, "Pathcch.lib") #include "Pathcch.h" STATUS DumpExe(WIN32_FIND_DATA File); DWORD NrFiles = 0; STATUS SearchDirectory(LPSTR Filename, BOOL Recursive) { WIN32_FIND_DATA FindFileData; HANDLE hFind = INVALID_HANDLE_V...
C
#include <stdio.h> #include <ctype.h> int my_isupper(); int my_tolower(); int main(int argc, char* argv[]) { printf("Enter text, ^D to end:\n"); int c; while ((c=getchar()) != EOF) { if (my_isupper(c)) { c = my_tolower(c); } putchar(c); } return 0; } int my_isupper(int c) { return c >= 'A' && c <= 'Z'...
C
/**************************************************************************** * apps/fsutils/passwd/passwd_find.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright...
C
#include <assert.h> #include <ctype.h> #include <stdbool.h> #include <stdio.h> #include <builtins.h> #include <builtins/bashgetopt.h> #include <shell.h> #include "log.h" #define LINEMAX 8000 /* TODO UTF-8 Support */ typedef void str_proc(const char *buf); int strfn_builtin(WORD_LIST *list, str_proc fn, const c...
C
#include "emulator.h" /******************************************************* - fonction instructionToHex: Traduis une instruction MIPS en hexadecimal - parametre: > instruction : instruction MIPS - retour: > instruction en hexadecimal *******************************************************/ char* instru...
C
#include "header.h" void initPerso(perso *p) { TTF_Init(); TTF_Font *police=NULL; police=TTF_OpenFont("Urusans.ttf",40); SDL_Color couleur= {255,255,255}; p->sprite=IMG_Load("sprite sheet.png"); p->posPerso.x=250; p->posPerso.y=290; p->posSprite.w=50; p->posSprite.h=40; p->p...
C
#include<stdio.h> int main() { int i, n; printf("\nPlease enter number:"); scanf("%d", &n); printf("\n"); for(i=0;i<n;i++) printf("yes "); printf("\n print %d many yes",n); return 0; }
C
#include "cola.h" #include "abb.h" #include "lista.h" #include <stdio.h> #include <string.h> #include "game_of_thrones.h" #define INICIAR_SIMULACION 'S' #define AGREGAR_CASA 'A' #define MOSTRAR_INTEGRANTES 'L' #define CASAS_EXTINTAS 'E' #define FINALIZAR_EJECUCION 'Q' /* Compara los elementos como si fueran strings. D...
C
/** * @file State.c * @author {Layne} ({shu_huanglei@163.com}) * @brief * @version 0.1 * @date 2020-08-10 * * @copyright Copyright (c) 2020 * */ #include "Context.h" #include "StateStruct.h" #include "ctools.h" void state_do_action(State* state, Context* context) { if (NULL == state || NULL == state->do_...
C
/**********************************************/ /* Пример для работы #1 */ /**********************************************/ /* ПОРОЖДЕНИЕ ПРОЦЕССОВ */ /**********************************************/ /* Монитор Слонов - файл ganesha1.c */ /*************************...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* init_struct_parser.c :+: :+: :+: ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_lstnew.c :+: :+: :+: ...
C
/* See LICENSE below for information on rights to use, modify and distribute this code. */ /* * hilbert.c - Computes Hilbert space-filling curve coordinates, without * recursion, from integer index, and vice versa, and other Hilbert-related # calculations. * * Author: Doug Moore * Dept. of...
C
#include <pthread.h> /* PThread */ #include <stdio.h> /* Printf */ #include <stdlib.h> #include <assert.h> #include "filtro_salas.h" #define NOPATOVA -1 #define MOLS 10 struct filtro { int * salas; int * patovas; }; /* Crea un filtro para _n_ hilos */ filtro_t* filtro(unsigned int n){ filtro_t* filtro =...
C
/*--------------------------------------------------------------------*/ /* functions to connect clients and server */ #include <stdio.h> #include <fcntl.h> #include <string.h> #include <strings.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> #include...
C
/* * File: uart.c * Author: Bernd * * Created on 16 maart 2017, 16:31 */ #include <xc.h> #include "uart.h" #include "delay.h" char isCommandSent = TRUE; unsigned char *currentMessagePointer; unsigned char uart_receive_buffer[BUFFER_SIZE]; unsigned int uart_receive_buffer_index = 0; unsigned ...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> #define DT_MAX 0.1 #define DT_MIN 0.0001 #define TMAX 1000 #define TMIN 10 #include "../include/initialisation.h" void Creation_Parametre(Parametre* par){ printf("Entrez les parametres sigma, rho, beta\n"); printf("Sigma : "); scanf (...
C
/******************************************************************************* + + LEDA 5.0.1 + + + min_cut.h + + + Copyright (c) 1995-2005 + by Algorithmic Solutions Software GmbH + All rights reserved. + *******************************************************************************/ // $Revision: 1.2 $ $...
C
#include <stdio.h> #include <stdlib.h> int main(int argc,char *argv[]){ char islem; float sonuc; if(argc!=3){ printf("Az veya çok sayı girdiniz."); exit(1); } printf("\nİŞLEMLER\n +=Toplama\n -=Çıkarma\n *=Çarpma\n /=Bölme\nİşlem: "); scanf("%c",&islem); if(islem=='+'){ sonuc=atoi(argv[1])+atoi(argv[2]); } else i...
C
/* * Copyright (C) agile6v */ #include "pupa_config.h" #include <errno.h> #include <fcntl.h> #include <sys/mman.h> #include <sys/stat.h> #include <unistd.h> int pupa_shm_init(pupa_ctx_t *ctx, int op_type) { int fd; int flag; pupa_shm_t *shm; struct stat st; shm = &ctx->shm; ...
C
/***************************************************************** * Memstat program - shows maximum memory usage of given program * * Handy tool made by Bartosz [ponury] Ponurkiewicz 2009 * * GPL Licence or whatsoever * ***************************************************...
C
// // main.c // Assignment04 // // Created by Lim Si Eian on 13/02/2019. // Copyright © 2019 Lim Si Eian. All rights reserved. // #include <stdio.h> #include <stdlib.h> #include <time.h> //Exercise01 int main(void) { float fAverage = 0; int nArray[10] = {5, 24, 76, 1, 8, 53, 40, 7, 33, 10}; int nSmall...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.c :+: :+: :+: ...
C
#include <stdint.h> #include <stdio.h> typedef struct lista TLISTA; typedef struct no TNO; TLISTA *criar_lista(); int lista_vazia(TLISTA *li); int tamanho(TLISTA *li); void imprimir(TLISTA *li); int buscar_valor(TLISTA *li, int valor); int inserir_inicio(TLISTA *li, int valor); int inserir_final(TLISTA *li, int val...
C
#include <stm32l4xx.h> unsigned int sysMillis = 0; void ClockInit(void); void TimerInit(void); void Delay(unsigned int duration); int main(void) { ClockInit(); TimerInit(); RCC->AHB2ENR = RCC_AHB2ENR_GPIOBEN | RCC_AHB2ENR_GPIOEEN; // enable GPIO Port B and E in general GPIOB->MODER &= ~GPIO_MODER_MODE2_1; ...
C
//x값, 계산값을 파일에 저장 #include "poly.h" void printfile(double x, double result){ FILE *fp = fopen("poly_result.txt", "a"); if (fp == NULL){ printf("File open error!\n"); return; } fprintf(fp, "%f %f\n", x, result); return; }
C
// // SortAlgorithms.c // D_week5 // // Created by runny on 2020/7/3. // Copyright © 2020 runny. All rights reserved. /** 几种常用的排序算法 首先明确一个概念 什么是逆序 假设我们定义元素从左到右依次递增 那么对于A[i]>A[j] ,i<j 则说明Ai Aj是逆序的 称(Ai,Aj)为一对逆序对 排序算法的目的就是消除所有的逆序对 */ #include "SortAlgorithms.h" typedef int ElementType; void swap(ElementT...
C
/* * Copyright (C) 2018 Bill Bao * * 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 t...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* test2.c :+: :+: :+: ...
C
#include<stdio.h> #include<string.h> int main() { char s[] = "hello"; char *p = strchr(s, 'l'); char *t = (char*)malloc(strlen(p) + 1); strcpy(t, p); printf("%s\n", t); free(t); return 0; }
C
/* main_T3.c, Tasks 3 and 4, H1b. Also used as input in Tasks 5-7. In this task, we use an equlibration scheme, based on scaling particle momenta and positions, to equlibrate the temperature and pressure in the system. We do this for T=500 degC and T=700 degC and P=1 bar. The difference between the two temper...
C
#include <stdio.h> #include <stdlib.h> #include <pthread.h> #include <time.h> // Matrixes int *A, *B, *C; // the number of threads int n; // 行列を一時配列で保管するため typedef struct { int A_rows; int B_columns; } Matrix_elem; void multi_mat_elem(Matrix_elem *m); // calc int main(int argc, char *argv[]) { int i, j, k = ...
C
/* 1-2 */ #include <stdio.h> #include <stdlib.h> #include <string.h> #define NAME_SIZE 100 typedef int element; typedef struct _Element { int id; char name[NAME_SIZE]; } Element; typedef struct _SortType { char menu; int sort; int length; Element *list; } SortType; void init(Sort...
C
#include "header.h" void kjob(char *arr){ ll n=strlen(arr); ll sn=-1; for(ll i=0;i<n;i++){ if(arr[i]==' '){ arr[i]='\0'; if(sn!=-1){ printf("invalid arguments to kill\n"); return; } sn=i+1; } } if(sn==-1){ printf("i...
C
#include "Chaining.h" HashTable* CHT_CreateHashTable(int TableSize){ HashTable* HT = (HashTable*)malloc(sizeof(HashTable)); HT->Table = (List*)malloc(sizeof(List)*TableSize); memset(HT->Table, 0x00, sizeof(List)*TableSize); HT->TableSize = TableSize; return HT; } Node* CHT_CreateNode(int Key, char* Value){ ...
C
/*1019. ֺڶ (20) ʱ 100 ms ڴ 65536 kB 볤 8000 B Standard CHEN, Yue һλֲȫͬ4λ Ȱ4ְǵٰǵݼ Ȼõ1ּ2֣õһµ֡ һֱظǺܿͣСֺڶ֮Ƶ6174 ҲKaprekar 磬Ǵ6767ʼõ 7766 - 6677 = 1089 9810 - 0189 = 9621 9621 - 1269 = 8352 8532 - 2358 = 6174 7641 - 1467 = 6174 ... ... ָ4λдʾڶĹ̡ ʽ һ(0, 10000)ڵN ʽ N4λȫȣһN - N = 0000 򽫼ÿһһֱ6174Ϊ֣ ʽעÿְ4λʽ 1 6767 1 776...
C
// socket编程udp客服端编写 // 1. 创建套接字 // 2. 为套接字绑定地址信息 // 3. 接收数据 // 4. 发送数据 // 5. 关闭套接字 #include<stdio.h> #include<stdlib.h> #include<unistd.h> #include<string.h>//sockaddr 结构体 / IPPRPTP_UDP #include<netinet/in.h> //包含一些字节序转换接口 #include<sys/socket.h>// 套接字接口头文件 int main(int argc,char *ar...
C
/****************************** genHTML.c *********************************** Student Name: Marshall Aaron Asch Student Number: 0928357 Date: March 14, 2017 Course Name: CIS*2750 Assignment: A3 Parses the config file (.wpml) into HTML with imbeded PHP NOTE: button, text form, radio fo...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* btree_insert_data.c :+: :+: :+: ...
C
// $Id: dataArray.h,v 1.1.1.1 2001/12/04 20:32:34 bob Exp $ /* 23 Aug 01 ... Alter how operators are applied to data arrays. 7 Jul 01 ... Import operators from distinct file,then revised. 28 Jun 01 ... Operator in place. 26 Jun 01 ... Row-major form for mgs version of sweeper. 15 Oct 98 ... Created in origi...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> int main(int argc,char *argv[]) { if(argc!=2) { printf("Use this format: <filename> \n"); return -1; } FILE *fp; char str[100]; if((fp=fopen(argv[1],"w"))==NULL) { printf("program can not open file for writing...
C
#include <ctype.h> #include <stdio.h> #include <string.h> /* what if we return a value inside a recursive function call? */ int TESTER(int k) { k += 1; if (k == 7) return 123; int j = TESTER(k); return k; } int main() { int i = TESTER(5); printf("%d\n",i); } /* as expected, return only sends value ...
C
// Copyright 2022 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 #include "client/api/json_parser/outputs/features.h" #include "client/api/json_parser/common.h" #include "core/models/outputs/features.h" #include "core/utils/macros.h" #include "utlist.h" /* "type": 0, "address": { "type": 0, "pubKeyH...
C
#include <stdio.h> #include "holberton.h" /** *print_triangle - Print a Triangle. *@size: integer. *Return: Always 0. */ void print_triangle(int size) { int f, c; if (size > 0) { for (f = 0; f < size; f++) { for (c = (size - 1); c > f; c--) { _putchar(' '); } for (c = 0; c <= f; c++) { _putcha...
C
// 例解UNIX/Linuxプログラミング教室 P99 #include <stdio.h> int check_bit(unsigned int x, int n) { return (x & (1 << n)) != 0; } int main() { for (int i = 0; i < 31; i++) { printf("%d\n", check_bit(0x20, i)); } return 0; }
C
/******************************************************************************* * Copyright (c) 2015 Intel Corporation * * 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.apa...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* lib.c :+: :+: :+: ...
C
#include<stdio.h> void main() { float marks; int index; printf("enter the marks obtained by the student:"); scanf("%f",&marks); index = marks/10; switch(index) { case 10 : case 9 : printf("A+"); ...
C
#include <stdlib.h> #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <string.h> float generateNum() { float a = 200; float result = ((float)rand()/(float)(RAND_MAX)) * a; result = result - 100; return result; } void generateNnumbers(int n) { FILE* nnumbers = fopen("temp/nnumbers", "w"); ...
C
#include<stdio.h> #include<stdlib.h> struct Tree{ int data; struct Tree* left; struct Tree* right; }; struct Tree* newnode(int data) { struct Tree* node = (struct Tree*)malloc(sizeof(struct Tree)); node->data = data; node->left = NULL; node->right = NULL; return node; }...
C
#include<stdio.h> #include<unistd.h> #include<fcntl.h> #include<string.h> struct admin{ int userID; // userID starts from 100 char username[30]; char password[15]; }; struct normalUser{ int userID; // userID starts from 100 char name[30]; char password[15]; int account_no; // account_no sta...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/msg.h> #include <sys/time.h> #include "commons.h" int server_qid, client_qid; FILE *outfile, *fp; void closeFiles() { fclose(fp); fclose(outfile); } void closeQueues() { if( msgctl(server_qid, IPC...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #define MAX_ALVOS 1000001 long long int busca_b(long long int raio, long long int alvos_raios[], long long int C, long long int T) { long long int e, m, d, soma=0; e = 0; d = C-1; if((sqrt(raio)==0...
C
#include<stdio.h> #include"infolink.h" int main(void){ ShotCL shot1 = make_cl_node("111", "hehe"); ShotCL shot2 = make_cl_node("222", "gogo"); ShotCL shot3 = make_cl_node("333", "world"); insert_cl_node(shot1); insert_cl_node(shot2); insert_cl_node(shot3); if(cl_is_empty()){ print...
C
#include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <math.h> #define MAXOP 100 #define MAXVAL 100 #define BUFSIZE 100 #define NUMBER '0' #define PRINT '?' #define DUPLICATE '!' #define SWAP '~' #define CLEAR '<' int getch(void); void ungetch(int); int getop(char s[]); void push(double f); double pop(v...
C
void nextPermutation(int* buf, int len) { // 1,2,3 // 1,3,2 int i = len - 1; while (i > 0 && buf[i] <= buf[i - 1]) { i--; } if (i == 0) { int a = 0; int b = len - 1; while (a < b) { int tmp = buf[a]; buf[a] = buf[b]; buf[b] = tmp; a++; b--; } return; } ...
C
#include <stdio.h> int main() { int v, lido, rs; scanf("%d", &v); lido = v; printf("%d\n", lido); rs = v - (v % 100); v -= rs; printf("%d nota(s) de R$ 100,00\n", (rs/100)); rs = v - (v % 50); v -= rs; printf("%d nota(s) de R$ 50,00\n", (rs/50)); rs = v - (v % ...
C
#include <stdio.h> int main(){ int c[5]; int i; for (i = 0; i < 5; ++i) { printf("Digite elemento %d do vetor: ", i); scanf("%d", &c[i]); } printf("\nElemento Valor\n"); for (i = 0; i < 5; ++i) printf("%d %d\n", i, c[i]); }
C
#include <stdio.h> /* printf */ #include <assert.h> /* assert */ #include <limits.h> /* INT_MAX */ static long *SumPairsToLong(int ints[], size_t size); static void TestSumPairsToLong(); int main() { TestSumPairsToLong(); return (0); } static long *SumPairsToLong(int ints[], size_t size) { long *longs = (lon...
C
/*Author: Galdima Ahmed; Assignment: usinf for loop to print a 2d chess board*/ #include<stdio.h> int main(void) { printf("+----+----+----+----+----+----+----+\n"); for (int row = 8; row >= 1; row--) { for (char column = 'a'; column < 'h'; column++) { printf("| %c%d ", column, row); } prin...
C
#ifndef __linux__ #include <stdlib.h> #include <stdio.h> #include <windows.h> #include "rs232win.h" T_RS232WIN_INSTANCE* instance; unsigned char rs232winConfigure(); unsigned char rs232winFlush(); void getLastSystemError(int* code, char* description); //System error variables int sysErrCode; unsigned char sysErrDe...
C
#include<stdio.h> #include<stdlib.h> #include<time.h> int main(){ int teste, t, a, b, n, j; n= 1000; j=1; srand(time(NULL)); while(j==1){ b=rand() % (n+1); printf("\nAdivinhe o numero gerado de 0 a 1000:\nPara desistir, escreva uma letra.\n"); teste= scanf("%d", &a); if(teste != 1){ ...
C
//////////////////////////////////////////////////////////////////////////////// // Main File: testcases // This File: linkedlist.h // Other Files: 537malloc.c 537malloc.h range_tree.c range_tree.h // linkedlist.c // Semester: CS 537 Fall 2018 // // Author: Youmin ...
C
#define F_CPU 16000000UL #include <avr/io.h> #include <util/delay.h> #include <avr/interrupt.h> #include "libuart.h" #define CHANNEL_1 0 #define CHANNEL_2 (1 << MUX0) #define ADMUX_DEFAULT (1 << REFS0) | (1 << ADLAR) volatile unsigned char receivedByte; int main() { DDRB |= 1 << PINB1; // 1. baud rate // 2...
C
/*! * \file * \brief Ecg4 Click example * * # Description * This example reads and processes data from ECG 4 clicks. * * The demo application is composed of two sections : * * ## Application Init * Initializes the driver, sets the driver handler and enables the click board. * * ## Application Task *...
C
#include <stdio.h> #include <stdlib.h> #include <sys/time.h> #include <limits.h> #define PI 3.141592653 #define N 20000000 double melo() { long n = N; long count = 0; double x, y; srand(time(NULL)); while(n-- > 0) { x = rand() / (double)INT_MAX * 2; y = rand() / (do...
C
#include <obs-module.h> #include <graphics/vec2.h> #include "easings.h" #define S_DIRECTION "direction" struct slide_info { obs_source_t *source; gs_effect_t *effect; gs_eparam_t *a_param; gs_eparam_t *b_param; gs_eparam_t *tex_a_dir_param; gs_eparam_t *tex_b_dir_param; struct vec2 dir; bool slide_in; }; s...
C
// // BinaryTree.h // Binary Tree // // Created by Jordan Thomas on 10/24/14. // Copyright (c) 2014 Jordan Thomas. All rights reserved. // #ifndef __Binary_Tree__BinaryTree__ #define __Binary_Tree__BinaryTree__ #include <stdio.h> typedef struct list_node node; typedef struct binary_tree { node* root; }AVL...
C
#include "search_algos.h" /** * print_array - print array in rage * @array: integer array * @head: head of the array or sub array * @tail: tail of the array or sub array * Return: Void */ void print_array(int *array, int head, int tail) { int i; printf("Searching in array: "); if (head == tail) { printf...
C
#include <stdio.h> #include "list.h" int main(void) { int ret = 0; int num1 = 19; int num2 = 29; int *iptr1 = &num1; int *iptr2 = &num2; List *list; ListElmt *element1; ListElmt *element2; /* 分配链表头的空间 */ list = (List *)malloc(sizeof(List)); if(list == NULL) { printf("malloc failed.\n"); return -1...
C
/* parsers.c */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include "./include/irc-datatypes.h" #include "./include/parsers.h" #include "./include/arr.h" int parse_irc_packet(char* buf, IRCPacket* packet) { if (strstr(buf, "!") == NULL || strstr(buf, "@") == NULL) { return 0; ...
C
#include "config.h" #include <windows.h> #include <stdio.h> #include <string.h> #include <stdbool.h> #include "log.h" #include "pe.h" static int getTextSectionOffset(PIMAGE_SECTION_HEADER pSectionHeader , int NumberOfSections) { int n = NumberOfSections; while(n > 0) { if( !strcmp((char*)pSection...
C
#include <stdio.h> #include <heapapi.h> #include <stdlib.h> #include "Status.h" #include "Heap.h" #define SWAP(a, b) \ { \ heaptype c; \ c = a; \ a = b; \ b = c; \ } //定义游标temp struct Temp { heaptype num; int index; } temp; void InitHeap(str...
C
#include "comm.h" void *ppu_pthread_function(void *thread_arg) { thread_arg_t *arg = (thread_arg_t *) thread_arg; unsigned int entry = SPE_DEFAULT_ENTRY; if (spe_context_run(arg->ctx, &entry, 0, (void*) arg->id, NULL, NULL) < 0) { perror("PPU:Failed running context"); exit(1); } pthread_exit(NULL); } ...
C
#include<stdio.h> int main() { printf("NAMA : Diaz Dwi Kurniawan\n"); printf("NIM : F1B019040\n"); printf("KELOMPOK : 8\n"); int a [6]; printf("Masukkan nilai 1 :"); scanf("%d",a); printf("Masukkan nilai 2 :"); scanf("%d",a); printf("Masukkan nilai 3 :"); scanf("%d",a); printf("Masukkan ni...
C
/* rekotoppm - convert RKP and REKO cardsets to PPM graphics format Copyright (C) 2004 by Dirk Stcker <doc@dstoecker.de> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the L...
C
#include <stdlib.h> #include <assert.h> #include <stdio.h> #include "plateau.h" #include "plateaupions.h" PlateauPions * plateau_pions_new (int longueur, int largeur) { PlateauPions * self = calloc (1, sizeof (PlateauPions)); plateau_pions_init (self, longueur, largeur); return self; } void plateau_pions_init ...
C
#include <fcntl.h> #include "../apue.h" int main(int argc, char **argv) { int fd = open(__FILE__, O_RDONLY); // 注意,stat 中是不包含文件名的。因为 linux 中一个文件可以有多个文件名 struct stat s; if (fstat(fd, &s) == -1) err_quit("failed fstat [%d]", __FILE__); char filePath[MAXLINE]; if (fcntl(fd, F_GETPATH, fi...
C
#include<stdio.h> int main(void) { int i; int h1,m1,s1; int h2,m2,s2; int sum; for(i=0; i<3; i++) { scanf("%d %d %d",&h1,&m1,&s1); scanf("%d %d %d",&h2,&m2,&s2); sum = (h2-h1)*3600 + (m2-m1)*60 + (s2-s1); printf("%d ",sum/3600); sum %= 3600; printf("%d ",sum/60);...
C
#include <unistd.h> #include <stdio.h> #include <sys/socket.h> #include <stdlib.h> #include <netinet/in.h> #include <string.h> #include <sys/select.h> #include <fcntl.h> #include <errno.h> #include <string.h> #include <sys/time.h> #include <signal.h> struct sockaddr_un { sa_family_t sun_family; char sun_path[108]; }...
C
#include "ft_printf.h" #include <stdio.h> static void ft_putnbr(long n) { if (n >= 10) { ft_putnbr(n / 10); ft_putnbr(n % 10); } else ft_putchar(n + '0'); } static long ft_nbrlen(long n) { long res; res = 0; if (n == 0) return (1); while (n != 0) { n /= 10; res++; } return (res); } void ft_pri...
C
#include <stdio.h> int even(int); int main() { int a; printf("Enter a integer: "); fflush(stdout); scanf("%d", &a); even(a) ? printf("%d is an even number\n", a) : printf("%d is an odd number\n", a); return 0; } int even(int x) { return x % 2 == 0; }