language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include "player.h" #include "rich.h" #include "map.h" #include "printMap.h" #include "util.h" #include <stdio.h> #include <string.h> #ifdef __cplusplus extern "C" { #endif static void buyLand(Place *place, Player *player); static void upgradeLand(Place *,Player*); #define MIN_DICE_VALUE 1 #define MAX_DICE_VALUE 6...
C
// EXERCICIO 1 DA AC1 #include <stdio.h> #include <stdlib.h> //Um recipiente com gua foi colocado em um ambiente com temperatura monitorada. Faa um //programa que l a temperatura do ambiente e informa se gua o recipiente contm gua em estado //lquido, gelo, ou vapor. int main() { int recipiente; int ambiente; pri...
C
#include <stdio.h> unsigned int hz2add(unsigned char hz[3]) { return ((hz[1]-0xA0-1) + 94*(hz[0]-0xB0+15))*32; } void hz2buf(unsigned char hz[3], FILE* fp, unsigned char buf[32]) { int offset; offset = hz2add(hz); fseek(fp, offset, SEEK_SET); fread(buf, 1, 32, fp); } void print(unsigned ...
C
static void putdeps(SemVars *v) { if(v != nil && --v->ref == 0){ free(v->p); free(v->f); free(v); } } /* create a new copy (if necessary) */ static SemVars * depmod(SemVars *a) { SemVars *b; if(a->ref == 1) return a; assert(a->ref > 1); b = emalloc(sizeof(SemVars)); b->p = emalloc(-(-a->n & -SEMVARSBLOCK...
C
/************************************************************************************************** * * Copyright (c) 2007 Palm Computing, Inc. or its subsidiaries. * All rights reserved. * *************************************************************************************************/ /** @ingroup IRCommunicat...
C
#include <stdio.h> #include <time.h> #include <stdlib.h> int main() { clock_t start, end; int arr[80000] = { 0, }; //Ұ 1 迭 long long i, j, n, temp = 0; start = clock(); n = sizeof(arr) / sizeof(int); // n=40000/4=10000 srand(time(NULL)); // Լ. for (i = 0; i < n; i++) arr[i] = (rand() % 80000)+1; //1 1 ...
C
/********************************************************************************************** * Programmer: Manuel Berrueta * * WSU ID: 011585195 * * ...
C
#include <windows.h> #include <stdio.h> #include <tchar.h> #include <time.h> #define MAX_BUF 1024 #define pipename "\\\\.\\pipe\\qemu" void delay(int milliseconds); int main() { HANDLE pipe = CreateFile(pipename, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); if (pipe == INVALID_HANDLE_VALUE...
C
#include<stdio.h> #include<stdlib.h> #include<time.h> unsigned long long int fibonacci(int n); int main(void) { int n, N; printf("Enter number: "); scanf("%d", &N); for (n = 0; n <= N; n++) { printf("%d. Fibonacci Number: %llu\n", n, fibonacci(n)); } return 0; ...
C
#include<stdio.h> #include <stdlib.h> #include <time.h> #define STACK_INIT_SIZE 100 //存储空间初始分配量 #define STACKINCREMENT 10 //存储空间分配增量 typedef char SElemType; typedef struct Sq_Stack { SElemType *base; SElemType *top; int stacksize; } SqStack;//存储运算数和运算符的结构体 typedef enum { OK, ERROR, OVERFLOW,...
C
#include <stdio.h> int main() { int counter = 0; int sum = 0, current = 0; /*while (counter < 5) { printf("Enter number: "); scanf("%d", &current); sum += current; ++counter; }*/ for (counter; counter < 5; ++counter) { printf("Enter number: "); ...
C
#include <pspsdk.h> #include <pspsysclib.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdarg.h> typedef struct { char *buf; const size_t *len; size_t cpylen; } xprintf_ctx; static void snprnt_cb( void *ctx, int ch ) { if( ch == 0x200 || ch == 0x201 ) return; ...
C
/* ** tools.c for in /home/thauvi_a/rendu/psu/PSU_2016_myirc/src ** ** Made by Alexandre Thauvin ** Login <thauvi_a@epitech.net> ** ** Started on Sun May 22 15:16:58 2017 Alexandre Thauvin ** Last update Sun May 22 15:16:59 2017 Alexandre Thauvin */ #include <stdio.h> #include <stdlib.h> #include "server.h" void ...
C
// Ľ㼰زΪһͷļ #ifndef _BINARYTREE_H #define _BINARYTREE_H // Ľ typedef struct btreenode { char data; // struct btreenode *lchild; // ָ struct btreenode *rchild; // Һָ }btnode, *btnodePoint; // עbtnode, *btnodePoint // btnodeǽṹbtnodePointǽṹָ // btnode *btbtnodePoint btǵȼ۵ģbtǽṹָ // http://blog.sina.com.cn/s/blog_8...
C
/* Autor(es): Patrícia da Silva Ramos Data de Criação: 02/11/2020 Data de Atualização: 02/11/2020 Nome: Distância Entre Dois Pontos Objetivos: Leia os quatro valores correspondentes aos eixos x e y de dois pontos quaisquer no plano, p1(x1,y1) e p2(x2,y2) e calcule a distância entre eles, mostrando 4 casas decimai...
C
#include "param.h" #include "types.h" #include "stat.h" #include "user.h" // printf() #include "fs.h" #include "fcntl.h" #include "syscall.h" #include "traps.h" #include "memlayout.h" char buf[512]; // void // wc(int fd, char *name) // { // int i, n; // int l, w, c, inword; // // l = w = c = 0; // inword = 0;...
C
/* Q10. Access 2D array Element using pointer*/ #include<stdio.h> int main() { int arr[3][4] = {1,2,3,4, 5,6,7,8, 9,10,11,12}; int (*p)[4]; p = arr; printf("sizeof(p) %lu\n",sizeof(p)); printf("sizeof(*p) %lu\n",sizeof(*p)); printf("sizeof(**p) %lu\n",sizeof(**p)); printf("Values of p = %p\n",p); pr...
C
#include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #include <stdio.h> void handleExit(status) { printf("I got exit sys call baba! \n"); } void handler_2(status, arg) { printf('exited on status %d \n', *status); } int main() { // atexit(&handleExit); on_exit(&handler_2, "kall"); ex...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> int main (int argc, char *argv[]) { if (argc < 4) { fprintf (stderr, "usage: %s C n over-subscription\n", argv[0]); exit (1); } long int C = atol (argv[1]); /* capacity */ int n = atoi (argv[2]); /* number ...
C
#define PROGRAM_NAME "mesg" #define PROGRAM_VERSION "1.0" #define PACKAGE_NAME "Unitrix usr.bin" #define COPYRIGTH_HOLDER "Bartosz Mierzynski" #define COPYRIGTH_YEAR "2019" #define LICENSE_ABBREVIATION "none" #define LICENSE_LINE "" #include <getopt.h> #include <locale.h> #includ...
C
#include "Long.h" #define import #include "Object.h" #include "Number.h" #include "Hash.h" /*! @startuml !include Number.c namespace aeten { class Long implements Number { + {static} Long(int value) <<constructor>> + {static} fromNumber(Number value) <<constructor>> + bool equals(Object other) <<override>> +...
C
#include <stdio.h> int sum(int a,int b); int main() { int (*p)(int x,int y); int result; p=sum; result=(*p)(10,20); printf("%d",result); return 0; } int sum(int a,int b) { return a+b; }
C
#include "colors.h" extern void alloc_tex(); extern void render(); double modOne(double a) { return a - floor(a); } void hsv_to_rgb(double hue, double sat, double var, rgb_t *pixel) { hue = modOne(hue); sat = modOne(sat); var = modOne(var); int h_i = (hue*6); double f = hue*6 - h_i; double p = var*(1-sat); ...
C
#include <stdio.h> #include <stdint.h> #include <string.h> #include <stdlib.h> #include <errno.h> #include <sys/socket.h> #include <linux/netlink.h> static int open_nl( int grps ) { struct sockaddr_nl nl; int fd; fd = socket(PF_NETLINK,SOCK_DGRAM,NETLINK_KOBJECT_UEVENT); if (fd < 0) { perror("socket()...
C
/** * state.c * kevin lynx * 2.15.2010 */ #include "state.h" #include <stdlib.h> #include <stdio.h> #define MALLOC( type ) \ (type*) malloc( sizeof( type ) ) #ifdef DEBUG static int id_index = 0; static int gen_id() { return id_index++; } #endif struct state *state_new() { struct state...
C
#include <omp.h> #include <stdio.h> double **allocate_matrix(int size) { double **matrix = (double **)malloc(size * sizeof(double *)); for (int i = 0; i < size; i ++) { matrix[i] = (double *)malloc(size * sizeof(double)); } return matrix; } double **clean_matrix(int size) { double **matrix...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include "matrixlib.h" #include <complex.h> double q6matnorm2(int n,double A[n][n]){ double B[n][n],y[n],yk[n]; bzero(B,sizeof(double)*n*n); for(int k=0;k<n;k++){ // B = AT A for(int i=0;i<n;i++){ for(int j=0;j<...
C
/* Simple LED task demo, using timed delays: * * The LED on PC13 is toggled in task1. */ #include "FreeRTOS.h" #include "task.h" #include <libopencm3/stm32/rcc.h> #include <libopencm3/stm32/gpio.h> #include <libopencm3/stm32/usart.h> #include "f303_printf.h" extern void vApplicationStackOverflowHook( xTaskHand...
C
#include <netdb.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <ctype.h> #include <string.h> #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <fcntl.h> #include "ini/ini.h" #define SA struct sockaddr #define IpSv "127.0.0.1" int puertoSv; t...
C
#include <stdio.h> #include <stdlib.h> int main() { int a,i,z,space; printf("enter the number:"); scanf("%d",&a); for(i=a;i>=1;i-=2) { for(space=z-i;space<=a;space+=2) printf(" "); for(z=i;z<=a;z++) printf("*",z); printf("\n"); } return 0; }
C
/********************************************************************/ /* */ /* Module : FpArith */ /* */ /* Description : ...
C
#include "header.h" #define OUTPUT_FILE "processes.out" // Node struct for a linked list to implement queue typedef struct node { process *proc_node; struct node *next; } node; // Global variables node *front = NULL; node *rear = NULL; FILE *ofp = NULL; // For queue implementation: creates a node that linkes proce...
C
/* Copyright 2015 Lyncos Technologies S. L. * * 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 ...
C
// // constructive.c // HO-Project1 // // Created by Jens Nevens on 13/04/16. // Copyright © 2016 Jens Nevens. All rights reserved. // #include <stdlib.h> #include <stdio.h> #include <stdlib.h> #include <time.h> #include <math.h> #include <string.h> #include "utils.h" #include "constructive.h" /*****************...
C
#include <stdio.h> int main(void) { char fir_name[10], las_name[10]; printf("Enter your name(first last):"); scanf("%s, %s", fir_name, las_name); printf("%s,%s\n", fir_name, las_name); printf("%5s,%-5s", fir_name, las_name); return 0; }
C
#include <config.h> /*****************************************************************/ /*** ***/ /*** Play out a file on OpenBSD ***/ /*** (conf/linuxplay.c with changes) ***/ /*** ...
C
#include <stdio.h> #include <math.h> // passing function pointers double aFunc(double a, double b); double bFunc(double a, double b); double cFunc(double (*fptr)(double,double), double a, double b); void main(int argc, char *argv){ double a = 2.0,b = 5.0; double c; c = cFunc(&aFunc,a,b); printf("c = %4.2f\n...
C
/* cmd_free The free command accepts a single argument which is the address * of a region of memory previously allocated using malloc and then * call free to deallocate that region of memory. The address * is to be specified either as a decimal integer constant (of * arbitrary length) or as a hexadecimal number (i...
C
#include <zephyr.h> #include <device.h> #include <devicetree.h> #include <drivers/gpio.h> /* The devicetree node identifier for the "led0" alias. */ #define LED0_NODE DT_ALIAS(led0) #define LED1_NODE DT_ALIAS(led1) #define LED0 DT_GPIO_LABEL(LED0_NODE, gpios) #define PIN0 DT_GPIO_PIN(LED0_NODE, gpios) #define LED1 ...
C
#include "read.h" #include <stdio.h> #include <string.h> #include "structures.h" #include "tree.h" void prompt() { int choice; node *tree = create_new_tree(); do { printf("Enter a choice (1, 2, -1): "); scanf("%d", &choice); switch(choice) { case 1: { int number; char hostname[200]; char ip[3...
C
#pragma once #include "FidelisDuino_Output.h" #include "FidelisDuino_EdgeDetection.h" FidelisDuino::IO::Output::DigitalOutput _DigitalOutput; FidelisDuino::EdgeDetection::TransitionDetection startedDetection; void setup() { } void loop() { _DigitalOutput.Loop([](bool OnChangeState)->void { if (OnChangeState) ...
C
#include "holberton.h" /** *_strcmp - do something *@s1: do something *@s2: do something *Return: something */ int _strcmp(char *s1, char *s2) { int i = 0, n = 0; while (s1[i] != '\0' && s2[i] != '\0') { if (s1[i] == s2[i]) { n = 0; } else { n = (s1[i] - s2[i]); break; } i++; } return (n); }
C
/* ----------------------------------------------------------- ** Functions to manipulate the local WebDAV locks base. ** ** Author : Manuele Kirsch Pinheiro ** Email: Manuele.Kirsch_Pinheiro@inrialpes.fr / manuele@inf.ufrgs.br ** Project CEMT - II/UFRGS - Opera Group/INRIA ** Financed by CNPq(Brazil)/INRIA(France) C...
C
//******************************************************************************************************* // Filename: main.c // Lab Project: 1 // AUTHORS: // Abdulla Al Braiki (ayalbrai@asu.edu) // Zachary Priddy (zpriddy@asu.edu) (http://www.zpriddy.com) // Course: CSE325 Embedded Microprocessor Systems // S...
C
#include <stdio.h> #include <unistd.h> #include <stdio.h> #include <string.h> /* * Commentary enhanced version of exercise 5.0a * @Author: Julian G. West */ int main(){ exercise5_1(); return 0; } int exercise5_0c(){ int k; printf("An int please. \n>>"); scanf("%d", &k); return k; } void exercise5_0(){ ...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> int main () { char *ptr; ptr = (char *) malloc(10); char *ptr_dest; ptr_dest = (char *) malloc(10); ptr[0] = '1'; ptr[1] = '2'; *(ptr+2) = '3'; *(ptr+3) = '4'; ptr[4] = '5'; ptr[5] = '6'; ptr[6] = '7'; ptr[7] = '8'; p...
C
/* From:ITC 6 Pointer related defects 6.1 Bad cast of a function pointer 6.1.9 return type function union * and function pointer: union */ int rand(void); typedef union { int a; int b; } func_pointer_009_u_001; func_pointer_009_u_001 * func_pointer_009_func_001 (void) { int flag = rand(); flag ...
C
/** @file SecureAuthentication.h * @brief Contain the header of secure functions * * These function can be call directly by the secure application * or indirectly thru a veneer table by the non-secure application * * @author Quang Hai Nguyen * * @date 29.05.2019 - initial * * @bug No known bugs. */ #if...
C
#include <stdio.h> void trojuhelnik(int h) { int pocetHvezd; for (int i = 1; i <= h; i++) { for (int j = i; j < h; j++) { printf(" "); } for (int j = 0; j < i; j++) { printf("* "); } printf("\n"); } } ...
C
#include<stdio.h> #include<math.h> int main() { double pi=2.0*acos(0.0),a; while(scanf("%lf",&a)!=EOF){ printf("%.3lf %.3lf %.3lf\n",(1-sqrt(3)+pi/3)*pow(a,2),4*(sqrt(3)/2+pi/12-1)*pow(a,2),4*(1-sqrt(3)/4-pi/6)*pow(a,2)); } return 0; }
C
#include<stdio.h> #include<stdlib.h> int main() { int i,b[] = {10,20,30,40}; int *bptr = &b; printf("Array subscript notation\n"); for (i = 0; i <= 3; i++) { printf("%d\n",b[i]); } printf("\n\nPointer/offset notation where the pointer is the array name\n"); for (i = 0; i <= 3; i++) { printf("*<b+%d> = %d\...
C
#ifndef _SYSERVER_LIST_H_ #define _SYSERVER_LIST_H_ #include "mempool.h" typedef struct sy_list_node{ struct sy_list_node* next; struct sy_list_node* prev; char data; }sy_list_node_t; #define SY_LIST_WIDTH(type) (2 * sizeof(sy_list_node_t*) + sizeof(type)) typedef struct { int size; sy_list_...
C
/* file: setOps.c */ #include <stdio.h> #include <math.h> #include "set.h" #include "smallSetOps.h" unsigned int y; void CreateSet(Set S, unsigned int UnivSpace) { int i,N; N=ceil(((float)UnivSpace)/((float)(8*sizeof(unsigned int)))); for(i=0;i<N;i++) S[i]=Create(); } void AddElementSet(unsigned int x, Set S, u...
C
/* BEGIN Via MAIN */ /* * Via.c is a tiny,simple,iterative HTTP/1.0 Web server * that uses the GET method to serve static and dynamic * content. * Author:alex kinhoom */ #include "viafunc.h" /* * INIT FUNCTION LIST */ void viado(int fd); /* void read_requesthdrs(rio_t * rq); void parse_uri(char *) */ int main(...
C
#include<stdio.h> int num(int n) { if(n<=3) return 1; return num(n-1)+num(n-3); } main() { int n,sum; scanf("%d",&n); sum=num(n); printf("%d\n",sum*2); }
C
#include "string_render.h" #include "main.h" #include <mcufont.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <stddef.h> #define BUFFER_SIZE (uint16_t)(BUFFER_HEIGHT*BMP_WIDTH) const struct mf_font_s *font; options_t options; state_t state = {}; int font_height = 48; unsigned char text_rende...
C
#ifndef BROWSE_H #define BROWSE_H #define BROWSE_ACTION_OK 0 #define BROWSE_ACTION_SKIP 1 #define BROWSE_ACTION_ABORT 2 /** * Callback function for directories. * \ret BROWSE_ACTION_OK use directory, BROWSE_ACTION_SKIP don't browse this directory, BROWSE_ACTION_ABORT abort the whole process */ typedef int (browse_...
C
#include <stdio.h> #include <stdlib.h> #include "ABB.h" #include "comparavel.h" #include "palavra.h" #include "string.h" //CRIA ELEMENTO DO TIPO N TNo* criarNo(void* elem){ TNo* NovoNo = malloc(sizeof(TNo)); NovoNo->dadoNo = elem; NovoNo->filhoDireito = NULL; NovoNo->filhoEsquerdo = NULL; return No...
C
#include <pthread.h> #include <semaphore.h> #include <stdio.h> #include <stdlib.h> #define N 1000000 int count = 0; void *thread_count(void *a) { int i, tmp; sem_t *sem = a; for (i = 0; i < N; i++) { sem_wait(sem); tmp = count; tmp = tmp + 1; count = tmp; sem_pos...
C
#include <stdio.h> //1 void main () { int x=1,y=0; while (x!=0) {scanf ("%d",&x);y+=x;} printf("%d\n", y); } //2 void main () { int x=1,y=0; while (x!=0) {scanf ("%d",&x);if (x>y) y=x;} printf("%d\n", y); } //3 void main () { int x=1,y=0,w=-1; while (x) {scanf ("%d"...
C
#include "darray_int.h" #include <stdlib.h> #include <stdio.h> struct darray{ int m_initial_capacity; int m_capacity; int m_index; int* m_Arr; }; AdtStatus darrayCreate(darray** dArr, size_t initial_capacity){ darray* da; da=(darray*)malloc(sizeof(darray)); if(da){ if((da->m_Arr=(int*)malloc(initial_capa...
C
/** @file anglesg.h * @brief Function prototypes for the * orbit determination using three optical sightings. * * This header file contains the prototypes for the * orbit determination using three optical sightings. * * @author Miguel Alonso Angulo. * @bug No known bugs. */ #ifndef _ANGLESG...
C
#include <stdlib.h> #include <stdio.h> #include <time.h> #include "libtz.h" void print_tm(struct tm* tm, const char *pre) { printf("%30s: %02i.%02i.%04i %02i:%02i:%02i %4s %+3li:%02li %1i\n", pre, tm->tm_mday, tm->tm_mon, 1900+tm->tm_year, tm->tm_hour, tm->tm_min, tm->tm_sec, tm->tm_zone, tm->tm_gmtoff/3600, ((tm->tm...
C
#include <stdio.h> #include <math.h> void array_ausgeben(int *array, int groesse) { for(int i = 0; i < groesse; i++) { printf("%d ", array[i]); } } void array_vorne(int *array, int groesse) { int erstezahl = array[0]; for(int i = 0; i < groesse; i++) { array[i] = array[i + 1]; ...
C
/* * main.c * * Created on: Oct 26, 2016 * Author: Nick Pederson * MCU: ATMEGA128 * Purpose: This code reads the mode from the push buttons and displays them using the bar graph. When the encoders are turned it adds or subtracts the number displayed on the 7 segment; the minimum and maximum valu...
C
#include "myapue.h" #include <sys/select.h> int main(void) { int retvalue, n, fd[2]; pid_t pid; char line[MAXLINE]; fd_set writefds; struct timeval timeout; if (pipe(fd) < 0) err_sys("pipe error"); if ((pid = fork()) < 0) { err_sys("fork error"); } else if (pid > 0) { /...
C
/*xxx*/ #include<stdio.h> #include<math.h> void name1 (int,double); void name (int,double); main() { int number=0; double a,total=0; char check; do{ if(number<10) printf("Enter cost of item: "); else{ printf("This Program Will Only Allow A Ma...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* modifier.c :+: :+: :+: ...
C
#include <stdio.h> /** *main - Entry point * *Description: This program will print all letters in lowercase except for *q and e. *Return: 0 upon successful completion */ int main(void) { int n1; int n2; for (n1 = 0; n1 < 100; n1++) { for (n2 = n1 + 1; n2 < 100; n2++) { putchar((n1 / 10) + '0'); putchar((n1 % 10)...
C
#include <stdio.h> #include <math.h> main() { //Variables int contador; //Inicializacion contador=0; //Programa //Bucle While printf("Bucle while\n"); while(contador<58) { if (contador>=1) { printf("%d\n",contador); } contador++; } }
C
/** * aligned_alloc (since C11) * Defined in header <stdlib.h> * void *aligned_alloc( size_t alignment, size_t size); (since C11) * Allocate size bytes of uninitialized storage whose alignment is specified by * <alignment>. The size parameter must be an integral multiple of <alignment>. * aligned_alloc ...
C
#include <stdio.h> #include <stdlib.h> #include <malloc.h> #include <string.h> #define LEN sizeof(STUDENT) typedef struct { long snum; char sname[10]; char ssex; int sage; struct STUDENT *next; }STUDENT; void print(STUDENT *head) { STUDENT *p1; p1 = head; while(p1!=NULL) { ...
C
#include"holberton.h" /** * string_toupper - fonction toupper * @a: pointer * Return: pointer in return */ char *string_toupper(char *a) { int i; for (i = 0; a[i] != 0; i++) { if (a[i] > 90 && a[i] != 10) { a[i] = a[i] - 32; } } return (a); }
C
#include <stdio.h> #include <stdlib.h> #include <assert.h> int STD_SKI_ENABLED = 0; // Default disabled int STD_SKI_FORK_ENABLED = -1; int STD_SKI_CPU_AFFINITY = -1; int STD_SKI_HYPERCALLS = -1; int STD_SKI_SOFT_EXIT_BARRIER = -1; int STD_SKI_USER_BARRIER = -1; int STD_SKI_TOTAL_CPUS = -1; int STD_SKI_TEST_NUMBER = ...
C
/** * \file * ADC.c * * \authors * Dario Hoyo * Alan Duran * \date * 19/03/18 * * */ #include <ADC.h> #define LIMIT 0xFF #define SHIFT 8 void ADC0_init(const ADC_ConfigType* ADC_Config) { ADC0_clockGating(); /**Activates System Clock Gating for ADC0*/ setRegisters(ADC_Config); /**Write...
C
#include <stdio.h> int main(void) { int mc, ip, ics, ls; char *mc_status, *ip_status, *ics_status, *ls_status; char name[20], sid[20]; printf("Student Name: "); fgets(name, 20, stdin); printf("Student ID: "); fgets(sid, 20, stdin); puts("\nPlease enter your marks for following subjects"); printf("Mathema...
C
#include <TRandom.h> #include <TStopwatch.h> #include <AliFMDFloatMap.h> Float_t TestValue(UShort_t d, Char_t r, UShort_t s, UShort_t t, Float_t v) { return d * 1000000 + ((r=='I')+1) * 100000 + s * 1000 + t + v; } struct TestOne : public AliFMDMap::ForOne { Bool_t operator()(UShort_t d, Char_t r, UShort_t s, ...
C
// // HostInfo.c // // Use WinSock gethostbyX functions to lookup a host // name or IP address and print the returned hostent // structure; // // // Pass a server name or IP address on the command line. // // Examples: // HostInfo www.idgbooks.com // HostInfo www.sockets.com // Hos...
C
void main() { double kilometers,total; int bag; printf("Welcome to the taxi \n"); printf("How far you have to travel in kilometers?\n"); scanf_s("%lf", &kilometers); printf("How many bags do you have?\n"); scanf_s("%d", &bag); total = bag * 2 + kilometers * 1.30 + 10.20 ; printf("For this trip you have to pa...
C
/*Insert any value at tenth(10th) index of the array ..... Razia Sultana Himu ID-1915002542 */ #include<stdio.h> int main() { int a[100]={10,20,30,40,50,60}; int i=0; printf("Before Adding value to that the Last Index: \n\n"); for(i=0;i<100;i++){ printf("%d",a[i]); } printf("\n\n insert a value at the last...
C
#include<stdio.h> #include<conio.h> void main() { int num,expo; long double res=1; printf("Enter Number and the power"); scanf("%d%d:,&num,&expo); while(expo!=0) { res*=num; --expo; } printf("Output= %Lf",res); getch(); }
C
#include<stdio.h> #include<time.h> #include<stdlib.h> #include<string.h> #include<ctype.h> #define W 20 #define H 15 #define STIMES 1000000 int RANGE; /* Used to make choices*/ /* Data: Column, row number and respective value*/ struct data{ int col, row, value; }; int map[H][W],map1[H][W]; /* Map data*/ struct data o...
C
#ifndef EV_RWLOCK_H_INCLUDED #define EV_RWLOCK_H_INCLUDED #include <sys/cdefs.h> #include <stdlib.h> #include <stdbool.h> #include <pthread.h> #include <ev_include.h> typedef struct ev_rwlock_s* ev_rwlock_type; __BEGIN_DECLS /* * ### ev_rwlock_type ev_rwlock_init(ev_rwlock_type s); * DESCRIPTION: * Allocate...
C
#include "pid.h" //===================函數定義======================== /**************************************************** *說 明: * (1)PID控制器預設為PI調節器 * (2)使用了條件編譯進行功能切換:節省計算時間 * 在校正PID參數時,使用巨集定義將PID_DEBUG設為1; * 當參數校正完成後,使用巨集定義將PID_DEBUG設為0,同時,在初始化時 * 直接為p->a0、p->a1、p->a2賦值 *******...
C
int main() { printf("Starting Addition Benchmark\n"); int i; for(i = 0; i < 3; i++) { int val = 0; #pragma CGRA for(int j = 0; j < 256; j++) { val = val + j + i; } printf("Result = %d\n", val); } printf("Addition Benchmark Complete\n"); printf("Starting Multiplicaiton Benchmark\n"); for(i = 0; ...
C
#include "homework.h" #include <stdio.h> #include <stdlib.h> #include <pthread.h> #define isColored(img) (img->pic_type == 6) int num_threads; int resize_factor; void readInput(const char * fileName, image *img) { //Open input file FILE *input_file = fopen(fileName, "rb"); //Read he...
C
#include <stdio.h> #include <string.h> int main(){ char cmd[50][50]; int N; scanf("%d",&N); for(int i = 0 ; i < N ; i++){ scanf("%s",cmd[i]); } int len = strlen(cmd[0]); for(int j = 0 ; j < len ; j++){ for(int i = 0 ; i < N ; i++){ } } return 0; }
C
/* * Reverses a series of numbers. Uses a macro for the size of numbers. */ #include <stdio.h> #define LEN (int) (sizeof(a) / sizeof(a[0])) int main() { int a[10], i; printf("Enter %d numbers: ", LEN); for(i = 0; i < LEN; i++) scanf("%d", &a[i]); printf("In reverse order:");...
C
#include <stdint.h> #include "memory.h" uint8_t my_itoa(int32_t data, uint8_t * ptr, uint32_t base) { *ptr = 0; uint8_t len = 1; uint8_t sign = 0; //for +ve if (data < 0) { sign = 1; //for -ve sign data *= -1; } do { *(ptr+len++)= '0' + (data%base); }while(data /= base); if(sign) { *...
C
#ifndef NPY_SIMD #error "Not a standalone header" #endif #ifndef _NPY_SIMD_SSE_MATH_H #define _NPY_SIMD_SSE_MATH_H /*************************** * Elementary ***************************/ // Square root #define npyv_sqrt_f32 _mm_sqrt_ps #define npyv_sqrt_f64 _mm_sqrt_pd // Reciprocal NPY_FINLINE npyv_f32 npyv_rec...
C
#ifndef UTILITIES_H_INCLUDED #define UTILITIES_H_INCLUDED #include <time.h> #include <sys/time.h> // Returns (a - b) in microseconds inline long int timeDiff(struct timeval *a, struct timeval *b) { return ((a->tv_sec*1000000 + a->tv_usec) - (b->tv_sec*1000000 + b->tv_usec)); } inline void setBitBitfield(uint8...
C
#include <stdio.h> #include <string.h> #include <unistd.h> #include <stdlib.h> #include <stddef.h> #include <assert.h> #include <poll.h> #include <errno.h> #include <time.h> #include <sys/time.h> #include <sys/socket.h> #include <sys/uio.h> #include <netinet/in.h> #include "rlib.h" #define PACKET_DATA_MAX_SIZE 1000...
C
#include "bb.h" #include <stdlib.h> #include <stdio.h> void criaSeqBB(ListaSeqBB *l) { l->vet = NULL; l->tam = 0; } int insereSeqBB(ListaSeqBB *l, elem x){ if(l == NULL) return 1; // Aumenta o tamanho da lista. l->tam ++; if(l->tam > 1) l->vet = realloc(l->vet ,l->tam * siz...
C
#include <stdio.h> // Ca sa evitam alocarea dinamica, transmited matricea transpusa (nepopulata) // ca parametru. void compute_transpose(int n, int m, int mat[n][m], int transposed[m][n]) { for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { transposed[j][i] = mat[i][j]; } } } int main() { ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* pf_output_d.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> char* n2s(int n) { rsize_t strSize = 255; char* str = (char*)malloc(strSize * sizeof(char)); int i; if (n == 0) { strcpy_s(str, strSize, ""); } if (n < 10) { switch(n) { case 1: strcpy_s(str, strSize, "one"); break; case 2: strcpy...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* modifiers.c :+: :+: :+: ...
C
/* /////////////////////////////////////////////////////////////////////// Name: INA219_lib.c Autor: Mario Lugo Date: 02/05/20 Description: Library for current/voltage sensor INA219 v1.0 (POSITIVE VALUES ONLY) /////////////////////////////////////////////////////////////////////// */ #de...
C
#define _CRT_SECURE_NO_WARNINGS 1 #include "seqlist.h" #include "list.h" #include "stack.h" #include "queue.h" #include "tree.h" /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////...
C
#include <netinit.h> void net_config(char *address, char *netmask, char *gateway) { ip_addr_t addr, mask, gtway; struct netdev *netdev = RT_NULL; inet_aton(address, &addr); inet_aton(netmask, &mask); inet_aton(gateway, &gtway); /* 通过名称获取网卡对象 */ netdev = netdev_get_by_name("e0"); if (n...