language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_itoa_hex.c :+: :+: :+: ...
C
/* * OS Scheduling Policy Simulator - Foreground Background Policy Implementation * Author: Ana Berthel * Date: 12/13/18 */ #include<stdio.h> #include<stdlib.h> #include<unistd.h> #include "helper.h" //returns relevant data about round of simulation struct results { int pc; int t; int timer; struct ll_node* curren...
C
#include "stdafx.h" #include <process.h> #include <malloc.h> #include <stdlib.h> int main(int argc, char* argv[]) { int i, r, numprocs; printf("Estresador: se recibieron %d argumentos\n",argc); for(i = 0; i < argc; i++) printf("Estresador: argv[%d]:%s\n", i,argv[i]); char** args = (char**) mallo...
C
//LeetCode - 413_Arithmetic_Slices.h //3ms 100% /* Instruction: LeetCode 413 - Arithmetic Slices - [M] Developer: lrushx Process Time: Apr 14, 2017 */ /* Total Accepted: 18149 Total Submissions: 33031 A sequence of number is called arithmetic if it consists of at least three elements and if the difference between ...
C
#include <string.h> #include <stdio.h> #include <gst/gst.h> // gcc tutorial-13.c -o tutorial-13 `pkg-config --cflags --libs gstreamer-1.0` typedef struct _CustomData { GstElement *pipeline; GstElement *video_sink; GMainLoop *loop; gboolean playing; /* Playing or Paused */ gdouble rate; /* Current pl...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #include <ctype.h> #include <errno.h> #include <signal.h> #include "piping.h" #include "redirection.h" int writeHistory(char *toWrite); void readHistory(); void clearHistory(); int readnEntries...
C
#include "lists.h" #include <stdio.h> /** * sum_listint - Sums the nodes of the input linked list * @head: ptr to the head of the list * * Return: sum of the nodes **/ int sum_listint(listint_t *head) { int sum = 0; while (head != 0) { sum += head->n; head = head->next; } return (sum); }
C
#include <stdio.h> int strcmp(const char *s1, const char *s2){ printf("cmp : <%s> <%s>", s1, s2); return 0; }
C
#include <stdio.h> #include <conio.h> #include<math.h> #include<time.h> #include<stdlib.h> #include<Windows.h> #define uint32 unsigned long int #define int32 signed int #define TOFIX(d, q) ((int) ( (d)*(float)(1<<(q)) )) #define TOFLT(a, q) ( (float) (a) / (float) (1<<(q)) ) #define cosinusDelta 0.999999 #define sin...
C
/* ** EPITECH PROJECT, 2020 ** minishell1 ** File description: ** smaller-desu */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "my.h" int exe_checker(char *pathname) { int test = 0; if (access(pathname, F_OK) != 0) test += 1; else { if (access(pathname, R_OK) != 0) ...
C
#include <stdio.h> #include<string.h> int main(int argc, char *argv[]) { int n,i,ch=0,bi=0,ba=0; scanf("%d",&n); int a[n]; for(i=0;i<n;i++) scanf("%d",&a[i]); for(i=0;i<n;i=i+3) ch = ch +a[i]; for(i=1;i<n;i=i+3) bi = bi +a[i]; for(i=2;i<n;i=i+3) ba = ba +a[i]; ...
C
//Amanda Bedard //PA-1 // //The header files for the program //These are all the headers I have used for //either testing my file or the final copy //needs it to run #include <stdio.h> #include "pa-1.h" #include <stdbool.h> #include <stdlib.h> #include <time.h> #include <math.h> #include <string.h> //I used this for a...
C
//program to delete the record in a file #include <stdio.h> #include <stdlib.h> int main(void) { struct record { char name[20]; int roll; int marks; } student; FILE *fp, *fptmp; char name[20]; unsigned flag = 0; fp = fopen("stu", "rb"); if (fp...
C
#include "common.h" int socket_fd; char name[MAX_ARRAY]; char *ip; int port; char *path; void __del__(); void howToUse(); void sigintHandler(){ exit(0);} void __init__(int argc, char *argv[]); void registerOnServer(){ Msg msg; strcpy(msg.name,name); msg.type = REGISTER; write(socket_fd,&msg,sizeof(M...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strjoin.c :+: :+: :+: ...
C
/* This function marks the start of the farm */ int start_farm() { return 1; } unsigned addval_210(unsigned x) { return x + 2425411699U; } unsigned getval_441() { return 3351742792U; } void setval_269(unsigned *p) { *p = 2428995912U; } unsigned addval_184(unsigned x) { return x + 2462550344U; } ...
C
#include "hbridge.h" int current_A_1, current_B_1, current_A_2, current_B_2; /* * Function: unsigned int init_hbridge(void) * Description: init the hbridge */ unsigned char init_hbridge(void) { // set everything to output gpio_register_pin(PIN_MOTOR1_A, GPIO_DIRECTION_OUTPUT, false); gpio_register_p...
C
/* ************************************************************************** */ /* */ /* :::::::: */ /* main.c :+: :+: ...
C
#include <stdio.h> int main(){ int a = 10; while(a<20){ printf("The value of a: %d\n", a); a++; // printf("%d",a); if(a>16){ break; } } return 0; }
C
#include "Trie.h" extern int maxSize; // Function that returns a new Trie node node* getNewTrieNode(char letter) { node* p = (node*)malloc(sizeof(node)); if (p != NULL) { // if the malloc finished succesfully p->count = 0; p->letter = letter; for (int i = 0; i < NUM_LETTERS; i++) // by default making its array ...
C
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> int main() { int n, m; float a, b; scanf("%d%d", &n, &m); scanf("%f%f", &a, &b); printf("%d %d\n%1.1f %1.1f", n + m, n - m, a + b, a - b); return 0; }
C
/*E32*/ #include<stdio.h> int log2(int num); int logN(int num, int base); main() { int num, base; printf("Enter a number :"); scanf("%d",&num); printf("%d\n",log2(num)); printf("Enter a number and a base :"); scanf("%d%d",&num,&base); printf("%d\n",logN(num,base)) ; } int log2(int num) { ...
C
/* Author: Jack Earhart * Start Date:07/05/2020 * End Date: 07/29/2020 * File: motor.c * Description: This file configures the motor in its entirety, the motor is initialized in the motor_init function * and the motor_PWM function constantly updates the motor's speed. */ #include "msp.h" #inclu...
C
//----------------------------------------------------------------------------- // Maria Fernanda Becerra // mfbecerr // CSE101 // pa4 // Graph.c //----------------------------------------------------------------------------- #include <stdio.h> #include <stdlib.h> #include <string.h> #include "List.h" #include "Graph.h...
C
#define INT 0 #define FLOAT 1 #define PWR_TYPE FLOAT #include <stdio.h> int main(void) { int i; #if PWR_TYPE==FLOAT float j, res; #elif PWR_TYPE==INT int j, res; #endif printf("数値を入力してください: "); #if PWR_TYPE==FLOAT scanf("%f", &j); #elif PWR_TYPE==INT scanf("%d", &j); #endif res = 1; printf("何乗しますか?: "); ...
C
#ifndef SOUNDEX_H #define SOUNDEX //create the soundex encoding for a given surname void encode(const char *surname, char *soundex); //create the soundex encoding for a given letter char encode_one(const char surname); //return 1 if the soundex codes are the same, 0 if they are not int compare(const char *soundex1, ...
C
#include "peo.c" // void map_put(char map[SIZEX][SIZEY],struct people peo[])//ﶨmapΪβ { int i,j,commandcolor=0; //people_put(map,peo); setcolor(11,0); printf("\t\t\t: "); setcolor(7,0); printf("%s",peo[0].name); setcolor(10,0);printf("\tHP: ");setcolor(10,0);printf("%d",peo[0].hp); setcolor(10,0);printf("\t\t...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #define TAMNOME 120 char * pegarSobrenome(char *nome); char * pegarPrimeiroNome(char * nome); char * pegarNomeCompanhia(char * nome); int main(){ char nome[TAMNOME], *nomeCompanhia = NULL; printf("Digite um nome: "); scanf(" %[^\n]", nome); nomeCom...
C
/** * @file Game.h * @brief plik ze stutur gry oraz funkcjami dotyczcych gry */ #pragma once #include "stdafx.h" /** Stany gry */ typedef enum GameState { WaitingForAction, WaitingForMove, UpdatePawnValue, EndOfTheGame } GameState; /** Struktura maszyny stanw gry */ typedef struct Game { bool player; ///< zmi...
C
/* Grupo 03 Bruno Freitas 51468 Marcelo Mouta 51110 Pedro Marques 51021 */ #include<stdlib.h> #include<string.h> #include <stdio.h> #include"client_stub-private.h" #include "network_client.h" static server_t *head = NULL; static server_t *tail = NULL; #define TIMEOUT 2000 static char *root_path = "/chai...
C
#include <stdio.h> #include <stdbool.h> int main (void){ int ratingCounters[11], i, response; for(i = 1; i <= 10; ++i) ratingCounters[i] = 0; printf("Enter your responses: \n"); printf("When you are done, enter 999: \n"); while(true){ scanf("%i...
C
/*! \file MLX90614.c \brief the read and write function file \version 2019-06-05, V1.0.0, demo for GD32VF103 */ #include "ir_sensor/MLX90614.h" #include "ir_sensor/i2c.h" #include <stdint.h> #include <stdio.h> #include "systick.h" float ir_readTemp(uint8_t reg); uint16_t ir_read16(uint...
C
#include<stdio.h> #include<string.h> #define MAX 50 int main() { char s[MAX]; int icount = 0; do { printf("Please enter a string: "); gets(s); } while (strlen(s) >= MAX); for (int i = 0; i < strlen(s) / 2; i++) if (s[i] != s[strlen(s) - 1 - i]) { icount++; ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "marca.h" /** \brief Muestra un array de eMarca. * \param marcas Es el array que va a mostrar. * \param tam Es el tamao del array. * \return void. */ void mostrarMarca(eMarca* marcas, int tam) { if(marcas != NULL) { printf("\n ...
C
#include <stdio.h> #include <unistd.h> int main() { printf("The REAL UID ~~~~~> UID (%d)\n", getuid()); printf("The EFFECTIVE UID ~~~~~> EUID (%d)\n", geteuid()); return 0; }
C
//20133417:11:01 //ʹþ˷ÿԶ֮· //ʹͼıʾʱʹõڽӾ #include<stdio.h> // #define INF_T 0x30000000 //********************************* int weight[5][5]={{0,3,8,INF_T,-4}, {INF_T,0,INF_T,1,7}, {INF_T,4,0,INF_T,INF_T}, {2,INF_T,-5,0,INF_T}, ...
C
/* Dan Matheson Homework 5 Part 1 */ #include <stdio.h> #include <time.h> #include <stdlib.h> #define ARRSIZE 5 void generateRandArray(int [], int *[], int *[]); void printArray(int [], int *[], int *[]); void sortArray(int [], int *[], int *[], int, int, int, int); int main() { int normal[ARRSIZE], *ascend[ARRSIZE], ...
C
/** * @file lab9.c * @brief Simulates a simple cpu with a user specified word size * @details Allows a user to calculate two binary numbers of a specified word * size using a user speciifed operation. The operation could be addition, * subtraction, binary and, binary or, and binary xor. * * @author Matthew Olse...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <fcntl.h> #include <ctype.h> #include "grammar.h" #include "util.h" // Defines. #define MAX_STRING 255 #define MAX_CHARSET 256 // // Initialise a grammar structure. // void GrammarInit(Grammar *grammar) { memset(grammar, 0, sizeof(*grammar));...
C
/** * @defgroup SG_BASE base sengi modules * @defgroup SG_ERROR sengi error modules * */ #include "sg_base.h" // function that create a row vector sg_vector create_rv( const size_t size ) { sg_vector vec = { 0, SG_INVVEC, NULL }; if( 1 > size ) { SENGI_ERR( INVALID_SIZE ); return vec; } vec...
C
//---------------------------------------------------------------------------- // //---------------------------------------------------------------------------- #include <wake_cmd.h> #include <wake_exchange.h> #include <wake.h> #include <registers.h> //------------------------------ : ---------------------------...
C
#include "lists.h" /** * reverse_listint - reverses a linked list * @head: the pointer to a pointer to the first struct in the linked list * Return: a pointer to the first node of the reversed list */ listint_t *reverse_listint(listint_t **head) { listint_t *prev = NULL, *next; if (head == NULL || *head == NULL...
C
#include <stdio.h> #include <stdlib.h> int sizes[1001]; FILE *new_freopen(const char *filename, const char *mode, FILE *stream); void handleCase(void); void sort(int start, int finish); int main() { int first_iteration; new_freopen("candy.in", "r", stdin); new_freopen("candy.out", "w", stdout); int numCases; ...
C
/***************************************************************************** ** ** ** Snake Game by rcbgalido ** ** ** ****...
C
//from SCL #include <stdio.h> #include <stdlib.h> #include <time.h> #define N 20 int a[N+1]; void quick_sort(int A[], int low, int high) { int i=low,j=high,x=A[(i+j)/2],y; do{ while(a[i]<x) i++; while(a[j]>x) j--; if(i<=j) { y=A[i]; A[i]=A[j]; A[j]=y; i++;j--; } }while(i<j); if(i<high...
C
/* Tools for handling numbers as strings. */ #include <stdio.h> #include <string.h> char get_final_chr (char *num_str) /* Returns the final character of a string. */ { int len = strlen(num_str); char val; val = num_str[len-1]; return val; } void *strip_final_chr (char *num_str) /* Stri...
C
#include <stdlib.h> #include <stdio.h> #include <time.h> #define TAM_MAX 256 #define MAX 0xFFFF double media(int*, int); int main(void) { int *array; int tamanho; srand(time(NULL)); tamanho = rand() % TAM_MAX; array = (int *) malloc(tamanho * sizeof(int)); for (int indice = 0; indice < tamanho; indice+...
C
#include "stm32f4xx.h" #include "FlashSave.h" #include "HITCRT_Types.h" #include "PrivateFunction.h" UINT32 i=0; SSHORT16 GetOneShort16(UINT32 uiReadAddr) { SSHORT16 ssTemp; ssTemp=(SSHORT16)(*(__IO SINT32*)(ADDR_FLASH_SECTOR_11+(uiReadAddr<<2))); return ssTemp; } SINT32 GetOneInt32(UINT32 uiReadAddr) { SINT...
C
/************************************************* Copyright (c) 2020 All rights reserved. File name: mqtt_app.c Description: History: 1. Version: Date: 2021-02-11 Author: WKJay Modify: *************************************************/ #include <rtthread.h> #include <wolfmqtt.h> #includ...
C
#ifndef __FS_DIR_H #define __FS_DIR_H #include <cpu/type.h> #define MAX_FILE_NAME_LEN 15 // 最大文件名长度 #ifndef FT_FILE #define FT_UNDIFINE 0x00 // 未定义的类型 #define FT_FILE 0x01 // 普通的文件 #define FT_DIRECOTRY 0x02 // 目录 #define FT_SLINK 0x03 // 软链接 #define FT_HLINK 0x04 // 硬链接 #endif #define SUCCESS 0 ...
C
/* * uart.c * * Created on: Nov 10, 2019 * Author: Zac */ #include "msp.h" #include <stdint.h> #include "uart.h" #include "circularBuf.h" extern volatile uint8_t RX1FLAG; extern volatile uint8_t TX1FLAG; extern volatile uint8_t RX2FLAG; extern volatile uint8_t TX2FLAG; // Configure the EUSC_Ax module to ...
C
/* ** get_map.c for get_map in /home/fisun_s/wolftest ** ** Made by Fisun Sergii ** Login <fisun_s@epitech.net> ** ** Started on Sat Dec 6 22:12:19 2014 Fisun Sergii ** Last update Sun Dec 21 23:34:56 2014 Fisun Sergii */ #include <unistd.h> #include <stdlib.h> #include "my_struct.h" int check_line(char *line)...
C
#include <stdio.h> int handler_tcp(const unsigned char *p, void *param, unsigned int len); //tcp.c int handler_udp(const unsigned char *p, void *param, unsigned int len); //udp.c int handler_ip(const unsigned char *p, void *param, unsigned int len) { unsigned int headerLength, protocol; headerLength = (p[0] & 0x0...
C
/*This program converts a number to decimal,binary and hexadecimal format. It also prints number of high bits in the binary format. In order t exit, the input should be E.*/ #include <stdio.h> #include<string.h> #include<ctype.h> #include<stdlib.h> void decimal_to_binary(int);/*Function Declaration*/ int counter=0; ...
C
#include "need.h" int main(void) { struct rusage r_usage; struct rlimit r_limit; int priority; //cpu-load-line test work(); getrusage(RUSAGE_SELF, &r_usage); printf("CPU:User = %ld.%06ld, System = %ld.%06ld\n", r_usage.ru_utime.tv_sec, r_usage.ru_utime.tv_usec, r_usage.ru_stime.tv_sec, r_usage.ru_stime.t...
C
#include "holberton.h" #include <stdio.h> /** * infinite_add - add two strings * @n1: string 1 * @n2: string 2 * @r: added string * @size_r: buffer of string * * Return: character */ char *infinite_add(char *n1, char *n2, char *r, int size_r) { int i, j; i = j 0; while (n1[i] != '\0') i++; while (n2[j...
C
#include "mglibc.h" void mg_exit(int status) { /* * 1 is the 32bit linux system call to exit, and we place * the status value in ebx */ asm ( "movl $1, %%eax\n\t" "int $0x80" : /* no output */ : "b" (status) : "%eax", "%ebx" ); }
C
/************************************************************************************** * Author: Gunnar Gulbrandsen * Course: EGR 226 - 902 * Date: 4/1/2021 * Project: Lab 10 * File: Lab10_Functions.c * Description: .c file for functions used in Lab 10 ***********************************************************...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_error_list.c :+: :+: :+: ...
C
/* * Program to find the largest rectangle in the histogram. * * Question Link: * https://leetcode.com/problems/largest-rectangle-in-histogram/ * * @author: Manuj Grover, @Roll_Number: 1910990170 * Assignment - 4(Stacks and Queues). */ // max size for stack. int max_size = 0; // stack array. int *stack; int p...
C
#include <stdio.h> #include <stdlib.h> /*???????x,???????x???????????????,???????9??,????????????*/ int main(void) { long y,z; int x,s[10],i,j,t,k,n; while(1){ printf("input x:\n"); scanf("%d",&x); x=x>32000?32000:x; n=0; for (i = 10000; i < x; i++){ for(j=0;j<=9;j++){ s[j]=0; } y=i*i; ...
C
typedef struct { size_t n, maxsize; unsigned long *items; } ltable_t; void ltable_init(ltable_t *t, size_t n) { t->n = 0; t->maxsize = n; t->items = (unsigned long*)malloc(n * sizeof(unsigned long)); } void ltable_clear(ltable_t *t) { t->n = 0; } void ltable_insert(ltable_t *t, unsigned long ...
C
// файловые функции // функция копирования файла с параметрами имя 1 имя 2 void copy_file(char* name1,char* name2) { // STARTUPINFO si; // PROCESS_INFORMATION pi; // GetStartupInfo(&si); char b[1]; FILE *f1, *f2; // point to file if (!(f1 = fopen(name1, "r"))) { printf("No open file name %s...
C
#ifndef _HASHTABLE_H #define _HASHTABLE_H #include <stdint.h> /* a light stack-friendly hash library, * (it uses stack space for smallish hash tables) */ /* based on a doubling non-chaining approach */ typedef struct { uintptr_t key; void *val; } SmallHashEntry; /*how much stack space to use before dynamically ...
C
#ifndef __STRUCTURE_H__ #define __STRUCTURE_H__ #include <stdbool.h> #include "symbol.h" enum NodeType { SYMBOL, PAIR, LIST, EMPTY, VECTOR, BOOL, COMPLEX, CHAR, STRING, FIX_LAMBDA, VAR_LAMBDA, BUI_LAMBDA, MACRO, UNSPECIFIED, // macro, BUILTIN_MAC, DUMMY, LISTELL, VECTORELL, MARG, }; typedef struct...
C
#include <stdio.h> #include <math.h> #define n 3 //размер двумерного массива //я не помню задачу=( int main(void) { int i,j,a,nx,max,z,k; int mas[n][n]={-11,16,0,-10,13,16,-4,15,0};//заполненый массив int mis[a]; //одномерный массив int x[n*n/2];// for (i=0;i<n;i++) { for (j = 0;j<n;j++) { printf("%3d ...
C
#include<stdio.h> #include<string.h> #define MIN(a,b) ((a)<(b)?(a):(b)) #define MAX(a,b) ((a)>(b)?(a):(b)) int main(){ char triangle[105][205]; int table[105][205]; int n,i,j,max; int cases; for(cases=1;scanf("%d",&n),n;cases++){ for(i=0;i<n;i++) scanf("%s",triangle[i]); memset(table,0,sizeof(table)); max=0;...
C
/* * Copyright (C) by Argonne National Laboratory * See COPYRIGHT in top-level directory */ #include <math.h> #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include "mpi.h" #include "mpitest.h" int main(int argc, char *argv[]); /* helper functions */ int parse_args(int argc, char **argv); static...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_print_champion.c :+: :+: :+: ...
C
#include <stdio.h> #include "util.h" #include "merge_sort.h" #include "quick_sort.h" #include "insertion_sort.h" void test_merge_sort() { printf("merge sort...\n"); { int a[] = { 3, 9, 1, 7, 5 }; int len = sizeof(a)/ sizeof(a[0]); dump_array("before", a, len); merge_sort(a, len)...
C
#include <brdkSTR_func.h> signed long brdkStrSlice(unsigned long pString, signed long start, signed long end) { signed long i,j, len = -1; if(start > -1) { if(start > 0) { len = brdkStrLen(pString); j=0; while(j<start) { for(i=0;i < len;i++) ((char*)pString)[i] = ((char*)pString)[i+1]; /* moves all ch...
C
#include <stdio.h> #include <math.h> #include "mytypes.h" int main (int argc, char *argv[]) { u64 n, v, q; for (n = 1; n < 100000000; n++) { v = 5*n*n + 2*n + 1; q = sqrtl(v); if (q*q == v) { printf("N = %I64u\n", n); fflush(stdout); } } return ...
C
/********************************* > File Name: insertion_sort_wiki_randomNum.c > Author: Zeno > Mail:340562424@qq.com > Created Time: 2015年09月04日 星期五 16时35分09秒 ********************************/ #include<stdio.h> #include<time.h> #include<string.h> #include<stdlib.h> #define LEN 100000 int arr[LEN]; v...
C
#include <stdlib.h> #include <stdio.h> #ifndef __cplusplus typedef unsigned char bool; static const bool false = 0; static const bool true = 1; #endif typedef struct TypeDefinition { enum {INT = 1, FLOAT = 2, DOUBLE = 3, BOOL = 4, CHAR = 5, STRING = 6, ARRAY = 7, OBJECT = 8} tag; union { int int_value; floa...
C
#include "cpu.h" /* ASL (SHIFT LEFT ONE BIT: MEMORY OR ACCUMULATOR) */ void nes_cpu_asl_ac(void) { log_op("ASL A"); uint16_t value = (uint16_t)(cpu.a) << 1; if (hi(value)) cpu_set_C(); cpu.a = lo(value); cpu_check_Z(cpu.a); cpu_check_N(cpu.a); cpu.pc ++; } void nes_cpu_asl_zp(void) { uint8_t ad...
C
#include <stdio.h> int main() { char str1[] = "hello"; char str2[] = "world"; printf("%s\n",my_strncat(str1,str2,3)); }
C
#include <emscripten.h> #include <stdlib.h> /*EMSCRIPTEN_KEEPALIVE int addTest(int a, int b) { return a + b; }*/ EMSCRIPTEN_KEEPALIVE int addPointerTest(int a, int b) { volatile int* temp = (int*) malloc(sizeof(int)); *temp = a; *temp += b; return *temp; }
C
#include <stdio.h> int main(void) { int opcao = getchar(); printf("Opo escolhida: "); putchar(opcao); printf("\n"); return 0; }
C
#include <stdio.h> #include <stdlib.h> int main() { int x; printf("Digite um numero: \n"); scanf("%i",&x); while(x<1||x<4){ printf("ENTRADA INVALIDA,DIGITE OUTRO NUMERO: "); scanf("%d",&x); } printf("\nNUMERO CORRETO, %d", x); printf("\n\n"); system("pause"); retu...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_int_isany.c :+: :+: :+: ...
C
source: http://www.securityfocus.com/bid/4891/info Informix is an enterprise database distributed and maintained by IBM. A buffer overflow vulnerability has been reported for Informix-SE for Linux. The overflow is due to an unbounded string copy of the INFORMIXDIR environment variable to a local buffer. There is ...
C
/* * Last modified: Sat, 06 Apr 2013 03:42:27 +0900 */ #include <stdio.h> #include "mycommon.h" void free_myArgs(myArgs* args) { free_unsortedNodes(args); free(args); } void free_unsortedNodes(myArgs* args) { /* int i; for (i = 0; i < args->unsort_len; i++) { free(args->unsortedNodes[i]); } */ f...
C
#include <iostream> using namespace std; void counting_sort(int *arr, int n, int e) { int C[10] = {}; int sorted_arr[n]; for (int j = 0; j < n; j++) C[(arr[j] / e) % 10]++; for (int i = 1; i < 10; i++) C[i] += C[i - 1]; for (int j = n - 1; j >= 0; j--) { sorted_arr[C[(arr[j] / e) % 10] - 1] = ...
C
#include "platform.h" #include "xparameters.h" #include "xgpio.h" char inbyte(void); void outbyte(char c); //declare an XGpio and XGpio instance XGpio GPIO_0; XGpio_Config GPIO_0_conf; int main() { char c; GPIO_0_conf.BaseAddress = XPAR_AXI_GPIO_0_BASEADDR; GPIO_0_conf.DeviceId = XPAR_GPIO_0_DEVI...
C
#include <unistd.h> #include <sys/signal.h> #define SIZE 32 int main(void) { int pid;; char buf[SIZE]; pid = fork(); if (pid == -1) { perror("Fork failed"); exit(1); } /* Parent process */ if (pid > 0) { exit(0); } /* Chi...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #define PI 3.141592 int main(){ float raio; printf("Digite o valor do raio\n"); scanf("%f",&raio); raio = (pow(raio,2))* PI; printf("A area eh %.2f\n",raio); system("pause"); return 0; }
C
#include<stdio.h> int main(){ char grade; printf("Enter your grade : "); scanf("%c",&grade); switch(grade){ case 'A': printf("Excellent"); break; case 'B': printf("Well Done"); break; case 'C': printf("Try Again"); break; default: printf("Invalid grade"); } }
C
#include <math.h> #include<stdio.h> #define T 0.0001 double genSin(double A, double f, double phase, double DC, double time){ return A*sin(2*M_PI*f*time + phase) + DC; } double genSqr(double A, double f, double phase, double DC, double time){ if(sin(2*M_PI*f*time + phase) < 0){ return -A+DC; } ...
C
#include <stdio.h> void le_nota(float *A,float *B) { int aux,verifica=1; printf("Informe n1 e n2: "); scanf("%f", &(*A)); scanf("%f", &(*B)); return ; } void exibe_dados(float A,float B) { printf("media simples: %.2f\nmedia ponderada: %.2f\n", A, B); return; } void calc_media(float *A,float *B) { float...
C
#include <stdio.h> #include <stdlib.h> int Constrcmp(char *source, char *dest) { while (*source && *dest && (*source - *dest) == 0){ if (*source == '\0') return 0; source ++; dest++; } return -1; } int main (void) { char source[] = "hello"; char dest[] = "hellO"; int val = Constrcmp (source, dest); ...
C
#include<stdio.h> int main(){ int n; scanf("%d",&n); int ans = 0; for(int i = 0;i <n;i++){ int x; scanf("%d",&x); ans += x; } printf("%d", ans); }
C
#include <netdb.h> #include "is_seqnum.h" #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <string.h> int createAddrInfo(struct addrinfo *info); int main(int argc, char *argv[]) { char seqNumStr[INT_LEN]; int cfd; ssize_t numRead; struct addrinfo hints; struct addrinfo *result, *rp; cr...
C
#include "sig.h" #include <signal.h> #include <stdio.h> #include "time_.h" static volatile sig_atomic_t progress_flag = 0; static void progress(int signum) { progress_flag = signum; } static volatile sig_atomic_t stop_flag = 0; static void stop(int signum) { stop_flag = signum; } static FILE *log = NULL; static tick...
C
/* * button.c * Module to read the buttons. * * Created on: Oct 5, 2011 * Author: Brian Fraser; based on code by EmbedSky (button.c) */ #include "buttondrv.h" #include <stdio.h> #include <stdlib.h> #include <linux/stddef.h> // for NULL #include <fcntl.h> // for open() #include <unistd.h> // for close()...
C
/* NAME moriadecode.c COMMENTS decodes (i.e. xors) a moria.save file this is a filter (reads in stdin, writes in stdout) AUTHOR Eric W. Bazin (currently bazin@carolus.cma.fr) HISTORY bazin - 17/10/1992: Created. */ #include <stdio.h> #include <stdlib.h> main(argc, argv...
C
#include<stdio.h> int main(void) { int i,j,k,l,m,n; for(i=1;i<=5;i++) { for(k=5-i;k>0;k--) printf(" "); for(j=1;j<=1+2*(i-1);j++) printf("%d",j); printf("\n"); } for(l=1;l<=4;l++) { for(m=1;m<=l;m++) printf(" "); ...
C
#pragma once #include <stdint.h> uint32_t hash_fnv1(uint32_t key); struct linkedlist_t { static const uint32_t invalid = 0xffffffffu; struct node_t { uint32_t value = invalid; uint32_t prev = invalid; uint32_t next = invalid; inline void free() {value = invalid;} inline bool taken() const {return value...
C
#include <stdio.h> int main(int argc,char *argv[]) { printf("Hello World\n"); int i = 0; for(i=0;i<10;i++) printf("I = %d\n",i); return 0; }
C
#include <stdio.h> #include <stdlib.h> typedef struct node { int data; struct node *link; }N; N* create(int v) { N* nu; nu=(N*)malloc(sizeof(N)); nu->data=v; nu->link=NULL; return nu; } int count(N** tail) { int c=0; N* ptr; for(ptr=(*tail)->link;ptr!=*tail;ptr=ptr->link) ...
C
#include "acc.h" static char *argreg[] = {"rdi","rsi","rdx","rcx","r8","r9"}; static int labelseq = 1; static char *funcname; static void gen(Node *node); static void gen_addr(Node *node){ switch(node->kind){ case ND_VAR: printf(" lea rax,[rbp-%d]\n",node->var->offset); pr...