language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include<stdio.h>
int a[10];
int cg(int x,int y)
{int tmp;tmp=a[x];a[x]=a[y];a[y]=tmp;}
int main()
{
int i,j,k,min=0;
for(i=0;i<10;i++)scanf("%d",&a[i]);
for(i=0;i<10;i++)printf("%d ",a[i]);
printf("\n");
for(i=0;i<9;i++)
{ min=i;
for(j=i;j<10;j++)
{
if(a[min]>a[j])min=j;
}
if(min!=i)... |
C | #include <stdio.h>
#include <math.h>
int main(){
float num;
int interval = 0;
char intSym;
scanf("%f", &num);
if(num <= 100 || num > 0){
interval = ceil(num/25);
intSym = (interval-1) ? '(' : '[';
printf("Intervalo %c%d,%d]\n", intSym, (interval-1) * 25, interval * 25);
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "dk_tool.h"
int main()
{
Node *theNode = NULL;
FILE *afile = fopen("txt.txt","r");
if (afile != NULL)
{ //переменная, в которую поочередно будут помещаться считываемые байты
char symbol;
//чтение одного байта из файла
//проверка на конец... |
C | /*
* reconstruction.c
* Author: sunder
*/
#include "hype.h"
//----------------------------------------------------------------------------
// Value of Nth Order basis functions
//----------------------------------------------------------------------------
PetscReal basis(PetscReal x, PetscReal y, PetscInt n... |
C | /****************************************************************************************************
** File name: terminal.c
** функции работы с RS485
****************************************************************************************************/
/* Includes -----------------------------------------------... |
C | /////////////////////////////
// //
// SISTEMAS OPERACIONAIS //
// TRABALHO 2 //
// //
// Talles Siqueia Ceolin //
// 201610108 //
// //
/////////////////////////////
// versão com threads
#include "curl_code.h"
#inc... |
C | #include "holberton.h"
/**
* get_bit - function that returns the value of a bit at a given index.
* @n: var int
* @index: var index
* Return: the value of the bit at index index or -1 if an error occured
*/
int get_bit(unsigned long int n, unsigned int index)
{
if (index > 64)
return (-1);
return ((n >> index)... |
C | #include "sunclock.h"
#include <math.h>
#include "project.h"
#define PI 3.14159265358979323846
#define fixangle(a) ((a) - 360.0 * (floor((a) / 360.0))) /* Fix angle */
#define fixangr(a) ((a) - (PI*2) * (floor((a) / (PI*2)))) /* Fix angle in radians*/
#define dtr(x) ((x) * (PI / 180.0)) /... |
C | /*
** EPITECH PROJECT, 2019
** BSQ : display_result.h
** File description:
** Displays the map with 'X's where the biggest square is located. (header)
*/
#ifndef DEF_DISPLAY_RESULT
#define DEF_DISPLAY_RESULT
#include <unistd.h>
#include "map.h"
#include "square.h"
void display_result(map_t *map, square *biggest_squa... |
C | //input : 1401601499
//output: legal
// 1*1+4*2+0*3+1*4+6*5+0*6+1*7+4*8+9*9+9*10=253
//253%11=0 ===> legal
// =1===> illegal
#include<stdio.h>
int main()
{
int isbn,sum=0,count=0;
printf("enter the value of ISBN number ");
scanf("%d",&isbn);
while(isbn%10!=0)
{ //140160149900
isbn=isbn/10;
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.c :+: :+: :+: ... |
C | #include <stdio.h>
#include "st_vector.h"
int main()
{
st_vector(int) Z;
st_init(Z);
st_push(Z,123);
st_push(Z,435);
st_push(Z,567);
printf("%zu\n", Z.len);
int z = st_pop(Z);
z = st_pop(Z);
printf("%d\n", z);
st_free(Z);
return 0;
}
|
C | #include "Redovi.h"
#include <stdlib.h>
void insertPQueue(deoReda **red, deoReda *deo)
{
deoReda *tr = *red, *pred = NULL;
if (tr == NULL)
{
*red = deo;
(*red)->sledeci = NULL;
}
else
{
while ((tr != NULL) && (deo->razdaljna>tr->razdaljna))
{
pred = tr;
tr = tr->sledeci;
}
if ... |
C | #include<stdio.h>
#define MIN(c,d) (c < d ? c : d)
#define MAX(a,b) (a > b ? a : b)
int main()
{
int t,a,b,c;
int i;
scanf("%d",&t);
for(i = 1; i <= t; i++)
{
scanf("%d %d %d",&a,&b,&c);
if((a > b && b > c) || (c > b && b > a))
{
printf("Case %d: %d\n... |
C | /**
* Author: João Leal©
*
* Revised by: Bruno Veiga - 1180712
* Revised by: Bruno Ribeiro - 1180573
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/wait.h>
#include <string.h>
#include <time.h>
#inc... |
C | #include <unistd.h>
#include "internalFuncts.c"
int displayheader(struct posix_header *header)
{
printf("======= EXTRACTING THE FILE =======\n");
printf("GETTING THE HEADER...\n");
printf("Filename is %s\n", header->name);
printf("%s\n", header->size);
printf( "===================================\n... |
C | #include"headers.h"
void execute_history(char ** parsed_commands){
int num=10;
if(history_latest!=19){num=history_latest+1;}
if(parsed_commands[1]!=NULL)num=atoi(parsed_commands[1]);
if(num>=11)num=10;
for(int i=0;i<num;i++){
printf("%s",history[history_latest-i]);
}
}
|
C | #include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/io.h>
#include <stdio.h>
#include <errno.h>
#include "ledmatrixUtils.h"
#include "i2c-utils.h"
#include <legato.h>
// private variables
static uint8_t led_matrix_currentDeviceAddress;
static uint8_t led_matrix_o... |
C | /* Exercise 5-4. Write a function strend(s,t) which returns 1 if the
string t occurs at the end of the string s, and zero otherwise. */
#include <string.h>
#include <stdio.h>
/* strend(): returns 1 if t is at the end of s, otherwise 0. */
int strend(const char *s, const char *t)
{
const char *a; /* antici... |
C | /*
GLIB - Library of useful routines for C programming
Copyright (C) 2009-2015
Free Software Foundation, Inc.
Written by:
Slava Zanko <slavazanko@gmail.com>, 2009, 2013.
This file is part of the Midnight Commander.
The Midnight Commander is free software: you can redistribute it
and/or modif... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "shellp.h"
const char * token_sep = " \r\n\\\t";
char ** parseline(char * line, int * num_args){
char ** args = malloc(1024 * sizeof(char *));
char * arg;
int argnum = 0;
for ( int i = 0; i < 1024; i ++){
args[i] = (char *)ma... |
C | // *****************************************************************************
// usart0_isr.c
//
// USART0 Interrupt Service Routine
//
// This demonstration is designed to read 10 characters into a buffer.
// After the 10th character arrives, transmit the 10 characters back.
//
// The application is interrupt-d... |
C | #inculde<stdio.h>
void waitingtime(int ar[],int ar2[],int n)
{
int i,j;
ar[0]=0;
printf("\n\nCalulating the waiting time for every process");
for(i=1;i<n;i++)
{
ar[i]=0;
for(j=0;j<i;j++)
{
ar[i]=ar[i]+ar2[j];
}
}
return(ar);
}
void turnartime(int ar[]... |
C | #include "../test.h"
#include <aerospike/as_random.h>
#include <pthread.h>
#include <string.h>
#include <ctype.h>
/******************************************************************************
* TEST CASES
*****************************************************************************/
static uint64_t n3, n4, n5, n... |
C | #include <stdio.h>
#include <stdlib.h>
main(){
float n1,n2;
scanf("%f%f",&n1,&n2);
if(n1 > n2){
printf("O %f é maior !\n",n1);
}
if(n2 >n1){
printf("O %f é maior !\n",n2);
}
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* init.c :+: :+: :+: ... |
C | /*
Create a function that returns True if three points belong to the same line, and False otherwise. Each point is represented by a list consisting of an x- and y-coordinate.
Examples
same_line([[0, 0], [1, 1], [3, 3]]) ➞ True
same_line([[-2, -1], [2, 1], [0, 0]]) ➞ True
same_line([[-2, 0], [-10, 0], [-8, 0]]) ➞ T... |
C | /*
* gt_uthread_attr.c
*
*/
#include <sys/time.h>
#include <assert.h>
#include "gt_thread.h"
#include "gt_uthread.h"
#include "gt_kthread.h"
#include "gt_common.h"
#include "gt_typedefs.h"
void uthread_attr_getcputime(uthread_attr_t *attr, struct timeval *tv)
{
tv->tv_sec = attr->execution_time.tv_sec;
tv->tv_u... |
C | #include <stdio.h>
int main()
{
#if 0
int a1 = 1, a2 = 0;
printf("sizeof int:%d\n", sizeof(a1));
while (a2 < a1) {
a2 = a1;
a1++;
}
printf("a1=%d\n", a1);
printf("a2=%d\n", a2);
long b1 = 1, b2 = 0;
printf("sizeof long:%d\n", sizeof(b1));
while (b2 < b1) {
b2 = b1;
b1++;
}
printf("b1=%ld\n", ... |
C | #include <stdio.h>
#include <string.h>
/*
* Looks for a string inside another one and returns a pointer to its
* occurance or else a NULL.
*/
int findchar(search_str, c)
char *search_str,
c;
{
int index = 0;
while (search_str[index] != '\0')
{
if (search_str[index++] ==... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_histopt_args.c :+: :+: :+: ... |
C | bool hatSwitchControl();
void joystickControl();
void drive() {
if(!hatSwitchControl()) {
//joystickControl();
}
}
int oldHat = -1;
bool hatSwitchControl() {
int hatValue = joystick.joy1_TopHat;
if (hatValue != oldHat) {
writeDebugStreamLine("hatvalue is %d", hatValue);
oldHat = hatValue;
}
switch (hatV... |
C | #include <gtk/gtk.h>
void on_button(GtkWidget *pButton, gpointer data){
const gchar * sText = "click";
GtkWidget * label = gtk_label_new(sText);
GtkWidget *pTempEntry;
GtkWidget *pTempLabel;
GList *pList;
/* Recuperation de la liste des elements que contient la GtkVBox */
pList = gtk_container_get_... |
C | //
// Program.c
// Listing 14
//
// Created by Mustafa Youldash on 8/3/17.
// Copyright © 2017 Umm Al-Qura University. All rights reserved.
//
#include <stdio.h>
int main(void) {
int a = 21, b=10, c;
c = a++;
printf("Line 1 - Value of c is %d\n",c);
c = a--;
printf("Line 2 - Value of c is... |
C | /* ==========
Question: Imagine the case of a darshan queue at a holy temple, where the queue is
divided into three levels: I, II, and III. There are three categories of
darshan: i) Normal, ii) Special Darshan, and iii) Special Darshan with
Puja. A devotee for normal ... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include "../header/tableaux.h"
//Déclarartion des prototypes de fonctions
//========================================
void TabCarre(int[], int);
//Définition des fonctions
void TabCarre(int tableau[], int n) {
int i;
for (i=0 ; i < n ; ... |
C | // gcc -Ofast -march=native ./pinwheels.c -o pinwheels; ./pinwheels | mpv - -scale oversample
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#define W (1080 / 4)
#define H (1920 / 4)
#define STATES 3
char rule[] = "--+---00000+---++"
"------00000++++++"
"--+++-00000+++-++";
... |
C | /*
The C programming language includes a very limited standard library in
comparison to other modern programming languages. This is a collection of
common Computer Science algorithms which may be used in C projects.
Copyright (C) 2016, Guilherme Castro Diniz.
This program is free software; you can redistribute i... |
C | #include "unknow_project.h"
t_face_list create_t_face_list(void)
{
t_face_list list;
if (!(list.face = (t_face *)malloc(sizeof(t_face) * PUSH_SIZE)))
error_exit(-25, "Can't malloc a t_face array");
// printf("malloc t_face_list.face\n");
list.size = 0;
list.max_size = PUSH_SIZE;
return (list);
}
t_face_list ... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define SIZE 80
//һһεַ
int main()
{
int index,j=0,k=0;
int arr[255]={0};
char str[]={"hsdjadisjrh"};
// printf("%d",strlen(str));
for(index=0;index <strlen(str);index++)
{
arr[str[index]]++;
}
for(index=0;index<strlen(str);index++)
{
if(arr[str[... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define BUFFER_SIZE 40
#define TRUE 1
#define FALSE 0
// Estrutura de Dados
typedef struct no {
char pal[20];
int urg;
struct no *prox;
} Elem;
// Valores globais de ampĺo acesso
int bufferCount = 0;
FILE * outputFile, * inputFile;
Elem * Bu... |
C | #include "stdio.h"
#include "stdlib.h"
/*
https://leetcode.com/problems/move-zeroes/
Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.
For example, given nums = [0, 1, 0, 3, 12], after calling your function, nums should be [1, 3, 12,... |
C | #include "shell.h"
#include <stdlib.h>
/**
*forkitfunction - if user's is already a direct path to command, the function
*will execute
*@all: all variables
*
*Return: 0 upon success
*/
int forkitfunction(struct wrap *all)
{
int status;
pid_t process = fork();
if (process == -1)
_error(all, NULL);
if (pro... |
C | #include <string.h>
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
/*
这道题的关键是找任意两个数的不同的比特位数,所以对于两个数来说,只要比特位有一处不同就加一。
那对于很多个数来说,相当于32个比特位其实都是独立关系的,所以可以拆开来看。
把比特位是0和1的分成两拨,各自组合就可以了,即one*zero
*/
int totalHammingDistance(int * nums, int n)
{
int i, j;
int mask;
int total = 0;
int tmp;
for (i = 0; i < 32;... |
C | void afficherChauffeur(ptville pdebutVille){
ptville px = pdebutVille->villeSuivante;
ptlivraison py;
while(px->villeSuivante != NULL)
{
py = px->listeLivraison->livraisonSuivante;
printf("Dans la ville %d, chauffeur :\t\n",px->numVille);
while(py->livraisonSuivante != NULL)
{
printf(... |
C | #include <stdio.h> /* for printf() and fprintf() */
#include <sys/socket.h> /* for recv() and send() */
#include <unistd.h> /* for close() */
#include "Practical.h"
#define RCVBUFSIZE 32 /* Size of receive buffer */
void HandleTCPClient(int clntSocket)
{
char echoBuffer[RCVBUFSIZE]; /* Buffer f... |
C | // Name: Sameer Raj
// Roll number: 1801CS42
// Task 2
// Assignment 10
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <unistd.h>
#include <sys/types.h>
#define MX 100
#define NN 1000001
#define INT_MAX 1000000000
int arr[NN], ctr = 1;
bool over = false;
FILE *fptr;
struct node { // Nod... |
C | /*
Условие задачи
void strCopy(char target[], char source[])
Гарантируется, что строка target не короче строки source.
*/
#include <stdio.h>
void strCopy(char target[], char source[]) {
int limit;
for ( limit = 0; source[limit] != 0; limit++ ) {
target[limit] = source[limit];
}
... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct kitap
{
char kad[30];
double fiyat;
} K;
typedef struct raf
{
int rkod;
char rtur[30];
int ksayi;
K *kitaplar;
} R;
R *bilgi_al(R *k, int raf)
{
int i;
if(raf == 1)
k = (R*)malloc(sizeof(R)*1);
els... |
C | #include <stdio.h>
#include <conio.h>
#include <windows.h>
#define MAX 100
#define BEZEICHNUNG_MAX_L 30
struct modell
{
char bezeichnung[BEZEICHNUNG_MAX_L + 1];
int kleistung;
int verbrauch;
int hoehe;
int breite;
int tiefe;
double preis;
};
void gotoxy(int x, int y)
{
COORD coord;
co... |
C | //////////////////////////////////////////////////////
//
// Projet TFTPD32. Mai 98 Ph.jounin - Jan 2003
// File async_log.c: Asynchronous multithread Log management
//
// source released under European Union Public License
//
//////////////////////////////////////////////////////
#include "headers.h"
#include <std... |
C | #include<stdio.h>
#include<stdlib.h>
int main()
{
char a[1000];
int n,i,j;
scanf("%s",a);
for(i=0;a[i]!='.';i++){}
if(a[i-1]-48==9)
{
printf("GOTO Vasilisa.");
exit(getch());
}
else
{
if(a[i+1]-48<5)
{
for(j=0;j<i;j++)
printf("%... |
C | #include "odbcs.h"
#ifdef ODBCS
/*
Returns IP-address (ipv4) for the given host_name.
If not found, then exit code (rc) is non-zero.
Usage: odbi_host.x host_name
Author: Sami Saarinen, ECMWF, 20-Dec-2007
*/
int
main(int argc, char *argv[])
{
int rc = 2; /* by default all NOT ok */
if (--argc >= 1... |
C |
#include "stdlib.h"
#include "math.h"
#include "stdio.h"
int rinv(a,n)
int n;
double a[];
{ int *is,*js,i,j,k,l,u,v;
double d,p;
is=malloc(n*sizeof(int));
js=malloc(n*sizeof(int));
for (k=0; k<=n-1; k++)
{ d=0.0;
for (i=k; i<=n-1; i++)
for (j=k; j<=n-1; j++)
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdbool.h>
// Compile this program with:
// cc -std=c99 -Wall -Werror -pedantic -o lab3 lab3.c
// Execution of the whole program begins at the main function
int my_strlen(char* str) {
int len = 0;
while (str[len] != '\0'... |
C | #include <stdio.h>
int divide (int a, int b);
int main()
{
int a = 144, b = 5;
int resultado = divide (a, b);
printf("%d\n", resultado);
return 0;
}
int divide (int a, int b)
{
if (a < b)
return 0;
else
return (divide(a-b,b) + 1); // O +1 representa o sinal se -1 é negativo
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include "crc32.h"
#include "scomp.h"
#define HDR_SIZE 10
#define TRL_SIZE 8
#define SND_TIMEOUT 100
static int dummycb( void *data, int size, int to )
{
return 0;
(void)data;
(void)size;
(void)to;
}
static struct {
int use_... |
C | #include <stdio.h>
#include <stdlib.h>
int BuscaBinaria(int busca, int v[],int n) {
int right = n-1,left = 0;
int middle;
if (busca < left || busca > right)
return -1;
while (v[right] != busca) {
middle = (right+left)/2;
if (busca <= v[middle])
right =... |
C | #include<stdio.h>
void swap(int*x,int*y)
{
int sd=0;
sd=*x;
*x=*y;
*y=temp;
}
int main()
{
int a=10;
int b=58;
swap(a,b);
return 0;
}
|
C | #include <stdio.h>
#include <ctype.h>
/*
ctype.h is for 'isalpha' I used this to detect letters instead of numbers when looking for words.
*/
#define true 0
#define false 1
main() /* Count words */
{
int c, wordCount, isWord;
isWord = false;
c = wordCount = 0;
while ((c = getchar... |
C | #include <stdio.h>
#include <assert.h>
#include "util.h"
/*
Using the or operator is good for turning designated bits on.
*/
int main()
{
short a = 0b1010000; // Binary 80
/* TODO: Initialize 'mask' such that when 'a' is
OR'ed with it turns the last three bits of 'a' on. */
short mask;
assert(... |
C | // Example usage:
// > gcc -o pi-serial-c pi-serial.c
// > ./pi-serial-c
//
// Example output:
// Result: 3.141237
// Elapsed time: 0.294798
//
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
double drandom() {
// Generate a uniform random number [0, 1).
return (double) ... |
C | int fibonacci (int n, int a, int b) {
if (n <= 2) {
return b;
}
return fibonacci(n - 1, b, a + b);
}
int fib (int n) {
return fibonacci(n, 1, 1);
}
|
C | #include "atlas_misc.h"
void ATL_UROT(const int N, TYPE *X, const int incX, TYPE *Y, const int incY,
const TYPE c, const TYPE s)
/*
* rot, no unrolling, arbitrary incX, incY, S & C
*/
{
int i;
TYPE tmp;
for (i=N; i; i--, Y += incY, X += incX)
{
tmp = c * *X + s * *Y;
*Y = c * *Y... |
C | #include<iostream>
#include<vector>
#include<queue>
#include<map>
#include<string>
using namespace std;
#include <assert.h>
class Solution {
public:
string getPermutation(int n, int k)
{
vector<int> val(n, 0);
int i;for(i=0;i<n;i++) val[i]=i+1;
t9[0] = 0;t9[1]=1;for(i=2;i<10;i++) t9[i]=t9[i... |
C | #ifndef __PROGTEST__
#include <stdio.h>
#include <assert.h>
#define RECT_NO_OVERLAP 0
#define RECT_OVERLAP 1
#define RECT_A_IN_B 2
#define RECT_B_IN_A 3
#define RECT_ERROR (-1)
#endif /* __PROGTEST__ */
int rectanglePosition ( int ax1, int ay1,
int ax2, int ay2,
... |
C | #include <stdio.h>
int main(void)
{
int a; //data variable
int *p; //pointer variable
int **q; //pointer to pointer
int ***r;//pointer to pointer to pointer
a = 10; //assigning 10 to a
p = &a; //assigning address of a to p
q = &p; //assigning address of p to q | single pointer to double pointer
r = &q; //assi... |
C | /*
** main2.c for emacs in /home/kevin.ferchaud/PSU_2016_navy
**
** Made by ferchaud kevin
** Login <kevin.ferchaud@epitech.net>
**
** Started on Thu Feb 2 20:06:50 2017 ferchaud kevin
** Last update Sun Feb 5 18:17:12 2017 Maxime Le Huu Nho
*/
#include "my.h"
char *strcapamoi(char *str)
{
i... |
C | #include <project.h>
static void unittest1(t_test *test)
{
char buf[9];
bzero(buf, 9);
ft_strcat(buf, "");
ft_strcat(buf, "Bon");
ft_strcat(buf, "j");
ft_strcat(buf, "our.");
ft_strcat(buf, "");
mt_assert(strcmp(buf, "Bonjour.") == 0);
mt_assert(buf == ft_strcat(buf, ""));
}
void suite_02_part2_ft_strcat(t_... |
C | #include <stdio.h>
#include <string.h>
int add_sum(int answered[26], int group_size, int *sum)
{
int count = 0;
for (int i = 0; i < 26; ++i)
{
if (answered[i] >= group_size)
{
count++;
}
}
*sum += count;
return count;
}
int main(int argc, char *argv[])
{
... |
C | #ifndef LOGS_H_
#define LOGS_H_
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdbool.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <time.h>
#include <sys/times.h>
#define GROUP_LEADER (getpid() == getpgid(getpid()))
#define GROUP_ID (getpgid(... |
C | #include<stdio.h>
int main(){
int input,i;
printf("Enter the range upto which prime numbers has to be found");
scanf("%d",&input);
int prime[input+1];
//first initialize every element to be prime
for(i=0;i<=input;i++){
prime[i]=1;
}
for(int number=2;number*number<=i... |
C | // Copyright 2020 Gregory Davill <greg.davill@gmail.com>
// Copyright 2020 Michael Welling <mwelling@ieee.org>
#include <dac53608.h>
#include <i2c.h>
#define DAC_I2C_ADDR 0b1001000
static bool dac_write(uint8_t addr, uint16_t d)
{
char data[2];
data[0] = d >> 8;
data[1] = d & 0xFF;
return i2c_write(DAC_I2C_ADDR... |
C | /*
* analog.c
*
* Created on: May 2, 2018
* Author: Marco
*/
//===========================================================================
/*------------------------------- Includes --------------------------------*/
//===========================================================================
#include "ana... |
C | #include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <string.h>
#include <signal.h>
#include <limits.h>
#include <unistd.h>
#define ERROR(string) {printf(string);exit(1);}
void read_confi(char*);
void prepare();
void start_threads();
void join_threads();
void *producer(void *fvoid);
void *consumer(voi... |
C | #include "interpolation.h"
float interpolation(float inputVal, float x1, float x2, float y1, float y2);
float limitedInterpolation(float inputVal, float x1, float x2, float y1, float y2);
float interpolation(float inputVal, float x1, float x2, float y1, float y2)
{
static float deltaX = 0.0;
static fl... |
C | /*
Enonce :
L'objectif est de deboguer ce programme comportant un bug "evident".
Compilez-le et trouvez le bug a l'aide des methodes adaptees de debogage.
Competences : 1,2,88,107,108,109
Difficulte : 1
*/
#include <stdio.h>
int main()
{
int *age;
printf("Bonjour,\n");
printf("Entrez votre a... |
C | /**
* @file basic.c
* @brief Memory management, portable types, math constants, and timing
* @author Pascal Getreuer <getreuer@gmail.com>
*
* This file implements a function Clock, a timer with millisecond
* precision. In order to obtain timing at high resolution, platform-
* specific functions are needed:
*... |
C | #include "headers.h"
int redirection(char **arg, char *home, int size)
{
int f1 = 0, f2 = 0, f3 = 0;
int fd, curr ,start,end = size;
char in[10000];
char out[10000];
for (int i = 0; i < size; i++)
{
if (!(strcmp(arg[i], "<") == 0)==0)
{
strcpy(in,arg[i+1]);
... |
C | int add(int a, int b, int c){
return a+b+c;
}
int main(){
int x =0;
int y = 3;
int z =5;
return add(x,y,z);
}
|
C | #include <stdio.h>
#include <stdlib.h> // Para usar o exit()
#include <stdbool.h> // Para poder usar o booleano
void fatal(char *msg) {
fprintf(stderr, "Erro: %s\n", msg);
exit(1);
}
void usage(void) {
printf("Uso: \n\treadpe <arquivo.exe>\n");
exit(1);
}
bool ispe(const unsigned char *b) { // F... |
C | /*
** character.c for Naruto2 in /home/valentin/Projets_persos/Naruto2
**
** Made by valentin combes
** Login <combes_v@epitech.net>
**
** Started on Thu Apr 19 10:20:31 2012 valentin combes
** Last update Sun Apr 22 21:07:35 2012 valentin combes
*/
#include "naruto.h"
t_perso *add_character(char *name, int all... |
C | /*
iki_boyutlu_dizi_ekrana_yazdirma_kullanici_girisli.c
*/
#include<stdio.h>
#include<math.h>
int main(){
int a[3][3];
int i,j;
for(i=0;i<3;i++){
for(j=0;j<3;j++){
printf("%d %d elemanini gir = ",i+1,j+1);
scanf("%d",&a[i][j]);
}
}
printf("Girilen Matris...\n_______________\n");
for(i=0;i<3;i++){
fo... |
C | ////////////////////////////////////////////////////////////////////////
//
// Copyright 2015 PMC-Sierra, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you
// may not use this file except in compliance with the License. You may
// obtain a copy of the License at
// http://www.apache.org/lic... |
C | #include "defines.h"
#include "data.h"
#define PropertyLen 7
typedef struct{
char* key;
char* value;
} dict_entry;
char* null_char = "NULL";
char* PropertiesList = NULL;
dict_entry Properties[PropertyLen] = {
{.key = "mode", .value = "judje"},
{.key = "source", .value = "run.c"},
{.key = "lbinary... |
C | // https://www.urionlinejudge.com.br/judge/en/problems/view/2310
#include <stdio.h>
int main(int argc, char *argv[])
{
int n, tmpSer, tmpBlk, tmpAtk, totSer = 0, totBlk = 0, totAtk = 0;
int tmpScsSer, tmpScsBlk, tmpScsAtk, totScsSer = 0, totScsBlk = 0, totScsAtk = 0;
char tmpName[100];
scanf("%d", &n);
while (... |
C | #include <stdio.h>
int convnum(int conv);
int main() {
unsigned long n, o;
int i, j;
unsigned int num[62];
printf("base 10 input: ");
scanf("%lu", &n);
for (i = 2; i <= 62; i++) {
printf("base %d: ", i);
j = 0;
o = n;
while (o != 0)
{
num[j] = o % i;
o /= i;
j++;
}
j--;
while... |
C | /*
** change_key_quit.c for change_key_quit in /home/marel_m/Rendu/Semestre_2/Systeme_Unix/PSU_2015_tetris
**
** Made by maud marel
** Login <marel_m@epitech.net>
**
** Started on Sun Feb 28 18:56:56 2016 maud marel
** Last update Tue Mar 8 15:40:47 2016 maud marel
*/
#include "tetris.h"
bool change_key_quit(t_te... |
C | #include <stdio.h>
int main()
{
long long int N;
int T;
scanf("%d", &T);
while(T--)
{
scanf("%lld", &N);
if(N&1)printf("BOB\n");
else printf("ALICE\n");
}
return 0;
} |
C | #include "ready_queue_utils.h"
int compare_nodes(Node *node1, Node *node2)
{
int res = node1->priority - node2->priority;
return (res == 0) ? (node2->timestamp - node1->timestamp) : res;
}
|
C | #include <minios/sem.h>
#include <minios/idt.h>
#include "con.h"
extern void kbd_intr();
struct console_s console[MAX_CONSOLES];
struct console_s *current_con;
size_t con_read(struct file_s *flip, char *buf, size_t n);
ssize_t con_write(struct file_s *flip, char *buf, size_t n);
static struct file_operations_s ops ... |
C | #include "stm32f1xx_ll_bus.h"
#include "stm32f1xx_ll_gpio.h"
#include "stm32f1xx_ll_utils.h"
#include "stm32f1xx_ll_usart.h"
#include "stm32f1xx_ll_rcc.h"
#include "stm32f1xx_ll_system.h" // utile dans la fonction SystemClock_Config
#include "Allure.h"
#include "Voile.h"
#include "string.h"
#define TAILLE_MESSAGE_MAX ... |
C | #ifdef _WINDOWS
#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>
#endif
#include"leptjson.h"
#include<assert.h>
#include <errno.h> /* errno, ERANGE */
#include <math.h> /* HUGE_VAL */
#ifndef LEPT_PARSE_STACK_INIT_SIZE
#define LEPT_PARSE_STACK_INIT_SIZE 256
#endif
/*װһṹֹ*/
typedef struct {
const char* json;
char*... |
C | #include <stdio.h>
#include <omp.h>
static long num_steps = 100000;
static double step;
#define NUM_THREADS 8
int main ()
{
int i, nthreads; double pi, sum[NUM_THREADS];
step = 1.0/(double) num_steps;
omp_set_num_threads(NUM_THREADS);
#pragma omp parallel
{ // fork
int i, id, nthrds;
double x;
id = omp... |
C | #include "NU32.h"
#include "direction.h"
#include <stdio.h>
#define BUF_SIZE 200
#define NU32_SYS_FREQ 80000000ul
#define MAX_MESSAGE_LENGTH 10
int main(){
char buffer[BUF_SIZE];
NU32_Startup();
NU32_LED1 = 1;
NU32_LED2 = 1;
U1MODEbits.BRGH = 0;
// U3BRG = (float)((NU32_SYS_FREQ / 38400) / 16) - 1;
U... |
C | //
// Created by Bernigend on 23.05.2020.
//
#ifndef LABORATORY_WORK_3_V2_BYTE_H
#define LABORATORY_WORK_3_V2_BYTE_H
struct Byte {
char value;
Byte* next;
Byte* prev;
Byte() {
this->value = '\0';
this->next = NULL;
this->prev = NULL;
}
explicit Byte(char _value) {
this->value = _value;
this->next... |
C | #include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>
#include "funciones.h"
#include "autos.h"
#include "egresos.h"
#define TAMPROP 50
#define TAMAUTO 20
int main()
{
EPropietario listaDePropietario[TAMPROP];
inicializarListaPropietario(listaDePropietario,TAMPROP);
inicializarPr... |
C |
/*the maze problem
* 2 stands for the start position
* 3 stands for the end position
* 0 stands for the road
* 1 stands for the wall
* 6 stands for the road you have walked
* */
/*there are some examples for you
7 6
0 0 1 0 0 3
0 1 0 0 1 1
0 0 0 1 0 0
1 1 0 1 0 1
1 0 0 1 0 1
1 0 0 0 0 0
0 1 0 0 1 2*/
/*
16 12
... |
C | #include <stdio.h>
int ft_recursive_power(int nb, int power);
int main()
{
int number = 5;
int power = 5;
int result = ft_recursive_power(number, power);
printf("%d", result);
}
|
C | #include <stdlib.h>
typedef struct node {
int val;
struct node * next;
} node_t;
node_t * head = NULL;
head = malloc(sizeof(node_t));
if (head == NULL) {
return 1;
}
head->val = 1;
head->next = NULL; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.