language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include "event.h" #include "initfile.h" #include <SDL.h> int main() { int game_over = 0; int mode = 0; /* * * mode 0 : menu ou pause * mode 1 : jeu * mode 2 : choix difficultée * mode 3 : level sup * mode 4 : carte * mode 5 : option * */ init_window(); ...
C
#include<stdio.h> #include<math.h> int amstrong_number(int n) { int i,count=0,temp=n,res=0; while(temp != 0) { count++; temp/=10; } temp=n; while(temp != 0) { res+= pow((temp%10),count); temp/=10; } if(res == n) { printf("%d\n",res); }...
C
/* Problem Statement : Write application which accept file name from user and create that file. Input : Demo.txt Output : File created successfully. */ #include "Header.h" int main() { char cFile[80] = {'\0'}; BOOL bRet = FALSE; printf("Enter file name\n"); scanf("%s",cFile); bRet = Create(cF...
C
#include <stdio.h> int main() { int sequence[100]; int* buffer; FILE* infile; FILE* outfile; infile = fopen("task.in", "r"); for (buffer = sequence; fscanf(infile, "%d", buffer) == 1; buffer++) { ; } fclose(infile); outfile = fopen("task.out", "w"); fprintf(out...
C
/* * challenge 2_13_2019.c * * Created: 2/13/2019 10:50:29 AM * Author : AVE-LAP-025 */ #include "type.h" #include "BitwiseOperation.h" #include "DIO_Serialized.h" #include "timer.h" #include "BCDSevSegment.h" #include "keybad.h" #include "LCD.h" #define F_CPU 16000000UL #include <util/delay.h> int main(void) ...
C
#include<stdio.h> #include<string.h> #include<stdlib.h> #define MAX_ARGC_NUM 20 #define MAX_PARAM_LEN 20 int main(int argc, char * argv[]) { if (argc > 1){ if (argc > MAX_ARGC_NUM){ printf("argc number is out of range!\n"); return 0; } char param[MAX_ARGC_NUM][MAX_...
C
#include <stdint.h> #include "lab1header.h" #define LED4 0x1 #define LED3 0x1 #define LED2 0x1 #define LED1 0x1 int main(void) { volatile unsigned short delay = 0; RCGCGPIO |= 0x1120; // Enable PortF, PortJ, PortN GPIO. we need bit 9 delay++; // Delay 2 more cycles before access Timer registers...
C
#include<stdio.h> #include<stdlib.h> //中序线索二叉树,即利用二叉树的节点,在二叉树节点指向左孩子指针为空时,左指针指向二叉树中序遍历时该节点的前驱节点 //在二叉树节点指向右孩子指针为空时,右指针指向二叉树中序遍历时该节点的后继节点 //二叉树的遍历 //构造二叉树如下: // [5] // / \ // [2] [3] // / \ / \ // [7]...
C
/* * Pilha.c * * Created on: 30 de ago de 2018 * Author: n226804875 */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include "Pilha.h" void create(PILE* pile) { pile->topNode = (Node*) malloc(sizeof(Node)); pile->bottomNode = pile->topNode; pile->topNode->nextNode = NULL...
C
#include "AES.h" #include "base64.h" #include <stdio.h> #include <stdlib.h> #include <openssl/aes.h> void logAES() { AES_KEY aes; unsigned char key[AES_BLOCK_SIZE]; // AES_BLOCK_SIZE = 16 unsigned char iv[AES_BLOCK_SIZE]; // init vector unsigned char *input_string; unsigned char ...
C
/************************ Minimize The Sum *************************/ #include<stdio.h> #include<math.h> #define MAX 9999 int main(int argc, char* argv[]) { int N; // Size of the array int K; // Maximum number of operation int arr[MAX]; // The array of numbers int sum=0; int i,j,loc=0,temp...
C
/* * This is a sample server program using the ARDP library. * * This server receives and replies to requests. * * This server runs forever; have to kill it. */ /* Last Change: g.chugh (9/30/97) handle security contexts */ #include <stdio.h> #include <pconfig.h> /* Prospero command line parsing routines */ ...
C
#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> /* 问题描述: 明明想在学校中请一些同学一起做一项问卷调查,为了实验的客观性, 他先用计算机生成了N个1到1000之间的随机整数(N≤100),对于其中重复的数字,只保留一个, 把其余相同的数去掉,不同的数对应着不同的学生的学号。 然后再把这些数从小到大排序,按照排好的顺序去找同学做调查。请你协助明明完成“去重”与“排序”的工作。 输入格式: 输入有2行,第1行为1个正整数,表示所生成的随机数的个数N。第2行有N个用空格隔开的正整数,为所产生的随机数。 输出格式 输出也是2行,第1行为1个正整数M,表示不相同的随机数的个...
C
// qlearn.c #include <stdio.h> #include <time.h> #include <math.h> #include <assert.h> #include "qtypes.h" const pos_t dir[ MAX_ACTIONS ] = { { -1, 0 }, /* N */ { 0, 1 }, /* E */ { 1, 0 }, /* S */ { 0, -1 } /* W */ }; char environment[ Y_MAX ][ X_MAX ] = { { '+','-','-','-','-','-','-','-','-',...
C
#include <stdio.h> int main(void) { int ABG_iNum1, ABG_iNum2; printf("\n\n"); printf("Printing Digits 1 to 10 and 10 to 100: \n\n"); ABG_iNum1 = 1; ABG_iNum2 = 10; do { printf("\t %d \t %d\n", ABG_iNum1, ABG_iNum2); ABG_iNum1++; ABG_iNum2 = ABG_iNum2 + 10; } while (ABG_iNum1 <= 10, ABG_iNum2 <= 100); ...
C
#include "pile.h" Entry *newEntry(float pos[2]){ Entry *entry = malloc(sizeof(Entry)); if(entry == NULL){ printf("Error in newEntry()\n"); perror("malloc"); } memcpy(entry, pos, 2*sizeof(float)); return entry; } Entry *push(Entry *top, Entry *entry){ entry->next = top; return entry; } Entry *pop(En...
C
#include <stdio.h> #include <math.h> #include <string.h> struct Rectangle { double x1, y1; double x2, y2; } a[10]; int main() { int i, Rect_t = 0, t = 0, f; double x, y; char s[100]; /* freopen("p476.in","r",stdin); freopen("p476.out","w",stdout); */ /* input Rectangle*/ ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* encode.c :+: :+: :+: ...
C
/* 12. Given a non-negative integer num, repeatedly add all its digits until the result has only 1 digit */ #include <stdio.h> #include <string.h> void to_str(int n, char *str) { int i=0; while(n) { int t = n % 10; str[i] = t + '0'; i++; n /= 10; } str[i]='\0'; } int warp(char *strnum) { in...
C
/************************************************************/ /************** cliente.c **********************/ /************************************************************/ /********* proceso cliente con sockets AF_UNIX **********/ /*****************************************...
C
// Tutorial 9 // Malloc and Free Review // Question 3 and 4 // Written by Catherine Cheng #include <stdio.h> #include <stdlib.h> struct node { int data; struct node * next; }; struct node *create_node(int input_data); int main(void) { // QUESTION 3 // What does malloc do? // - allocates memory...
C
#include "record.h" #include "scoreboard.h" #include "settings.h" #include "fatal.h" #include <ncurses.h> #include <stdio.h> #include <string.h> Record CreateRecord(char *name) { Record new_record; if ((new_record = (Record) malloc(sizeof(struct _record))) == NULL) FatalError("Out of space!"); strn...
C
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward d...
C
//------------------------------------------------- //Date: 30.12.2019 //Autor: Vlaimir Draga //S. Prata. Chapter 10 // Programming exercise 1 //------------------------------------------------- /* Text programmming exersice. Modify the rain program in Listing 10.7 so that it does the calculations using pointers ins...
C
#include <stdio.h> #include <stdlib.h> #include "List.h" #define FatalError(Str) fprintf(stderr,"%s\n",Str),exit(1) struct Node { ElementType Element; Position Next; }; List MakeEmpty(List L)//将表置空 { if(L!=NULL) DeleteList(L);//删除链表 L=(List)malloc(sizeof(struct Node));//申请一个节点大小的空间 if(L==NUL...
C
#include <stdio.h> void print() { int p = 233; p = 230+p; printf("%d\n",p); }
C
#include <stdio.h> #include <stdlib.h> #include <math.h> int n; int a[100001], start[100001]; long int sum=0; void change(int *x, int *y){ int z; z = *x; *x = *y; *y = z; } int compare_int(const void *a, const void *b){ return *(int*)a - *(int*)b; } int main(void){ scanf("%d", &n ); for(in...
C
/* test_kfunc.c -- kt_fisher_exact() unit tests Copyright (C) 2020 University of Glasgow. Author: John Marshall <John.W.Marshall@glasgow.ac.uk> 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 So...
C
// // APS105 Lab 8 Lab8.c // // This is a program written to maintain a personal music library, // using a linked list to hold the songs in the library. // // Author: <Kexin Li> // Student Number: <1003978984> // #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <string.h> #include <stdbool.h> // A ...
C
#include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <signal.h> int main() { pid_t pid; int i; int n = 5; for (i=0; i<n; i++) { pid = fork(); if (pid == 0) { kill(getpid(), SIGKILL); } } return 0; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* initialize_args.c :+: :+: :+: ...
C
/* PCB has 3 fields PC : Points to the the current line reached for that program start: Points to first line of that program end: Points to last line of that program */ typedef struct PCB { int PC; int start; int end; }PCB; /* Passes 2 parameters (start , end) This method creates a PCB with ...
C
#include "variadic_functions.h" /** * sum_them_all - Entry point * * Description: write a function that returns the sum of all its parameters * @n: Is the parameter to be checked * Return: Always 0 (Success) */ int sum_them_all(const unsigned int n, ...) { va_list valist; double sum = 0.0; unsigned int k; if...
C
#include<stdio.h> int is_mul(int n, int m); int main() { int x, y; printf("Է : "); scanf("%d", &x); printf("Է : "); scanf("%d", &y); if (is_mul(x, y) == 1) printf("%d %d Դϴ.\n", x, y); else printf("%d %d ƴմϴ.\n", x, y); return 0; } int is_mul(int n, int m) { if (n % m == 0) return 1; else return 0; }
C
/** * unconnected version */ #include "unp.h" static void udp_cli(const char* host, const char* serv) { int sockfd; char buf[MAXLINE]; struct sockaddr *paddr; socklen_t len; int n; sockfd = udp_unconnect(host, serv, &paddr, &len); printf("send to %s...\n", Sock_ntop_host(pad...
C
/************************************************************************* > File Name: a.c > Author: GWG > Mail: gaowenguang123@gmail.com > Created Time: 2014年11月17日 星期一 23时29分45秒 ************************************************************************/ #include<stdio.h> int main(void) { int ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* help_making.c :+: :+: :+: ...
C
// Definição de um estrutura padrão de uma Árvore Binária que possui um item do tipo unsigned char e a frequência desse item typedef struct huffman_tree huffman_tree; /* Função que cria um nó de árvore para guardar os itens e suas frequências * @param: um caractere do tipo byte e a frequência desse caractere nu...
C
/************************************************************** * Class: CSC-415-02 Spring 2020 * Name: Andrew Hwang * Student ID: 918450486 * Project: Assignment 1 – Simple Shell * * File: Assignment1.c * * Description: A simple shell that uses fork() and execvp() * to take commands from the command line ...
C
/** * Prime Lib * * Implementation of common Math operations * such as GCD, LCD, primality check, etc. */ #ifndef __PRIME_LIB_H__ #define __PRIME_LIB_H__ #include <cmath> /** * gcd * * Calcuate the greatest common divisor using Euclid's Algorithm (iteratively) * GCD(a, b) = GCD(b, a mod b) */ int gcd(int a...
C
#include "color-rep.h" #include <opencv/cv.h> #include <opencv/highgui.h> #include <stdio.h> static void color_representation(const char *imgname) { IplImage *img = cvLoadImage(imgname, 1); if (!img) { return ; } #define COLOR_NUM 8 unsigned char bgr[COLOR_NUM][3]; ...
C
#include "util/formatter.h" /** * Converts a lowe nibble of a byte hex character. */ uint8_t formatter__nibble_to_hex_char(uint8_t value) { if (value > 9) value += ('A' - ('9' + 1)); return (uint8_t) (value + '0'); } /** * Converts a byte to 2 hex characters. */ uint16_t formatter__byte_to_hex_chars(const...
C
#include "unity.h" #include "source1.h" #include "source2.h" void setUp(void) { } void tearDown(void) { } void testCallChainedFunction(void) { char a; a = compilechar(); TEST_ASSERT_EQUAL_INT (a, 'a'); } void testByteSwap(void) { uint32_t a = 0x12345678; a = _bswap32(a); TEST_ASSERT_EQUAL_HEX (a, 0x78563412);...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> char *get_input() { int input_alloc = 10; char ch; char *string = (char *)malloc(input_alloc); int input_index = 0; while (1) { ch = getchar(); if ((ch == '\n') || (ch == EOF) || (ch == '\0')) break; if (input_index >= input_allo...
C
#include <stdio.h> int inlineasm(); int main() { printf("Test inline asm!\n"); int ret_result=inlineasm(); } int inlineasm() { int a=10, b; asm volatile ( \ "movl %1, %%eax; \n\t \ movl %%eax, %0;" :"=r"(b) /* output */ :"r"(a) /* input */ ...
C
#include "holberton.h" /** * get_bit - returns the value of a bit at a given index in the binary * representation of a number * @n: number to be evaluated * @index: index of bit * * Return: 1 or 0 depending on value of bit, or -1 if an error occured */ int get_bit(unsigned long int n, unsigned int index) { uns...
C
#ifndef STACK_H_INCLUDED #define STACK_H_INCLUDED typedef struct elem{ //Stack Elemente char elem; struct elem *prev; struct elem *next; } ELEM; typedef struct head{ //Stack fr Header int len; ELEM *first; ELEM *last; } HEAD; HEAD *create_stack(...
C
#include "holberton.h" /** * more_numbers - prints 0-14 * * Return: Always 0 (Success) */ void more_numbers(void) { int i, x; for (x = 1; x <= 10; x++) { for (i = 0; i <= 14; i++) { if (i > 9) _putchar(i / 10 + '0'); _putchar (i % 10 + '0'); } _putchar('\n'); } }
C
/** * is_palindrome - function that checks * whether or not a given unsigned integer * is a palindrome. * @n: unsigned long number to check * Return: 1 if is palindrome or 0 if not */ int is_palindrome(unsigned long n) { unsigned long i = 0; unsigned long aux = n; while (aux != 0) { i +=...
C
#include <stdio.h> #include <memory.h> #include "hdr.h" struct bmphdr* get_header(char filename[]) { FILE* fp; struct bmphdr* hdr; fp = fopen(filename, "rb"); if (!fp) { printf("File open error or such file does not exist!\n"); return NULL; } hdr = (struct bmphdr*) malloc(sizeof(...
C
/** * @file lex.c * @author François Portet <francois.portet@imag.fr> * @brief Lexical analysis routines for MIPS assembly syntax. * * These routines perform the analysis of the lexeme of an assembly source code file. */ #define _POSIX_C_SOURCE 200112L #include <stdlib.h> #include <stdio.h> #include <string.h> ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "utn.h" /** * \brief Solicita un numero flotante al usuario y devuelve el resultado * \parametro mensaje. Es el mensaje a ser mostrado * \Return El numero ingresado por el usuario */ float getFloat(char mensaje[]) { float auxiliar; ...
C
#ifndef SMPT_MESSAGES_H #define SMPT_MESSAGES_H /***************************************************************************//** * \file smpt_messages.h * \author Bjoern Kuberski * \copyright Hasomed GmbH 2013-2017 * * This file defines functions for error messages. The error function needs to * be initialize...
C
#include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/socket.h> //"in" per "sockaddr_in" #include <netinet/in.h> //"fcntl" per la funzione "fcntl" #include <fcntl.h> #include <string.h> #include <time.h> void closeSocket(int sock) { close(sock); return; } char* decode(char* x) { int len=s...
C
int max(int x, int y) { int z; z=x>y?x:y; return(z); }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_LINE 1024 int main() { int i,j=0; int a,b,c,d=0; int len1=0; char id[MAX_LINE]; char addr[20]={0}; char lei[20]={0}; char day[20]={0}; char time1[20]={0}; FILE *f1 = fopen("D:/data.txt","r"); /*ļָ*/ if(!f1) { return 0; } wh...
C
#include <stdio.h> int main() { int dist[10][10],succ[10][10],n,i,j,k; int newDist; printf(“Enter no. of vertices n=”); scanf("%d",&n); for (i=0;i<n;i++) for (j=0;j<n;j++) { dist[i][j]=999; succ[i][j]=j; } while (1) { printf(“Enter n*n adjacency matrix\n”); scanf("%d %d %d",&i,&j,&k)...
C
/* Exploiting the ca647 server */ #include <netinet/in.h> #include <sys/socket.h> #include <sys/types.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <stdio.h> #include <errno.h> #include <netdb.h> #include <time.h> #define PORTNUM (8001) #define BLENGTH (256) void *ebp; /* Exploit the fo...
C
/** * @file * @brief Dynamic List (FIFO) struct of the system project. */ #ifndef FIFO_H #define FIFO_H #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> typedef struct elem{ char *file; struct elem *next; } element; typedef struct{ element *Queue; element *Tete; } f...
C
#include "mcc_generated_files/mcc.h" #include "mcc_generated_files/TCPIPLibrary/udpv4.h" #include "mcc_generated_files/TCPIPLibrary/udpv4_port_handler_table.h" #define IPV4_BROADCAST 0xFFFFFFFF uint8_t udpData; bool receivedMsg = false; void Demo_UDP_Receive(int length) { //length holds the number of ...
C
#include <stdio.h> #include <string.h> int indexOf(char [],char []); int main(){ char s[100],word[100]; printf("String: "); fgets(s,100,stdin); printf("Word: "); fgets(word,100,stdin); int pos=indexOf(s,word); if(pos != -1) printf("Found at position %d",pos); else printf("Not Found"); } int indexOf(char...
C
#define _CRT_SECURE_NO_WARNINGS #include <locale.h> #include <stdio.h> #include <stdlib.h> #include <math.h> #include <time.h> #include <malloc.h> #define n 15 void qs(int [], int, int); int main() { setlocale(LC_ALL, "RUS"); int m[n], i; srand(time(NULL)); for (i = 0; i < n; i++) { m[i] = rand() % 100 + 1; ...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <signal.h> #include <sys/types.h> // cd /mnt/c/Users/Joseph/comp322/lab-5 int main(int argc, char* argv[]) { int pagesize = 4096; //4kb to 4096bytes unsigned int address; unsigned int pgNum; unsigned int offset; if(argc <2) { printf("Plea...
C
#ifndef MATHC_VEC_IVEC4_H #define MATHC_VEC_IVEC4_H #include "ivecn.h" #include "../types/int.h" #include "../types/bool.h" /** dst = unit_x */ static ivec4 ivec4_unit_x() { return (ivec4) {{1, 0, 0, 0}}; } /** dst = unit_y */ static ivec4 ivec4_unit_y() { return (ivec4) {{0, 1, 0, 0}}; } /** dst = unit_z ...
C
/** Demonstrates the use of va_list, va_arg, va_start and va_end macros that * are defined in stdarg.h header file. **/ #include <stdio.h> #include <stdlib.h> #include <stdarg.h> /** A function that receives an unspecified number of arguments. * The ellipsis (...) indicates that the function accepts variable n...
C
#include <unistd.h> #include <stdio.h> #include <errno.h> #include <stdlib.h> #define ANSI_COLOR_GREEN "\x1b[32m" void get_cwd(char *cwd){ FILE *fp; fp = fopen("cwd.txt", "r"); fgets(cwd, 1024, (FILE*)fp); fclose(fp); } int main() { char cwd[1024]; get_cwd(cwd); printf(ANSI_COLOR_GREEN "Cu...
C
void histo_axis() { // don't set the axis title here, but below, directly on the axis TH1F *histo = new TH1F("histo","A histogram",10,0,10); histo->Fill(4,2); histo->Fill(5,6); histo->Fill(6,4); // The histogram axis are own classes (TAxis), the can be accessed // using GetXaxis(), GetYaxix(), GetZaxis()...
C
/****************************************************************************** * rng.c * * Assorted routines for multiple, independent pseudo-random number * generation. * * John C. Gallagher * Department of Computer Science and Engineering * Wright State University * john.gallagher@wright.edu (Primary mainta...
C
/***************************************************************************************** * PROJECT: Sashe * TEAM MEMBERS: Arjun Aletty, Keely Haverstock, Sarah Seko, Sarah Strohkorb * * FILE: send_recieve.c * * DESCRIPTION: Provides sending and recieving capabilities that both the client and * server can u...
C
#include <stdio.h> #include <cs50.h> #include <math.h> int main(void) { printf("Ne kadar para ustu verilecek? "); double paraUstu = GetFloat(); while(paraUstu < 0) { printf("Ne kadar para ustu verilecek? "); paraUstu = GetFloat(); } int s = round((paraUstu - (int)paraUstu) * 100); ...
C
#include "PrintNChange.h" #include <stdio.h> void print_mundo(char arr[MAX][MAX], int *p) //Esta funcion imprime la matriz en pantalla { int countfil, countcol; for (countfil=p[1]; countfil<p[2]; ++countfil) { //Con ...
C
#include "MDB-c.c" void getTitleStudioYear(char title[MAX_STR_LEN], char studio[MAX_STR_LEN], int *year) { // This function reads the movie's name, title, and year from the terminal. // It's needed for inserting new reviews, for search, updating, and deletion. printf("Please enter the movie's title:\n"); fge...
C
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // FileName: test_passwd.c // Author: dingfang // CreateDate: 2020-11-28 17:47:29 // ModifyAuthor: dingfang // ModifyDate: 2020-11-28 18:24:08 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #include <st...
C
#include <stdio.h> #include <stdlib.h> #define STB_IMAGE_IMPLEMENTATION #include "stb_image.h" #define STB_IMAGE_WRITE_IMPLEMENTATION #include "stb_image_write.h" #define STB_IMAGE_RESIZE_IMPLEMENTATION #include "stb_image_resize.h" int main() { int width, height, channels; unsigned char *img = stbi_load("...
C
#ifdef __cplusplus extern "C" { #endif #include <R_ext/BLAS.h> typedef enum CBLAS_ORDER {CblasRowMajor=101, CblasColMajor=102} CBLAS_ORDER; typedef enum CBLAS_TRANSPOSE {CblasNoTrans=111, CblasTrans=112, CblasConjTrans=113, CblasConjNoTrans=114} CBLAS_TRANSPOSE; double cblas_ddot(int n, double *x, int incx, doub...
C
#include <mega32.h> #include <alcd.h> #include <stdlib.h> #include <delay.h> #define ADC_VREF_TYPE ((0<<REFS1) | (0<<REFS0) | (1<<ADLAR)) unsigned char read_adc(unsigned char adc_input) { ADMUX=adc_input | ADC_VREF_TYPE; // Delay needed for the stabilization of the ADC input voltage delay_us(10); // Start the...
C
// Name: Alyssa Kelley // Due: Jan. 23, 2018 // Call this program like so: // gcc -std=c11 -g -o clock.exe clock.c testClock.c #include "clock.h" int main() { ClockType *clock; initClock(clock); clock = malloc(sizeof(clock)); time_t cur_time; time(&cur_time); struct tm * time_data; time_data = localtime(&...
C
#include <stdio.h> int test(int,int); // 形参,只声明 int main() { int a,b; printf("%d\n",test(5,3)); // 实参,已赋值 } int test(int a,int b) // 形参 { a=a+b; return a; }
C
#include<stdio.h> void ft_print_comb(void) { int x; int y; int z; x = 0; y = 0; z = 0; while (x + y + z <= 24) { z++; if (y==9) { x++; y=0; } if (z==9) { z=0; y++; } if (x != y && y != z && x != z) && ("%d%d%d" x, y, z != "%d%d%d" y, z, x) { printf("%d,%d,%d, ", x, y, z); continue; } ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "ask2.h" /* Getting reference from trace file */ int get_reference(int refindex, char *buf,FILE *fp) { if((fseek(fp,TRACE_SIZE*refindex,SEEK_SET))!=0) { fprintf(stderr,"Cannot read file!\n"); return -1; } if(fread(buf,TRACE_SIZ...
C
void HelloFunction() { cout << "Hello world!" << endl;// GitHub exercise 1 } void HelloFunction (int val) { cout << "Hello world!" << val << endl;//GitHub exercise 2 } void LabInfo() {// Task 1 - Lab Info cout <<" Question 1: Lab Info:\n"; cout << " James Hughes\n"; cout << " Lab #2\n" << endl; }...
C
/*******************************************************************************************************************/ void aes_encrypt_n(unsigned char *key, unsigned char *msg, unsigned int msgLength) { unsigned int i, j, index; const unsigned int blockSize = 16; unsigned char block[blockSize]; un...
C
#include<stdio.h> int main() { float a,b,c,d,e,result,physics,chemistry,maths,english,hindi,total,percentage; int n,i,j,m; char choice,ch; printf("all in one app.........By bittu raj\n"); printf("what do you wnat to do? enter the first letter of that application in capital letter.\n"); printf("enter the R for res...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* list_fn1.c :+: :+: :+: ...
C
/* * rplcs.c *Yanhua Liu (ytz2) CS820 * Created by Yanhua Liu for CS820 assignment 3 */ #include "ospenv.h" /* this header defines POSIX, ISOC, XOPEN and EXTENSIONS */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include <string.h> #include "command_util.h" #include "plcsIO.h" #in...
C
#include<stdio.h> #include<unistd.h> #include<fcntl.h> #include<string.h> #include<stdlib.h> struct stud_info { int roll_no; int std; char name[8]; }; int ret_fd(char f_name[]) { int ret , fd; ret = access(f_name,F_OK|R_OK|W_OK); if(ret == -1) { printf(" Entered file is not present \n or \n user hav...
C
#include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <signal.h> #include <fcntl.h> #include <arpa/inet.h> #include <netinet/in.h> #include "ak_thread.h" #include "ak_common.h" #define CMD_SERVERD_TCP_PORT (8782) //server's tcp port #define CMD_SERVERD_MAX_WAITNO (...
C
/** * @file * @brief * * @author Anton Kozlov * @date 09.08.2013 */ #include <string.h> #include <stdio.h> #include <errno.h> #include <util/err.h> #include <util/log.h> #include <kernel/irq.h> #include <mem/misc/pool.h> #include <util/indexator.h> #include <drivers/device.h> #include <drivers/char_dev.h>...
C
#include <stdio.h> #include<stdlib.h> struct Queue{ int size; int front; int rear; int *Q; }; void enqueue(struct Queue *q,int x){ if(q->rear==q->size-1) printf("queue is full\n"); else{ q->rear++; q->Q[q->rear]=x; } } int dequeue(struct Queue *q){ int x=-1; if(q->front=...
C
/* Kelompok : UAS Nama file : meja.h Deskripsi : ADT untuk tipe meja */ /* merupakan tipe data restoran */ #ifndef MEJA_H #define MEJA_H #include "../point/point.h" /* Definisi Struktur */ typedef struct { int bangku; /* jumlah bangku */ Point posisi; /* x,y menyatakan posisi di matriks */ int status; /...
C
//Sorgente scritto da Marco Meli. Remember Smagen is the way. /* Scrivere un programma che stampi una stringa data in input da tastiera al contrario. NB: Usare una funzione ricorsiva */ #include <stdio.h> void reverse (void); int main () { printf ("Inserisci la stringa da stampare al contrario: "); reverse(); p...
C
/* ** EPITECH PROJECT, 2018 ** CALC ** File description: ** Easy to do operations */ int add(int n1, int n2) { int result = n1 + n2; return (result); } int sub(int n1, int n2) { int result = n1 - n2; return (result); } int mul(int n1, int n2) { int result = n1 * n2; return (result); } int di...
C
#include<stdio.h> void main() { int x[10],i,j,temp; printf("enter elements in array"); for(i=0;i<=9;i++){ scanf("%d",&x[i]); } for(i=0;i<=9;i++){ for(j=0;j<=8;j++){ if(x[j]>x[j+1]){ temp=x[j]; x[j]=x[j+1]; x[j+1]=temp; } } } printf("sorted array: "); for(i=0;i<=9;i++){ ...
C
#include <stdbool.h> struct figure_array { struct square *a_square; int size; int current_number; bool *arr_bool; }; struct point { int x; int y; }; struct square { struct point vertex1; struct point vertex2; struct point vertex3; struct point vertex4; }; struct figure_array *create_array(int n); int...
C
#include <stdio.h> int main() { int i, a, b, c, d; i = 42 + 20 + 25; printf("%d\n", i); i = i - 7 - 10; printf("%d\n", i); i = 3 + 4 * 5; printf("%d\n", i); a = 2; b = 8; c = 4; i = a * (b - 8 / (c - a)); printf("%d\n", i); c = 10 - 3 - 4 - 1; printf("%d\n", c); a = b = c = 10 - 2 * 2; printf("%d\n...
C
#ifndef _SQLIST_H_ #define _SQLIST_H_ /** * 定义线性表结构 */ struct LinearList { int * list; //存线性表元素 int size; //存线性表长度 int MaxSize; //存list数组元素的个数 }; typedef struct LinearList List; /** * 初始化线性表 * @param L * @param ms 定义线性表最大长度 */ void InitList (List * L, int ms); /** * 插入操作 * @param L ...
C
#include<stdio.h> int main() { int arr1[50],arr2[50],sum1=0,sum2=0,sum3; int size1; printf("enter the size1"); scanf("%d",&size1); for(int i=0;i<size1;i++) { scanf("%d",&arr1[i]); sum1=sum1+arr1[i]; } int size2; int single=0,rem2; printf("enter the size2"); scanf("%d",&size2); for(int i=0;i<size2;i++) { scanf("%d",&arr...
C
#include "Sorter.h" /** -> Everything Going into the data values and arrays -> All uneccearry fields are added -> print method is added -> corrected first[i]= '\0' in the subtokenize method ->added trim function **/ char* trim (char*); char* trim (char* input){ //checking if the input is Null or contains n...
C
#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include <endian.h> #include <sys/stat.h> #include <sys/types.h> #include <limits.h> #include <sys/time.h> #include <assert.h> #include "heap.h" /* Returns true if random float in [0,1] is less than * * numerator/denominator. Uses only i...
C
#include <stdio.h> #include <stdlib.h> // Tipo de dato | Booleano // typedef int bool; #define true 1 #define false 0 // Tipo de dato | Nodo // typedef struct Nodo { int valor; int nodos_left; struct Nodo *left; struct Nodo *right; } Nodo; // Tipo de dato | Cola // typedef struct Arbol { Nodo *raiz; int nodos;...