language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include <stdlib.h> #include "../../include/productDB.h" #include "../../include/common.h" #include "../../include/product.h" int main(void) { int testAns; Product a = product_new("pen", 100), b = product_new("stapler", 500), c; db_init(); db_save_product(b); db_save_product(a); testAns = db...
C
#define _CRT_SECURE_NO_WARNINGS #include "main.h" #include "db.h" int print_result(int result) { if (result == RESULT_TRUE) { printf("%c[1;32m", ESC); printf(" [ O ] Correct"); printf("%c[0m\n", ESC); return 0; } else { printf("%c[1;31m", ESC); printf(" [ X ] Incorrect"); printf("%c[0m\n", ESC); r...
C
/** @file GRUB environment block parser. Copyright (c) 2021, Mike Beaton. All rights reserved.<BR> SPDX-License-Identifier: BSD-3-Clause **/ #include <Library/BaseLib.h> #include <Library/OcDebugLogLib.h> #include "LinuxBootInternal.h" /* grubenv processing states. */ typedef enum GRUBENV_STATE_ { GRUBENV_...
C
#include <stdio.h> #include <stdint.h> #define __USE_GNU #include <unistd.h> #include <sys/mman.h> #include <time.h> #include <string.h> #include <stdlib.h> #include <errno.h> #include "mlog_array.h" #include "common.h" #include "csv_append.h" #include "generic_vector.h" #include "self_reboot.h" #define TEST_SIZE 42...
C
#include "BRTOS.h" #include "device.h" #include "drivers.h" #define NUM_I2C 1 static BRTOS_Sem *I2CTX[NUM_I2C]; static BRTOS_Queue *I2CQ[NUM_I2C]; static BRTOS_Mutex *I2CMutex[NUM_I2C]; char I2C_buffer; static uint32_t I2CHandler(void) { char c = I2C_buffer; OSQueuePost(I2CQ[0], c); return TRUE; } static vo...
C
#include <stdio.h> #include <stdlib.h> #define PIPE_W 1UL #define PIPE_WN 2UL #define PIPE_N 4UL #define PIPE_NE 8UL #define PIPE_E 128UL #define PIPE_ES 64UL #define PIPE_S 32UL #define PIPE_SW 16UL #define CELL_WHITE '.' #define CELL_BLACK 'x' #define CALLS_MAX 3 #define LINKS_MAX 8 typedef struct value_s value_t; ...
C
#include "Sale_Persist.h" #include "../Common/List.h" #include "../Service/Sale.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include<unistd.h> static const char SALE_DATA_FILE[] = "Sale.dat"; static const char SALE_DATA_TEMP_FILE[] = "SaleTmp.dat"; int Sale_Perst_Insert(const sale_t *dat...
C
#include<stdio.h> int add() { int x,y; scanf("%d%d",&x,&y); return x+y; } void main() { int res; res=add(); printf("%d ",res); }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #pragma warning (disable:4996) typedef struct book { char *name; char *author; char date[9]; }BOOK; void inputscore(struct book *st, int n) { struct book *p; char tmp[101]; char tmp2[21]; for (p = st; p < st + n; p++) { scanf("%s %s %s", tmp, tmp2, ...
C
#include "SList.h" void TestSList1() { SListNode* plist = NULL; SListPushBack(&plist, 1); SListPushBack(&plist, 2); SListPushBack(&plist, 3); SListPushBack(&plist, 4); SListPushBack(&plist, 5); SListPrint(plist); SListPopBack(&plist); SListPrint(plist); SListPopBack(&plist); SListPrint(plist); SListPopBac...
C
#include <stdio.h> #include <string.h> #define MAXLINES 5000 char *lineptr[MAXLINES]; int readlines(char *lineptr[],int nlines); void writelines(char *lineptr[],int nlines); void qqsort_(char *lineptr[],int left,int right); int getline(char s[],int lim) { int c,i; for(i=0;--lim>0 && (c=getchar())...
C
#pragma once static inline int pw(int x, int y) { if (y == 0) return 1; if (y == 1) return x; return (y % 2 == 0) ? pw(x * x, y / 2) : pw(x * x, y / 2) * x; }
C
#include <signal.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <fcntl.h> #include <unistd.h> #include <sys/mman.h> #include <sys/termios.h> #include <sys/time.h> #include <sys/types.h> // unix #include <unistd.h> uint16_t memory[UINT16_MAX]; // registers enum { R_R0 =...
C
#include <stdio.h> void main() { int a[100],i,n,s,m,b,e,f=0; printf("enter the size"); scanf("%d",&n); printf("enter the digits"); for(i=0; i<n; i++) { scanf("%d",&a[i]); } printf("Search the digits"); scanf("%d",&s); m=n/2; b=0; e=n-1; while(b<=e) { m=(b+e)/2; if(a[m]==s) ...
C
#include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/mman.h> #include <string.h> #include "mem.h" /* this structure serves as the header for each block */ typedef struct block_hd{ /* The blocks are maintained as a linked list */ /* The blocks are ord...
C
/* Turn 1 or more hex encoded bytes into base64 encoded data. */ #include <assert.h> #include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "common.h" void usage(char **argv) { printf("usage: %s [--decode]\n", argv[0]); printf("reads arbitrary data from stdin and outputs base64 enco...
C
/* NAME: Kevin Li EMAIL: li.kevin512@gmail.com ID: 123456789 */ #define _GNU_SOURCE #include <errno.h> #include <fcntl.h> #include <getopt.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #define R...
C
#include <std.h> #include "keep.h" inherit ROOM; void create() { ::create(); set_terrain(STONE_BUILDING); set_travel(PAVED_ROAD); set_property("indoors",1); set_property("light",1); set_short("Hallway of a Ruined Keep"); set_long( "The hallway curves here, running back to the east as well as co...
C
/* Usando a estrutura Atleta do exercício anterior, escreva um programa que leia os dados de cinco atletas e os exiba por ordem de idade: do mais velho para o mais novo. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX 5 typedef struct { char nome[20]; char esporte[20]; int idade; float ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int filtraInterpunzione(char* s1){ char* s2; int len; int conta; int i, j; len = strlen(s1); s2 = malloc(sizeof(char)*(len+1); if(s2){ for(i = 0, j = 0, conta = 0; s1[i] != '\0'; i++){ if((s1[i] >= 'a' && s1[i] <='z') || (s1[i] >= 'A' && s1[...
C
#include <stdio.h> #include <cs50.h> int main (void) { // get input int minutes; do { printf("Minutes: "); minutes = get_int(); } while(minutes < 0); //calculates bottels int bottels = minutes*192/16; printf("Bottels: %i\n", bottels); }
C
#include <stdlib.h> #include <R.h> #include <math.h> #include <time.h> void coordDescent(int *n, double *A, double *GY, double *alpha, double *beta, double *beta_old, double *del_beta, double *h, double *cost) { double const EPSILON = 1e-6; double delta_beta; int counter = 0; do { fo...
C
/*@file RRScheduling.c *@breif round robin scheduling * @author Sandeep Pratap Singh * @date 10 Aug 2018 */ /* includes */ #include "vxWorks.h" #include "taskLib.h" #include "kernelLib.h" #include "sysLib.h" #include "logLib.h" #include "stdio.h" /* function prototypes */ void taskOne(void); void taskTw...
C
#include <stdio.h> typedef struct{ char nome[20]; char dataNascimento[20]; char cpf[20]; char sexo[20]; } cadastro; cadastro funcaoCadastrarCliente(); int main(){ cadastro info; info = funcaoCadastrarCliente(); printf("Seu nome:\n%s\n", info.nome); printf("Seu cpf:\n%s\n", info.cpf);...
C
#include "../../../test_common.h" #include <math.h> void runSuccess() { isinf(anydouble()); } void runFailure() { } int f; void testValues() { f = 2; int result; result = isinf(0.0); //@ assert result == 0; result = isinf(-5.0); //@ assert result == 0; result = isinf(3e20); //@ ...
C
// // tt2utc.c // D-SPOSE // // Created by Luc Sagnieres on 2017-11-10. // Copyright © 2018 Luc Sagnieres. All rights reserved. // //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //% FUNCTION NAME: tt2utc.c //% //% DESCRIPTION: This function converts terrestrial time to ...
C
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <inttypes.h> #include <sys/time.h> #include "implicit.h" /* Set to 1 for additional debugging statements. */ #define DEBUG 0 /* Default size for the heap is 2MB( 2^21 B). */ #define HEAP_SIZE (1 << 21) /* Default size for array holding po...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> #include <string.h> #include <errno.h> int conn_p2(int *from_p2){ printf("Hi Player 1! What would you like your name to be?\n"); char p1name[100]; fgets(p1name, 100, stdin); ...
C
// Copyright 2021 The IREE Authors // // Licensed under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #ifndef IREE_VM_OPS_EMITC_H_ #define IREE_VM_OPS_EMITC_H_ // This file contains utility macros u...
C
#include <stdio.h> int main (){ char result; int input; while(scanf("%d", &input) != EOF){ if(input <= 59 && input >= 0){ printf("%c\n", 'E'); continue; } else if(input <= 69 && input >= 60){ printf("%c\n", 'D'); continue; } else if(input <= 79 && input >= 70){ printf("%c\n", 'C'); conti...
C
/* * tiny_dict.h * * Created on: Jul 11, 2017 * Author: senchuk */ #define SENTENCE_MAX 3 #define ENTRY_MAX 50 /* the following typedefs are just used to simplify * how we refer to the sturucture. Just think of * typedefs as aliasas. The first typedef replaces * the declaration struct dict-enrty with d...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(){ char *str = "England is my city."; char c = ' '; char c2 = 'z'; char *str2 = "my"; char *str3 = "skrrra"; printf("Str after first instance of a space: %s\n",strchr(str,c)); printf("Str after first instance of a z: %s\n",strchr(str,...
C
#include <stdio.h> #include <stdarg.h> #include <string.h> void print(int n, ...) { int count=0; char *ptr; va_list vl; int input; va_start(vl, n); while(count<n) { ptr=va_arg(vl, char*); if(strcmp(ptr, "%d")!=0) printf("%s ", ptr); else { scanf("%d",&input)...
C
#include<stdio.h> #include<conio.h> struct Job{ char jobname[100]; int deadline; int profit;//That's the money u get if u can finish the work within the deadline }; int main() { int i, j,n; struct Job jobs[100]; //LIST ITEMS //Considering that nothing is free printf("\nEnter the no. of i...
C
#include<stdio.h> int funcao_particao(int vetor[],int inicio, int fim ){ int pivo, down, up, aux; pivo=vetor[inicio]; down=inicio; up=fim; while(down<up){ while(vetor[down]<=pivo && down<fim){ down=down+1; } while(vetor[up]>pivo) { up=up-1; } if (down<up){ aux=vetor[down]; vetor[down]=...
C
#include "lists.h" #include <stdio.h> /** * print_list - Print all the elements of a list * @h: head pointer to list * Return: N */ size_t print_list(const list_t *h) { const list_t *buff; unsigned int i; buff = h; for (i = 0; buff; i++) { if (buff->str) printf("[%u] %s\n", buff->len, buff->str); else printf("[%u] ...
C
///char fgets(char *str, int n, FILE *stream) #include<stdio.h> int main() { FILE *fp; char s[300]; int a, b, sum; fp = fopen("input2.txt","r"); ///open file in reading mode if(fp==NULL) { printf("Error or there is no such file with this name.\n"); return 0; } if(fget...
C
/* Created By: Malvika Joshi Problem: subset Link: http://cerberus.delos.com:791/usacoprob2?S=subset&a=sk0Eg2D4Cba */ #include <stdio.h> #include <stdlib.h> unsigned DP[40][1600]; int N,K; unsigned subset_sums(){ int i,k; for(k = 0;k < K; k++) DP[0][k] = 0; DP[0][0] = 1; for(i = 1;i <= N; i++){ for(k = 0;k...
C
#include <stdio.h> #include <stdlib.h> void sum(int* listNums, int index) { int i; int sum = 0; for(i=0; i < index; i++) { sum = sum + listNums[i]; } printf("Sum of the numbers is %d\n", sum); } void getInput() { int MAX = 10; int SIZE = 10; int listNums[...
C
#include "game.h" #include <assert.h> #include <stdlib.h> void test_create_board() { board_t* board = create_board(5, 5); assert(board != NULL); assert(board_cell(board, 0, 0) != NULL); cell_t* cell = board_cell(board, 3, 2); assert(cell != NULL && *cell == CELL_OPEN); assert(board_cell(board, -1, 0) == NU...
C
#include <stdio.h> /* Raises any real number x to the power y, where y is an integer. */ double power(double x, int y) { /* Handle the special case where x = 0 */ if (y == 0) { return 1; } double result = x; /* No assignment statement in the for loop, we can use the variable y as-is. */ if (y < 0) { ...
C
#include<stdio.h> #include<conio.h> void PrintArray(int* arr,int row,int col){ int i; int j; for(i=0;i<row;i++){ for(j=0;j<col;j++){ printf("%d ",*(arr + col*i+ j)); } printf("\n"); } } void Swap(int *x,int *yy){ *x+=*yy; *yy=*x-*yy; *x-=*yy; } void Transpose(int* arr,int row,int col){ int size=row*col-1; ...
C
#include <stdlib.h> #include <string.h> #include <ctype.h> #include "lexer.h" lexer* new_lexer(char* text) { lexer* this = malloc(sizeof(*this)); this->error = 0; this->pos = 0; this->text = text; this->current_char = text[0]; return this; } void delete_lexer(lexer* this) { free(this); }...
C
/* * Autor name: Liu Chengeng * Login ID : c.liu75@student.unimelb.edu.au * Student ID : 813174 * This is the project 1 for COMP30023 Computer Systems. * All copyrights reserved. */ #include "my_server.h" /* * Thread handler is used to handle read/write in socket, including * looking for specific file. If success retu...
C
#define _GNU_SOURCE #include <fcntl.h> #include <stdarg.h> #include <dlfcn.h> int (*__fcntl__)(int fd, int cmd, ...); __attribute__((constructor)) void nolock_init() { __fcntl__ = dlsym(RTLD_NEXT, "fcntl"); } int fcntl(int fd, int cmd, ...) { va_list ap; long arg; va_start(ap, cmd); arg = va_arg(...
C
//Jackie Cai #include <stdio.h> #include <string.h> #define ALPHABET 26 int encrypt (int c, char mapping[]); int main(void){ char map[ALPHABET]; int cha = 0; int i = 0; while (i < ALPHABET) { map[i] = getchar(); i++; } getchar(); cha = getchar(); while(cha != EOF){ ...
C
/* Write a function rightrot(x,n) that returns the value of the integer x rotated to the right by n bit positions. Example input: x=11101101 (237), n=3 Example output: 1010 0000 0000 0000 0000 0000 0001 1101 (2684354589) (Assuming 64-bit architecture: x = 0000 0000 0000 0000 0000 0000 1110 1101) */ #include <stdi...
C
#include<stdio.h> int main() { int temp,kel; printf("enter the temperature in celsius: "); scanf("%d",&temp); kel=temp+273; printf("temperature in kelvin is %d",kel); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include "lib/csapp.h" #define BUFFLEN 50 int main(int argc, char* argv[]) { if(argc != 2) { printf("Invalid # of arguments"); exit(-1); } int input_file; if(access(argv[1],F_OK) == -1) { input_file = open(argv[1],O_RDWR|O_CREAT); ...
C
#include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include <time.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #define NTP_TIMESTAMP_DELTA 2208988800ull // Detla of NTP epoch #define PORT 123 // NT...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include "import.h" #include "imgutil.h" #include "edge.h" #include "export.h" void edge(){ FILE *fpIn,*fpOut; IMAGE *imgIn = (IMAGE *)malloc(sizeof(IMAGE)); IMAGE *imgOut = (IMAGE *)malloc(sizeof(IMAGE)); int color[3]; int label; PIXEL * tmp_pixels...
C
/* * Circular linked list implementation * References: DSA Made Easy. */ #include "CLinkedList.h" #include <stdio.h> #include <stdlib.h> void printList(struct CLLNode *head) { struct CLLNode *current = head; if (head == NULL) { printf("\nThe list is empty\n"); return; } do { printf("%d ", current -> data...
C
#include <stdio.h> #include <stdlib.h> void print_bin(int number) { int i = 0; char output[8]; while (i < 8) { if (number & 1) output[7-i] = '1'; else output[7-i] = '0'; number >>= 1; i++; } printf("base_2: %s\n", output); } int main() { int a; printf(...
C
int binary_search(int n, double *x, double z); double linterp(int n, double *x, double *y, double z) { int i = binary_search(n,x,z); double a = (y[i+1]-y[i])/(x[i+1]-x[i]); return y[i]+a*(z-x[i]); }
C
/* hash_check.c - verification of message digests of files */ #include "hash_check.h" #include "calc_sums.h" #include "common_func.h" #include "hash_print.h" #include "output.h" #include "parse_cmdline.h" #include "rhash_main.h" #include "librhash/rhash.h" #include <assert.h> #include <ctype.h> /* isspace */ #include...
C
/* * tipoPasajero.c * * Created on: 6 may. 2022 * Author: Hernan */ #include "tipoPasajero.h" #include <string.h> int cargarDescripcionPasajero(eTipoPassenger tipo[], int tam, int id, char desc[]) { int todoOk = 0; if(tipo != NULL && tam > 0 && desc != NULL) { for(int i= 0; i < ...
C
/* ============================================================================ Name : tp1.c Author : Mario Streri Version : Copyright : Your copyright notice Description : Hacer una calculadora.Para ello el programa iniciar y contar con un men de opciones: 1-ingresar 1er operando(A=x) ...
C
#ifndef PLOTLANG_LIST_H /* * 单链表 */ typedef struct ListNode { int x; // x坐标 int y; // y坐标 int r; // red值 int g; // green值 int b; // blue值 struct ListNode *next; // 下一个节点 } ListNode, *List; /* * 创建单链表 */ List createList(); /* * 在头结点后插入一个节点 */ void insertList(List ls...
C
#include <mpi.h> #include <stdio.h> #include <stdlib.h> #include <time.h> #define SIZE 2 int main() { MPI_Init(NULL, NULL); srand(time(NULL)); int id, p, size; int arr[SIZE]; int arr_t[SIZE]; MPI_Comm comm; MPI_Comm icomm; MPI_Comm_rank(MPI_COMM_WORLD, &id); MPI_Comm_size(MPI_COMM...
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
#include "mosaic.h" main(int argc, char *argv[]) { int i; long seed = -setseed(); char fname[MAXNAME]; struct data *my_data; struct pars *my_pars; FILE *ifp; if (argc<2) { printf("\n\nInput file name:"); scanf("%s", &fname); ifp = fopen(fname, "r"); } else ifp = fopen(argv[1], "r"); if (!ifp) nrerror...
C
#include<stdio.h> #include<math.h> int main() { int i,j,n,sum=0,rem,l,k,m,count=0; printf("Enter the no of elements:"); scanf("%d",&n); int a[n]; l=n-1; m = n-1; printf("Enter n elements:"); for(i = 0;i<n;i++) { scanf("%d",&a[i]); } for(j =0;j<n;j++) { a[j] = a[j] * pow(10,l); l--; ...
C
#include <stdio.h> int main(){ void copiarConteudo(FILE *file1, FILE *file2); FILE *file1; file1 = fopen("/home/o1234/arquivo.txt", "r"); //Se o arquivo estiver na mesma pasta do programa, basta colocar o nome dele if (file1 == NULL) { printf("Não foi possível abrir o arquivo!"); ...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<time.h> struct Student { char srn[9]; char name[15]; float gpa; }; int binarySearchRec(struct Student s[], int l, int r, char* key); double execTime(struct timespec start, struct timespec end); int main() { int n; int i = 0; int l; int r; int r...
C
#include "game.h" #include "database.h" #include "socket.h" #include "console.h" #include <string.h> #include <math.h> void error_packet(packet_t *packet, uint16_t code, uint8_t flags, char *msg) { memset(packet, 0, sizeof(packet_t)); packet->type = AD_PACKET_ERROR; packet->error.code = code; packet->error.flags =...
C
//PRANAV_JAGADEESH_1BM18CS071 // A complete working C program to demonstrate stack and queue implementation using linked List #include <stdio.h> #include <stdlib.h> // A linked list node struct Node { int data; struct Node *next; }; /* Given a reference (pointer to pointer) to the head of a l...
C
/*============================================================================= | Assignment: Program #11: The One with the 3D Orthogonal List | | Author: Daniel Eisenberg | Language: GNU C (gcc compiled, tested on lectura) | To Compile: gcc -c orthogonallist.c (if orthogonallist.h is in same | ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "itertools.h" int fun(const void* a, const void* b) { return *(int*) a + *(int*) b; } int main() { int n; printf("Enter the size of array: "); scanf("%d", &n); printf("Enter the array elements: "); int* b = (int*) malloc(n * sizeof(int)); for ...
C
/** * @file trace.h * * @date 28.06.2009 * @author Stephan Krempel <stephan.krempel@gmx.de> * @version \$Id$ */ #ifndef TRACE_H_ #define TRACE_H_ #include <stdio.h> #include "topo.h" /** * @internal * Bitfield of supported values to measure */ typedef struct { int Utrms : 1; int Itrms : 1; int P : 1; } ...
C
#include <stdio.h> #include <stdlib.h> int main(void) { int n[10] = {5, 6, 3, 2, 4, 9, 7, 8, 1, 10}; for(int i=0; i<10; ++i) { int min = i; for(int j=i+1; j<10; ++j) { if(n[j] < n[min]) min = j; } if(min != i) { ...
C
// switch case can use with variable, expression // break in switch case int printf(char s[100]); int printf1(char s[100],int a); int main(){ int arr[3]; arr[0] = 1; arr[1] = 'c'; arr[2] = 3; arr[3] = 9; int i = 0; float b = 3.1; while(i<4){ printf1("test%ld\n",i+1); s...
C
#include <stdio.h> #include <stdlib.h> int main(void) { char *staro_p = NULL; char *novo_p; char c; int i = 0; while( (c = getchar()) != '\n' ) { if(i % 10 == 0) { novo_p = realloc( staro_p, (i + 10) * sizeof(char) ); if(novo_p == NULL) { printf("Ne...
C
/* * File: main.c * Author: Fulons * * Created on 19 May 2017, 09:36 */ #include <stdio.h> //for: printf, fgets, stdin #include <stdlib.h> //for: EXIT_SUCCESS, malloc, strtod #include <string.h> //for: strlen #include "Operations.h" #include "Calculation.h" #include "Variable.h" ...
C
//TELEPHONE DIRECTORY MAINTAINANCE #include "phnoenerator.h" //fucnt decl extern void phonnomaintainance(); void add_number(); extern void phonnomaintainance() { while(1) { system("cls"); //inputting choiec int choice; printf("\t\t**********TELEPHONE DIRECOTRY MAINTENANC...
C
/* Part of: CRE2 Contents: test for easy matching Date: Mon Jan 2, 2012 Abstract Test file for regular expressions matching. Copyright (C) 2012, 2016 Marco Maggi <marco.maggi-ipsu@poste.it> See the COPYING file. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <cre2.h> #include ...
C
void main() { int x = abs(4); assert(x == 4, "x must be 4"); x = abs(-4); assert(x == 4, "x must be 4"); }
C
/* name id两个变量是定义的二维数组。name[i] id[i]都是一个一维数组, 一维数组名可以直接当首地址的指针用,但score本身就是一维数组,score[i]就是一个元素 ,如果你要给这个元素赋值就要取其地址。 */ /* 也可以写成score+i,表示给第i个元素赋值,score是数组名做指针+i表示指针往后跳i位,一样可以不用&符号 */ #include<stdio.h> int main(){ int n; int max=-1,min=101,maxIndex = 0,minIndex = 0 ; char name[101][100]; char id[101][100]; int scor...
C
#include "skynet.h" #include "skynet_env.h" #include "spinlock.h" #include <lua.h> #include <lauxlib.h> #include <stdlib.h> #include <assert.h> //skynet 环境保存lua虚拟机 struct skynet_env { struct spinlock lock; //互斥锁 lua_State *L; //lua虚拟机 }; // skynet 环境配置 主要是获取和设置lua的环境变量 static struct skynet_env *E = NU...
C
#include <stdio.h> #include <string.h> #include <assert.h> #include <time.h> void printArray(int arr[], int x) { for (int i = 0;i < x;i++) printf("%d",arr[i]); printf("\n"); } void swap(int *x, int *y) { int temp = *x; *x = *y; *y = temp; } void swapch(char* x, char* y){ char temp = *x; ...
C
#include "types.h" #include "user.h" #include "uthread.h" #include "x86.h" //***************************************************************************************// // implementation of random generation function unsigned long randstate = 1; unsigned int rand() { randstate = randstate * 1664525 + 1013904223; re...
C
/* Write the function _itob(n,s,b)_ that converts the integer _n_ * into a base _b_ character representation in the string _s_. In particular, * _itob(n,s,16)_ formats _n_ as a hexadecimal integer in _s_. */ #include <stdio.h> #include <limits.h> #include <stdlib.h> #define MAXLINE 20 /* itob: convert _n_ to chara...
C
#include<stdio.h> int isPower(unsigned int a, unsigned int b); int div = 0; int main(){ unsigned int a; unsigned int b; for(a = 1; a < 100; a++) { div = 0; if (isPower(a, 3)) { printf("a = b^n\n"); printf("%d e igual a 3^n\n",a); } else { ...
C
#include<stdio.h> #include<unistd.h> #include <sys/acct.h> #include<stdlib.h> #include <sys/types.h> #include <sys/wait.h> #define ACCFILE “/var/adm/pacct” FILE *fp; struct acct acdata; unsigned long compt2ulong(comp_t comptime) { int val; int exp; val = comptime & 0x1fff; /* 13-bit fraction */ exp = (comptime >> ...
C
/** ****************************************************************************** *------------------------------File Information------------------------------* * @file :led.c * @author :WZR * @date :2020-04-10 * @brief :LED * @attention: * *----------------------------Version Informati...
C
#include <stdio.h> #include <stdlib.h> #include <errno.h> #include <string.h> #include <sys/types.h> #include <netinet/in.h> #include <netdb.h> #include <sys/socket.h> #include <sys/wait.h> #include <unistd.h> #include <strings.h> #include <arpa/inet.h> #include <fcntl.h> #define BUFFER 576 int main(int argc, char *a...
C
// A program to introduce DEQUE #include<stdio.h> #define MAX 10 int deque[MAX]; int left = -1, right = -1; void input(); // Input Restricted Deque void output(); // Output Restricted Deque void insert_left(); // Insert Left Operation void insert_right(); // Insert Right Operation void delete_left(); // Delete Left Op...
C
#include <stdlib.h> #include <stdio.h> #include "distribution.h" /* Distribution: e.g.: 11 elements and 3 processes: 1.Process: element index 0-2 2.Process: element index 3-5 3.Process: element index 6-10 */ void distribution(vector* v, vector* dist_vector, int rank, int size) { int i, start_index, end_index...
C
// Informações do estudante // Nome: Gabriel Rodrigues Malaquias // Curso: Bacharelado em Ciência da Computação // RA: 758906 #include <stdio.h> #include <stdlib.h> #include <string.h> int main(){ int qtd=0, qtdmutacao=0, aux=0, inicio=1, menor=0, posmenor=0; scanf("%d", &qtd); int genes[qtd]; for(in...
C
/* * serial.c - rename! --> this is RS485 specific uart layer, * it knows nothing about the RSI protocol... * * Created on: May 21, 2014 * Author: kbroerman */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <fcntl.h> #include <termios.h> #include <linux/...
C
#include "lab.h" //Змінні для зчитування значення з джойстика int y = 0; int x = 0; //Ініціалізація компонент void adc_validation_init(void){ ADC_Start(); ADC_StartConvert(); PWM_X_Start(); PWM_Y_Start(); } //Алгоритм виконання завдання void adc_get_led_position(void){ //Зчитуванн...
C
#include "holberton.h" /** * _strstr - function that locates a substring * @haystack: string * @needle: substring * Return: 0 upon success **/ char *_strstr(char *haystack, char *needle) { int x, y; for (x = 0; haystack[x] != '\0'; x++) { for (y = 0; needle[y] != '\0'; y++) { if (needle[y] != haystack[...
C
#include <stdio.h> int main() { printf("Reverse Polish Notation Calculator v0.1 by dom96\n\n"); while (1) { /* Get two INT's */ int first, second; if(scanf("%i", &first) == 1 && scanf("%i", &second)) { /* Get the operator */ char op[2]; if(scanf("%1s", op) == 1) { ...
C
#include<stdio.h> #include<stdlib.h> struct node{ int value; struct node *next; }; struct node *reverse(struct node*); //把原list倒過來 struct node *print(struct node*); //列印list struct node* q_sort(struct node*, struct node*); int main(int argc,char *argv[]){ int n=atoi(argv[1]),m=atoi(argv[2]),s=atoi(argv[...
C
#include <stdint.h> /* 表示路由表的一项。 约定 addr 和 nexthop 以 **网络字节序(大端序)** 存储。 这意味着 1.2.3.4 在小端序的机器上被解释为整数 0x04030201 而不是 0x01020304。 保证 addr 和 len 构成合法的网络前缀。 当 nexthop 为零时这是一条直连路由。 你可以在全局变量中把路由表以一定的数据结构格式保存下来。 */ typedef struct RoutingTableEntry{ uint32_t addr; // 网络字节序,IPv4 地址 uint32_t len; // 主机字节...
C
/* Copyright (c) 2020 Peter Hsu. All Rights Reserved. See LICENCE file for details. */ #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <assert.h> #include <string.h> #include <sys/mman.h> #include <sys/stat.h> #include <fcntl.h> #include "shmfifo.h" #include "caveat.h" #define DEFAULT_BUFS...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct { char Meno_Priezvisko; char SPZ; char Typ_Auta; int Cena; int Datum; struct zaznam *dalsi; }zaznam; int pocet_zaznamov() { int x = 0; char pom; FILE *p_subor = fopen("predaj.txt", "r"); if (p_subor == NULL) { printf("Zaznami nebol...
C
#include <stdarg.h> #include <string.h> #include <unistd.h> #include "vprint.h" #define UNLOCKED 1 #define LOCKED 0 #undef vprintf #undef vfprintf int vlevel = V1; int _vprintf(const char * restrict format, ...) { va_list arg; int ret; if (vlevel == V0) { ret = 0; } else { va_st...
C
// Written by Ridwan Sadiq and Justin Bender #include "LPC17xx.H" #include "GLCD.h" #include <stdlib.h> #include <stdbool.h> #include "uart.h" #include "system_LPC17xx.h" #include "GLCD_UTILS.h" #include "Math.h" extern volatile uint32_t UART0_Count; extern volatile uint8_t UART0_Buffer[BUFSIZE]; voi...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_malloc.c :+: :+: :+: ...
C
// C11 standard // created by cicek on 09.11.2018 00:02 #include <stdio.h> #include <stdlib.h> struct student{ char name[50]; int number; int age; }st2; // mean: struct student st2; // Struct pointer as a function parameter void showStudentData(struct student *st) { printf("\nStudent:\n"); printf...