language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/* 10.1 (a) integer type expression implicitly converted to a narrower or different signness underlying type */ #include <stdio.h> char c = 'a'; short int w = -5; int x = -6; long int y = -7; unsigned char uc = 56u; unsigned short int uw = 5u; unsigned int ux = 6u; unsigned long int uy = 7u; int main() { c = w; ...
C
#include<stdio.h> int main() { int N, s, m, h; scanf("%d", &N); m=N/60; s=N%60; h=m/60; m=m%60; printf("%d:%d:%d\n", h,m,s); return 0; }
C
/* Interface: main.c Author: Vicente Cunha Date: September 2016 VERSÃO: WI16-26R1 */ #include "serialParser.h" #include "uart.h" #include <avr/eeprom.h> #include <avr/interrupt.h> //==================// //=== INTERRUPTS ===// //==================// volatile int ovfCounter1 = 0; volatile int ovfCounter2 = 0;...
C
// // Created by Sheldon Benard // #ifndef PROJECT_CONSTANTS_H #define PROJECT_CONSTANTS_H //---Include libraries for the project---// #include <stdio.h> #include <string.h> #include <stdlib.h> #include <stddef.h> #include <math.h> #include <stdint.h> //---define static constants for the project---// #define SFS_N...
C
/* * Implements Keychain Functionality using ECDSA. * * A Keychain consists of a Base Key Pair, a Chain Key, and a sequence of Key * Pairs derived from them. * * d_b = Base Private Key = random integer in range [1, ec_n - 2**128) * Q_b = Base Public Key = d_b * G * k = Chain Key = random integer in range [0, 2...
C
#include<stdio.h> #include<stdlib.h> #define N 100 typedef struct People { char name[20]; int age; }sP; int input(sP *pman,int n) { // printf("n in ip:%d\n",n); printf("please input name:"); scanf("%s",pman->name); printf("please input age:"); scanf("%d",&pman->age); // printf("age:%d\n",pman->age); // printf("n...
C
#include <stdio.h> #include <stdlib.h> #define MAX_SIZE 10 struct element { int data; }; struct element stack[MAX_SIZE]; int top = -1; void stackfull(void) { printf("Stack is full, cannot add element.\n"); exit(EXIT_FAILURE); } void push(struct element item) { if (top >= (MAX_SIZE - 1)) stackfull(); stack[...
C
/*------------------------------------------------------------------------- Include files: --------------------------------------------------------------------------*/ #include <stdio.h> #include <stdlib.h> int main() { int height = 0; int bSum = 0, bAmount = 0, gSum = 0, gAmount = 0; printf("Students...
C
#include <stdbool.h> #include <stdio.h> /*------------------------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------...
C
#include <stdio.h> #include <string.h> int main() { int n; scanf("%d", &n); getchar(); char c[n][20], i; char *p[n]; for (i = 0; i < n; i++) { gets(c[i]); p[i] = c[i]; } void sort(int n, char *[]); sort(n, p); printf("Now,the sequence is:\n"); for (i = 0; ...
C
/* * main.c * * Created on: 2018 Apr 10 10:24:28 * Author: Conor */ #include <DAVE.h> //Declarations from DAVE Code Generation (includes SFR declaration) /** * @brief main() - Application entry point * * <b>Details of function</b><br> * This routine is the application entry point. It is...
C
int prime(int k) { int p=(int)sqrt(k); int t; for (t=3;t<=p;t+=2) if (k%t==0) break; if (t>p) return 1; else return 0; } main() { int n; scanf("%d",&n); if (n<=200000) { for (int i=3;i<=n/2;i+=2) if (prime(i)) { if (prime(n-i)) printf("%d %d\n",i,n-i); }} else printf("%d",n); }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* arch_64.c :+: :+: :+: ...
C
#include <stdio.h> int x=10; int main() { int x=20; { int x=30; printf("\n%d",x); } printf("\n%d",x); return 0; }
C
#define GEPPETTO_NAME "matrix" // Must be defined before including geppetto.h #define GEPPETTO_VERIFY_H "build/"GEPPETTO_NAME".h" #define GEPPETTO_VERIFY_C "build/"GEPPETTO_NAME".verify.c" #define NUM_BANKS 3 #include "geppetto.h" #include "pinocchio.h" #ifndef MQAP #include <stdio.h> #include <...
C
#include "holberton.h" /** * _isdigit - This function checks whether c is an integer 0-9 * @c: The integer to check * Return: 1 if c is a digit, otherwise 0 */ int _isdigit(int c) { if (c >= '0' && c <= '9') return (1); else return (0); }
C
/** This file contain main function and gtk functions only * GtkWidget are declared global since passing more than 1 GtkWidget does not work */ #include <gtk/gtk.h> #include <gdk/gdk.h> #include <time.h> #include "game.h" typedef struct input inputType; /* Declare Global GTKWidget */ GtkWidget * coin[ROWS][COLS];...
C
#include<stdio.h> #include<math.h> #include<string.h> #include<stdlib.h> char main() { char a[20]; scanf_s("\n"); scanf_s("%[^\n]%*c", &a[20]); printf("\nhere is the output= %s", a); return 0; }
C
#include<stdio.h> #include<conio.h> void main() { int num; system("cls"); printf("The even Number from 1 to 30 are: \n"); for (num =2; num<=30; num+=2) printf("%d\n", num); }
C
//// //// Created by ſ on 2017/8/14. //// //#include <stdio.h> //#include <malloc.h> //#include <math.h> // //#define OK 1 //#define ERROR 0 //#define TRUE 1 //#define FALSE 0 // //typedef int Status; /* StatusǺ,ֵǺ״̬,OK */ //typedef char TElemType; //typedef enum { // Link, Thread //} PointerTag; /* Link==0ʾָҺ...
C
/* Program: Ch4_Ex4_29_MorgansLaws.c Descripción: Morgan's Laws state that the expression !(condition1 && condition2) is logically equivalent to the expression (!condition1 || !condition2). Also, the expression !(condition1 || condition2) is logically equivalent...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> double Mask(int b, int w); int main(void){ int b,w; scanf("%d %d",&b,&w); double mask = Mask(b,w); printf("%x\n",(long long int)mask); getchar(); return 0; } double Mask(int b, int w){ double mask =...
C
/* * This file is part of ce. * * Copyright (c) 1990 by Chester Ramey. * * Permission is hereby granted to copy, reproduce, redistribute or * otherwise use this software subject to the following: * 1) That there be no monetary profit gained specifically from * the use or reproduction of this software. * ...
C
// // bo2-6.h // 实际应用链表类型 // // Created by chilim on 2018/10/21. // Copyright © 2018年 chilim. All rights reserved. // #ifndef bo2_6_h #define bo2_6_h #include <stdio.h> #include "c2-5.h" // 分配由p指向的值为e的结点。若分配失败,则退出 void MakeNode(Link *p,ElemType e); // 释放p所指结点 void FreeNode(Link *p); // 构造一个空的线性链表L void InitLi...
C
/* ============================================================================ Name :Abdikarim Ibrahim Date : 06/13/18 Description : This program converts kilometers to miles. ============================================================================ */ #include <stdio.h> #define ADJUST 0 ...
C
#include "Color.h" Color ColorRGB(unsigned int r, unsigned int g, unsigned int b) { Color newColor; newColor.r = r; newColor.g = g; newColor.b = b; return newColor; }
C
/* Esse programa apresenta as iniciais das palavras digitadas por um usuário, essas palavras tem o limite de 99 caracteres + \0; O dado de entrada é ou são as palavras que o usuário digitar; Esse dado é capturado por meio de um scanf() com o formato %c; Esses caracteres serão armazenadas em um array...
C
/************************************************************************************* * This program is built based on SM4 S-box algorithm : * * Ref. Boolean Matrix Masking : * * * ...
C
#include <stdio.h> #include <string.h> #include <stdbool.h> #include <stdlib.h> typedef struct { char maSinhVien[50]; char ten[50]; char soDienThoai[50]; } SinhVien; void removeStdChar(char array[]) { if (strchr(array, '\n') == NULL) { while (fgetc(stdin) != '\n'); } } FILE *fp; int soSi...
C
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * File: lcmTable.h * * Course: CPSC457 * * Author: Chris Wozniak * * ...
C
/* File: mfr32.c */ #include "port.h" #include "mfr32.h" EXPORT Frac16 mfr32SqrtC (Frac32); /******************************************************* * Misc 32-bit Fractional Math *******************************************************/ Frac16 mfr32SqrtC (Frac32 x) { Frac16 Est; Frac16 Es...
C
#include <stdio.h> #include <string.h> #include "utc_hal_log.h" #include "utc_hal_timer.h" static u32 gSysTimerClk; static u32 gSystemTick = 0; static u8 gServiceSysTickTimer = 0; p_system_tick_handle_t gSysTickFunc = NULL; static u8 g_threadtimer = 1; void closeThreadTimer(){ g_threadtimer = 0; } static ...
C
#include "crossover.h" void crossMut(popptr p1){ int prob_crs=rand()%10; if(prob_crs<PROB_CROSSOVER){ crossover(p1); } else{ mutation(p1); } } void mutation(popptr p1){ printf("\n Mutation Started"); geneptr parent1=naryTrnment(p1); geneptr child=createCopyGene(parent...
C
#include <unistd.h> #include <stdio.h> int main(int argc, char** argv){ int var = 123456; int pid = fork(); if(pid==0){ printf("Variable vista por el hijo: %d \n", var); var=659684; printf("Variable cambiada por el proceso hijo: %d \n", var); } else { printf("Variable vista por el padre: %d \n", var);...
C
#include <sys/stat.h> #include <sys/types.h> #include <fcntl.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <string.h> extern char **environ; /** * main - function to read a line * * Return: Always 0. */ int main(void) { char *builtins = NULL; char *builtins_path = {"/bin/"}; size_t n =...
C
/* Purpose: guess password */ /* File Name: hw05_03*/ /* Completion Date: 20210523*/ #include <stdio.h> #include <stdlib.h> int main(void) { int password, UserInput; password = 5566; printf("Please input 1000~9999 to guess the password\n"); scanf("%d", &UserInput); if (UserInput == passwo...
C
#include <stdio.h> #include <string.h> #include "queue.h" #include "stack.h" #define CHARACTER_INSERTED 1 void insertParen(struct Queue * queue) { int ops = 0; int needed_parens = 0; char ch; struct Stack *s = createStack(); struct Stack *t = createStack(); while(queue->size > 0) { p...
C
#include "holberton.h" /** * print_square - function that prints a square, followed by a new line * @size: size of the square * * Return: void */ void print_square(int size) { int l = size; int m = size; if (size <= 0) { _putchar('\n'); } else { while (size > 0) { while (l > 0) { _putchar(...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strmap.c :+: :+: :+: ...
C
#include<stdio.h> #include<stdlib.h> #include<math.h> int main(){ int i=0,j=0,n; scanf("%d",&n); char before[n+1],after[n+1],dif[n+1]; scanf("%s",before); scanf("%s",after); for(i=0;i<n;i++){ if (before[i]<after[i]){ dif[i]=-1; } if (before[i]==after[i]){ dif[i]=0; } if (be...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* quick_sort_name.c :+: :+: :+: ...
C
#include <stdio.h> #define swap(t,x,y) \ do { \ t = x; \ x = y; \ y = t; \ } while (0) \ int main() { int temp; int x = 4; int y = 20; printf("\nPre Swap:"); printf("\nx = %d", x); printf("\ny = %d", y); swap(temp, x, y); printf("\nPost Swap:"); printf("\nx = %d", x); printf("\n...
C
/** * Dynamic programming * * Task 1 * * Количество маршрутов с препятствиями. * Реализовать чтение массива с препятствием и нахождение количество маршрутов. * * @author Maxim Levitan <maximlevitan@gmail.com> */ #include <stdio.h> #include <stdlib.h> #include <time.h> #include "tasks.h" #include "helpers.h" ...
C
#include<stdio.h> #include <string.h> #include<GL/glut.h> #include <stdlib.h> int pat = 0, scan = 1; int submenu; float x1,y1,x2,y2,x3,y3,x4,y4; void render(float x, float y, char *str){ glRasterPos2f(x,y); for(int i = 0 ; i < strlen(str); i++){ glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, str[i]); } } int...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #define CANTVENTAS 3 #define CANTVENDEDORES 4 typedef char palabra[20]; typedef int vec[CANTVENTAS]; struct vendedores{ int legajo; palabra nombre; int zona; vec ventas; }; typedef struct vendedores vendedor; typedef struct ventasCero vc; ...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> struct emplo { char ph[10]; char id[10]; char name[10]; }; struct emplo* add=NULL; void ent() {int i; char ss[10]; struct emplo* em=(struct emplo*)malloc(sizeof(struct emplo*)*3); add=em; for(i=0;i<3;i++) { scanf("%s",ss); strcpy((em+i)->ph,ss); scanf("%s",ss); s...
C
/* 027.c COPYRIGHT FUJITSU LIMITED 2017 */ #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <sys/mman.h> #include <sys/types.h> #include <unistd.h> #include <numaif.h> #include <errno.h> #include <string.h> #include "test_mck.h" #include "numa.h" static unsigned long max_node; static unsigned long *...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* handle_quotes.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <errno.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <libgen.h> #include <sys/select.h> #include "readn_writen_readline.h" #define ERR_EXIT(m) \ do { \ perror(...
C
/*********************************************** # # Filename: myerror.c # # Author: zg107uc@ustc.mail.edu.cn # Description: --- # Create: 2018-01-10 11:14:00 # Last Modified: 2018-01-10 11:14:00 ***********************************************/ #include "apue.h" #include <errno.h> int main(int arg...
C
/*Experiment to find out what happens when prints's argument string contains \c, where c is some character not listed above*/ #include <stdio.h> main(){ printf("hello, world\c"); } //What happen is that the program print "hello, worldc"
C
/* * NOME: Stefano Viola * MATRICOLA: 863000253 * * * * */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #define BUF 1024 int main(int argc, char **argv) { char line[BUF]; char line2[BUF]; int strcount; char **strarray = NULL; int c; int cflag = 0; int dflag = 0; i...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #include"list.h" #include"queue.h" //Array Structure //int nodes[4]={0,0,0,0}; struct Array { char code[7]; char name[4]; int credits; int maxLimit; struct List *regList; struct Dlist *waitList; }; struct Array *ptr[4]; //Single Linked List struct List { char data...
C
void ft_rev_int_tab(int *tab, int size) { int *start_tab; int *end_tab; int buff; if (!size) return ; start_tab = tab; end_tab = tab + size - 1; while (start_tab < end_tab) { buff = *start_tab; *start_tab = *end_tab; *end_tab = buff; ++start_tab; --end_tab; } }
C
#include <stdio.h> int main(void) { int ABG_iArrayOne[10]; int ABG_iArrayTwo[10]; /***** ABG_iArrayone ******/ ABG_iArrayOne[0] = 5; ABG_iArrayOne[1] = 10; ABG_iArrayOne[2] = 15; ABG_iArrayOne[3] = 20; ABG_iArrayOne[4] = 25; ABG_iArrayOne[5] = 30; ABG_iArrayOne[6] = 35; ABG_iArrayOne[7] = 40; ABG_iArrayO...
C
#ifndef QUEUE_H #define QUEUE_H /** * @brief Queue is a linear data structure which follows a particular order in which the operations are performed. * The order is First In First Out (FIFO). * A good example of a queue is any queue of consumers for a resource where the consumer that came first is ser...
C
/* Organização e recuperação da informação - Lista 01 Exercício 07 Aluno: Pedro Henrique Mendes */ #include <stdio.h> #include "aluno.h" #include "lista.h" #include "cadastro.h" int compare(struct aluno a1, struct aluno a2) { if (a1.RA < a2.RA) return -1; else if (a1.RA > a2.RA) retu...
C
#include "ia.h" #include "database.h" #include <stdio.h> #include <string.h> #define PERIOD_REFRESH 100 #define NB_IMAGES_GETERROR 1000 #define PATH_SAVE_GRAPH "train3_lr0.1_q0.85.csv" #define TRAIN_NAME "train3_lr0.1_q0.85" void train1(NN *nn, TDB *tdb, double lr, int count); void train2(NN *nn, TDB *tdb, double l...
C
#include<stdio.h> int main() { char a[10000]; gets(a); int b[6] = {0}; int i; for(i=0; a[i]!='\0'; i++) { if(a[i]=='P') { b[0]++; } else if(a[i]=='A') { b[1]++; } else if(a[i]=='T') { b[2]++; } else if(a[i]=='e') { b[3]++; } else if(a[i]=='s') { b[4]++; } else if(a[i...
C
#include <stdio.h> void distict_elements(int a[], int n); int main() { int s, i, arr[20]; // Get the array size scanf("%d", &s); // Get the array elements for(i=0; i<s; i++) { scanf("%d", &arr[i]); } // Function call to print the distinct elements in an array distict_elements(arr, s); return 0; } void...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* fill.c :+: :+: :+: ...
C
#include <stdio.h> int main(void) { int num = 1, num1 = 9; printf("출력할 단: "); scanf("%d", &num); while(num1>0) { printf("%d * %d = %d \n", num, num1, num*num1); num1--; } return 0; }
C
/* ** c_users.c for users in /Users/pierre/Epitech/PSU/IRC/irc_server ** ** Made by Pierre Monge ** Login <pierre@epitech.net> ** ** Started on Sun Jun 11 03:22:27 2017 Pierre Monge ** Last update Sun Jun 11 16:53:40 2017 Pierre Monge */ #include "command.h" #include "client_write.h" #include "hash.h" static void...
C
#include <stdio.h> #include <string.h> char mem[8]; char buf[128]; void initBuf(char *pBuf) { int i, j; mem[0] = '0'; mem[1] = '1'; mem[2] = '2'; mem[3] = '3'; mem[4] = '4'; mem[5] = '5'; mem[6] = '6'; mem[7] = '7'; //ascii table first 32 is not printable for (i = 2; i < 8;...
C
#if 0 set -e src="$(basename $0)" exe="$(echo $src | cut -f1 -d.)" trap "rm -f $exe" EXIT gcc -std=gnu99 -Wall -Werror -pedantic -O2 -g -o $exe $src ./$exe exit $? #endif #include "base.h" string remove_all(string s, int c) { string t = (string){.len = s.len}; t.s = malloc(t.len + 1); strcpy(t.s, s.s); ...
C
#include <stdio.h> #include <time.h> // The cycle time static const float cycle_duration = (float) 1 / (float) 3.1; // How long takes the chrono to start and stop static double residue; void perf_init(){ struct timespec start, end; clock_gettime(CLOCK_REALTIME, &start); clock_gettime(CLOCK_REALTIME, &end...
C
//CSC 332 Group Project //Authors: Leah Meza //Due: 5/8/20 #include <stdio.h> #include <stdlib.h> #include <string.h> #define N 10000 #include "list.h" #include "tree.h" //#include "path.h" #rei #include "exit.h" int main(void) { char* buffer = calloc (N, sizeof (char*)); //array of char from user input includin...
C
#include <stdio.h> #define MAXLINE 1000 /* Write a function reverse(s) that reverses the character string 's' Use it to write a program that reverses its input line by line */ void reverse(char to[], char from[]); int main() { int c; int i = 0; char temp[MAXLINE]; char perm[MAXLINE]; while ((c = getchar()...
C
#include <stdio.h> #include <time.h> #include <stdlib.h> #include <locale.h> #include <string.h> #include <windows.h> #define LIN 5000 #define COL 6 #define JOGADOR 3 void imprimir(int *concurso[LIN][COL]){ int l, c; for(l=0;l<LIN;l++){ for(c=0;c<COL;c++){ printf("|%02d| ",concurso[l][c])...
C
#include<stdio.h> int main() { int money,i,j; j=0; do { printf("你有多少钱\n"); scanf("%d",&money); }while(money<1&&printf("滚回家拿钱\n")); for(i=1;i<=money;i++) { j++; if(j%2==0) j++; } printf("您能喝多少瓶饮料%d\n",j); return 0; }
C
/* * file: wall.c * author: GAndaLF * brief: Wall detection task. */ #include "platform_specific.h" #include "led/led.h" #include "adc/adc.h" #include "wall_sensor/adc2dist.h" #include "wall_sensor/wall_sensor.h" /** Function converting ADC value to distance for specific sensor. */ typedef int32_t (*adc2dist_...
C
#include <stdio.h> #include <stdlib.h> #include <mpi.h> #include "global.h" // Rank of the root node #define ROOT 0 // Indexing macro for local pres arrays #define LP(row, col) ((row) + border) * (local_width + 2 * border) + ((col) + border) // Arrays used by MPI_scatterv and MPI_gatherv for f...
C
//题目:字符串排序 //ps:计算输入字符个数的问题,sizeof的用法并不是直接算个数的,而是使用的空间,其次64位系统,指针是8位,wtm,比较的时候看清楚 #include <stdio.h> #include <string.h> #include <stdlib.h> void swap(char * str1,char * str2); int main() { char str1[20],str2[20],str3[20]; printf("输入3个字符串(每个以回车结束):\n"); fgets(str1,(sizeof(str1) / sizeof(str1[0])),stdin); fgets(st...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_alignement.c :+: :+: :+: ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* s_operation.c :+: :+: :+: ...
C
#include <avr/io.h> #include <avr/interrupt.h> #include <stdio.h> #include <math.h> #include <util/delay.h> #include "serial.h" #include "dynamixel.h" #define PI 3.141592f /// Control table address #define P_CW_ANGLE_LIMIT_L 6 #define P_CCW_ANGLE_LIMIT_L 8 #define P_GOAL_POSITION_L 30 #define...
C
//printing fibonacci series upto nth term #include<stdio.h> main() { int n,f1,f2,fib,i; printf("Enter number of terms:"); scanf("%d",&n); f1=0; f2=1; printf("%d\t%d\t",f1,f2); i=3; while(i<=n) { fib=f1+f2; printf("%d\t",fib); f1=f2; f2=...
C
#include "board_usb.h" #include "board_led.h" /* USB Device Core handle declaration */ USBD_HandleTypeDef hUsbDeviceFS; volatile int conn_init; static void usb_vbus_exti_init(void) { /* PA0 (OTG_VBUS) Init: */ /* GPIO data struct to hold settings: */ static GPIO_InitTypeDef GPIO_InitStruct; GPIO_InitS...
C
/* ------------------------------- Name: Luxi Liang Student number: 165936188 Email: lliang44@myseneca.ca Section: SJJ Date: August 2, 2019 ---------------------------------- Assignment: 2 Milestone: 4 ---------------------------------- */ #define _CRT_SECURE_NO_WARNINGS #include <...
C
#include <stdio.h> #include <string.h> int main(int argc, char* argv[]) { char input[256]; while (1) { printf("enter text 255 chars or less, type quit and press enter to quit: "); fgets(input, 255, stdin); if (!strcmp(input, "quit\n")) { break; } else { printf("you said %s", input); } } return 0;...
C
#include<stdio.h> int main() { int a; scanf("%d",&a); while(a!=0) { printf("%d\n",(a*(a+1)*(2*a+1))/6); scanf("%d",&a); } return 0; }
C
#include "../include/sysio.h" size_t __sys_write(int fd, const void* buffer, size_t count){ switch(fd){ case STD_ERR: case STD_OUT: __print(STD_DISPLAY,buffer,count);break; case REG_OUT: __print(REG_DISPLAY,buffer,count);break; default: return -1; } } size_t __sys_read(int fd, void* buffer, size_t...
C
#include<stdio.h> int input(); int cetak(); int cari(); int main(void) { int keluar = 0; int pilihan; while(keluar != 1) { // Jika menggunakan UNIX/LINUX maka gunakan system("clear") // Jika menggunakan Windows maka gunakan clrscr(); system("clear"); printf("=========...
C
#include <stdio.h> #define MAXLINE 1000 /* maximum input line length */ int getline2(char line[], int maxline); void copy(char to[], char from[]); int strlen2(char s[]); void squeeze(char s[], int c); int main() { int len; int max; char line[MAXLINE]; char longest[MAXLINE]; max = 0; while ((len = getline2(line, MAXLI...
C
#include <mqueue.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include "shared.h" int i = 0; int produce_item() { printf("Produziu %d\n", i++); return i; } void consume_item(int item) { printf("Consumiu %d\n", item); } void receive(mqd_t mq, struct Message *message) { int n = mq_receive(mq, (c...
C
#include<stdio.h> int esprimo(int) ; int main() { int n, resultado; printf("Ingresar el numero a chequear.\n"); scanf("%d",&n); if (n==0) printf("\n No es primo "); else if (n==1) printf("\n No es primo "); else if (n==-1) printf("\n No es primo "); else ...
C
/**************************************************************************** * file: card.h * * author: kyle isom <coder@kyleisom.net> * * * * Defin...
C
#ifndef HANSHU_H #define HANSHU_H #include"graphm.h" #include"string.h" #include"strstream" #include"global.h" #include "qdebug.h" int minVertex(Graphm *G,int *D) //返回图G中最小的点 { int i, v=-1; for(i = 0; i<G->n(); i++) if(G->getMark(i) == UNVISITED){ v=i; break;} //找出图G中没有被访问的点 for(i++; i<G->n(); ...
C
#include "shell.h" /** *_getline - to recibe what user type in stdin *Return: a pointer to what user typed */ char *_getline() { size_t num_bytes = 1024; ssize_t chars; char *buffer; buffer = malloc(sizeof(char) * 1024); chars = getline(&buffer, &num_bytes, stdin); if (chars == EOF) { if (isatty(STDIN_FIL...
C
// Julia Tan #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> typedef struct { int acctNum[3]; // Account number char acctName[3][100]; // Account name float balance[3]; // Account balance } Account; void info(Account a, int client){ // prints current account info of client printf("Acc...
C
#include "stdafx.h" #include "mem.h" typedef struct memS_atom { struct memS_atom* link; int capacity; int offset; byte* p; }memS_atom; typedef struct ST { int cb; struct memS_atom* pl; }ST; #define INIT_CAPACITY_S 128 ZENGINE_API memS_t memS_create() { memS_t p = (memS_t)malloc(sizeof(ST))...
C
#include "pthread.h" #include "winint.h" #include <winsock2.h> typedef struct _helperStruct { void *param; ptRoutine fcn; }helperStruct; uint32_t WINAPI helper_thread(void* p) { helperStruct* hs = (helperStruct*)p; hs->fcn(hs->param); free(hs); return 0; } int pthread_create(void** h, void* a...
C
#include <stdio.h> #include <stdlib.h> void wytnijzn(char *napis1, char *napis2) { int i=0; int j=0; int czyjest[256]={}; for(i = 0; i < 256; i++) { czyjest[i]=0; } for(i = 0; *(napis2+i)!= 0; i++) *(czyjest+(int)(*(napis2+i))) = 1; for(i = 0; *(napis1+i)!=...
C
#include <stdio.h> #define SIZE 5 double diff_max_min(double[], int); int main(void) { double arr[SIZE] = { 0.5,9.0,5.3,6.0,1.2 }; double diff; diff = diff_max_min(arr, SIZE); printf("The diff between max and min of array is %5.2lf.\n", diff); return 0; } double diff_max_min(double arr[], int n) { double max...
C
/* * @lc app=leetcode.cn id=901 lang=c * * [901] 股票价格跨度 */ // @lc code=start typedef struct Node_ { int price; int preContinueNum; struct Node_ *next; } Node; typedef struct { int num; Node *top; } StockSpanner; StockSpanner* stockSpannerCreate() { StockSpanner *stack = NULL; stack...
C
#include <stdio.h> #include <ctype.h> #include <stdlib.h> #include <string.h> #include "gameService.h" #include "menu.h" int AnChessStatus[15][15]; int turn; int main(){ int number; ui(); int nRow=0 ; int nCol =0; int turn=0; scanf("%d",&number); switch (number) { case 1: ...
C
#include<stdio.h> int sort(int *a,int size) { int i,j,t; for(i=1;i<size;i++) { for(j=i;j>0&&a[j]<a[j-1];j--) { t=a[j]; a[j]=a[j-1]; a[j-1]=t; } } return 0; } int read(int *a) { int size,i; printf("Size: "); scanf("%d",&size); for(i=0;i<size;i++) scanf("%d",&a[i]); return s...
C
#ifndef REPRESENTATION_H #define REPRESENTATION_H // ***************************************************************************** // Symboles possibles pour ecrire un nombre. // On n'aura jamais une base plus grande que la longueur de cette chaine. // ******************************************************************...
C
#include<stdio.h> void main() { int row ; printf(" the number of row:5\n"); for(int i=1;i<=3;i--) if printf("*"); else { printf(" "); } printf("\n"); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <time.h> int COMPARE_COUNT=0; int Swap( long x[], long i, long j) { int tmp; tmp = x[i]; x[i] = x[j]; x[j] = tmp; return 0; } int Quick_Sort(long x[], long min, long max) { long i,j,p; if(min>=max)return 1; p = x[(min+max)/2]; i = mi...