language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include "hardening.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static int error_occured = 0;
static int current_iteration = -1;
inline int hardened_compare_and_return_int(int var_a, int var_b, char* file, long line, char* var_name)
{
int result;
int a = var_a;
int b = var_b;
result = int_xor... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "list_test.h"
#include "list.h"
List _g_list_header = LIST_NULL;
#define MAX_BUF_SIZE (20)
static void cleanLine(void)
{
while ( '\n' != getchar()) {
;
}
}
void T_createList(void)
{
List p_header = LIST_NU... |
C |
#include <stdlib.h>
#include <stdio.h>
#include "lexer.h"
#include "history.h"
/*
** Transformation of the command into a list of token in 2 parts:
** Elementary token (tokeniser) and group of token (token_secondary).
** Rebinding of the list for the history.
*/
t_token *lexer(char *line, t_shell *sh, int opt)
{
t... |
C | /*
* $Id$
*
* utils.c
*
* SmartPalm Mobile APRS Display
* Copyright (c) 2001, Joelle Maslak
* Portions Copyright (c) 2005, Curtis E. Mills, WE7U
* All Rights Reserved (see license)
*
*/
#include <PalmOS.h>
#include <PalmCompatibility.h>
//#include <math.h>
extern double sin(double);
extern double cos(double... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int numero;
int opcion=-9;
while(opcion!=0){
printf("\n1-Creciente:\n");
printf("2-Decreciente:\n");
printf("3-Factorial:\n");
printf("4-Binario:\n");
printf("5-Sumar hasta N:\n");
printf("0-Salir\n");
scanf("%d"... |
C | /**
******************************************************************************
* @file : main_boot.c
* @brief : Bootloader app body
******************************************************************************
*/
/* Includes ------------------------------------------------------------... |
C | #define _BSD_SOURCE /* Get on_exit() declaration from <stdlib.h */
#include <stdlib.h>
#include "../lib/tlpi_hdr.h"
static void atexitFunc1(void)
{
printf("atexit function 1 called\n");
}
static void atexitFunc2(void)
{
printf("atexit function 2 called\n");
}
static void onexitFunc(int exitStatus,void *arg)
{
... |
C | //******************************************************************************
// MSP430FR69xx Demo - eUSCI_A1 UART echo at 9600 baud using BRCLK = 8MHz
//
// Description: This demo echoes back characters received via a PC serial port.
// SMCLK/ DCO is used as a clock source and the device is put in LPM3
// The a... |
C | /*
Name: Ejercicio 35
Copyright: BlueCode
Author: Guillermo Canto
Date: 06/02/20 21:52
Description: E.P. que lea 25 números (N) y que imprima los que sean iguales a cero.
*/
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
float n;
int i = 0;
while(i<25){
//Entrada
printf("#%... |
C |
enum
{
M_TEAM = 1<<0,
M_CTF = 1<<1,
M_OVERTIME = 1<<2,
M_EDIT = 1<<3,
M_DEMO = 1<<4,
M_LOCAL = 1<<5,
M_LOBBY = 1<<6,
M_ELIMINATION = 1<<7,
M_LASTMAN = 1<<8,
M_JUGGERNAUT = 1<<9,
M_INFECTION = 1<<10,
M_HOLD = 1<<11... |
C | //
// main.c
// 141-LinkedListCycle
//
// Created by HuangLibo on 2017/8/20.
// Copyright © 2017年 Huang Libo. All rights reserved.
//
/*
141. Linked List Cycle
Given a linked list, determine if it has a cycle in it.
Follow up:
Can you solve it without using extra space?
*/
#include <stdio.h>
#include <std... |
C | #include<stdio.h>
#include<string.h>
int min(int x,int y)
{
return x<y?x:y;
}
int main()
{
int t,i,count,la,lb;
int a1[130],b1[130];
char a[10004],b[10004];
scanf("%d",&t);
while(t--)
{
for(i=0;i<130;i++)
{
a1[i]=0;
b1[i]=0;
}
scanf("%s",a);
scanf("%s",b);
la=strlen(a);
... |
C | // formas básicas do goto, for, while e do while
#include <stdio.h>
int main()
{
int i = 0, j = 0, k = 0, l = 0, count = 3;
imprimir:
printf("o valor de i é: %d\n", i);
i++;
if (i < 3)
goto imprimir;
printf("#################\n");
for (size_t j = 0; j < c... |
C | // Clockwise dir-high
#include "Arduino.h"
const int STEP_DELAY = 1000;
int speeddelay = 1000;
// M1 Constants - Motor Z Ramps Pinouts
const int M1DPin = 41;
const int M1EPin = 37;
const int M1SPin = 39;
// M2 Constants - Motor X Ramps Pinouts
const int M2DPin = 40;
const int M2EPin = 36;
const int M2SPin = 38;
// ... |
C | #include<stdio.h>
#include<string.h>
#define max(x,y)(x > y? x:y)
int dp[102][102];
char a[103],b[103];
int main(){
int cas = 1;
while(gets(a)){
if(strcmp(a, "#") == 0)break;
gets(b);
int as = strlen(a),bs = strlen(b);
for(int i = 0; i <= as;++i) dp[0][i] = 0;
for(int i =... |
C | #include <stdio.h>
void minMax(int arr[], int size, int *min, int *max);
int main() {
int n;
printf("How many numbers?\n");
scanf("%d", &n);
int arr[n];
for (int i = 0; i < n; i++) {
scanf("%d", &arr[i]);
}
int min, max;
minMax(arr, n, &min, &max);
printf("min=%d, max=%... |
C | #include <stdio.h>
#include <stdlib.h>
//#include "time_functions.h"
#include "setpath_defs.h"
void read_chars(FILE *fp,FILE *outfp);
void read_lines(FILE *fp,FILE *outfp);
int main(int argc, char *argv[]){
FILE *fp;
FILE *outfp;
char buff[80];
if (argc != 3){
printf("Usage: %s filename mode\n"... |
C | //
// main.c
// Proj1
//
// Created by Tony on 6/28/16.
// Copyright © 2016 Anthony Cavallo. All rights reserved.
// This program uses the Blowfish encryption algorithm to encrypt a message from stdin with a key as one of the command-line inputs.
#include "blow.h"
//This comment is added solely to test if GitHub... |
C | /*
** EPITECH PROJECT, 2020
** NWP_myteams_2019
** File description:
** load_message
*/
#include <stdlib.h>
#include "my_message.h"
#include "definitions.h"
int load_message(server_t *server, char **words)
{
uuid_t sender_uuid;
uuid_t receiver_uuid;
message_t *message;
uuid_parse(words[1], sender_uui... |
C | #include "main.h"
/**
* *_memcpy - The _memcpy() function copies n bytes
* * from memory area src to memory area dest
* *@dest:area where bytes are copied to
* *@src:area where bytes are copied from
* *@n:number of bytes to copy
* *Return: returns a pointer to n
* */
char *_memcpy(char *dest, char *src, unsigned... |
C | /******************************************************************************
* FILE : domain.c
* AUTHOR : Joshua Miller
* DESCRIPTION : Structures and functions for the domain
******************************************************************************/
#include <stdlib.h>
#include <stdio.h>
#inc... |
C |
#include "be_mem.h"
#include "berry.h"
#include <stdlib.h>
#define os_malloc( size ) malloc( size )
#define os_free( ptr ) free( ptr )
#define os_realloc( ptr, size ) realloc( ptr, size )
#define addr_pos( a, p, o ) ( (void *) ( (size_t) (a) o( p ) ) )
#define addr_region( a, s ) ... |
C | /*
24. int eval(char *s);
A simple stack-based expression evaluator. The input string contains expression in Reverse Polish
Notation with four possible arithmetic operators (+, -, *, /) and integer decimal numbers. The routine
should return integer result of expression. Assume that all input numbers fit in ... |
C | #ifdef RaspberryPi
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <stdint.h> //uint8_t definitions
#include <errno.h> //error output
#include <stdlib.h> //for exit(int);
#include <wiringPi.h>
#include <wiringSerial.h>
void loop(void);
void setup(v... |
C | #include <stdio.h>
int main()
{
int c;
int space_num, table_num, return_num;
space_num = table_num = return_num = 0;
printf("the value of EOF is %d\n", EOF);
while ((c = getchar()) != EOF) {
putchar(c);
if (c == ' ')
space_num ++;
else if (c == '\t')
... |
C | #include "http_accept.h"
#include <pthread.h>
void *wait_task(void *arg)
{
int epfd = *(int *)arg;
struct epoll_event *job = NULL;
job = (struct epoll_event *)malloc(sizeof(struct epoll_event) * 1024);
if(job == NULL)
{
perror("malloc job list fail!\n");
pthread_exit(NULL);
}
while(1)
{
int n;
if((n = e... |
C | /*
** my_file_tomatrix.c for wireframe in /home/antonin.rapini/ModulesTek1/GraphicalProgramming/wireframe/utils
**
** Made by Antonin Rapini
** Login <antonin.rapini@epitech.net>
**
** Started on Sat Dec 3 20:14:52 2016 Antonin Rapini
** Last update Tue Jan 3 18:44:15 2017 Antonin Rapini
*/
#include <stdlib.h>
... |
C | /*
DTMF decoder.
see also connect.txt
Just show the detected DTMF signal in a 16x2 lcd.
set timebase=10us or 50us of oszifox (test the GS port of LC7385) will show the wave clearly.
*/
#include <inttypes.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include "lcd.h"
volatile uint8_t q... |
C | #include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
int main()
{
int ret,p[2];
char rfd[4],wfd[4];
char msg[50] = {"HELLO THIS IS DISCRIPTOR PIPE EXAMPLE\n"};
if(pipe(p) == -1)
{
perror("pipe creation fails\n");
exit(EXIT_FAILURE);
}
ret = fork();
switch(ret){
case -1:
printf("%s: ERROR: fork failure\n"__FILE_... |
C | //P6136 5.5s
#include <stdio.h>
#include <stdlib.h>
#define INF 2147483647
struct tree
{
struct tree* ls;
struct tree* rs;
int siz,con,data,height;
};
typedef struct tree stu;
typedef struct tree* ptr;
int tot;
stu pol[1600000];
int read()
{
int q=0,w=1;
char c=getchar();
while (c>'9' ||... |
C | #include <time.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
/**
* Problem 16 from Project Euler
*
* 2?15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
* What is the sum of the digits of the number 2^1000?
*
* PLEASE NOTE
* In order to compile you must have gcc, or similar, installed... |
C | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
static const char grepInstruction[] = " | grep -a ERROR | grep -Eao \"https?://\\S+?\\/|http?://\\S+?\\/\" > ";
static const char getInstruction[] = " && wget -i ";
static const char catInstruction[] = "cat ";
static co... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#define TAM 10
struct cadJogos {
int id;
char nome[50];
char cat[20];
float tamanho;
int ano;
};
int main(int argc, char const *argv[]) {
// ponteiros para arquivos
FILE *arq1;
FILE *arq2;
FILE *ind;
// matriz ... |
C | // scanf1.c
#include<stdio.h>
int main(int argc,char**argv)
{
int a;
printf("数を入れてください:");
scanf("%d",&a);
printf("入力された数は %d です。\n",a);
return 0;
}
|
C | // commit: 7e6be42a77989c01155bdc7333ea58206e1563d4 2011-03-08
// pthread_once should not deadlock
#include <pthread.h>
#include <semaphore.h>
#include <errno.h>
#include <string.h>
#include "test.h"
#define T(f) if ((r=(f))) t_error(#f " failed: %s\n", strerror(r))
#define E(f) if (f) t_error(#f " failed: %s\n", stre... |
C | #include "my_tar.h"
#include <sys/wait.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <time.h>
#include <pwd.h>
#include <grp.h>
#include <errno.h>
#include <dirent.h>
#include <utime.h>
int tar(char** av, int fFlag, char* tarName,... |
C | #include "main.h"
#include <stdio.h>
/**
* reset_to_98 - change pointer's value
* @n: takes pointer of typer int
*/
void reset_to_98(int *n)
{
*n = 98;
}
|
C | #include "holberton.h"
#include <stdio.h>
#include <stdlib.h>
/**
* str_concat - function that concatenates two strings
* @s1: String #1.
* @s2: String #2.
* Return: Pointer to the new concatenated string.
*/
char *str_concat(char *s1, char *s2)
{
int iter1, iter2;
char *concat;
if (s1 == NULL)
s1 = "";
i... |
C | #include <stdio.h>
#include "funcs.h"
#include <math.h>
int main(void)
{
system("chcp 1251");
int i = 0, d;
while (i != -1)
{
system("cls");
printf("1\n");
printf("2\n");
printf("3\n");
printf("4\n");
printf("5\n");
printf("6()\n\n");
int n = 0, k = 0;
float e = 0.0;
printf(" : ");
scanf_s... |
C | #ifndef list_type
#define list_type
#include <stdbool.h>
typedef struct lelement LElement;
typedef struct llist LList;
//Generic list Element
struct lelement {
LElement *next;
LElement *prev;
void *data;
};
//Generic List Structure
struct llist {
int NumEl; //Number of elements in list
LElemen... |
C | /*
* SPI_Second_Driver.c
*
* Created: 10/7/2020 7:52:27 PM
* Author : Ahmed Atef
*/
#include "SPI.h"
#include "LED.h"
#define F_CPU 4000000
#include <util/delay.h>
int main(void)
{
uint8 Recivie_data = 0 ; // variable to recive data
uint8 Transfer_data = 0 ; // send a dummy byte to Master from slave
L... |
C | int is_symbol(char p) {
switch (p) {
case '+': case '-':
case '*': case '/':
case '%': case '=':
case ';': case ':':
case '(': case ')':
case '{': case '}':
case '[': case ']':
case '<': case '>':
case '!': case '?':
case '&': case '^':
case '|': case '#':
case '... |
C |
/* McDowell (2013), Crack the Coding Interview, 5e
* Question #1.1 (pp. 73)
* Implement a function void reverse(char *str) in C or C++ which rever-
* ses a null-terminated string. */
#include <stdio.h>
#include <string.h>
void reverse(char *);
void reverse(char *s) {
int i = 0, j = strlen(s) - 1;
while(i < j) ... |
C | // Server side C/C++ program to demonstrate Socket programming
#include <unistd.h>
#include <stdio.h>
#include <sys/socket.h>
#include<sys/wait.h>
#include <stdlib.h>
#include <netinet/in.h>
#include<pwd.h>
#include <string.h>
#include<assert.h>
#define PORT 8080
int main(int argc, char const *argv[])
{
int server... |
C | #ifndef _SCHEDULER_H
#define _SCHEDULER_H
#include "stm32f10x.h"
#define SCH_MAX_TASKS 30
#define SCHEDULERPERIOD 1000
extern void Scheduler_Dispatch_Tasks(void);
extern void Scheduler_Dispatch_Task_with_index(uint8_t index);
extern unsigned char Scheduler_Add_Task(void (*pFunction)(void), const unsigned... |
C | #include <jayc/jlog_stdio.h>
#include <jayc/jproc.h>
#include <jayc/jutil_time.h>
#include <jayc/jcon_client_tcp.h>
#include <jayc/jcon_thread.h>
#include <string.h>
#define EXITVALUE_SUCCESS 0
#define EXITVALUE_FAILURE 1
static jcon_client_t *g_client = NULL;
static jcon_thread_t *g_thread = NULL;
static void exit_... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_fillelem.c :+: :+: :+: ... |
C | /**
* @file ADC.h
*
* @brief The header file and function prototypes for the ADC.
* @details For single ended conversion, the ADC value an be found from the voltage using:
* @f[ \frac {V_{in} * 1024}{V_{ref}} @f]
* @author Kevin Harrington
* @date February 11, 2010
*
* @author Justin Barrett
* @date August 23... |
C | #include <stdio.h>
int main(void)
{
const int a = 90;
*(int *)&a = 999;
printf("a = %d\n", a);
int *p = (int *)&a;
*p = 1000;
printf("a = %d\n", a);
printf("*p = %d\n", *p);
return 0;
}
|
C | //Julio Villazón | A01370190 -> Trabajo hecho con Jesus Gonzalez
#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include <errno.h>
#include <string.h>
#include <sys/stat.h>
#include <math.h>
typedef struct
{
int min;
int max;
int count;
char * hist;
} Urn;
int traverseDirectoryTree(char ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define RANGE 256
void counting_sort(char arr[]) {
int n = strlen(arr);
int i = 0;
char output[n];
int count[RANGE];
memset(count, 0, sizeof(count));
for (i = 0; i < n; i++) {
count[arr[i]]++;
}
for (i = 1; i < RANGE; i++) {
c... |
C | #include<stdio.h>
int main()
{
int m,k;
printf("");
scanf("%d",&k);
if(k==1)
goto remove;
for(m=2;m<k;m++)
{
if(k%m==0)//km
{
remove:
printf("Ϊ\n");
goto to;
}
}
printf("Ϊ\n");
to:
system("pause");
return 0;
}
/*#include<stdi... |
C | //undefined behavior number 9 - similar to number 8
#include <stdio.h>
#include <stdlib.h>
int *gl_ptr;
void func2(){
int a = 23;
gl_ptr = &a;
}
void func1(){
func2();
}
int main(){
func1();
printf("gl_ptr = %d\n", *gl_ptr); //will be removed
return 0;
}
|
C | #include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <time.h>
int* initTab(int* tab, int size){
int i=0;
tab=(int*)malloc((sizeof(int))*size);
for(i=0; i<size; i++){
tab[i] = 3;
}
return tab;
}
int main(){
int* tabNum;
int i=0;
int size = 100;
tabNum = in... |
C | #ifndef __GX_LIBINI_H__
#define __GX_LIBINI_H__
#include "gxtype.h"
#include "gxcore.h"
__BEGIN_DECLS
#define EINVALID_HANDLE (0)
/*********************************************************
* @brief ڴУһINIļʽINI
* @param [in] memory ָһ洢INIļʽڴ
* @param [in] size memoryڴС
* @return h... |
C | //Write an OpenMP parallel program for Points Classification. Prove the correctness of sequential program with that of parallel.
//Clustering
#include<stdio.h>
#include<omp.h>
#include<math.h>
#include<time.h>
#include<stdlib.h>
#define no_of_clusters 4
int cluster_centers[no_of_clusters][2] = {{20, 20},{60,... |
C | #include "game.h"
void init_game(uint8_t* rom) {
// ROM Validation:
if( rom[0] != 'N' && rom[1] != 'E' && rom[2] != 'S' && rom[3] != '\32') {
debug_print("%s","Invalid ROM file, header does not match");
free(rom);
exit(0);
}
// Get header file information: https://wiki.nesdev.co... |
C | // Broker peering simulation (part 3)
// Prototypes the full flow of status and tasks
#include "czmq.h"
#define NBR_CLIENTS 10
#define NBR_WORKERS 5
#define WORKER_READY "\001" // Signals worker is ready
// Our own name; in practice, this would be configured per node
static char *self;
// This is the cli... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_otool.c :+: :+: :+: ... |
C | #define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <errno.h>
#include "lexer.h"
#include "ast.h"
#include "parser.h"
#include "symbol.h"
#include "compile.h"
#include "vm.h"
#include "alvc.h"
#define arg(s) (!strcmp(s, argv[i]))
extern char* yyfile;
extern FIL... |
C | // Absolude Beginner's Guide to C, 3rd Edition Kindle
// sample code of Chapter5
// File chapter5_1.c
// This is a sample program that lists three kids and their school supply needs, as well as cost to buy the supplies
#include <stdio.h>
int main(void)
{
// Set up the variables, as well as define a few
char firs... |
C | #include <stdio.h>
#include <winsock2.h>
#include <process.h>
#include <windows.h>
extern int initWSADATA();
extern SOCKET initSocket();
struct arglist {
char *message;
} args;
unsigned int __stdcall getServMsg(void *args) {
struct arglist *als = (struct arglist *)args;
char *message;
while(1) {
... |
C | #include <limits.h>
#include <stdlib.h>
#include <stdio.h>
#include "c_avltree.h"
char clearBuffer()
{
char c;
char wereChars=0;
while((c=getchar())!='\n' && c!=EOF) //let's clear a buffer!
wereChars=1;
return !wereChars; //let's return if there were unised chars in a buffer
}
int cgetValidat... |
C | /*
* Fails when adding double + integer.
*/
/*
* test13 - check to see if op2 works
*/
main()
{
int i, j, k;
double a, b, c;
j = 25;
k = 5;
i = j + k; /* integer arithmetic */
printf("i is %d\n", i);
i = j * k; /* integer arithmetic */
printf("i is %d\n", i);
i = j / k; ... |
C | #pragma systemFile
#if !defined(TRAPEZOIDALPROFILE_C_)
#define TRAPEZOIDALPROFILE_C_
typedef struct {
float maxVel;
float maxAcc;
float v0;
float v1;
} TrapezoidalProfile;
TrapezoidalProfile *newTrapezoidalProfile(TrapezoidalProfile *this, float maxVel,
float maxAcc, float v0, float v1) {
if (... |
C | #include<stdio.h>
#pragma warning(disable:4996)
int main() {
char code[16];
int time = 0;
scanf("%s", code);
for (int i = 0; i < 16; i++) {
if (code[i] == '\0')
break;
int k = code[i]-'A';
switch (k)
{
case 0: case 1: case 2:
time = time + 3;
break;
case 3: case 4: case 5:
time = time +... |
C | #include<stdio.h>
int main ( int argc, char * argv[] ) {
int i;
puts ( "This function, reads three words arguments(strings) and then it prints it back..." );
if ( argc != 4 )
puts ( "You need to type something like:'./function_param string1 string2 string3 ' this will run the command line tool..." );
els... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include "tf_qf.h"
typedef struct {
uint8_t *data;
uint32_t len;
} inputs_t;
int main(void){
unlink("/tmp/test.qf");
int i;
uint32_t cnt, dlen;
inputs_t inputs[4];
uint8_t msg1[512];
uint16_t msg1sz = 512;
for( i=0; i<msg1... |
C | #include <stdlib.h>
#include <math.h>
int calcDamage(int srcLevel, int srcAttack, int movePower, int trgDefense, int stab, float typeMod){
float final;
int randnum = rand() % 38 + 217;
int a = ((2*srcLevel)/5+2);
final = (((((a*srcAttack*movePower)/trgDefense)+2)*stab)*typeMod)/255;
return floor(final);
... |
C | /*Erik Grunnr
25/09/2017
Labs 2 */
#include <stdio.h>
int main ()
{
float radius,pi,area;
radius = 4.8;
pi = 3.14;
area = pi*radius*radius;
printf("area of the circle is %f", area);
getchar();
return 0;
}
|
C | /**
* @file ready_queue.h
* @author Ahmed Ashraf, Mohamed Hassanin
* @brief A mocking of the ready queue which contains the porcess that have already arrived to the scheduler
* @version 0.1
* @date 2020-12-30
*/
#ifndef _READY_QUEUE_H
#define _READY_QUEUE_H
#include "pcb.h"
struct Queue {
int front, ... |
C | #include <stdio.h>
#include <stdlib.h>
int main(int argc, char ** argv)
{
int a,b,c,vcm;
printf("Entre com a pontuacao dos concorrentes:");
scanf(" %d %d %d", &a, &b, &c);
vcm = 0;
if(a>b && a<c || a<b && a>c)
{
vcm = a;
}else if(b>a && b<c || b<a && b>c)
{
... |
C | /*
* optimize nullifying loops
* such as '[-]' into a single
* cell-zeroing instruction: *
*/
#include <stddef.h>
#include <stdlib.h>
#include "instructions.h"
#include "options.h"
#include "opt-nloops.h"
#include "status.h"
void
optimize_nloops(struct Options *opts, struct Instruction *head)
{
usize i = 0;
if... |
C | /*Both of these files are filled with unoptimized code. I ran out of time, and had to stick with my brute force code. Sorry for the delay it will cause.*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <time.h>
//initialize definition for rooms
struct room ... |
C | #include "twi_utils.h"
/*
* read bytes from chip register
*/
int8_t wire_read_reg_bytes(uint8_t addr, uint8_t reg, uint8_t length, uint8_t *data)
{
wire_begin_transmission(addr);
wire_write_byte(reg);
wire_end_transmission();
wire_request_from(addr, length, 1);
for (uint8_t i = 0; i < length; i... |
C | #include <stdio.h>
#include <math.h>
float x;
float a;
float d;
int areaofCircle(float r)
{
a = M_PI*r*r;
printf("the area of the circle with radius %f is %f\n", r, a);
return 0;
}
int main()
{
for (d = 3.5; d <= 12.5; d++)
{
x = areaofCircle(d);
}
return 0;
}
|
C | #ifndef __ERROR_H
#define __ERROR_H
#include <stdlib.h>
/*
* Error codes
*/
typedef enum status status_t;
typedef enum ogg_status ogg_status_t;
/* Codes liés au flux Vorbis */
enum status {
VBS_EOS = 1,
VBS_SUCCESS = 0,
VBS_OUTOFMEMORY = -127,
VBS_BADSTREAM = -128,
VBS_EOP ... |
C | #include <stdio.h>
int main()
{
int x=5;
printf("%d\n",x);
printf("%d\n",&x);
printf("%d\n",*&x);
return 0;
} |
C | #include <stdio.h>
#include <stdbool.h>
#include "collatz.h"
#include "dbg.h"
// Program written by kaelen carling and maxwell weiss
bool collatz_upload(int array[])
{
FILE* collatz_file;
int number, collatz;
// open file
collatz_file = fopen(COLLATZ_FILE, "r");
probe(collatz_file, "Opening fil... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
// ʣһڴռ
// ൱ƺţڴ൱ڷ
int a;
int* p;
// ֱӸֵ
a = 10;
printf("a = %d\n", a);
// Ӹֵ
printf("&a = %d\n", &a);
p = &a;
printf(" p = %d\n", p);
*p = 11;
printf("a = %d, *p = %d\n", a, *p);
printf("\n");
return 0;
} |
C | /**
*
* 给你一个整数 n,请你帮忙计算并返回该整数「各位数字之积」与「各位数字之和」的差。
示例 1:
输入:n = 234
输出:15
解释:
各位数之积 = 2 * 3 * 4 = 24
各位数之和 = 2 + 3 + 4 = 9
结果 = 24 - 9 = 15
示例 2:
输入:n = 4421
输出:21
解释:
各位数之积 = 4 * 4 * 2 * 1 = 32
各位数之和 = 4 + 4 + 2 + 1 = 11
结果 = 32 - 11 = 21
提示:
1 <= n <= 10^5
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/probl... |
C | #include <stdio.h>
#include <stdlib.h>
float tinhtong(int n){
if (n==1)
return 1;
return sqrt(n+tinhtong(n-1));
}
int main()
{
int n;
printf("nhap n:");
scanf("%d",&n);
printf("tong la :%f",tinhtong(n));
return 0;
}
|
C | #include "bankingClient.h"
#include <regex.h>
/**************************************************************
* Banking Client
*
* main:
* make connection to server
* spawn user_input_runner and server_response threads
*
* user_input_runner:
* read input from stdin
* validate input
* send message t... |
C | #include <stdio.h>
int main(int argc, char *argv[]) {
int i = 1;
int j = 2;
int *p = &i;
printf("i / j / p / *p = %2d / %2d / %p / %2d\n", i, j, p, *p);
*p = -1;
printf("i / j / p / *p = %2d / %2d / %p / %2d\n", i, j, p, *p);
p = &j;
printf("i / j / p / *p = %2d / %2d / %p / %2d\n", i, j, p, *p);
... |
C | #include <vector>
#include <algorithm>
#include <future>
#include <iostream>
#include <numeric>
using namespace std;
template <typename RDIter, typename T>
T parallel_sum(RDIter beg, RDIter end){
auto diff = end-beg;
if(diff < 100){
return accumulate(beg, end, T());
}
auto mid = beg + diff/2;
future<T> s... |
C | #include <stdio.h>
#include <stdio_ext.h>
#include <stdlib.h>
#include <string.h>
#include "utn.h"
#include "Cachorros.h"
static int isValidId(int *id);
static int isValidIdString(char *id);
static int isValidNombre(char *nombre);
static int isValidDias(int *dias);
static int isValidDiasString(char *dias);
static int... |
C | #include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(int argc, char *argv[])
{
char line[1024];
if (argc == 1 || strcmp(argv[1], "-p") == 0) {
while (gets(line))
puts(line);
}
else if (strcmp(argv[1], "-u") == 0) {
while (gets(line)) {
for (int i = 0... |
C | /*
* ======== UART_Task.c ========
* Author: Michael Kramer / Matthias Wenzl
*/
#include <stdbool.h>
#include <stdint.h>
#include <inc/hw_memmap.h>
/* XDCtools Header files */
#include <xdc/std.h>
#include <xdc/cfg/global.h>
#include <xdc/runtime/System.h>
#include <xdc/runtime/Error.h>
#include <xdc/runtime/Memo... |
C | #include <stdio.h>
void alter(int *, int *);
int main(void)
{
int a = 14, b = 129;
printf("Ordinary a = %d, b = %d.\n", a, b);
alter(&a, &b);
printf("Now a = %d and b = %d.\n", a, b);
return 0;
}
void alter(int * x, int * y)
{
int one, two;
one = *x + *y;
two = *x - *y;
*x = one;
... |
C | #include<stdio.h>
/*
文字列に特定文字が含まれているかどうか調べる
(添え字を返却)
*/
int str_ch(const char *s, int ch){
int index = 0;
while(*s){
if(*s++ == ch)
return index;
index++;
}
return -1;
}
int main(void){
char string[256];
char ch[10];
int index;
scanf("%s",string... |
C |
#include<stdio.h>
#include<stdlib.h>
int i;//ȫֱʼĬֵΪ0
int main()
{
i--;//iֵΪ-1;
if (i > sizeof(i))
//sizeof()---͵ĴСֵĬϴ.
//õunsigned int,ͣʱintunsigned int бȽϼ
//intתintתΪunsigned int
//1000000000000000000000000000001
//1111111111111111111111111111110
//1111111111111111111111111111111
//תΪͣ
//111111111111111... |
C | /*===============================================================
* Copyright (C) 2019 All rights reserved.
*
* 文件名称:const.c
* 创 建 者:pengtangtang
* 创建日期:2019年10月28日
* 描 述:
*
* 更新日志:
*
================================================================*/
#include <stdio.h>
#include <string.h>
#include <st... |
C | #include "philosophers.h"
void ft_philosophers_one(t_data *philo, int i)
{
int status;
int thread_num_array[philo->number_of_philosophers];
int block_at_start[philo->number_of_philosophers];
pthread_t pthread[philo->number_of_philosophers];
t_time prev_eat[philo->number_of_philosophers];
i = 0;
ft_start... |
C | # include <stdio.h>
# include <stdlib.h>
# include "6.h"
int main(void) {
Lista *l;
int qtde;
int i;
float peso,mala_p,max_permitido,somaT;
printf("Quantos itens deseja colocar?\n");
scanf("%d",&qtde);
printf("Informe o peso da mala:\n");
scanf("%f",&mala_p);
printf("Informe o maxim... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* valid.c :+: :+: :+: ... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#define MAX_QUEUE 100 // Max amount of requests that can be pending for the listen call
#define BUF_SIZE 1024
int main(int argc, char **argv) {... |
C | /*Brandon Snow hw05 .c file*/
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "stack.h"
/*
typedef double stackElementT;
struct stackCDT {
stackElementT *elements;
int count;
int size;
};*/
static stackADT stack;
void Displaystack();
c... |
C | /*Used with main.c,profile.c in profile graph
Finds freq helices in 1000 structs; finds their LCA
Creates Hasse diagram with these vertices
*/
#include "hashtbl.h"
#include "summaryGraph.h"
#include "profile.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "memoryDFS... |
C | #include <stdlib.h>
#include <stdio.h>
#include "tokens.h"
#include "../utils/utils.h"
Token* new_token(int* value, int col, int line)
{
Token* output = (Token*) malloc(sizeof(Token));
output->value = value;
output->line_index = line;
output->col_index = col;
output->tokenstream = NULL; // Set by tokenizer
retu... |
C | /**
* File: memory_manager.h
* ---------------
* Defines the interface for the memory manager module.
*
* This module handles memory operations.
*/
#ifndef memory_manager_h
#define memory_manager_h
//Language Libraries
#include <stdio.h>
//Data Structures Libraries
#include "../../datastructures/singly_linked_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.