language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include "holberton.h" /** * _strcat - Function to return NULL. * @dest: String to be recieved as argument (destiny). * @src: String to be recieved as argument (source). * Return: Always NULL. */ char *_strcat(char *dest, char *src) { return (NULL); }
C
#include<fcntl.h> #include<stdio.h> #include<stdlib.h> void main() { int fd_open,fd_open_creat,fd_creat; if((fd_open=open("1.c",O_RDONLY))==-1) { perror("open"); exit(EXIT_FAILURE); } printf("(此文件已存在(只读打开1.c))\nthe one file's descriptor is:%d\n\n",fd_open); char s[20],s1[20]; printf("(fd_open_creat)请输入文件名(此文...
C
#include <stdio.h> #include <time.h> #include <stdlib.h> int main(void) { int x, i, max; int tab[10]; srand(time(NULL)); i = 0; while (i < 10) { x = (rand() % 100 - 50); tab[i] = x; printf("%d ", tab[i]); i++; } i = 0; max = tab[0]; while (i < 10) { if (tab[i] > max) max = tab[i]; i++; } ...
C
#pragma once //ֹͷļظ #include <stddef.h> #define SeqListMaxNum 1000 //Ԫظ typedef char SeqListType; //ض typedef struct SeqList { SeqListType SeqListArr[SeqListMaxNum]; size_t size; //Ԫظ }SeqList; void SeqListInit(SeqList* seq); //ʼ˳ void SeqListPrint(SeqList* seq, const char* ch)...
C
#include<stdio.h> void main() { int i,j; for(i=5;i>0;i--) { printf("%d\t%d\t%d\t%d\t%d\t%d\t",i*10+0,i*10+1,i*10+2,i*10+3,i*10+4,i*10+5); } }
C
#include <stdio.h> #include <math.h> int fibonacci(int N) { if (N == 1 || N == 2) return 1; return fibonacci(N-1)+fibonacci(N-2); } int main() { int N; printf("Please, enter number N:"); scanf("%d", &N); for ( int i = 1; i <= N; i++) printf("%d ", fibonacci(i)); printf("\n"); return 0; }
C
/************************************************************************* > File Name: c.c > Author: Stomach_ache > Mail: 1179998621@qq.com > Created Time: 2013年12月07日 星期六 16时09分44秒 ************************************************************************/ #include<stdio.h> #include<string.h> #includ...
C
/* * Timer.c * * Created: 5/17/2021 9:47:22 PM * Author: Moustafa Moubarak */ #include "Timer.h" #include <avr/interrupt.h> uint32 NUM_OVF_0 = 0; uint8 INIT_VALUE_0 = 0; uint32 NUM_OVF_1 = 0; uint32 INIT_VALUE_1 = 0; void(* PTR_0)(void); void(* PTR_1)(void); void Timer_Init(uint8 Timer) { switch(Timer) {...
C
#include <stdio.h> #include <stdlib.h> struct Node { int data; struct Node * next; }; struct Node * head = NULL; void add(){ int value; printf("Enter a Value:"); scanf("%d", &value); struct Node * temp; struct Node *nt = malloc(sizeof(struct Node)); nt->data = value; nt->next = N...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* sudoku_solution_checker.c :+: :+: :+: ...
C
#include <sys/stat.h> #include <sys/wait.h> #include <fcntl.h> #include <string.h> #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <errno.h> #include <assert.h> void write_fifo(void); void read_fifo(void); #define NAMEDPIPE_NAME "/tmp/my_named_pipe" #define BUFSIZE 50 char buffer[] = "asdfasdfasd...
C
/* SPDX-License-Identifier: Apache-2.0 */ /* * Copyright (C) 2014-2019 Intel Corporation */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <fcntl.h> #include <sys/ioctl.h> #include <unistd.h> #include <errno.h> #include <stdint.h> #include <stdbool.h> #include <limits.h> #include <ctype.h> #inclu...
C
/************************************************************************* > File Name: my_lseek.c > Author: > Mail: > Created Time: Mon 20 Jul 2015 10:57:56 CST ************************************************************************/ #include<stdio.h> #include<sys/stat.h> #include<sys/types.h> #include<fcntl....
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #define N 1000 struct nodes{ int number; int value; }nodes[N]; void remember_nodes(int number, int value){ int i = 0; for (i = 1; i <= number; i++) { if (nodes[i].value == value){ break;} else { if (nodes[i].value == 0) ...
C
#include "libmx.h" void mx_print_unicode(wchar_t c) { char output[5] = {0}; if (c < 0x80) output[0] = (c >> 0 & 0x7F) | 0x00; else if (c < 0x0800) { // < 2048 output[0] = (c >> 6 & 0x1F) | 0xC0; output[1] = (c >> 0 & 0x3F) | 0x80; } else if (c < 0x010000) { // < 65536 output[0] = (c >> 12 & 0x0F) | 0xE0;...
C
#include <stdio.h> int main() { int ara[5], i, j, count=0; for(i=0; i<4; i++) { scanf(" %d", &ara[i]); } for(i=0; i<4; i++) { for(j=i+1; j<4; j++) { if((ara[i]==ara[j])&& ara[j]>0) { count++; ara[j]=0; }...
C
// // main.c // queue_simulation // // Created by Bradley Morgan on 11/14/18. // Copyright © 2018 BiT8. All rights reserved. // // // this program simulates a queue using a circular array // data structure to track arrivals and departures, i.e... // // departure<-[he...
C
#include <stdio.h> #define MAX_WORD_LENGTH 10 // TODO, fix off-by one, then do vertical orientation next int main(void) { int freqs[MAX_WORD_LENGTH + 1]; int c; int currentWordLength = 0; int j; int i; for (i = 1; i <= MAX_WORD_LENGTH; i++) freqs[i] = 0; while ((c = getchar()) != EOF) { if (...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> // Ͽ ִ ܾ ִ #define MAXWORD 1000 #define DELEMETERS " ,.!?\t\n" // Լ void initialize(); void read_file(); void move_downward(int); void insert_data(int, const char *); void print_words(); void deallocate(); void convert_lower(char *); int linear_search(con...
C
#include <project.h> unsigned char GetASCh(unsigned int uiNum, unsigned char ucNum); void Print_Temp(unsigned int uiTemp); void Print_All(unsigned char ucHTemp, unsigned char ucLTemp); int main(void) { unsigned char ucHTemp = 0; unsigned char ucLTemp = 0; unsigned int uiValue = 0; Lcd_Init(); Timer_Init(); Sp...
C
int iterative_factorial(int nb) { int num; num = 1; if (nb < 0) return (0); while (nb != 0) { num = num * nb; nb--; } return (num); }
C
#include <stdlib.h> #include <stdio.h> #include <getopt.h> #define pr_usage(fmt, ...) \ fprintf(stderr, fmt, ##__VA_ARGS__) static const char *execname = ""; static void base_usage(const char *name, const char *help) { pr_usage("\t%s\t%s\n", name, help); } static void argument_usage(const char *argname, c...
C
#include <stdlib.h> #include <pthread.h> #include <stdio.h> #include <sys/time.h> #include <time.h> #define N 1000 #define NBMAT 10 double counter=0; double serialFunc(){ counter++; return counter; } void *multiplyMatCst(void *arg){ int i,j; double *M; M = (double *) arg; for (i=0;i<N;i++){ for (j=0;...
C
#include<stdio.h> #include<stdlib.h> int max(int x,int y){ return x>y?x:y; } void populate_arran(int*array,size_t arraySize,int (*getNextValue)(void)){ for (size_t i=0;i<arraySize;i++){ array[i]=getNextValue(); } } int getNextValue(){ return rand(); } int main(){ // in...
C
#include <stdio.h> #include <stdlib.h> #include "matrix.h" Matrix* create_matrix(int row, int col) { Matrix* matrix = calloc(row*col,sizeof(Matrix)); if(matrix ==NULL) { printf("Not enough memory!\n"); exit(1); } return matrix; } double get_l_norm(Matrix *matrix, int row, int col) {...
C
#include <stdio.h> #include <unistd.h> #include <tipos.h> #include <bisection.h> /* * Main */ void no_friction(Params *p); void friction(Params *p); int main(int argc, char* argv[]){ // Aca se asignan los params parseados del CLI al estilo -h <valor> -v <valor> static const char *optString = "M:h:v:t:m:c:i:a:...
C
/* Eric Paulz (epaulz) CPSC 3600-001 Homework 4 */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> #include <time.h> #include <unistd.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <pthread.h> // thread function prototype vo...
C
/** Lab 4 for SYSC 3310A: Intro to Real Time Systems (Summer 2021) This application uses two switches, a built-in 16 bit timer called TimerA and two LEDs (a red LED and an RGB LED). Only one LED can be controlled at any given time, and that LED that is being controlled is referred to as the 'selected' LED switch 1 swi...
C
/* ** my_prinf.c for my_prinf.c in /home/bequig_s//workspace/module-Unix/my_printf/my_prinf2 ** ** Made by sebastien bequignon ** Login <bequig_s@epitech.net> ** ** Started on Sat Nov 17 09:27:20 2012 sebastien bequignon ** Last update Sun Nov 18 20:54:59 2012 sebastien bequignon */ #include <stdarg.h> int my_pri...
C
void ft_putchar(char c); void ft_swap(char **s1, char **s2) { char *tmp; tmp = *s1; *s1 = *s2; *s2 = tmp; } void ft_putstr(char *str) { while (*str) ft_putchar(*(str++)); } int ft_strcmp(char *s1, char *s2) { int i; i = 0; while (s1[i] == s2[i]) i++; return (s1[i] - s2[i]); } int main(int argc, char...
C
/*************************************************************************************** * * * *Author: Jiwen CHEN <chen1984jiwen@163.com> * * * * * * ****************************************************************************************/ /* *2.7ǰNȻһ */ #include <stdio.h> #include "sort.h" #include <ti...
C
/// // Buffers.c // // Vertex and element buffer implementations. // // Author: Warren R. Carithers // Date: 2017/02/11 22:34:54 // // This file should not be modified by students. /// #include <stdlib.h> #include <stdio.h> #include <stdbool.h> #if defined(_WIN32) || defined(_WIN64) #include <windows.h> #end...
C
//Tyler Harley and Margaux LeBlanc //11/3/14 //Graphics #include <stdio.h> #include <stdlib.h> #include <string.h> #include <color.h> #include <list.h> #include <image.h> #include <math.h> #include "graphics.h" #include "drawstate.h" #include "light.h" #include "polygon.h" #include "matrix.h" #include "view.h" #includ...
C
#include<stdio.h> int main() { int a,b,num1,num2,sum; while(1) { int carcnt=0,cf=0; scanf("%d%d",&a,&b); if(a==0&&b==0) break; while(a!=0||b!=0) { num1=a%10; num2=b%10; sum=cf+num1+num2; if(sum>=10) { carcnt++; cf=1; } else cf=0; a/=10; b/=10; } if(carcnt==0) pr...
C
#include <stdio.h> int main(){ char a,b,c,d,e; printf("Informe 5 letras:\n"); scanf("%c%c%c%c%c",&a,&b,&c,&d,&e); if(a == e && b == d && c == c && d == b && e == a){ printf("a palavra eh palindromo\n"); exit(0); }else{ printf("a palavra nao eh palindromo\n"); exit(0); } return 0;...
C
#ifndef __DHERA_STACK__ #define __DHERA_STACK__ /* defines stack, pop and push fucntions. */ typedef struct Stack { float info; struct Stack * next; }Stack; void push(Stack ** top, float input); float pop(Stack** top); #endif
C
#include "holberton.h" /** * print_last_digit - print_last_digit * *@n: variable the number * * Return: Always 0 (Success) */ int print_last_digit(int n) { if (n < 0) { n = n % 10; n = n * -1; _putchar(n + '0'); } else { n = n % 10; _putchar(n + '0'); } return (n); }
C
#include <limits.h> #include <stdbool.h> #include <stdlib.h> #include <stdio.h> #include "graph.h" #include "deque.h" struct graph { VertexHashSet *vertices; //used as just a set rather than a map of vertices to weights }; Graph *makeGraph() { Graph *graph = malloc(sizeof(*graph)); graph->vertices = makeEmptySetVe...
C
/* * Copyright (c) 1991-1997 Science Applications International Corporation. * * NAME * solve_via_svd -- Perform Singular Value Decomposition. * FILE * solve_via_svd.c * SYNOPSIS * int * solve_via_svd (icov, nd, np, maxp, at, d, damp, cnvgtst, condit, xsol, * covar, data_importances, applied_dam...
C
// Module: rnrcs.c // // Description: // This sample illustrates how a server can create a socket and // advertise the existance of the service to clients. It also // shows how a client with knowledge of the server's name only // can find out how to connect to the server in order to transmit // d...
C
#include<stdio.h> main() { int n ; scanf("%d",&n); int reverse=0; int s=0; int nn=n; int i=0; while(nn) { nn=nn>>1; s++; } nn=n; while(s>0) { nn=n; nn=nn>>s-1; nn=nn&1; nn=nn<<i; reverse=reverse|nn; s--; i++; } printf("%d",reverse); }
C
#include<stdio.h> int main() { int x,i,j,k; char a,arr[5][10]={"Ram","Sham","Aryan","Karan","Hari"}; for(i=0;i<=5;i++) { for(j=0;j<5-1-i;j++) { if(arr[j][0]>arr[j+1][0]) { a=arr[j]; arr[j]=arr[j+1]; arr[j+1]=a; } } } //printf("----------------\n"); for(i...
C
#include <stdio.h> #include <math.h> int main(void) { unsigned int year;//year count int rate;//interest rate double amount;//amount on deposit double principal = 5000.0;//starting principal //loop through interest rates 10% to 12% for (rate = 10; rate <= 12; ++rate) { //display table headers ...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <sys/types.h> #include<netinet/in.h> #include <netdb.h> void error(const char *msg) { perror(msg); exit(0); } int main(int argc, char *argv[]) { int sockfd,portno,n; struct sockaddr_in serv_addr; struct hostent *server; ...
C
#include <stdlib.h> #include <stdint.h> #include "test_semantics.h" #include "ctverif.h" int32_t get100_wrapper(void) { return get100(); } int32_t identity_wrapper(int32_t my_int) { return identity(my_int); } int32_t mutateArray_wrapper(int32_t arr[5]) { public_in(__SMACK_value(arr)); return mutateAr...
C
#define _CRT_SECURE_NO_WARNINGS 1 //qsortϰʹ #include <stdio.h> #include < stdlib.h > void test(void); int my_strcmp1(const void* s1, const void* s2); //ȽС int my_strcmp2(const void* s1, const void* s2); //ȽַС int my_strcmp3(const void* s1, const void* s2); //ȽϽṹ-С int my_strcmp4(const void* s1, const void* s2); ...
C
#include<stdio.h> #include "myStr.h" #include "myMath.h" void main() { char arr[4]="abba"; if(isPalindrome(arr,4) == 1) { printf("Palindrome\n"); } else { printf("Not a palindrome\n"); } int a=7; int b=5; if(isEqual(a,b) == 1) { printf("Equal\n"); } else { printf("Not Equal\n"); } swap(a,b); ...
C
#include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h> #include <math.h> #define FILE_NAME_BUF 12+4 #define MAX_COLOR_VAL 255 #define PIXELS_PER_LINE 2 #define X_BOUND 1024 #define Y_BOUND 1024 //usage: ./main outfile t-value func typedef struct Pixel { uint8_t red; uint8_t grn; uint8_t blu...
C
#include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <stdio.h> #include <memory.h> #include <string.h> #include <errno.h> #include <stdlib.h> #include <time.h> #include <stddef.h> int s1; struct sockaddr_in addr; int secret, number; int send_server(); void recv_server(ch...
C
// Program treba spojit 2 stringa u 1. #include <stdio.h> int main() { char str1[50], str2[50], i, j; printf("Unesi prvi string: "); scanf("%s",str1); printf("\nUnesi drugi string string: "); scanf("%s",str2); // Ova petlja ide kroz prvi string for(i=0; str1[i]!='\0'; ++i); ...
C
#include <stdio.h> #include <math.h> main(int argc, char *argv[]) { double L; /* Srednji broj pokvarenih uredaja u liniji */ double Q; /* Srednji broj pokvarenih uredaja u sustavu */ double R; /* Srednje vrijeme zadrzavanja */ double S; /* Srednje vrijeme popravka */ double U; /* Ukupno srednj...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* sa_sb_ss_pa_pb.c :+: :+: :+: ...
C
#include "../inc/maze.h" /** * render_mini - Renders a minimap on the top right of the screen. * * @instance: Struct containing the SDL2 renderer and window. * @maze: Struct containing a pointer to the layout of the maze. * @status: Struct containing variables on camera position. */ void render_mini(SDL_Instance...
C
bool binary_search(vector<int> list, int bot, int top, int target){ if (list.size() == 0) return false; if (list.size() == 1) return true; if (bot < top){ int m = bot + (top - bot) / 2; if (list[m] == target) return true; else if (list[m] < target) return binary_search(list, m + 1, t...
C
#include <stdio.h> struct exercise{ const char *discrpition; float duration; }; struct meal{ const char *ingredient; float weight; }; struct preference{ struct meal food; struct exercise exercise; }; struct fish{ const char *name; const char *species; ...
C
// WAP To Create two sets and perform the Symmeteric set difference operation #include<stdio.h> int main (){ int n,m , set1[100] , set2[100]; printf("\n Enter the Elements of SET A "); scanf("%d",&n); for(int i=0;i<n;i++){ scanf("%d",&set1[i]); } printf("...
C
#include <stdio.h> #include <stdlib.h> int main() { int n1 = 0; printf("Introduza o numero\n"); scanf("%d",&n1); if((n1>=0) && (n1%2)==0){ printf("%d par",n1); }else if((n1>=0) && (n1%2)==0){ printf("%d impar",n1); } return 0; }
C
#include <stdio.h> #include <string.h> int main() { const char *date = "18.07.2013w"; char c[10]; memset(c, 0, 10); int y, m, d, i; i = sscanf(date, "%d.%d.%4d%c", &d, &m, &y, c); printf("date: %s; day %2d, month %2d, year %4d, extra: %c, %d\n", date, d, m, y, c[0], i); i = sscanf(date, "%d.%d.%3...
C
#include<stdio.h> #include<string.h> struct STR {char num[10];int s;}; main() { struct STR t,*p; t.num[0]="a"; t.num[0]="b"; t.num[0]="c"; p=&t; //p->num[0]='\0'; //strcpy((*p).num,""); //puts(t.num); p->s=99; printf("%d",(*p).s); } /* void fun(char *a) { int i=0,j,k; while(a[i]=='*') ++i; ...
C
/*############################################################################*\ # _ ___ _____ _ ___ ___ __ __ _ _ _ _ _____ ___ ___ # # /_\ | _ \_ _/ | / __|_ _| \/ | | | | | /_\_ _/ _ \| _ \ # # / _ \| / | | | | \__ \| || |\/| | |_| | |__ / _ \| || (_) | / ...
C
#include <stdio.h> void main() { char chiffre; do { printf("\nChoisir un chiffre :"); scanf(" %c",&chiffre); switch(chiffre) { case '0': printf("ZERO"); break; case '1': printf("UN"); break; case '2': printf("DEUX"); break; case...
C
#pragma once /* "kernel" utility things */ /* fprintf */ #define fprintf(fd, fmt, args...) dbg(DBG_TEST, fmt, ##args) #define printf(fmt, args...) dbg(DBG_TEST, fmt, ##args) /* errno */ #define errno (curthr->kt_errno) /* malloc/free */ #define malloc kmalloc #define free kfree /* The "kernel" system calls */ #def...
C
/** Handling for type tuple nodes * @file * * This source file is part of the Cone Programming Language C compiler * See Copyright Notice in conec.h */ #ifndef ttuple_h #define ttuple_h // A tuple is a comma-separated list of elements, each different. // This structure supports both type tuples and tuple literals...
C
/* * This program can simulate the execution of a memory-bound task. Under the simulation, * Each task writes its the residence time into /proc/buffer for each 3 seconds. * When /proc/buffer is written, the guest OS indirectly writes the file storing data * of each memory-bound task. */ #include "FixedAccMem...
C
#include <stdio.h> // [man, dog, sheep, vegetable] char impassable[6] = {0b0011, 0b0110, 0b0111, 0b1000, 0b1001, 0b1100}; char stack[15]; int top = 0; int isPassable(char status) { // check repeating for (int i = 0; i < top; i++) if (stack[i] == status) return 0; // check impassable for (int...
C
#include "lem_in.h" void free_string_array(char **array) { size_t i; if (array) { i = 0; while (array[i] != NULL) { free(array[i]); i++; } free(array); } } void free_lemin(t_lemin *lemin, t_room *path) { t_room *tmp; if (lemin) { while (lemin->room) { ft_strdel(&(lemin->room)->name); ...
C
#include<stdio.h> #define min(a,b) (((a)<(b))?(a):(b)) typedef long long int lli; int main() { lli d1,d2,d3; scanf("%lld %lld %lld", &d1, &d2, &d3); lli dis1,dis2,dis3,dis4; dis1=d1+d2+d3; dis2=2*(d1+d2); dis3=d1+d3+d3+d1; dis4=d2+d3+d3+d2; printf("%lld\n", min(dis1,min(dis2,min(dis3,dis4)))); return...
C
#ifndef _UNIT_H_ #define _UNIT_H_ #include <stdint.h> #include <stdbool.h> #define UNIT 1.0f typedef double data_t; /* unit conversion works as follows */ /* RATIO and OFFSET are used to convert the unit into terms of units[0] */ /* value[0] = RATIO[n] * value[n] + OFFSET[n]; */ /* this can then be converted to anoth...
C
#include <stdio.h> #include <string.h> int strrindex(char s[], char t[]); int main(){ char s[] = "Hallo Test123 Hallo Test123 Hallo Test123 Hall"; char t[] = "Hallo"; printf("%d \n", strrindex(s,t)); } int strrindex(char s[], char t[]){ int i, j, temp; int final = -1; for( i = 0; i < strlen(s); i++){ ...
C
/********************************************************************* * Filename: ring.c * Author: Prasad Maddumage <mhemantha@fsu.edu> * Created at: Wed Jul 16 22:48:34 2014 * Modified at: Mon Oct 2 23:55:25 2017 * Modified by: Prasad Maddumage <mhemantha@fsu.edu> * Version: $Revision:...
C
/** * Copyright (c) 2014-2019 Timothy Elliott * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, ...
C
#include "filesys/inode.h" #include <list.h> #include <debug.h> #include <round.h> #include <string.h> #include "filesys/filesys.h" #include "filesys/free-map.h" #include "threads/malloc.h" #include "threads/synch.h" /* Identifies an inode. */ #define INODE_MAGIC 0x494e4f44 /* Number of direct blocks in inode_disk. *...
C
#include <stdio.h> #include <stdlib.h> /** *main - print out all the arguments it recieves *@argc: argument count *@argv: argument array type char *Return: 0 multiple or -1 if less than 2 arguments */ int main(int argc, char **argv) { int i, multiple = 1; if (argc <= 2) { printf("Error\n"); return (-1...
C
#include<stdio.h> void swap(int *a, int *b) { // simple function to swap numbers int temp = *a; *a = *b; *b = temp; } void printArray(int arr[], int size) { // simple function to print an array for (int i=0; i < size; i++) printf("%d ", arr[i]); printf("\n"); } void insertion_s...
C
#include <unistd.h> #include <getopt.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <poll.h> #include <fcntl.h> #include <math.h> #include <time.h> #include <pthread.h> #include <ctype.h> #include <mraa.h> #include <mraa/aio.h> int period = 1; int scale = 'F'; int logfd = -1; const int B = ...
C
//Read formatted time (in HH:MM:SS) through scanf in C program #include <stdio.h> void main() { int h, m, s; printf("\n Enter Time (in HH:MM:SS)"); scanf("%02d:%02d:%02d", &h, &m, &s); printf("Entered time is %02d:%02d:%02d\n", h, m, s); }
C
#include "ei_decode.h" #include "process_manager.h" /** * Decode the arguments into a new_process * * @params * {Cmd::string(), [Option]} * Option = {env, Strings} | {cd, Dir} | {do_before, Cmd} | {do_after, Cmd} | {nice, int()} **/ const char* babysitter_action_strings[] = {"run", "exec", "list", "status", "kill"...
C
#include <stdio.h> #include <stdlib.h> #define MAXLINE 100 #define YES 1 #define NO 0 #define TAB 8 void esetab(int argc, char *argv[], char *tab); void entab(char *tab); main(int argc, char *argv[]) { char tab[MAXLINE+1]; esetab(argc, argv, tab); entab(tab); return 0; } void esetab(int argc, char *argv[], char ...
C
#include <stdio.h> #include <stdlib.h> /*Considerando o registro de um produto de uma loja contendo as seguintes informações: descrições, valor Fazer um programa que, dado o registro de 50 produtos, exiba-os na oredem inversa em que foram digitados.*/ struct produtoLoja{ char descricao[50]; float valor; int...
C
#include <stdio.h> int main() { int broj, cifra, c1, novibroj=0, c2, broj1=0 ,broj2; do { printf("Unesite broj: "); scanf("%d" ,&broj); } while(broj<0); do { printf("Unesite cifru: "); scanf("%d" ,&cifra); } while (cifra<0); do { c1=broj%10; broj=broj/10; if( c1 != cifra){ novibroj=novibroj*10+c1...
C
#include "Stack.h" void StackInit(ST* ps) { assert(ps); ps->a = (STDataType*)malloc(sizeof(STDataType) * 4); if (ps->a == NULL) { printf("malloc fail\n"); exit(-1); } ps->capacity = 4; ps->top = 0; } void StackDestory(ST* ps) { assert(ps); free(ps->a); ps->a = NULL; ps->top = ps->capacity = 0; } // ...
C
#include <stdio.h> #include <stdlib.h> struct stack { unsigned int size; int * data; }; int push_stack(struct stack * s_ptr, int * top, int new_element); int pop_stack(struct stack * s_ptr, int * top); int top_stack(struct stack s, int top); int size_stack(struct stack s, int top); int is_empty(struct stack s, int ...
C
#include <stdio.h> #include <sys/ioctl.h> #include <sys/select.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdlib.h> #include <termios.h> #include <unistd.h> #include "1-pty_master_open.h" #include "2-pty_fork.h" #include "tty_functions.h" #define MAX_SNAME 1000 #define BUF_SIZE 256 s...
C
# include <stdio.h> #include "hstcal.h" # include "hstio.h" # include "xtables.h" # include <time.h> # include "acs.h" # include "hstcalerr.h" typedef struct { IRAFPointer tp; /* pointer to table descriptor */ IRAFPointer cp_date; /* column descriptors */ IRAFPointer cp_shiftx; IRAFPointer cp_shifty; int nro...
C
#include <stdio.h> #include <stdlib.h> int main(void){ int *x = malloc(sizeof(int)); int *y = malloc(sizeof(int)); *x = 1; *y = 2; printf("*x is %d\n", *x); printf("*y is %d\n", *y); // free(x); // x = y; printf("x now points to y\n"); printf("*x is %d\n...
C
#include <stdio.h> int main() { freopen("301.txt", "w", stdout); int n, op, i; long long a1, b1; double a2, b2; scanf("%d", &n); for (i = 1; i <= n; i++) { scanf("%d", &op); if (op == 1 || op == 2) { scanf("%lld%lld", &a1, &b1); printf("%lld", a1 + b1); } else { scanf("%lf%lf", &a2, &b2); ...
C
#include <sys/time.h> #include <stdio.h> #include <unistd.h> #include <signal.h> #include <string.h> unsigned int j = 0,i = 0; void prompt_info(int signo) { i++; } void init_sigaction(void) { struct sigaction act; act.sa_handler = prompt_info; act.sa_flags = 0; sigemptyset(&act.sa_mask); sigaction(SIGPROF,&act,...
C
// TEAM APPLE! #include "esos_lcd_menu.h" // ******** G L O B A L S *************** #define LM60_OFFSET 0xA5A0 // 424 * 100 #define LM60_CELSIUS_CONSTANT 0x0271 // 6.25 *100 volatile menu st_menu; // the structure which holds the values /*********************************************************...
C
#include <stdio.h> #include <string.h> #define R_ENV "OLDPWD" int main(int argc, const char *argv[]) { extern char **environ ; printf("environ = %s\n",*environ) ; printf("environ addr = %p\n", environ) ; char** env = environ; while( *env != NULL) { printf("%s\n", *env++) ; } /*读指定的 环境变量的值*/ printf("***...
C
#include "rt_hist.h" #include <string.h> #include <stdlib.h> #include <assert.h> void hist_init (hist_head_t* list) { memset(list, 0, sizeof(hist_head_t)); } /* Push to the front */ void hist_push (hist_head_t* list, int c) { hist_t* hist; hist = malloc(sizeof(hist_t)); assert(hist); hist->c = c;...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX(A,B) (((A) > (B))? (A) : (B)) void show_vector(int* ,int ); void initialize_right_LCS_vector(int* , int ); int* lLCS(char*, int, char*, int); char* get_string(); int main(){ char *word1 = NULL; char *word2 = NULL; word1 = get_string(); ...
C
#include <stdio.h> int main(void) { int ch; ch = 97; // 변환 코드: %c, %d printf("ch: %c, %d \n", ch, ch); // a, 97 return 0; }
C
#include <stdio.h> int main() { unsigned int num=0x7fd00; unsigned int i; for(i=256;i<512;i++){ if(i%8==0) printf("\n"); printf("0x%x, ", num/i); } return 0; }
C
#include <stdio.h> /* printf */ #include <stdlib.h> /* malloc, free */ /* global functions and variables */ int s_count; void print_count() { printf("s_count: %d\n", s_count); } void print_info() { print_count(); } /* PublicTrasport */ void PTdisplayVT(void* PT); struct PTvtable { void (*display)(voi...
C
/** * @file chacha20_poly1305.c * @brief ChaCha20Poly1305 AEAD * * @section License * * Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved. * * This file is part of CycloneCrypto Open. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Genera...
C
#include <stdio.h> int main(void){ printf("input the kuatuo water:\n"); int kuatuo; scanf("%d", &kuatuo); double waters = 0; waters = kuatuo * 950 / (3.0e-23); printf("%d kuatuo is %e waters\n", kuatuo, waters); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <ctype.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> void error(const char *msg) { perror(msg); exit(2); } // Error function used for reporting...
C
#include <stdio.h> int AB[26]; int T,a,b; char s1[1<<20]; void build(int a,int b){ int temp=0; for (int i=0;i<26; i++){ temp = (a*i+b)%26; AB[i] =temp; } } int main() { freopen("data.txt","r",stdin); scanf("%d", &T) ; for (int i = T; i; i--){ scanf("%d...
C
// Number of pictures to take #define shots 1000 // How far to advance between shots // 128 steps == 1 mark on the fine control == 1 micron #define MICRON 128L #define distance (100 * MICRON) //Declare pin functions on Arduino #define stp 2 #define dir 3 #define fire 13 void setup() { pinMode(stp, OUTPUT); pinMod...
C
/* * ported the V7 rm * * cmd/rm/rm.c * Changed: <2022-01-06 16:38:16 curt> */ int errcode = 0; #include <stdio.h> #include <types.h> #include <sys/fs.h> #include <sys/stat.h> #include <sys/dir.h> char *sprintf(); main(argc, argv) char *argv[]; { register char *arg; int fflg, iflg, rflg; fflg =...