language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include<stdio.h>
#include<time.h>
#define SIZE 50000
void main()
{
int a[SIZE],pos,i,j,n,temp;
double total;
clock_t start,end;
printf("Enter n :\n");
scanf("%d",&n);
//printf("Enter elements :\n");
for(i=0;i<n;i++)
a[i]=rand();
//scanf("%d",&a[i]);
start=clock();
for(i=0;i<n;i++)
{
pos=i;
for(j=i+1;... |
C | /*
Header file for regular expression compiler
Copyright (C) 2016 Kyle Gagner
All Rights Reserved
*/
#include "unicode.h"
#ifndef REGEX_H
#define REGEX_H
typedef struct
{
UNICODE_Char *expression;
unsigned long accepts;
} REGEX_Expression;
typedef struct
{
REGEX_Expression *expressions;
unsigned long expressio... |
C | /*28. Hacerelprogramaantelapreguntadeseacontinuarslonospermitaintroducircomorespuesta'S'o'N'*/
#include <stdio.h>
int main(){
char r='S';
while(r=='S'){
printf("desea seguir S/N \n");
fflush(stdin);
scanf("%c",&r);
while(r !='S' && r =='N');{
printf("error ingrese S/N \n");
}
}
system("pa... |
C | // This code is created by Ahmed A. Eltahan
/*
----------------------------- Program Description -----------------------------------------
This code motivates the importance of using functions, here a function for pringtin the hashtags and stars will ease the code readability and make it concise.
This is the desir... |
C | #include "menu_principal.h"
#include <stdio.h>
#include "utilidad.h"
#include "estructura.h"
#include "entrada&salida.h"
#include "partida.h"
/** \brief Funcion de inicio de programa
*
* \return No devuelve nada
*
*/
void entrar() {
int d;
printf("\tBienvenido a ESINAIT \n 1.Entrar en el sistema\n 0.Sal... |
C | #include <stdio.h>
int main(void){
int start, end, sum=0;
int idxTable[46];
int n=0;
for(int i=0;i<46;i++){
n+=i;
idxTable[i] = n;
}
scanf("%d %d",&start,&end);
start--;
end--;
for(int i=start;i<=end;i++){
for(int j=0;j<46;j++){
if(idxTable[j] <= i && i < idxTable[j+1]){
sum += (j+1);
break;
... |
C | #include <stdio.h>
unsigned long f(unsigned long N);
int main()
{
unsigned long N,sum=0;
scanf("%lu",&N);
for(unsigned long i=1;i<=N;i++)
{
sum=sum+f(i);
}
printf("%lu\n",sum);
return 0;
}
unsigned long f(unsigned long N)
{
while(N%2==0)
{
N=N/2;
}
return N;
}
|
C | /* Write a program which accept one number and position from user and on that bit. Return modified number.
Input : 10 3
Output : 14
*/
#include<stdio.h>
int OnBit(int iNo,int iPos)
{
int iMask=0X00000001;
int iResult=0;
if(iNo<0)
{
iNo=-iNo;
}
if((iPos<0)||(iPos>32))
{
r... |
C | /*
* Copyright(C) 2014 Pedro H. Penna <pedrohenriquepenna@gmail.com>
*
* friendly-numbers.c - Friendly numbers kernel.
*/
#include "../libs/global.h"
#include <omp.h>
#include <stdlib.h>
#include "../libs/util.h"
#include "fn.h"
__global__ sumdiv ( int n, int sum ){
int index = threadIdx.x + BlockIdx.x * Block... |
C | /*
* This program adds a vector binary file that first lists the number of
* elements in the vector followed by the values
* Parallel implemntation using MPI
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
#include <mpi.h>
#include "MyMPI.h"
void floyd (int ***... |
C | /**
* \file print_comparisons.c
*
* \brief Compares and formats messages describing each FFT result
* \details See README
*
* \copyright Copyright (c) 2018, DornerWorks, Ltd.
* \license See LICENSE for full licensing and copying information
*/
/****************************************************************... |
C | #include <stdio.h>
int main()
{
typedef struct{
int hh;
int mm;
int ss;
}Jam;
Jam J;
const int penambah=1;
int tampung;
scanf("%d %d %d", &J.hh, &J.mm, &J.ss);
J.ss+=penambah;
if(J.ss>=60)
{
J.mm=J.mm+(J.ss/60);
J.ss=J.ss%60;
if(J.mm>=60)
{
J.hh=J.hh+(J.mm/60);
J.mm=J.mm%60;
if(J.hh>2... |
C | /*****************************************************
* structures.c *
* *
* Structures file. *
* Implement functions to manage list and *
* print elements of structures. ... |
C |
#include <stdio.h>
int main()
{
int a,b;
printf("\n enter the value of a");
printf("\n enter the value of b");
scanf("%d %d",&a,&b);
for(i=a,i<=b,i++)
{
if(i%2==1)
{
printf("odd");
}
else
{
printf("even");
}
}
}
|
C | /*
* queue.c
*
* Created on: 2011-4-29
* Author: root
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include "queue.h"
static void _lock(QUEUE* _queue)
{
pthread_mutex_lock(&_queue->lock);
}
static void _unlock(QUEUE* _queue)
{
pthread_mutex_un... |
C | #include <stdio.h>
int main() {
long a, b, i;
scanf("%d%d", &a, &b);
i = a % 2 == 0 ? a + 1 : a;
do {
printf("%d\n", i);
i += 2;
} while (i <= b);
return 0;
} |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct book
{
int number_of_book;
char name_of_book[20];
int sale_of_book;
char state_of_book[10];
};
struct students
{
int number_of_student;
char name_of_student[20];
int number_of_book_who_take;
char state... |
C | #include <stdio.h>
/*int main()
{
int num;
scanf("%d",&num);
int col = ((num+num)-1);
int midValue = col/2;
int arr[col][col];
int arrFinal[col][col];
for(int i=0; i<num; i++)
{
for(int j=0; j<col; j++)
{
if(j>=i) {
//printf("%d",num-i);
... |
C | #define _GNU_SOURCE
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/errno.h>
#include <sys/syscall.h>
#include <faup/datadir.h>
#include <faup/modules.h>
int shell_modules_list_cb(faup_modules_t *modules, char *modules_dir, char *module, void *user_data, int count)
{
p... |
C | /*
** EPITECH PROJECT, 2020
** server
** File description:
** get_or_error2.c
*/
#include <stdlib.h>
#include <stringext.h>
#include "channel/channel_util.h"
#include "get_or_error.h"
#include "server/server_util.h"
#include "team/team_util.h"
#include "user/user_util.h"
#include "util/string.h"
team_t *get_or_error... |
C | #include "fonts.h"
/* the font, where each code line is a character from 0-F */
const byte chipbox_font[CHIPBOX_FONT_TOTAL_BYTES] = {
0xF0, 0x90, 0x90, 0x90, 0xF0,
0x20, 0x60, 0x20, 0x20, 0x70,
0xF0, 0x10, 0xF0, 0x80, 0xF0,
0xF0, 0x10, 0xF0, 0x10, 0xF0,
0x90, 0x90, 0xF0, 0x10, 0x10,
0xF0, 0x80,... |
C | #include <stdio.h>
#include <unistd.h>
int main(){
int fd[2];
int pid;
pipe(fd);
pid = fork();
if (pid == 0){
//cerrar entrada de estandar
close (0);
//cerrar entrada del pipe
dup(fd[0]);
//cerrar salida del pipe
close(fd[1]);
// conectar entr... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define swap(a, b) {int tmp = a; a = b; b = tmp;}
int partition(int *arr, int left, int right) {
int pivot = arr[right];
int p_idx = left;
for (int i = left; i < right; i++) {
if (arr[i] <= pivot) {
swap(arr[i], arr[p_idx]);
... |
C | #ifndef _IMAGE_H_
#define _IMAGE_H_
//Bibliotecas padrão
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//Bilbioteca para usar leitor de impressões digitais
#include <libfprint/fprint.h>
//Estrutura das imagens usadas
typedef struct image{
int height; //Altura
int width; //Largura
unsigned char *data; ... |
C | /* vim: set noet nosta sw=4 ts=4 ft=c : */
/*
Copyright (c) 2011-2015, Mahlon E. Smith <mahlon@martini.nu>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain... |
C | #include<stdio.h>
int main()
{
int t, n,i,h,k=2;
scanf("%d",&t);
for(i=0;i<t;i++)
{
scanf("%d",&n);
h=1;
while(k!=(n+2))
{
if(k%2==0)
h*=2;
else
h+=1;
k++;
}
printf("%d",h);
}
return 0;
}
|
C | #include "contour.h"
Contour* create_contour(void *c_contour){
if(c_contour == NULL){
print_msg(ERR_OBJ_NULL_LIST,"contour.c/create_contour");
return NULL;
}
Contour *contour = (Contour*) malloc(sizeof(Contour));
int err = INF_NOT_ERR;
contour->cv_contour = c_contour;
err = calc_a... |
C | #include <stdio.h>
#include <time.h>
#define DEBUG 1
inline unsigned long tsc(void)
{
register unsigned int lo, hi;
asm volatile ("rdtsc" : "=a" (lo), "=d" (hi));
return ((unsigned long)hi << 32UL) | (unsigned long)lo;
}
#ifdef DEBUG
int main()
{
unsigned long t1, t2;
//sleep (1);
t1 = tsc();
... |
C | #include<stdio.h>
int main()
{
unsigned int num,num_temp,i;
unsigned int temp;
while(1)
{
printf("Enter the Hexadecimal number: ");
scanf("%x",&num);
num_temp=num;
//Clea the buffer
while(getchar() != '\n');
printf("\n");
printf("Number is %x\n",num);
//Extract each bit and display it
for(i=... |
C | #include<stdio.h>
int main()
{
int n[10],i,Sum=0;
for(i=0;i<10;i++)
{
printf("Enter the numbers \n");
scanf("%d",&n[i]);
}
for(i=0;i<10;i++)
{
Sum=Sum+n[i];
}
printf("The sum of numbers in array is:%d \n",Sum);
return 0;
}
|
C | #include "stdio.h"
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
#include "arpa/inet.h"
int main(int argc,char **argv)
{
char ch ='A';
int client,return_val,client_len;
struct sockaddr_in address;
client = socket(AF_INET,SOCK_STREAM,0);
add... |
C | #include <stdlib.h>
#include <utils/heap.h>
/**
* @file heap.c
*/
/**
* Description d'un tas.
*/
struct heap {
int (*compar)(void*, void*);
int (*id)(void*);
size_t heap_size;
void **buf;
int *position;
int free_buf;
};
/**
* Créer un tas.
* @param buffer_size - Taille du tas.
* @param... |
C | #include <stdio.h>
#include <stdlib.h>
#include "uncmnt.h"
void main(int argc,char **argv)
{
FILE *fptr;
int line_no;
int line_len;
int comment_start;
int comment_stop;
bool bInComment;
bool bInDoubleQuote;
int curly_brace_depth;
int debug_line_no;
if (argc != 2) {
printf("usage: uncmnt filena... |
C | #include "scheduler.h"
int main(int argc, char *argv[]){
if (argc!=5){
printf("must enter 4 command line inputs\n");
exit(1);
}
FILE* input_file = fopen(argv[3], "r");
if (input_file==NULL){
printf("file %s does not exist\n", argv[3]);
exit(1);
}
FIL... |
C | /////////////////////////////////////////////////////////////////
//
// CCISEL
// 2007-2011
//
// UThread library:
// User threads supporting cooperative multithreading.
//
// Authors:
// Carlos Martins, Joo Trindade, Duarte Nunes, Jorge Martins
//
#include <crtdbg.h>
#include "UThreadInternal.h"
#include <stdio... |
C | /*
* Data Structure - Stack(array)
*
* Author : ChangWook Kim
* Modified : Sep. 29. 2017
*
*/
#include <stdio.h>
#include <stdlib.h>
#include "arrayStack.h"
void stackInit(Stack *pStack){
pStack->top = -1;
}
int sIsEmpty(Stack *pStack){
if(pStack->top < 0) return TRUE;
else return FALSE;
}
void sPush(St... |
C | /**
* @file decagon.c
* @brief Implements functions for Decagon GS3 soil moisture sensor
* @author Brandon Wong, Matt Bartos, Ivan Mondragon
* @version TODO
* @date 2017-06-19
*/
#include "decagon.h"
uint8_t Decagon_Take_Reading(DecagonGS3* decagon_reading) {
char *dielectric, *temp, *conductivity;
uint... |
C | /*-------------------------------------------------------
List Mode Format
-- correctUnknownField.c --
Magalie.Krieguer@iphe.unil.ch
Crystal Clear Collaboration
Copyright (C) 2003 IPHE/UNIL, CH-1015 Lausanne
This software is distr... |
C | #include "bmp.h"
#include <stdio.h>
#include <string.h>
bmp_t* bmp_init(char *image){
int fd,
success,
mask = 0b1101;
bmp_t *bmp = malloc(sizeof(bmp_t));
if( (fd = open(image, O_RDONLY)) == -1 ){ return NULL; }
if( (success = pread(fd, bmp, BMP_HEADER_SIZE, 0)) <= 0 ){ return NULL; }
... |
C | /*
* mash_profile.c
*
* Created on: 19 nov 2015
* Author: rmcar
*/
#define _GNU_SOURCE
#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
#include <time.h>
#include <string.h>
#include <assert.h>
#include "control.h"
#include "data_logger.h"
#include "mash_profile.h"
#include "profile_reader.h"
/*... |
C | // Meant to be played on Terminal not 'command prompt'
//
// Simple Model of typing master program
//
// Maximum Custom Keys Size is 500
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<time.h>
#include <sys/time.h>
int scoreNT;
char all[500];
void doitcap(char *ch){
int len = strlen(ch), i;
for... |
C | /*
* File: hash.h
* Author: gferreira
*
* Created on June 22, 2017, 2:57 PM
*/
#ifndef HASH_H
#define HASH_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define MAXP 640
#define MAXT 12700
int linha = 1;
int flag = 0;
typedef st... |
C | #include<stdio.h>
#include <stdlib.h>
struct node
{
int data;
struct node *next;
};
struct node *head1 = NULL;
struct node *head2 = NULL;
void merge()
{
struct node *temp1 = head1;
struct node *temp2 = head2;
struct node *holder1 = NULL;
struct node *holder2 = NUL... |
C | #include<stdio.h>
main()
{
int i,a=0,d=0,h;
char res[100000];
scanf("%d%s",&h,&res);
for(i=0;i<h;i++)
{
if(res[i]=='A')
a++;
else
d++;
}
if(a>d)
printf("Anton");
else if(d>a)
printf("Danik");
else
printf("Friendship");
}... |
C | /*
============================================================================
Name : GPuzzle.c
Author : Tiangang Liu
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
============================================================================
*/
#includ... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int i,quantH,QuantM;
char genero;
QuantM = quantH = 0;
float altura,media;
float maiorAl = 0,menorAL = 1000;
float somaAL = 0;
for(i=1;i<=4;i++){
printf("Qual seu genero: H/M\nDigite aqui: ");
scanf(" %c",&genero);
... |
C | #include "magnetometer.h"
#define MAGNETOMETER_ADDRESS 0x1E
static int16_t offsets[3];
void magnetometer_init(){
twi_init();
uint8_t message[2];
message[0] = 0x00; //Register 0
message[1] = 0x78; //8 sample average, 75 Hz, normal mode
twi_write_to(MAGNETOMETER_ADDRESS, message, 2, TWI_BLOCK, TWI_STOP);
mes... |
C | #include <stdio.h>
void func();
int sum;
int main() {
int var1;
int *var2 = &var1;
var1 = 1;
sum = var1 + *var2;
func();
printf("sum = %d\n", sum);
return 0;
}
|
C | #include <osal.h>
#include <httpd.h>
/* A simple example that demonstrates how to create GET and POST handlers for
* the web server.
*/
#define HELLO_WORLD "Hello World!"
/* An HTTP GET handler */
int hello_get_handler(httpd_req_t *req)
{
/* Send a simple response */
httpd_resp_send(req, HELLO_WORLD, strlen(HELLO... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct node
{
int data;
struct node *next;
} node;
void getLength(node **head)
{
if (*head == NULL)
printf("list is empty");
else
{
int count = 0;
node *cur = *head;
do
{
count++;
cur = c... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include "dico.h"
int piocherMot(char *motPioche)
{
FILE* dico = NULL; /*Le ponteur de fichier qui va contenir notre fichier*/
int nombreMots = 0, numMotChoisi = 0, i = 0;
int caractereLu = 0;
dico = fopen("dico.txt", "r"); ... |
C | // Copyright (c) 2018, Tobechukwu Osakwe.
//
// All rights reserved.
//
// Use of this source code is governed by an
// MIT-style license that can be found in the LICENSE file.
#include <stdlib.h>
#include <string.h>
#include "stack.h"
#include "vm.h"
bonobo_stack_entry_t *bonobo_stack_top(bonobo_vm_t *vm) {
bonob... |
C | #include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "./sound_medium.h"
#include "./lt.h"
#include "./error.h"
struct sound_medium_t
{
lt_t *lt;
};
sound_medium_t *create_sound_medium_from_folder(const char *folder_path)
{
assert(folder_path);
lt_t *lt = create_lt();
if (lt == NULL) {
... |
C | #ifndef SRAM_H
#define SRAM_H
#include <stdint.h>
/**
* @brief Write to SRAM address
*
* @param address Address in SRAM
* @param data Data to be sent
* @return 0 if successful, 1 if errors occured
*/
int sram_write(uint16_t address, char data);
/**
* @brief Read from SRAM address
*
* @param address Addres... |
C | #include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
#include <stdio.h>
#include <math.h>
/**
* Read a positive number (excluding 0) from STDIN.
* Stops at the first position which is not a digit
* between 1..9
*
* @return the number or 0 if nothing to read from STDIN.
*/
int read_num() {
char buf;
... |
C | #include <stdio.h>
#include <stdlib.h>
struct node
{
int key;
struct node *left, *right;
};
struct node* newnode(int value)
{
struct node* temp = (struct node*)malloc(sizeof(struct node));
node->key = value;
node->right= NULL;
node->left = NULL;
return temp;
}
void traverse_func(... |
C | /*------------------------------------------------------------------------------
TEST.C: ISD51 Demo for TI MSC 1210
Copyright 2003 Keil Software, Inc.
------------------------------------------------------------------------------*/
#include <REG1200.H>
#include <intrins.h>
#include <stdio.h>
#include "ISD51... |
C | #include "cus-common.h"
int CusFileSetlock(int fd){
struct flock lk;
memset(&lk,0,sizeof(lk));
lk.l_type = F_WRLCK;
lk.l_whence = SEEK_SET;
lk.l_start = 0;
lk.l_len = 0;
lk.l_pid = getpid();
int r = fcntl(fd,F_SETLK,&lk);
if(r < 0){
printf("pidfile,unable to set l... |
C | #include <stdio.h>
int main(int argc, char* argv[])
{
FILE* f = fopen("/tmp/out.txt", "wb");
if( f != NULL )
{
fprintf(stderr, "File creation should have failed\n");
return 1;
}
if( mkdir("/tmp/foobar") == 0 )
{
fprintf(stderr, "Directory creation should have failed\n");... |
C | #include <detpic32.h>
void configTimer(void);
void configInterrupts(void);
unsigned char flag = 0;
int main(void){
configTimer();
configInterrupts();
while(1);
return 0;
}
void configTimer(void){
// Configuration of Timer T1 - 2Hz
T1CONbits.TCKPS = 3;
PR1 = 39062;
TMR1 = 0; // Reset timer 1
T1CONbits... |
C | #include<stdio.h>
#include<conio.h>
int t,size,element[100],head;
void cscan()
{
int i,j,temp,index,sum=0,d;
for(i=0;i<size;i++)
{
for(j=i+1;j<size;j++)
{ if(element[i]>element[j])
{
temp=element[i];
element[i]=element[j];
element[j]=temp;
}
}
}
for(i=0;i<size;i++)
... |
C | //
// Created by edmon on 18/4/2020.
//
#ifndef GRUPO_4_CORREDOR_H
#define GRUPO_4_CORREDOR_H
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "funciones_Basicas.h"
/**
* La estrucutra Corredor contiene los atributos particulares de cada piloto. La estructura Corredores va a almacenar
* un array... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line.h :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#define TEMP_TROPOPAUSE -56
/**
* This method is a linear equation (temp = temp0 + (deltaT / deltaH) (height - height0))
* @param height0 - initial height of the layer
* @param height - the input height
* @param temp0 - the initial tempe... |
C | #include <stdio.h>
int main(int argc, char *argv[])
{
/* Write your code after this line */
while (1)
{int x,n;
scanf ("%d",&x);
while (x<0)
{ printf("Input number not in range, please enter again\n");
scanf ("%d",&x);
}
scanf("%d",&n);
while ((n>=17)||(n<=1))
{ printf("Input base ... |
C | /*
ȡABʾϷĿʼʱͽʱ䣬СʱΪλ
ȻϷijʱ䣬֪Ϸһ쿪ʼһʱΪ24Сʱ
ABȣΪ24Сʱ
ʽ
һУAB
ʽ
ʽΪO JOGO DUROU X HORA(S)XΪϷʱ䡣
ݷΧ
0A,B23
1
16 2
1
O JOGO DUROU 10 HORA(S)
2
0 0
2
O JOGO DUROU 24 HORA(S)
3
2 16
3
O JOGO DUROU 14 HORA(S)
*/
#include <iostream>
using namespace std;
int main()
{
... |
C | #include<stdio.h>
#include<conio.h>
main()
{
char a,b,c,product=1;
clrscr();
printf("entern the any number ");
scanf("%c",&a);
for (b='a';b>='a'&&b<'z';b++ )
{
c=b;
printf("%d",c);
}
getch();
} |
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 | /***************************************************************************************************
*
* @author Preshit Harlikar, Shivam Khandelwal
* @file project3_1.c
* @brief This file includes logging functions for host and beaglebone black
* @date November 23, 2017
*
* long description - The logger... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line.c :+: :+: :+: ... |
C | #include <stdio.h>
#include "myLib.h"
#include "DataLoader.h"
static dldrMethods dldr_vtable={
DataLoader_dtor,
NULL,
NULL,
loadFrom,
build
};
dldr* DataLoader_ctor(){
dldr* d = (dldr *)malloc(sizeof(dldr));
if(d==NULL) mallocError("DataLoader");
d->input = NULL;
d->vptr = &dldr_vtable;
return d;
}
void D... |
C | /**
*@file main.c
*@Author Dirk Dubois
*@version 1.0
*@date Feb 12, 2011
*
*@brief A C program that displays a voltage measured on RB7 using the onboard ADC
*and displays it to a standard LCD display on PORTA running in 4bit mode.
*The voltage at RB7 is divide by a voltage divider of (1/4) requiring a scaling of 4.
*Th... |
C | /*
* Copyright (C) 2017, Saul Lawliet <october dot sunbathe at gmail dot com>
* All rights reserved.
*
* 两个指针, 往中间查找
*/
#include <stdlib.h> /* malloc() */
#include <string.h> /* strlen(), strchr() */
#include "c/test.h"
void swap(char *a, char *b) {
char tmp = *a; *a = *b; *b = tmp;
}
char *reverseVowels(char... |
C | #define _CRT_SECURE_NO_DEPRECATE
#include <stdio.h>
int main() {
FILE *f;
char s[100],c,d;
int k=0;
printf("Plese, enter full way to file: ");
//getchar();
gets(s);
f = fopen(s, "r+t");
if (f != NULL) {
while ((c = fgetc(f)) != EOF) {
d = tolower(c);
fseek(f, -1, SEEK_CUR);
fputc... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
typedef unsigned int uint;
/*
九九乘法表
小时候学过的九九乘法表也许将会扎根于我们一生的记忆,
现在让我们重温那些温暖的记忆,请编程输出九九乘法表.
现在要求你输出它的格式与平常的 不同啊!
是那种反过来的三角形啦,具体如下图:
每两个式子之前用一个空格 隔开。。。
输入 第一有一个整数N,表示有N组数据(N<10)接下来由N行,
每行只有一个整数M(1<=M<=9);
输出 对应每个整数M,根据要求输出乘法表的前N行,
具体格式参见输... |
C | #include<stdio.h>
#include<stdlib.h>
#include<limits.h>
struct array
{
int free;
int *arr;
int *top;
int *next;
int n,k;
};
struct array *createStack(int n,int k)
{
struct array *s=(struct array*)malloc(sizeof(s));
s->free=0;
s->arr=(int*)malloc(n*sizeof(int));
s-... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <GL/glx.h>
#include "shaderprogramset.h"
struct ShaderProgramSet {
GLuint vertShaderId;
GLuint fragShaderId;
GLuint programId;
};
static int32_t printShaderCompileInfo(GLuint shade... |
C | #include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <getopt.h>
#include <string.h>
#include "websocket.h"
#include "WebsocketBridge.h"
#include "version.h"
const char* progname = NULL;
extern settings_t settings; //allocated in websocket.c
void usage(int exit_code)
{
printf(
"version: " APP_... |
C | #include <stdio.h>
int Maximun(int Array[],int array_size)
{
int max=0,i;
max=Array[0];
for(i=0;i<array_size;i++)
{
if(Array[i]>max)
{
max=Array[i];
}
}
return max;
}
int Minimum(int Array[],int array_size)
{
int min=0,i;
min=Array[0];
for(i=0;i<array_size;i++)
{
if(Array[i]<... |
C | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
typedef struct s_drawing
{
char *m;
int w;
int h;
char c;
} drawing;
typedef struct s_rectangle {
char type;
float x;
float y;
float w;
float h;
char c;
} rectangle;
FILE *f;
drawing d;
rectangle r;
int get_info(void)
{
if (fs... |
C | #include <stdio.h>
#include <malloc.h>
#include <string.h>
char* adfgxPlain;
int * adfgxNormPlain;
int * adfgxTransposed;
int * adfgxNormCipher;
int * adfgxKey;
int * adfgxKeyOrder;
int * adfgxKeyIndex;
int * adfgxRowsPerCol;
int * adfgxCumRowsPerCol;
char adfgxMatrix[5][5]=
{
{'A', 'B', 'C', 'D', 'E'},
{'F', ... |
C | listnode* reverseList(listnode* A, int B)
{
if (B == 1)
return A ;
listnode *tmp, *prev, *nex, *rprev, *rhead, *ret ;
int cnt = 1 ;
printf ("Starting rev %d, ", A->val) ;
rprev = NULL ;
rhead = A ;
while (rhead)
{
cnt = 1 ;
prev = rprev ;
tmp = ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct vet
{
int vert;
struct vet *prox;
};
void grafo(struct vet **vetOrig, int nroArest);
void digrafo(struct vet **vetOrig, int nroArest);
void showMatAdj(struct vet **vetOrig, int nroArestas, int nroVertices);
void insertGrafo(struct vet **vetOrig, int ... |
C | /*
ID: wangbn11
LANG: C
TASK: fact4
*/
#include <stdio.h>
/*
* 对10取余数,则数有几个5的因子,就有多少2
* */
int main()
{
int number;
FILE *fin = fopen("fact4.in", "r");
FILE *fout = fopen("fact4.out", "w");
fscanf(fin, "%d", &number);
int digit[5000], time, i;
time = 0;
for (i = 1; i <= number; i++)... |
C | #include<errno.h>
#include<fcntl.h>
#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
#include<string.h>
#include<mosquitto.h>
// Server connection parameters
#define MQTT_HOSTNAME "broker.mqttdashboard.com"
#define MQTT_PORT 1883
#define MQTT_USERNAME "NULL"
#define MQTT_PASSWORD "NULL"
#define MQTT_TOPIC "test... |
C | #include <stdio.h>
int main()
{
int n1,i,a[1000],b[1000],c[1000],d=0,k=0;
scanf("%d",&n1);
for(i=0;i<n1;i++)
scanf("%d",&a[i]);
for(i=0;i<n1;i++)
{
if(a[i]==0)
{
b[k]=a[i];
k++;
a[i]='#';
}
}
for(i=0;i<n1;i++)
{ if(a[i]!='#')
{
c... |
C | #ifndef QUEUE_T_H
#define QUEUE_T_H
#include <stdlib.h>
#include <pthread.h>
typedef struct queue_element_t {
void *next;
int value;
} queue_element_t;
typedef struct queue_t {
queue_element_t *head;
queue_element_t *tail;
pthread_mutex_t *mutex;
unsigned int size;
} queue_t;
extern queue_t*... |
C | #include <stdio.h>
int main()
{
int scores = 3;
int garry[scores], sharry[scores];
for (int name = 0; name < 2; name++) {
for (int score = 0; score < scores; score++) {
if (name) {
scanf("%d", &sharry[score]);
} else {
scanf("%d", &garry[score]);
}
}
}
int garry_get = 0;
int sharry_get = 0... |
C | #include <stdio.h>
#include <string.h>
int main()
{
char a[1000];
long long int t,n,i,sum=0;
scanf("%lld",&t);
for(i=1;i<=t;i++)
{
scanf("%s",a);
if(a[0]=='d')
{
scanf("%lld",&n);
sum=sum+n;
}
else if(a[0]=='r')
printf("%ll... |
C | /*
* AMIT_Program.c
*
* Created on: Oct 13, 2021
* Author: Lenovo
*/
#include "STD_TYPES.h"
#include "DIO_Interface.h"
#include "SEG_interface.h"
#include "AMIT_Interface.h"
#include "util/delay.h"
u16 Counter5000=0;
u8 Counter10=0,Counter100=0;
u8 Button_State_On_Off=OFF_STATE;
u8 ModeFlag=DEFAULT_MODE;
... |
C | /* \file file_utils.c
*
* \brief Implementacao de funcoes relativas ao tratamento de arquivos
* necessarios ao servidor
*
* "$Id: $"
*/
#include "file_utils.h"
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <sys/stat.h>
const char * const IndexStr ... |
C |
#include<stdio.h>
#include<math.h>
int main()
{
int valor, qnt;
scanf("%d", &valor);
printf("%d\n", valor);
qnt=floorf(valor/100);
printf("%d nota(s) de R$ 100,00\n", qnt);
valor = (valor -(qnt*100));
qnt=floorf(valor/50);
printf("%d nota(s) de R$ 50,00\n", qnt);
valor = (valo... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strsplit.c :+: :+: :+: ... |
C | /* hw2_20a.c */
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int i=5;
printf("%d+%d=%d\n",i,i,i+i);
system("pause");
return 0;
}
/* output----
5+5=10
-----------*/
|
C | #include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#define TAM 100
int readln(int fd, char* buff, int tam){
int r, i;
r = read(fd, buff, tam);
for(i=0; i<r && buff[i] != '\n'; i++);
if(buff[i] == '\n') i++;
return i;
}
void main(int argc, char* argv[]){
char buff[TAM];
char aux[10];
int n, i=0;
while... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b;
scanf("%d\n%d",&a,&b);
int result=1;
float value;
if(a>0 && b>0)
{
for(int i=0;i<b;i++)
{
result*=a;
}
printf("%d",result);
}
else if(a>0 && b<0)
{
for(int i=0;i<(b*-1);i... |
C | #include "holberton.h"
/**
*_strdup - returns a pointer to a new string which is a duplicate of
* the string.
*@str: * string
*Return: NULL or String
*/
char *_strdup(char *str)
{
char *s;
unsigned int a;
if (str == NULL)
{
return (NULL);
}
for (a = 0; str[a] != '\0'; a++)
{
}
s = malloc(sizeof(c... |
C | #include <math.h>
#include <DHT.h>
#include <SigFox.h>
// Definimos el pin digital donde se conecta el sensor
#define DHTPIN 2
// Dependiendo del tipo de sensor
/* Offset encoding */
#define OFFSET_ENCODING 27
#define DHTTYPE DHT11
/* 12 Bytes per message as a requirement of SigFox */
#define BYTES_PER_MSG 12
/* On... |
C | #include <stdio.h>
#include <stdlib.h>
#include <wchar.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
char buf[256][256];
int read_buf(char *filename)
{
FILE *fp;
int line = 0;
fp = fopen(filename, "r");
if (fp ... |
C | #include "sort.h"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include "sort.h"
int i_pow(int v, int p)
{
if(p<0) return 0;
int i, rez=1;
for(i=0; i<p; ++i) rez*=v;
return rez;
}
void sortVstavkaInt(int size, int* array, int loops)
{
int i, j, temp;
for (i = 1; ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.