language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/* Exemplo0101 - v0.0. - __ / __ / _____ Author: Matheus Augusto Moreira Para compilar em terminal (janela de comandos): Linux : gcc -o exemplo0101 exemplo0101.c Windows: gcc -o exemplo0101.exe exemplo0101.c Para executar em terminal (janela de comandos): Linux : ./exemplo0101 Windows: exemplo0101 */ // depend...
C
#include<stdio.h> #include<stdlib.h> int main(){ int *A; int size, sum = 0; scanf("%d",&size); A = (int* )malloc(sizeof(int)*size); for(int i=0;i<size;i++){ scanf("%d",&A[i]); } for(int i=0;i<size;i++){ sum = sum + A[i]; } printf("sum of Array: %d",sum); return 0...
C
#include <pthread.h> #include <stdlib.h> #include <stdio.h> #include <sys/socket.h> #include <arpa/inet.h> #include <unistd.h> #include <string.h> #include "procarray.h" #include "master.h" #include "type.h" #include "master_data.h" int nodenum; int threadnum; int client_port; int master_port; int message_port; int pa...
C
#include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <string.h> #include <errno.h> #include <unistd.h> int main(int argc, char *argv[]) { int fd; if(argc != 2) { printf("\n Usage: please provide the file to open\n"); return 1; } errno = 0; //attempt to open a file or cr...
C
#ifndef CreateFlag #define CreateFlag(name,type, count,...) \ struct name\ {\ static const type __VA_ARGS__;\ static const unsigned int NUM_FLAGS = count;\ name() : _flags(type()) {}\ name(const type& singleFlag) : _flags(singleFlag) {}\ name(const name& original) : _flags(original._flags) {}\ bool operator==(const nam...
C
#include "main.h" #include <unistd.h> #include <stdlib.h> #include <stddef.h> #include <string.h> #include <limits.h> #include <stdint.h> /** * print_char - copies a char to a buffer * @c: the char * @buff: the buffer * Return: number of char printed = 1 */ char *print_char(char c, char *buff) { return (mem...
C
/* -*- Mode: C; tab-width: 8; c-basic-offset: 2; indent-tabs-mode: nil; -*- */ #include "util.h" int main(void) { int fd; fd = fcntl(1, F_DUPFD, 3); test_assert(fd >= 3); close(1); fd = dup2(fd, 1); test_assert(fd == 1); atomic_puts("EXIT-SUCCESS"); return 0; }
C
#include <stdio.h> #define MAX 50 #define true 1 #define false 0 typedef int bool; typedef struct { int chave; } REGISTRO; typedef struct { REGISTRO A[MAX]; int nroElem; } LISTA; void inicializarListaSequencial(LISTA* l) { l->nroElem = 0; } void exibirListaSequencial (LISTA l) { for (int i = 0;...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <errno.h> #include <stdbool.h> #include <time.h> #include "cz_API.h" /* VARIABLES GLOBALES */ char disk[1000]; ///////////////////////// /* FUNCIONES GENERALES */ ///////////////////////// // FUNCIONANDO void cz_mount(const char* diskname) { strcp...
C
/* RAHMANI TAHA ABDELAZIZ */ #include <stdio.h> #include <stdlib.h> #include <omp.h> #include <math.h> #define NSTEPS 100000000000000 #define NTHREADS 4 int main(){ float pi = 0; float pi_prime = 0; printf(" ------------ Le calcul de pi en sequentiel ---------------\n"); double start = omp_get_wtime(); for (lo...
C
#ifndef H_SCHEDULER #define H_SCHEDULER #include <pcb.h> #include <utilities/types.h> #define TIME_SLICE 3000 /* Time slice in microsecondi di CPU dedicato ad ogni processo */ /* Ciclo di vita dello scheduler: (Per # si intende un evento che genera l'interruzione dell'esecuzione ) (Per @ si inten...
C
#pragma once #define N 3 typedef int SDataType; //̬ջ typedef struct Stack { SDataType*_array; int _capacity;//ЧԪص int _top;//ջ }Stack; void StackInit(Stack*ps);//ջijʼ void _Checkcapacity(Stack*ps);// void StackPush(Stack*ps, SDataType data);//ѹջջdata) void StackPop(Stack*ps);//ջջdata SDataType StackTop(Stack*ps);//...
C
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h> #include <math.h> const double eps = 1e-12; double sin_count(double x) { int count = 0; double tek = x; double sum = 0.0; while (fabs(tek) > eps) { sum += tek; count += 1; tek *= -x * x / (2 * co...
C
#ifndef GCD #define GCD inline long unsigned int gcd (long unsigned int a, long unsigned int b) /* Euclid algorithm gcd */ { long unsigned int c; while(a!=0) { c=a; a=b%a; b=c; }; return(b); }; inline int co_prime(long unsigned int a, long unsigned int b) { return(gcd(a,b)==1); }; #endif
C
#include <stdio.h> #include <locale.h> /*Faça um programa que calcule reajustes salariais de acordos com faixas pré-estabelecidas e mostre os valores reajustados, o diferencial de reajuste e o equivalente em percentual */ int main() { setlocale (LC_ALL, "Portuguese"); float salario, novo_s...
C
#include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <errno.h> #include <sys/wait.h> #define CHECK_MENO_1(p,str) if((p) == -1){ perror(str); exit(EXIT_FAILURE); } /* stampa il pid dei processi zombie presenti nel sistema utiliazzando una pipeline di 3 processi. il primo processo esegue il comando 'ps -A...
C
#include <stdio.h> int max2(int a,int b) /*返回较大数值*/ { if (a>b) return a; else return b; } int max4(int a,int b,int c,int d) { return max2(max2(a,b),max2(c,d)); } int main(void) { int n1,n2,n3,n4; puts("请输入4个整数。"); printf("整数1:"); scanf("%d",&n1); printf("整数2:"); scanf("%d",&n2); printf("整数3:"); scanf(...
C
#include <stdio.h> #include <stdlib.h> int main() { int x = 10; size_t t = sizeof(int); printf("%z \n",t); return 0; } unsigned long convert(char *arr){ int n = strlen(arr); if(n > 19) return -1; unsigned long res = 0; for(int i = 0; i < n; i++){ int x = arr[i] - '0'; if(('...
C
#include <Arduino.h> #include <WiFi.h> #include <ser.h> #define PINGHOSTS 2 #define WEBSETIES 2 const char* ssid = "<NETWORK NAME>"; const char* password = "<PASSWORD>"; /* This scruct for hosts you want to ping. NB: you should use IP address */ struct HostToPing { const char* name; // Name to show on r...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "EspaciosBD.h" #include "../Sqlite3/sqlite3.h" sqlite3* conexionEspacios(){ sqlite3 *db; int e = sqlite3_open("database.db", &db); if( e) { fprintf(stderr, "Se ha producido un error en la conexion con la BD. %s\n", sqlite3_errmsg(db)); ...
C
#include <stdio.h> #include <stdlib.h> // funcao selectionSort void selectionSort (int num[], int n){ int i, j, o, x = 0; int menValor = 0; int aux = 0; for (i = 0; i < n; i++){ // 01 menValor = i; for(j = i+1; j < n; j++){ // 02 // verifica if (num[j] < num[menValor]){ menValor = j;...
C
#include "inner.h" /* ====================================================================== */ /* see curve9767.h */ int curve9767_point_encode(void *dst, const curve9767_point *Q) { int i; uint8_t *buf; uint8_t m; curve9767_inner_gf_encode(dst, Q->x); buf = dst; buf[31] |= curve9767_inner_gf_is_neg(Q->y) << ...
C
///////////////////////////////////////////////////////////////////////////// // // Program 4 - keygen - Operating System // Created By Jakob Eslinger // eslingja@oregonstate.edu // // Code outputs a random key that is generated with a length of n, // being the legth that is an input. Output is...
C
/* * The function recieves a String type value and then performs on it * to check for any characters present in the formate.. is thier are only numerical * value present in the given String value the function returns 1 or else 0 * */ #include "header.h" int isInputValid(char testString[]){ unsigned long newVa...
C
#include "passcode.h" #include <string.h> //Compares entered password with stored passwords int checkValid(char *str, char passWord[passwords][wordLen]){ int i = 0; int j = 0; int match = 0; int temp = 0; for (i = 0; i < passwords; i ++){ for (j = 0; j < wordLen; j++){ if (str[j...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include "hacking.h" #include <unistd.h> #define PORT 1337 char buffer1[128]; int copying (int l) { int i; unsigned int j=1; char buffer2[8]; printf("No Canary Found, %d\n",l); ...
C
#include <math.h> #include <stdio.h> extern double boysGaussJacobi(int m, double z); /*************************************************** * @brief compute a value with the program and compare it with a correct one. * @param[in] m The integer index of Boys function. * @param[in] z The argument of Boys function. * @param...
C
#include <stdio.h> #include <stdlib.h> #include <getopt.h> #include <string.h> #include <ctype.h> #include <unistd.h> #include <pthread.h> #include <semaphore.h> #include <sys/time.h> #include "lib/defines.h" #include "lib/lock.h" #include "lib/sem.h" #include "fs.h" #define MAX_COMMANDS 10 #define MAX_INPUT_SIZE 10...
C
#include <avr/io.h> #include "sht1x.h" static void sht1x_delay() { // 1 us (at 1MHz clock ??) asm volatile ("nop\nnop\nnop\nnop\nnop\nnop\nnop\nnop\nnop\nnop\nnop\nnop"); asm volatile ("nop\nnop\nnop\nnop\nnop\nnop\nnop\nnop\nnop\nnop\nnop\nnop"); asm volatile ("nop\nnop\nnop\nnop\nnop\nnop\nnop\nnop\nnop\nnop\nno...
C
/**** Develop your owx functions for performing following operations on strings: (a) copying one string to another (b) comparing two strings (c) adding a string to the end of another string Write a driver program to test your functions. functions. ***/ //un complete (A) #include<stdio.h> #include<string.h> ...
C
#include <stdio.h> void solve() { int no_of_numbers, no_of_ones = 0, number, no_of_zeroes = 0, i, no_of_ways_to_erase = 0; scanf("%d", &no_of_numbers); for(i = 1; i <= no_of_numbers; i++) { scanf("%d", &number); number == 0 ? no_of_zeroes++ : no_of_ones++; } no_of_ways_to_erase += (no_of_ones%2 ...
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
/* ** exec.c for minishell1 in /home/nicolaspolomack/shell/PSU_2016_minishell1 ** ** Made by Nicolas Polomack ** Login <nicolas.polomack@epitech.eu> ** ** Started on Mon Jan 9 11:14:09 2017 Nicolas Polomack ** Last update Fri Nov 2 03:39:20 2017 nicolaspolomack */ #include <stdlib.h> #include <unistd.h> #include <...
C
#include "output.h" #include <stdio.h> float sum_float(float *, int); // bitwise convert unsigned(32) to float(32) float u2f(unsigned x) { return *((float *)&x); } // u2f // 3(a): insert supporting code for qsort(.., .., .., ..) here: int compar(const void * val1, const void * val2) { float arg1 = *(fl...
C
#include <stdio.h> #define FIRST_TIPO "INT","FLOAT","CHAR" #define FIRST_COMMAND "READ","PRINT","WHILE","FOR" #define FIRST_TOTAL FIRST_TIPO,FIRST_COMMAND char tokens[][30] = {FIRST_TOTAL}; int toCharMatrix(char mat[][30], int size){ int i; for(i = 0; i < size; i++){ printf("%s\n",mat[i]); } return 1; } int m...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* tokens_translate.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> int main(){ int X,Y,i,aux, COUNT=0; scanf("%d %d", &X,&Y); if(X>Y){ aux = Y; Y = X; X = aux; } for(i=X;i<=Y;i++){ if(i%13 !=0){ COUNT+=i; } } printf("%d\n",COUNT); system("pause"); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <sys/mman.h> #include <fcntl.h> #include <unistd.h> int main(void) { int fd; char *buf; int i; struct stat statbuf; if(stat("test.txt",&statbuf)==-1) { perror("fail to get stat"); exit(1); } fd=open("test.txt",O_RDONLY); if(fd==-1) { perror("fail to open")...
C
#include "sources/dijkstra.h" #include <stdlib.h> #include "sources/utils/boolean.h" #include <math.h> // Dijkstra from index start : return vector of distances to every other vertex // TODO: use a good priority queue, and pass NI instead of pDistsIn (+ linear preprocessing) double* dijkstra_core(double* pDistsIn, int...
C
#include "temp_tool.h" void adcInitialize () { ADC_InitTypeDef adc_init_s; ADC_CommonInitTypeDef adc_common_init_s; RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE); //Clock Gating. Enables the ADC interface clock //Configure the ADC Prescaler, conversion resolution and data alignment...
C
#include<stdio.h> #include<stdlib.h> #include<pthread.h> #define MAX 1000000000 //整数范围 1 ~ MAX #define N 100 //创建N 个子线程求和 #define AVE (MAX/N) //每个子线程处理的整数个数 long long *sum = NULL; //保存各个子线程计算的结果 //获取当前时间 double get_time() { struct timeval t; gettimeofday(&t,NULL); ...
C
#include "hashtab.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/time.h> #include <time.h> double wtime() { struct timeval t; gettimeofday(&t, NULL); return (double)t.tv_sec + (double)t.tv_usec * 1E-6; } int main() { collision hash_; srand(time(NULL)); listnode* ha...
C
/* ============================================================================ Name : hal_timer.c Author : Version : Copyright : Your copyright notice Description : Hello World in C, Ansi-style ============================================================================ */ #include <stdio.h>...
C
#include<stdio.h> #include<math.h> double f(double x,double y) { if(x==0) return 0; else return 1-y; } void rk(float y0,float yy[]) { float x=0.2,y=0.181,k1,k2,k3,k4; float h=0.2; int i; yy[0]=0.181; for(i=2;i<=3;i++) { k1=f(x,y); k2=f(x+h/2,y+h*k1/2); k3=f(x+h/2,...
C
/* * Copyright (C) 2006-2012 by Benedict Paten (benedictpaten@gmail.com) * * Released under the MIT license, see LICENSE.txt */ //Cache functions #include "sonLibGlobalsInternal.h" struct stCache { stSortedSet *cache; }; typedef struct _cacheRecord { /* * A little object for storing records in the ...
C
#include "delay.h" #include "uart4.h" //ջ u8 UART4_RX_BUF[64]; //ջ,64ֽ. //յݳ u8 UART4_RX_CNT=0; void UART4_IRQHandler(void) { u8 res; if(USART_GetITStatus(UART4, USART_IT_RXNE) != RESET)//յ { res =USART_ReceiveData(UART4);//;ȡյ UART4_RX_BUF[UART4_RX_CNT]=res; //¼յֵ UART4_RX_CNT++; /...
C
/* * dec.c * * Created: 17/05/2021 09:46:02 a. m. * Author: ManuelNeri */ #include <io.h> void main(void) { #asm .EQU DDRD = 0x0A .EQU PORTC = 8 .EQU PINC = 6 .EQU PORTD = 0x0B Inicio: LDI R16,0xFF OUT DDRD,R16 ;Salida en PDO A PD7 LDI R16,0x0F OUT PORT...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { FILE *fp; char *myfile="test.txt"; char c; char line[40]; int i=0; int busy_time[13]={0}; char param1[10],param2[10],param3[10],timing[10]; if( 0 == (fp=(FILE*)fopen(myfile,"r"))) { perror("fopen() failed"); ex...
C
#include <stdio.h> int main(){ int n,x,i,sumaPares=0,cantPares=0; int sumaImpares=0,cantImpares=0,cantCero=0; float promPares,promImpares; do{ printf("Ingrese la cantidad: "); scanf("%d",&n); }while(n<=0); for(i=0;i<n;i++){ printf("Ingrese un valor: "); scanf("%d",&x); if(x==0){ cantCero=cantCer...
C
// OSMAN BOZOĞLU 220201048 #include <stdio.h> #include <stdlib.h> #include<time.h> #include <stdbool.h> /* Struct for list nodes */ struct lst_node_s { int data; struct lst_node_s* next; }; /* Struct for task nodes */ struct tsk_node_s { int task_num; //starting from 0 int task_type; // insert:0, delete:1,...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_parse_options.h :+: :+: :+: ...
C
#include "../src/base64.c" #include "test.h" #include <string.h> static int test_X(const char *input, const char *output) { char encoded[80]; char decoded[80]; unsigned int input_len, output_len; unsigned int encoded_len, decoded_len; input_len = strlen(input); output_len = strlen(output); encoded_len ...
C
#include <stdio.h> #include <stdlib.h> int* aprovados (int n, int *mat, float *notas, int *tam) { int i, contadorAprov = 0; for(i = 0; i < n; i++) //Contando a quantidade de aprovados { if(notas[i] >= 5.0) contadorAprov++; } int *vetorAprov = (int *) malloc(contadorAprov); //Alocando um vetor do...
C
#include <stdio.h> void printDown(int n) { while (1) { printf("%d", n); if (n > 1) n--; else break; } }
C
#include<stdio.h> //int main() { // int a = 0x11223344; // int b = 010; // printf("%d %d", a, b); // return 0; // // //} //int sz(int n){ // int count = 0; // for (n=n; n % 2 == 0; n = n / 2) // { // if (n % 2 == 1) // { // count++; // } // } // return count; //} // //int main() { // int tem = 0; // // scanf_s("%...
C
#include <stdio.h> #include <math.h> #include <ctype.h> #include <string.h> #include <stdlib.h> #include <assert.h> #define BUFSIZE 100 int bufp = 0; int buf[BUFSIZE]; int getch(void); void ungetch(int); int getfloat( double *pn); int main() { double val = 0; int c; while((c = getfloat(&val)) != EOF) { ...
C
//*************************************************************************** // File name: TCP_Lab.c // Author: chadd williams // Date: September 10, 2018 // Class: CS 360 // Assignment: In Class TCP Lab // Purpose: Practice using TCP sockets //***************************************************************...
C
/* * This file is an example named ``This example``. * * ``This example`` is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. ...
C
#include "read_size.h" #include <stdio.h> int read_size() { int consol_input; printf("Please, type a number!\n"); scanf("%d", &consol_input); return consol_input; }
C
#include "symbol.h" void init_st() { length = 0; max_size = N; st = (Symbol *) malloc (N * sizeof (strSymbol)); int i; for(i=0;i < N;i++) { st[i] = (Symbol) malloc (sizeof (strSymbol)) ; // symbol eux meme sont des structures, il faut aussi les allouer } // next_quad = 0; // id_temp = 0; } void print...
C
#include "TimeManager.h" static Status SetCreateRange(Timer *pTimer, float theIniMinX, float theIniMaxX, float theIniMinY, float theIniMaxY, float theIniMinVx, float theIniMaxVx, float theIniMinVy, float theIniMaxVy, float theIniMinDir, float theIniMaxDir); static Status SetBaseObjToCreate(Timer *pTimer, unsigned lon...
C
#ifndef COORD_H #define COORD_H struct coord { double x; double y; double z; coord operator-(const coord& sub) { return {x-sub.x, y-sub.y, z-sub.z}; } }; #endif
C
#include<stdio.h> int removeElement(int* nums, int numsSize, int val){ int i,j; for(i=0,j=0;j<numsSize;++j){ if (nums[j]!=val){ nums[i++]=nums[j]; } } return i; } int main(void) { int nums[3]={3,2,2,3}; int numsSize = sizeof(nums)/sizeof(nums[0]); int val = 3; ...
C
#include <stdio.h> #include "sort.c" #include "search.c" int main(void) { int a[10] = {0,20,2,6,1,98,32,56,78,21}; int n = 10; // quickSort(a,0,n-1); insert(a,n); for(int i=0;i<n;i++) { printf("%d ",a[i]); } printf("\n"); return 0; }
C
// Squarewaves.c // Runs on MSP432 // Initialize P2.1 and P2.2 as outputs with different initial values, // then toggle them to produce two out of phase square waves. // Daniel Valvano // April 23, 2015 /* This example accompanies the book "Embedded Systems: Introduction to the MSP432 Microcontroller", ...
C
#include <stdio.h> #define N 200 int n; int queue[N]; int top_queue, tail_queue; int stack1[N], stack5[N], stack60[N]; int top_stack1, top_stack5, top_stack60; int perm[N]; int ans; int gcd(int x, int y) { if (y == 0) return x; else return gcd(y, x % y); } int main() { int i, j, k; while (scanf("%d", &n), n) ...
C
/* ************************************ */ /* */ /* vc_sort_params.c */ /* */ /* By: Charles, EmreA, Kenta */ /* */ /* ************************************ */ #include <stdio.h>...
C
#include <stdio.h> /** * binary_search - Searches for a value in an array (Binary search) * @array: int array. * @size: size of array. * @value: value to search in the array. * Return: index of occurrence or -1 if not found or array is NULL. */ int binary_search(int *array, size_t size, int value) { size_t righ...
C
#pragma warning(disable : 4996) #include <stdio.h> struct person { char name[20]; char phoneNum[20]; int age; }; int main45(void) { struct person arr[3] = { {"̽±"}, {"", "010-1313-0002", 22}, {"", "010-1717-0003", 19} }; int i; for (i = 0; i < 3; i++) { printf("%s %s %d \n", arr[i].name, arr[i].phoneN...
C
#define _CRT_SECURE_NO_WARNINGS //رհȫ #include<stdio.h> #include<stdlib.h> #include<string.h> void main() { char path[100] = "C:\\Users\\Ollydebug\\Desktop\\CodeCStudy\\07\\ļ޸IJʾ-test"; char outputpath[100] = "F:\\list.txt"; remove(outputpath); //ÿִ Ҫɾļ char CMD[100]; //ʽַָ鿴еtxtļ ...
C
/* David LaMartina * lamartid@oregonstate.edu * Utilities for Program 4 * CS344 Spr2019 */ #ifndef UTILITIES_H #define UTILITIES_H #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include "boolean.h" // Simple utilities for reducing code in Program 3 main // Set all top-level (in...
C
#include <stdio.h> float alg_quadratico(float v[], int n) { float max_ate_agora = 0.0; float soma; int i; int u; for (i = 1; i < n + 1; ++i) { soma = 0.0; for (u = i; u < n + 1; ++u) { soma += v[u - 1]; max_ate_agora = max_ate_agora > soma ? ma...
C
/* -- eerom_dump.c -- Copyright (c) 2017 Shinichiro Nagasato -- -- This software is released under the MIT License. -- -- 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, ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <netdb.h> #include <sys/socket.h> #include <sys/types.h> #include <errno.h> #include <arpa/inet.h> #include <netinet/in.h> #define BUFSIZE 512 static void bail(const char *on_what) { fputs(strerror(errno),stderr); fputs(":",stde...
C
/* Partner 1 Name & Email: Catherine Lai clai022@ucr.edu * Lab Section: 28 * Assignment: Final Project * * I acknowledge all content contained herein, excluding template or example * code, is my own original work. */ #include <avr/io.h> #include <avr/interrupt.h> #include "bit.h" #include <stdio.h> #include "t...
C
#if DEBUG > 0 #include <stdio.h> #endif #include <stdlib.h> #include <stddef.h> #include <string.h> #include "smedl_types.h" #include "monitor_map.h" #include "Collect_global_wrapper.h" #include "Collect_local_wrapper.h" #include "Collect_mon.h" /* Singleton monitor */ static CollectMonitor *monitor; /* Register the ...
C
//accept string from return count of string do not consider repeated character //input: abcabccbba //output:2 bcs =abc this 3 character in our string comes repeatedly #include<stdio.h> int lengthOfLongestSubstring(char arr[]) { char brr[26]; int i=0,icnt=0; char temp='\0'; printf("Non-R...
C
#include <stdio.h> #include <math.h> typedef struct { float x; float y; } point; int main(int argc, int *argv) { point p; p.x = 0.1; p.y = 10.0; printf("%f is the sqrt!\n", sqrt(p.x * p.x + p.y + p.y)); };
C
#include "fila.h" //============================================================================= int main() { Fila f; int i, x1, x2, x3; printf("==== FILA FLEXIVEL ====\n"); f = new_fila(); for(i=0; i < 10; i++) enqueue_fila(&f, i); printf("Apos inserrir os dados: \n"); print_fi...
C
#include <stdio.h> #include <stdlib.h> #include <string.h>/* memset */ #define MAX_SYMBOLS 256 #define MAX_LEN 256 struct tnode { struct tnode* left; /*used when in tree*/ struct tnode*right; /*used when in tree*/ struct tnode*parent;/*used when in tree*/ struct tnode* next; /*used when in list*/ int ap...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<time.h> void 1mymenu(); void 2gamemenu(); void 3registe(char * name,char *passwd); void 4mygets(char * str,int size); void 5login(char *name,char *passwd); void 6attack(int * user,int *com,int flag); void 7judge(int * arr); int main() { srand((unsigned)t...
C
#ifndef _IPCPROTOCOL_H #define _IPCPROTOCOL_H #define MAX_INFOS 50 //Max number of infos that can be displayed at one time. #define MAX_INFO_LENGTH 1024 //Max size of the text for each info. #define INFO_SCREEN_PADDING 10 //The padding between info text and the screen border. #define INFO_CO...
C
/** @file board.h @author Aurora Tiffany-Davis (attiffan) Function prototypes and macro definitions to support a generalized game of connect four. */ #include <stdbool.h> // This trick will let us define the length of a winning // run when we compile the program, if we want to. #ifndef RUNLEN /** Number ...
C
#ifndef TRANSITION_H #define TRANSITION_H #include "State.h" typedef struct Trans Transition; typedef struct List ListTransition; struct Trans { State* from; State* to; char* label; bool lower; ListTransition* list; /* for listing all transitions in the FA */ ListTransition* postList; }; struct List ...
C
/* ** EPITECH PROJECT, 2019 ** my_revstr.c ** File description: ** No file there just an epitech header example */ #include <stdio.h> char *my_revstr(char *str) { int i; int len; char swap; int j = 0; i = 0; len = my_strlen(str) - 1; while (i < (my_strlen(str) / 2)) { swap = str[i...
C
#include "Funct.h" #include <math.h> double siny(double x, int i)// { double y; y = (pow(-1, i) * (pow(x, 2 * i + 1) / factorial(2 * i + 1))); return y; } double cosy(double x, int i)// { double y; y = (pow(-1, i) * (pow(x, 2 * i) / factorial(2 * i))); return y; } double expy(double x, int i)// exp { double...
C
/** * Implements a dictionary's functionality. */ #include <stdbool.h> #include <string.h> #include <ctype.h> #include <stdlib.h> #include <stdio.h> #include "dictionary.h" /** * Declare the structure used in each element of the trie_node's array * * The two structs are circular dependant so they both need to b...
C
/* A formatted file master.txt contains the employee code, name and basic pay of employees of an organization. Write a program to calculate the D.A(dearness allowance), H.R.A (House rent allowance) and gross income of each employee and store employee code, name, basic pay, D.A, H.R.A and gross income to the file emp...
C
// // Created by rqsir on 3/24/19. // #include "CLinkListInsert.h" Status CLinkListInsert(CLinkList *L,int position,ElemType e){ CLinkList walker = *L; int length = CLinkList_getLength(*L); int absPos = 0; // calculate the absolute position of the inserted element if(position > 0){ absPo...
C
#include <stdio.h> #include <stdlib.h> int main() { int firstNumber, secondNumber, result; char operation; do { system("cls"); scanf("%d", &firstNumber); result = firstNumber; do { scanf(" %c", &operation); switch (operation) {...
C
#include "files_operations.h" /* * Escribir un programa ANSI C que procese el archivo "b.bin" sobre sí mismo. El * mismo posee enteros de 16 bits sin signo con valores entre 0 y 255. El * proceso consiste en reemplazar cada entero por sus correspondientes símbolos * hexadecimales (2 caracteres ASCII). Ej: 000000...
C
/* /Xianxing Zhang / driver.c / This file contains implementation of sending requests to timer process */ #include<stdio.h> #include<string.h> #include<stdlib.h> #include<sys/socket.h> //socket #include<sys/types.h> //socket #include<netinet/in.h> //sockaddr_in #include<netdb.h> #include<unistd.h> ...
C
#include <stdio.h> int main(void) { int n,count=1; scanf("%d",&n); while(n!=0) { n=n/10; if(n!=0) { count=count+1; } } printf("%d",count); return 0; }
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 "arch/libc/config.h" #ifndef HAVE_ARCH_MEMCHR #include <string.h> void *memchr(const void *s, int _c, size_t n) { const unsigned char *p = s; unsigned char c = _c; while (n--) { if (c == *p) return (void *)p; p++; } return NULL; } #endif
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "functions_declarations.h" #include "hash_declarations.h" #include "queue_declarations.h" #define MAX_SIZE 8 /* ESTRUTURAS NECESSRIAS: - HASH - LIST - TREE FUNES NECESSRIAS: - HuffTree - CreateEmptyList - AddListNode */ ///te...
C
#include<stdio.h> unsigned long long int fact(int); int main(){ int n; scanf("%d", &n); printf("%llu\n", fact(n)); } unsigned long long int fact(int n){ unsigned long long int f=1; if(n == 1) return 1; f=n*fact(n-1); return f; }
C
#include "stdin.h" #include "system.h" #include "walloc.h" #include "palloc.h" #include "kprint.h" static FILE stdinstream; static FILE *redirectstream = 0; FILE *getstdinstream(void) { return redirectstream ? redirectstream : &stdinstream; } void redirect(FILE *newstream) { redirectstream = newstream; +...
C
#include <stdio.h> #include <string.h> #include <windows.h> #include <conio.h> int main(int argc, char const *argv[]) { const unsigned char* fName = "file.map"; BOOL process; STARTUPINFO cInf; PROCESS_INFORMATION pInf; HANDLE hFileMap; HANDLE hFile; ZeroMemory(&cInf, sizeof(STAR...
C
#include <stdio.h> #define return_exam(p) if(!(p)){printf("error:"#p"\tfile_name:%s\tfunction_nae:%s\tline:%d .\n",__FILE__, __func__, __LINE__); return 0;} int print() { return_exam(0); } int main(int argc, char **argv) { print(); printf("hello world!!!\n"); return 0; }