language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include "ks0108.h" /******************************************************************************************/ void ks0108SetDot(uint8_t, uint8_t); void ks0108ClearDot(uint8_t, uint8_t); /******************************************************************************************/ displayPos pos; #ifndef ...
C
#include<stdio.h> #include<time.h> int BubbleSort(int *a, int n); int InsetSort(int *a, int n); int main() { int a[1000]; int n,i,res; int begintime,endtime,runtime; printf("n = "); scanf("%d",&n); //the number of the input for(i = 0; i < n; i++) scanf("%d",&a[i]); begintime = clock(); res = BubbleSort(a, n)...
C
#include<stdio.h> int main() { char alph; printf("Enter alphabet to check it is vowel or consonant:"); scanf("%c",&alph); if(alph=='a' || alph=='e' || alph=='i' || alpha=='o' || alpha=='u') printf("\n Vowel"); else printf("\n Consonant"); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include "list.h" //向链表最后插入一个item void insert_list(llink *list, int item) { llink new = malloc(sizeof(struct List)); if (!new) { return; } new->vertex = item; new->next = NULL; if (!*list) { *list = new; return; } ...
C
#ifndef QUEUE_H #define QUEUE_H #include <stdint.h> #include <pthread.h> #include "list.h" struct queue_item_s{ void *data; list_head_t list; }; typedef struct queue_item_s queue_item_t; struct queue_s{ list_head_t *head; intptr_t size; pthread_mutex_t mutex; }; typedef struct queue_s queue_t; queue_t* in...
C
#include<stdio.h> #include<stdlib.h> #include<fcntl.h> #include<string.h> #include<unistd.h> #include<sys/shm.h> #include <signal.h> int pp[2]; int c; void fnp() { char* s="parent write."; close(pp[0]); printf("parent:\n"); write(pp[1],s,strlen(s)); kill(c,SIGUSR2); sleep(1); } void fnc() { char buffer[50]; clo...
C
#define _CRT_SECURE_NO_WARNINGS #define _WINSOCK_DEPRECATED_NO_WARNINGS #include <stdio.h> #include <string.h> #include <winsock2.h> #include "Source.h" #include "SocketExampleShared.h" #include "SocketSendRecvTools.h" void MainServer(int portnum) { int Ind; int Loop; SOCKET MainSocket = INVALID_SOCKET; unsign...
C
// Chapter 12 Exercise 5 #include <stdio.h> #include <stdlib.h> void random_ints(int *int_array); int main(void) { // test random ints int int_array[100]; random_ints(int_array); for (int i = 0; i < 100; i++) { printf("%2d ", int_array[i]); if (i % 20 == 19) putchar('\...
C
#ifndef AUX_H #define AUX_H #define SWAP1(x, y) { double temp = x; x = y; y = temp; } #define SWAP2(x, y) { int temp = x; x = y; y = temp; } //The partioning function to be used in double concurrent quickselect int partition(double *a, int *b, int left, int right, int pivotIndex) { //Pick pivotIndex as pivo...
C
#include "tabsim.h" simbolo * crear() { return NULL; }; /* la T se refiere al elemento que esta en la parte alta de la pila */ /* al principio el siguiente de ese apunta a nulo */ void insertar(simbolo **pT, simbolo *s) { s->sig = (*pT); /* el siguiente del principio apunta a nulo, en caso que empiece a s...
C
// The new records system. #include "conf.h" #include "sysdep.h" #include "structs.h" #include "utils.h" #include "comm.h" #include "interpreter.h" #include "handler.h" #include "db.h" #include "spells.h" #include "screen.h" #include "constants.h" #include "coins.h" void display_records(int class); struct record_data...
C
#define CREATOR "valar" /* New workroom.c for newbie immortals. Same basic functions * as the old one, but isn't going to force the entire mudlib * down your throat in comments. * * Radix : September 27, 1995 */ inherit "/std/room.c"; // inherit the file "/std/outside.c" if you want clouds and such. void setup...
C
/** Name: Shamima Akther ID: 1834902616 **/ /* Search a value X (take input X from user) in the array and print the location if X found in the array otherwise print -1. Access the array using pointer */ #include<stdio.h> int main () { int array[100] = {10,20,30,40,50,60,70,80,90,10}; int X,...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #define M 125 typedef struct { char Surname[20]; char Name[20]; int Code; }BinTreeElementType; typedef struct BinTreeNode *BinTreePointer; struct BinTreeNode { BinTreeElementType Data; BinTreePointer LChil...
C
/**************************************************************************** * dictionary.c * * Computer Science 50 * Problem Set 5 * * Implements a dictionary's functionality. * * ***************************************************************************/ #include <stdbool.h> #include <stdio.h> #include <s...
C
#include "barber_shop.h" int SHM_ID; int SEM_ID; pid_t* MEM; int CUSTOMERS; int HAIRCUTS; void atexit1(){ if (shmdt(MEM)) printf("atexit error: failed to detach shared memory segment\n");; } void print_error(int error_code){ switch(error_code){ case -1: printf("Error: incorrect argument...
C
// // main.c // 兔子题 // // Created by qianfeng on 15/10/15. // Copyright (c) 2015年 qianfeng. All rights reserved. // #include <stdio.h> int main(int argc, const char * argv[]) { int m; int a[50]={1,1}; scanf("%d",&m); for (int i=2; i<m;i++) { a[i]=a[i-1]+a[i-2]; } printf("%d\n",a[m-...
C
/* spi.c * Written by Connor McKee and Michael Georgariou * CPE 316 - Spring 2020 * * For use with the MSP432. * DAC functions for use with the MCP4921. */ #include "msp.h" #include "spi.h" /* SPI_init * initializes SPI communication on the MSP432. */ void SPI_init(void) { /* first reset the ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strsplit.c :+: :+: :+: ...
C
/* sg_encdec - encode or decode a file into the correct format for the E4438C signal generator */ /* Takes an input file consisting of either un-encoded I/Q data or encoded I/Q data, as well as a count of the number of data points, and transform it to the other format, using a command-line option to specify which. ar...
C
#include "./unpipc.h" #define MAXNITEMS 1000000 #define MAXNTHREADS 100 int nitems = 0; struct { // 互斥锁 pthread_mutex_t mutex; // 共享资源 int buff[MAXNITEMS]; // buff 的索引 int nput; // 放进去的值 int nvalue; } put = {PTHREAD_MUTEX_INITIALIZER}; struct { pthread_mutex_t mutex; pthread...
C
#include "mtrace.h" #if TRACE_MEMORY_ALLOCATIONS typedef struct mtinfo_t { size_t size; // Cantidad de bytes asignados. char* file; // Archivo donde se realiza la asignacion. short line; // Linea dentro del arch...
C
#include "plrCompare.h" #include "plrLog.h" #include <stdio.h> int plrC_compareArgs(const syscallArgs_t *args1, const syscallArgs_t *args2) { int faultVal = 0; #define CompareElement(elem, faultBit) \ if (args1->elem != args2->elem) { \ faultVal |= 1 << faultBit; \ plrlog(LOG_D...
C
#include "flashStore.h" #define PARA_SIGN 0x20190320 #define SIGN_ADDRESS (0x08040000 - 0x800) //һҳ(2KB),û extern u32 TSC_Para[7]; //У׼ϵ #define TSC_ADDRESS (0x08040000 - 0x800 + 4) extern SETTINGS infoSettings; //û #define SETTING_ADDRESS (0x08040000 - 0x800 + 32) bool readStoredPara(void) ...
C
//بسم الله الرحمن الرحيم // Bubble Sort Implementation #include <stdio.h> #define SIZE 10 int main(void){ int array[] = {9,8,7,6,5,4,3,2,1,0}; for(size_t i=0; i<SIZE; ++i){ for(size_t j=0; j<SIZE; ++j){ if (array[i] < array[j]){ int tmp; tmp = array[i]; ...
C
/* * Copyright (c) 2016 Zibin Zheng <znbin@qq.com> * All rights reserved */ #include "timer.h" //timer handle list head. static struct Timer* head_handle = NULL; //Timer ticks static uint32_t _timer_ticks = 0; /** * @brief Initializes the timer struct handle. * @param handle: the timer handle strcut. * @...
C
#include <stdio.h> #include <stdlib.h> #include "peliculas.h" #define LEN 5 int main() { ePelicula listPeliculas[LEN]; eActor listActores[LEN]; initPelicula(listPeliculas, LEN); harcodearActores(listActores); char option; do { printf("\n _____________________...
C
#include "stdio.h" #include "stdlib.h" int** transpor(int matriz[3][3]) { int ** matrizt = malloc(sizeof(int *)*3); for (int i=0; i<3; i++) { matrizt[i] = malloc(sizeof(int)*3); } for (int i=0; i<3; ++i) { for (int j=0; j<3; ++j) { matrizt[i][j] = matriz[j][i]; } } return matr...
C
#include <stdio.h> #include <stdlib.h> #include <Windows.h> static WORD get_attrib(char in) { WORD out = 0; switch(in) { case 'a': out = 0x10; break; case 'b': out = 0x20; break; case 'c': out = 0x40; break; case 'd': out = 0x10 | 0x20; ...
C
#include<stdio.h> #include<stdlib.h> struct node{ int count; int delete; struct node *dir; }; struct node *circle,*first,*temp; void main(){ int i,j,k,bool=1,count,number=0,add; first=(struct node *)malloc(sizeof(struct node)); circle=(struct node *)malloc(sizeof(struct node)); printf("ENTER KIDS...
C
#include <func.h> int main() { pid_t pid = fork(); if(pid) { printf("i am parent pid=%d\n",getpid()); int status=0; pid_t childpid; childpid = waitpid(pid,&status,0); printf("child exit\n"); printf("childpid = %d\n",childpid); return 0; } else...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> //Estructura struct pila{ int tope; void **eltos; }; typedef struct pila Pila; //Prototipos char* creaChar(char); Pila* creaPila(int); void push(Pila*,void*); void* pop(Pila*); void* top(Pila*); int isEmpty(Pila*); void marco(); //main void main (){ FIL...
C
/* ** EPITECH PROJECT, 2021 ** B_PSU_400_BER_4_1_nmobjdump_karl_erik_stoerzel ** File description: ** parser.c */ #include "../include/parser.h" #include "../include/help.h" void write_invalid_option(char *flags) { write_error("invalid option -- '"); write_error(flags + 1); write_error("'\n"); write_h...
C
/* ************************************************************************** */ /* */ /* :::::::: */ /* uninstall_machine.c :+: :+: ...
C
#include <stdio.h> #include <ctype.h> #include <string.h> int main() { int num; char c; scanf("%d%c",&num , &c); while(num-- != 0){ char input[210]; gets(input); unsigned long int length = strlen(input); int i , frequency[26] = {0} , max = 0; for(i = 0 ; i < leng...
C
/* * The test model for server */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <sys/socket.h> #include <netinet/in.h> #include <sys/select.h> #include <fcntl.h> #include <sys/wait.h> #include <sys/time.h> #include <my_global.h> #include <mysql.h> //#define MAX 100 #define DM...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include "common.h" #include "parameters.h" #include "argcheck.h" #include "eprint.h" #include "util.h" #include "port.h" #include "null.h" #include "eof.h" #include "character.h" #include "number.h" #include "boolean.h" #include "symbol.h" #include "sstring....
C
#include <stdint.h> #include <errno.h> #include <string.h> #include <unistd.h> #include <sys/stat.h> #include <fcntl.h> #include <stdbool.h> #include <sys/mman.h> #include <sys/types.h> #include "block_store.h" #include "bitmap.h" #include <file_descriptor.h> #define NUM_FD 256 #define SIZE_FD 6 struct block_store { ...
C
/************************************************************************* > File Name: test.c > Author: ztf > Mail: 379177267@qq.com > Created Time: Thu 13 Apr 2017 03:51:59 PM CST ************************************************************************/ #include<stdio.h> int main() { while(1) { printf("my ...
C
#include <stdio.h> #include <stdlib.h> int main(){ //Declaration int n,i, j, tmp; n = 10; int t[10] = {1, 5, 7, 2, 3, 9, 8, 4, 10, 6}; int stop = 0; for(i=0;i<n;i++){ printf("%d ", t[i]); } printf("\n"); while(stop == 0){ i = 0; stop = 1; while(i < n-1){ if(t[i] > t[i+1]){ tmp = t[i+1]; ...
C
/** * @file displaycontours.c * @brief Display contours detected by mosaiced contour stencils as EPS * @author Pascal Getreuer <getreuer@gmail.com> * * Copyright (c) 2010-2011, Pascal Getreuer * All rights reserved. * * This program is free software: you can use, modify and/or * redistribute it under the terms...
C
#include "sph.h" #include <sys/stat.h> void options ( int argc, char **argv ); void generate_output ( FILE *in ); char *filename = NULL; size_t filesize = 0; int_t n_field = 0; bool print_all = false; int main ( int argc, char **argv ) { options ( argc, argv ); if ( filename != NULL ) { FI...
C
#include <stdlib.h> #include <stdio.h> #include <unistd.h> #include "rand.h" #define ROUNDS 10 #define LOOP 10000 #define BUFFER 100 int main() { void *init = sbrk(0); void *current; void *buffer[BUFFER]; for(int i =0; i < BUFFER; i++) { buffer[i] = NULL; } printf("The initial top of the heap is %...
C
// bitmap implementation #include "bitmap.h" #include <stdio.h> #include <assert.h> // Masking techniques inspired by user dbush on SO // stackoverflow.com/questions/52742756/mapping-a-number-to-bit-position-in-c // Returns if a bitmap value at an index is true or false int bitmap_get(void* bm, int ii) { // Return ...
C
#define _CRT_SECURE_NO_WARNINGS # include <stdio.h> # include <stdlib.h> int main() { int score = 0; printf("ѧijɼ"); scanf("%d", &score); while (score<0 || score>100) { printf("ijɼǴģѧijɼ"); scanf("%d", &score); } if (90 < score&&score <= 100) { printf("ijɼȼǣA"); } else if (80 < score&&score <= 90) { pri...
C
#include <stdio.h> #include <stdlib.h> #include <pthread.h> #include <unistd.h> void* thread(void* vargp) { int* myid = (int*)vargp; sleep(1); printf("42\n"); pthread_exit(NULL); } int main() { pthread_t id; int n, val; printf("Enter the number of threads: "); scanf("%d",&n); for (int i=0; i<...
C
#include "usart.h" #include "stdio.h" #include <stdarg.h> #include "stdlib.h" #define RINGBUFFER_SIZE 1024 static uint8_t txBuffer[RINGBUFFER_SIZE]; static uint8_t rxBuffer[RINGBUFFER_SIZE]; static uint8_t *txHead = txBuffer; static uint8_t *txTail = txBuffer; static uint8_t *rxHead = txBuffer; static uint8_t *rxTa...
C
// // Created by Suraj M on 11/27/17. // #include "read_lines.h" #include <stdlib.h> #include <stdbool.h> char *read_a_line(FILE *fp) { char *line = NULL; int num_chars = 0; char c; fscanf(fp, "%c", &c); while (!feof(fp)) { num_chars++; line = (char *) realloc(line, num_chars * sizeof(char));...
C
/* * Implementation according to tutorial on Red Black trees by Julienne Walker * at http://www.eternallyconfuzzled.com/tuts/datastructures/jsw_tut_rbtree.aspx */ #include <stdio.h> #include <stdlib.h> #include <event.h> #include "redblack.h" node_t *insert_r(node_t *root, int data, read_callback rcb); node_t *dele...
C
#include "dataAndStructure.h" //ȫֱҪͷļ Button structureSelectMenu[MENU_SIZE]; //һѡûݽṹİť Button backButton; //صݽṹѡ˵İť int Setup() { // char * structureName[] = {"˳","","","","ͼ"}; void (*structureSystem[])(void) = {sequList,linkList,tree,binaryTree,map}; //ʼ initWindow("ݽṹ",DEFAULT,DEFAULT,WIDTH...
C
/* Problem Statement : Write a recursive program which accept number from user and return its reverse number. Input : 523 Output : 325 */ #include "Header.h" int main() { int iNo = 0; int iRet = 0; printf("Enter a number\n"); ...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> typedef struct SimpulMahasiswa MNode; typedef struct SimpulMataKuliah MKNode; struct SimpulMahasiswa{ int nrp; char nama[100]; MNode *next; MNode *prev; MKNode *nextMK; }; struct SimpulMataKuliah{ int id; char namaMatkul[100]; ...
C
#include <stdio.h> #include <stdlib.h> struct node { int data; struct node *next; }; struct node *insert_in_end(struct node *start, int x); struct node *insert_in_beginning(struct node *start, int x); struct node *delete_in_end(struct node *start); struct node *delete_in_beginning(struct node *start); int size_of_...
C
int main() { char *p[4] = {"hello","world","gloebal","edge"}; int *pt[4] = {100,200,300,400}; int i; int a = 100, b = 200, c = 300, d = 400; pt[0] = &a; pt[1] = &b; pt[2] = &c; pt[3] = &d; for (i = 0; i < 4; i++) { printf("%s\n",p[i]); printf("%d\n",*pt [i]); } }
C
#include <stdlib.h> #include <string.h> #include <stdio.h> #include "networking_v1beta1_ingress_status.h" networking_v1beta1_ingress_status_t *networking_v1beta1_ingress_status_create( v1_load_balancer_status_t *loadBalancer ) { networking_v1beta1_ingress_status_t *networking_v1beta1_ingress_status_local_va...
C
// Assumes -5 is error code int foo(); int main() { int err = foo(); if (foo > 0) { return -5; } return 0; } // EXPECTED: foo > 0
C
#include <stdio.h> #include <stdlib.h> int main() { int n=10; for(int i=0;i<=n;i++) { printf("外层循环第%d次 hello world\n",i); for(int j=0;j<=n;j++) { printf("内层循环第%d次 hello world\n",j); } } return 0; }
C
#include <stdio.h> int n; void printArr(int *a, int n) { for (int i = 0; i < n; i++) { printf("%d ", a[i]); } printf("\n"); } int partition(int *a, int low, int high) { int pivot = a[low], i = low + 1, j = high, temp; do { while (pivot >= a[i] && i < n) { ...
C
#include <stdio.h> void counter(int n) { if (n <= 0) return; counter(n - 1); printf("%i ", n); } int main() { counter(10); } /* В этой задаче нужно учитывать то, что при вызове функции из другой функции, вызывающая функция не заканчивается, а дожидается пока закончится та фун...
C
// Note: If operand arguments are too large, result may overflow. #include <stdio.h> #include <stdlib.h> #include <unistd.h> // fork() #include <string.h> // strcmp() #include <limits.h> // MAX_LONG #include <errno.h> // perror() // Copies src to dest until terminating character or null terminater or destMax is reach...
C
/** * * timer.c * created by: Ahmed Hassan * created on July 6, 2020 */ #define _XTAL_FREQ 8000000 #include <xc.h> #include "types.h" #include "macros.h" #include "timer.h" void(*timer0_isr)(void); void(*timer1_isr)(void); void(*timer2_isr)(void); void __interrupt() timer_isr() { if (TMR0IF == 1) { ...
C
//question name: 검증수 //question number: 2475 //status: correct #include <stdio.h> int sqrot(int a) { return (a * a); } int main(void) { int a[5]; int mod; int i; scanf("%d %d %d %d %d", &a[0], &a[1], &a[2], &a[3], &a[4]); mod = 0; i = 0; while (i < 5) { mod += sqrot(a[i]); i++; } printf("%d", mod % ...
C
#include "main.h" int main() { tArbolBinBusq ar; //int vec[] = {10,25,50,60,75,100,110,125,150,175,200}; int vec[] = {25,50,75,100,125,150,175}; int dato; crearArbolBinBusq(&ar); cargarDesdeDatosOrdenadosArbolBinBusq(&ar, vec, sizeof(vec)/sizeof(int),leerDesdeVectorEnteros,NULL); ///eliminarRaizArbolBinBusq...
C
#include <stdio.h> #include <stdlib.h> #include "list.h" void init_list(list_t *p_list) { p_list->hd = -1; p_list->fhd = 0; for(int i = 0; i < 4; i++) // nsk: hard coding { p_list->freenext[i] = i + 1; } p_list->freenext[4] = -1; } void insert_list(list_t *p_list, int key) { if(p_list->fhd == -1) { return...
C
/***************************************************************************** C-DAC Tech Workshop : HEMPA-2011 Oct 17 - 21, 2011 Example : MatMatMulLocalMemDP.c Objective : Perform matrix matrix multiplication using local memory ...
C
//堆空间的开辟、使用和释放。使用stdlib.h中的malloc()开辟,使用free()释放。 //堆空间开辟的是一个连续的内存空间 #include<stdio.h> #include<stdlib.h> int main(void) { int* p = (int*)malloc(sizeof(int)*1000000000000); if(!p) { printf("开辟堆空间失败"); return -1; } for (int i = 0; i< 10; i++) ...
C
/* ** get_bsf.c for get_bsf_scroller in /home/Akeno85/delivery/test_scroller ** ** Made by Bastien Guesdon ** Login <Akeno85@epitech.net> ** ** Started on Sat Apr 1 17:16:07 2017 Bastien Guesdon ** Last update Sun Apr 2 22:27:55 2017 ferchaud kevin */ #include "../include/tracker.h" int get_nb_line(char *f...
C
#include<stdio.h> #include<float.h> /* * Print float-point number. */ int main(void) { double d_var = 1.0/3.0; float f_var = 1.0/3.0; printf("Double variable d_var: %.6f %.12f %.16f.\n", d_var, d_var, d_var); printf("Float variable f_var: %.6f %.12f %.16f.\n", f_var, f_var, f_var); printf("FLT_DIG: %.6f %.12f %...
C
#include <sys/stat.h> #include <fcntl.h> #include <ctype.h> #include "tlpi_hdr.h" #define printable(ch) (isprint((unsigned char) ch) ? ch : '#') #ifndef BUF_SIZE #define BUF_SIZE 1024 #endif static void usageError(char *progName, char *msg, int opt) { if (msg != NULL && opt != 0) fprintf(stderr, "%s (-%c)\n", msg...
C
#include "tbf.h" #include <stdio.h> #include <stdlib.h> #include <signal.h> #include <unistd.h> typedef struct { int cps; int token; int burst; }tbf_t; #define MAXTBFS 1024 tbf_t *jobs[MAXTBFS] = {}; static int falg = 0; static void alrm_handler(int s) { int i; alarm(1); for(i = 0; i < MAXTBFS; i++) { if(j...
C
/************************************************************************************************ # C-Program that deletes specified elements from an 1-d array # RAHUL GAUTAM ***********************************************************************************************/ #include<stdio.h> //declaring a global ...
C
/** * @file field.h * @brief Generic field header. * @copyright * Copyright (c) 2014 Cryptography Research, Inc. \n * Released under the MIT License. See LICENSE.txt for license information. * @author Mike Hamburg */ #ifndef __FIELD_H__ #define __FIELD_H__ #include "constant_time.h" #include "f_field.h" ...
C
#include <stdio.h> #include <sys/socket.h> #include <arpa/inet.h> #include <unistd.h> #include <stdlib.h> int main() { int fd,sockfd,lenofaddr,cliport,ret; struct sockaddr_in seraddr,cliaddr; char buf[1024],cliip[16]; pid_t rpid; //socket() fd=socket(AF_INET,SOCK_STREAM,0); //bind() seraddr.sin_family=AF_IN...
C
#include <stdio.h> int min(int x, int y) { return x < y ? x : y; } int main() { int T; scanf("%d", &T); while(T--) { int N, A, B, C; int i, j; long long ans; scanf("%d%d%d%d", &N, &A, &B, &C); ans = 0; for(i = 0; i <= min(A, N) ;i++) { for(j = 0; j <= min(B, N); j++) { int sum = i +...
C
#include "config.h" typedef int (*gettimeofday_t)(struct timeval *tv, struct timezone *tz); typedef int (*clock_gettime_t)(clockid_t clk_id, struct timespec *tp); gettimeofday_t gettimeofday_REAL = NULL; clock_gettime_t clock_gettime_REAL = NULL; uint64_t time_div = 1; uint64_t time_mul = 1; double time_speedhack = ...
C
#include "hardware/hardware.h" #include "kernel/print.h" char x2c(int c) { if (c <= 9) { return '0' + c; } return 'a' + c - 10; } int printDecimal(U32 value, U32 width, const char delim, const char comma) { char buffer[16]; U8 i = 0; do { U8 d = value % 10; buf...
C
// // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // /*============================================================ ** ** Source: childprocess.c ** ** Purpose: Test to ensure GetExitCodeProcess returns the right *...
C
/* date2018/12/02 author:Better_Me1 program: compiler:Visual Studio 2013 */ #define _CRT_SECURE_NO_WARNINGS 1 #include <stdio.h> #include <stdlib.h> /*1.Ϸ*/ //void menu(){ // printf("**********Ϸ********\n"); // printf("***** 1.play 2.exit *****\n"); // printf("****************************\n"); //} //void game(){ ...
C
#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<malloc.h> typedef struct Node { int data; struct Node* next; }Node; void creatlist(Node *c ,int a[], int n) { Node* s; int i; for (i = 0; i < n; ++i) { s = (Node*)malloc(sizeof(Node)); s->data = a[i]; s->next = c->next; c->next = s; } } void ...
C
#include "sysutil.h" int tcp_client(unsigned short port) { int sock; if((sock=socket(PF_INET,SOCK_STREAM,0))<0) ERR_EXIT("tcp_client"); //通常port=0,客户端不需要绑定 if(port>0) { int on=1; if((setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,(const char*)(&on),sizeof(on)))<0) ERR_EXIT("setsockopt"); struct sockaddr_in ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* prepare.heat_map.c :+: :+: :+: ...
C
/*TP4 Ejercicio 3: Se cargan 2 matrices con nmeros reales para realizar las siguientes operaciones: a) Cargar en un vector la suma de cada columna de la primera matriz. b) Cargar un vector con el promedio de cada fila de la segunda matriz. c) Calcular el promedio de los valores de ambas matrices.*/ #include <...
C
#include<stdio.h> void main() { int num1,num2; printf("Enter two numbers"); scanf("%d %d",&num1,&num2); printf(" %d & %d =%d \n",num1,num2,num1 & num2); printf(" %d && %d =%d \n",num1,num2,num1 && num2); printf(" %d | %d =%d \n",num1,num2,num1|num2); printf(" %d || %d =%d \n",num1,num2,num1||num2...
C
/* * Copyright (c) 2002, Intel Corporation. All rights reserved. * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com * This file is licensed under the GPL license. For the full content * of this license, see the COPYING file at the top level of this * source tree. */ /* * Test that if O_NONBLOCK is s...
C
/* Coverage Report: For dominion.c as a whole: I had 29.74% coverage I had 34.77% branch execution Calls executed: 20.00% For the cards and functions I specifically tested I had excellent, near 100% coverage and block execution. It seems like most of the branches I miss in the functions and cards I test are fall th...
C
#include<stdio.h> #include <assert.h> #include "pontoFlutuante.h" int main(){ int sinal1, sinal2,e1,e2; int numero1[32] = { 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; int numero2[32] = { ...
C
#include "stdio.h" #include "stdlib.h" typedef struct Node { char data; struct Node *LChild; struct Node *RChild; }BiTNode, *BiTree; void CreateBiTree(BiTree *bt) { //һŶ,磺 ABD.G...CE..F.. char ch; ch = getchar(); if(ch=='#') { *bt=NULL; } else { *bt=(BiTree)ma...
C
int mx_sqrt(int x) { int start = 1; int end = x <= 46340 ? x : 46340; while (start <= end) { int mid = (start + end) / 2; int n = mid * mid - x; if (n < 0) { start = mid + 1; } else if (n > 0) { end = mid - 1; } else { ...
C
/* By Anand K S CSE-B AM.EN.U4CSE19106 Program to find the sum of contents of a dynamic array, increase its size and find sum again */ #include <stdio.h> #include <stdlib.h> int main() { int *ptr, i, n1, n2,sum=0; printf("Enter size: "); scanf("%d", &n1); ...
C
#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <pthread.h> #include <time.h> #include <unistd.h> #include <semaphore.h> sem_t agentSem = 1, tobacco = 0, paper = 0, match = 0; bool isTobacco = false, isPaper = false, isMatch = false; sem_t tobaccoSem = 0, paperSem = 0, matchSem = 0, m...
C
// // Created by User on 2021/04/13. // #ifndef PROJECT_01_CARD_H #define PROJECT_01_CARD_H #include "../util/types.h" #include "../container/id_array.h" enum CardState { TO_DO, DOING, DONE }; typedef struct { char *title; char *description; enum CardState state; id_t userId; id_arra...
C
/**LCD**/ #include "stdio.h" #include "device.h" /*Fn writes on data*/ static int mydev_init(struct packet *p){ p->size = 0; p->data = 0; return 1; } /*Fn writes on data*/ static void mydev_uninit(struct device_operations *devops){ devops->devop_init_registered = 0; } int main() { /* ...
C
/* eventually put the text into a file, sonnet18 */ #include <stdio.h> int main() { char sonnet18[] = "Shall I compare thee to a summer’s day?\n" "Thou art more lovely and more temperate.\n" "Rough winds do shake the darling buds of May,\n" "And summer’s lease hath all too short a date.\n" "Sometime too ho...
C
#include<stdio.h> #include<string.h> int counter1 = -1; int counter2 = -1; int counter3 = -1; struct student { int roll_no; char subject_code[10]; char name[50]; int marks; }; /* function initialization */ struct student list1[25]; struct student list2[25]; struct student list3[50]; void options_for_selecti...
C
#include <limits.h> #include <stdbool.h> //Definition for a binary tree node. struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; }; bool preorder(struct TreeNode *root, long minval, long maxval) { if (!root) return true; if (root->val <= minval || root->val >= maxval) return false; re...
C
# include <stdio.h> # include <stdlib.h> # include <sys/types.h> # include <unistd.h> # include <sys/ipc.h> # include <sys/shm.h> # include <wait.h> # include <string.h> # include <signal.h> # define ERROR 1 # define FINISH 0 static void sig_user(int signo) { if (signo == SIGINT) { printf("\nThe number of...
C
/* * define.h * * Created on: 12 Oct 2021 * Author: savehk */ #ifndef DEFINE_H_ #define DEFINE_H_ int number_1; int number_2; char operator; void opening(){ printf("Welcome to Simple Calculator\n"); printf("You can do simple calculations with this calculator\n"); printf("i.e. Addition, Subtra...
C
#include <stdio.h> void main() { float phy,che,math,bio,comp,per; printf("Enter your marks in physics chemistry mathematics biology and computer respectively\n"); scanf("%f%f%f%f%f",&phy,&che,&math,&bio,&comp); per = (phy+che+math+bio+comp)/5.0; printf("Your percentage is %f",per); if (per>=90) printf(...
C
#include <avr/io.h> #include <avr/interrupt.h> #define LED PC5 #define set_bit(reg, bit) (reg |= (1 << bit)) #define clear_bit(reg, bit) (reg &= ~(1 << bit)) #define toggle_bit(reg, bit) (reg ^= (1 << bit)) const int COUNT_START = 3036; ISR (TIMER1_OVF_vect) { toggle_bit(PORTC, LED); TCNT1 = COUNT_START; } voi...
C
/** * EIA-FR - Embedded Systems 2 laboratory * * Abstract: ARM Exception Handling * Author: Daniel Gachet / EIA-FR / Telecoms * Date: 29.01.2014 */ #include <stdio.h> #include "interrupt.h" #include "stdbool.h" static void exception_handler(void* addr, enum interrupt_vectors vector, void* param) { printf ...