language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C |
#include <stdio.h>
#include <stdlib.h>
union num_var {
int vi;
short int svi;
unsigned int uvi;
float vf;
double vd;
char *word;
};
int main(int argc,char** argv){
union num_var temp;
printf("Declare union temp var using short integer ... \n");
temp.svi = 32000;
printf("Value of union in short int typ... |
C | #include <stdio.h>
#include <string.h>
#define MAX_INT_STRING_LEN 11 // "-4000000000"
#define MAX_FLOAT_STRING_LEN 20 // Guesstimated
/**
* Splits a string of elements into chunks of elements, and performs an action
* on each chunk. Delimited by ' '.
*
* @param data The string of elements.
* @param chunkS... |
C | /*
This function pops two variables and pushes the quotient of the {\em
intValue} fields of these variables. The resulting pushed variable is
of type {\em e\_int}.
It is assumed that the left argument of the division was pushed first;
therefore, the right argument is popped first. A division by zer... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strstr.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<stdlib.h>
#include<limits.h>
#include"LinkedList.h"
#define MAX 100
int max(int a, int b){return a>b ? a : b;}
int min(int a, int b){return a<b ? a : b;}
/** Print array
*/
void printArray(int arr[], int size)
{
int i;
printf("\n");
for(i=0;i<size;i++)
printf("%d ", arr[i]);
}
int a... |
C | // Sorting
#include <stdio.h>
#include <stdlib.h>
// Swap Function
void swap (int *a, int *b){
//printf("\n a = %d , b = %d \n", a, b);
int temp;
temp = *a;
*a=*b;
*b=temp;
//printf("Now a = %d , b = %d. \n", a, b);
}
// Selection Sort
void SelectionSort(int A[], int n){
int i;
int j;
... |
C | /*-----------------------------------------------------------------
File: fat2minix.c
Description: This file contains code for reading the minix
file system. SB, Maps, Inode, Directory Tables.
Synopsis:
fat2minix <fat dev file> <minix dev file>
where <fat dev file> is the device file that con... |
C | int fibo (int n ) {
if(n== 1)
return 1;
if (n==2)
{return 1; }
else
{return fibo(n-1) + fibo (n-2) ; }
}
|
C | #ifndef SYMTAB_H
#define SYMTAB_H
typedef enum
{
SYMBOL,
DEFINED,
UNDEFINED
}type_t;
typedef type_t symstat;
typedef struct symtab
{
type_t t;
char *symbol;
uint32_t adrs;
struct symtab *next;
}symtab_t;
symtab_t *init_symtab(void);
symtab_t *insert_symtab(symtab_t *symtab, char *symbol, int adrs);
symtab_t *... |
C | #include<stdio.h>
#include<time.h>
int main()
{
clock_t start, end;
double cpu_time_used;
int n,i,j,l,temp;
scanf("%d",&n);
int *a=(int*)malloc(n*sizeof(int));
for(i=0;i<n;i++)
a[i]=rand()%50;
start = clock();
for (i=n-1;i>=0;i--){
l=0;
for (j=0;j<=i;j++)
if (a[j]>a[l])
l=j;
if(l!... |
C | #include "election.h"
//include any other headers you need here...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void Initialize_CharArr(char ** chararr, int length) {
for (int i = 0; i < length; ++i) {
(*chararr)[i] = '\0';
}
}
state_t parseLine(const char * line) {
//STEP 1: write me
if (li... |
C |
/*************************************************
Copyright (C), 1988-1999, Tech. Co., Ltd.
File name:
Author: Version: Date:
Description:
Others:
Function List:
1. ....
History:
1. Date:
Author:
Modification:
2... |
C | #include<stdio.h>
long long int Com(long long int D,long long int j)
{
long long int p1=1,p2=1;
if(D-j<j)
j=D-j;
for(;j>0;j--,D--)
{
p1*=D;
p2*=j;
}
return p1/p2;
}
long long int Pow(long long int C,long long int j)
{
long long int pro=1;
while(j--)
pr... |
C | double mbe(double want, double get) {
return (want - get);
};
double mse(double want, double get) {
return pow(want - get, 2)/2;
};
double mae(double want, double get) {
return fabs(want - get)/2;
};
double cel(double want, double get) {
return -(want*log10(get) + (1-want)*log10(1 - get));
}; |
C | /* Copyright (c) 2007 Nordic Semiconductor. All Rights Reserved.
*
* The information contained herein is property of Nordic Semiconductor ASA.
* Terms and conditions of usage are described in detail in NORDIC
* SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
*
* Licensees are granted free, non-transfera... |
C | #include <stdio.h>
long Sum(int n);
int main(){
int n=0;
for(int i=0;i<=5;){
printf("nֵ(3<=n && n<=20)\n");
scanf("%d\n", &n);
if(n < 3 || 20 < n){
printf("3~20֮ڵ\n");
continue;
}else{
printf("1!+2!+...+%d! = %ld\n",n,Sum(n));
... |
C | /**
* @defgroup lwip lwIP
*
* @defgroup infrastructure Infrastructure
*
* @defgroup api APIs
* lwIP provides three Application Program's Interfaces (APIs) for programs
* to use for communication with the TCP/IP code:
* - low-level "core" / "callback" or @ref callbackstyle_api.
* - higher-level @ref sequential... |
C | #include "philo.h"
int is_valid_numbers(char **a, int c)
{
int i;
int j;
i = 1;
while (i < c)
{
j = 0;
while (a[i][j] >= '0' && a[i][j] <= '9')
j++;
j--;
if (j > 4 || a[i][j] < '0' || a[i][j] > '9')
return (0);
i++;
}
return (1);
}
int check_arguments(char **argv, int c)
{
if (c < 5 || c > 6)... |
C | /*-
* Copyrgiht (c) 2015 Olli Vanhoja
* Copyright (c) 2003 Poul-Henning Kamp
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above cop... |
C | # include <stdio.h>
# include <string.h>
# include <stdlib.h>
int main(int argc, char **argv){
FILE *source = fopen(argv[1],"r");
char targetPath[128];
strcpy(targetPath, argv[1]);
strcat(targetPath, ".c");
FILE *target = fopen(targetPath, "w");
fputs("char* data = \"", target);
char text[1024];
while(fgets(t... |
C | #include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv []) {
int count = atoi(argv[argc-1]);
for(int i = 0; i < count; i++) {
printf("Hello");
for (int k =1; k < (argc-1); k++) {
printf(" %s", argv[k]);
}
printf("!\n");
}
return 0;
}
|
C | #include<stdio.h>
int main(void)
{
const int LARGE = 5;
char * eofptr = NULL;
char arr[LARGE];
printf("Enter once a line(EOF to quit):\n");
do
{
eofptr = fgets(arr, LARGE + 1, stdin);
if (eofptr != NULL)
fputs(arr, stdout);
}
while (eofptr != NULL);
puts("End.");
return 0;
}
|
C | /****************************************************************************
*
* Copyright 2018 Primesoft All Rights Reserved.
*
* Filename: 522_LWIPClient.c
* Author: enj.park, yr.kim
* Release date: 2018/05/02
* Version: 2.1
* Modified date : 2018/05/23 by sj.yang
*
**************************************************... |
C | #include <math.h>
#include <stdio.h>
#include <conio.h>
// !Формула дискриминанта вычисяется по формуле D = b*b - 4*a*c
double discrim(double a, double b, double c)
{
return b * b - 4 * a * c;
}
int main()
{
printf("Never say 'never'\n");
printf("This "
"is"
" a string "
"wh... |
C | /*
(specialNumbers1D) A special number is a 3 digit positive integer, in which the sum of the cubes of each
digit is equal to the number. For example, the number 407 is a special number as 407 = 444 + 000 +
777. Write a C function that computes special numbers from 100 up to the a specified number. The
function tak... |
C | #include <stdio.h>
#include <string.h>
int main(int argc, const char* argv[]) {
// define the data type
struct People {
char name[30];
char email[25];
int age;
};
// dynamic
struct People *peoples;
int quantity_of_people = 2;
peoples = (struct People*) malloc( quantity_of_people * sizeof(struct People) )... |
C | #include <sprites.h>
#define SPRITES_BUFFER ((struct sprite*)(0x0200))
#define SPRITES_BUFFER_MAX_SIZE 64
static unsigned char old_size;
static unsigned char size;
// Cette fonction doit être appellée au début de la boucle principale,
// Elle réinitialise le buffer des sprites.
void sprites_begin()
{
old_size = si... |
C |
#include "intersection.h"
//计算两个圆的交点
void inter_computeIntersectionTwoCirlce(circle *aCircle1, circle *aCircle2, double *x1, double *y1, double *x2, double *y2)
{
double a, b, r;
double c, d, s;
double temp;
double temp2;
double temp3;
double temp4;
double temp5;
double temp6;
double delta;
... |
C | /*!
* \author Hugo Joby
* \verion 5.0
* \file fichier.h
* \brief Fonctions relatives au fichier.
* Toutes les fonctions necessitant une interface direct entre le programme et les différents fichiers.
* Utile pour la lecture et l'ecriture de logs anonymisés.
*/
#ifndef FICHIER_H_INCLUDED
#define FICHIER_H_INCLUDED
#i... |
C | #include<stdio.h>
#include "mul.h"
float mul(double a, double b)
{
float c;
c=(double)a*(double)b;
printf("The Multiplication of %f and %f is %f \n",a,b,c);
return 0;
}
|
C | #pragma once
#include <cuda_runtime.h>
#include <cstdlib>
#include <cassert>
// convert local index to global index
//index -> (row, col, inchimera=8)
//
struct RCIStrct{
uint32_t i;
uint32_t j;
uint32_t index;
};
__host__ __device__ __forceinline__ uint32_t glIdx_RCI(
uint32_t row, uint32_t col,
uint32_t i, u... |
C | #include <stdio.h>
#include <stdlib.h>
//couldn't do so, instead of it i did a swap without 3rd variable.
int main()
{
int a = 5, b = 10;
a += b;
b = a - b;
a -= b;
printf("a = %d and b = %d\n", a, b);
return 0;
}
|
C | //
// Created by Medivh on 2021/6/8.
//
#include "predictor.h"
#include "tournament.h"
uint32_t *lhistoryTable;
uint32_t *lpatternTable;
uint32_t *gpatternTable;
uint32_t *choiceTable;
uint32_t lhistory;
uint32_t lmask;
uint32_t ghistory;
uint32_t gmask;
uint32_t pcmask;
uint32_t choice;
uint8_t lprediction;
uint8_t ... |
C | #include <hbp.h>
void hbp_remove(t_hbp **r, t_hbp *hbp)
{
t_hbp *prv;
if (*r)
{
if (*r == hbp)
*r = (*r)->nxt;
else
{
prv = *r;
while (prv && prv->nxt != hbp)
prv = prv->nxt;
if (prv)
{
prv->nxt = hbp->nxt;
if (hbp->nxt)
hbp->nxt->prv = prv;
}
}
}
hbp->nxt = NU... |
C | /* ex_3.16 deitel*/
/* Stabilite quali delle seguenti affermazioni sono vere e quali false.
Qualora una affermazione sia falsa, spiegatene il motivo */
/*a*/ F la cosa più difficile è ideare l'algoritmo
/*b*/ V
/*c*/ F indicano l'ordine con cui devono essere eseguite le azioni
/*c*/ F (contengono gli operatori ... |
C | #ifndef __DATETIME_H__
#define __DATETIME_H__
void displayTime();
struct DateTime {
int year;
byte month, day, hour, minute, second, dayOfWeek ;
DateTime();
DateTime(int year, int month, int day, int hour, int minute, int second);
int cmp(DateTime other);
static DateTime fromDateTimeString(const char... |
C |
#include "stm32f10x_gpio.h"
#include "stm32f10x.h"
#include "stm32f10x_rcc.h"
void delay(int counter)
{
int i;
for (i = 0; i < counter * 10000; i++) {}
}
int main(void)
{
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC,ENABLE);
RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOC,DISABLE);
GPIO_InitTypeDef gp... |
C | /**
* Description : Palindrome Linked List
* Given a singly linked list, determine if it is a palindrome.
* Author : Evan Lau
* Date : 2016/04/11
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
struct ListNode {
int val;
struct ListNode *next;
};
bool isPalindrom... |
C | #include "stdio.h"
#include "stdlib.h"
#include "inttypes.h"
#include "math.h"
/* Integer square root by Halleck's method, with Legalize's speedup */
inline uint64_t isqrt (uint64_t x){
uint64_t squaredbit, remainder, root;
if (!x) return 0;
/* Load the binary constant 01 00 00 ... 00, where the number
... |
C | #include "libft.h"
char *ft_strjoin(char const *s1, char const *s2)
{
char *str;
if (!s1 || !s2 || !(str = ft_strnew(ft_strlen(s1) + ft_strlen(s2))))
return (NULL);
if (!(str = ft_strcat(str, (char *)s1))
|| !(str = ft_strcat(str, (char *)s2)))
return (NULL);
return (str);
}
|
C | /*
* Copyright (C) 2014-2015 Fabien Parent. All rights reserved.
* Author: Fabien Parent <parent.f@gmail.com>
*
* Provided under the three clause BSD license found in the LICENSE file.
*/
#ifndef __LIST_H__
#define __LIST_H__
#include <stdbool.h>
#include <stdint.h>
struct list_head {
struct list_head *prev... |
C | #include "simulate.h"
#include <stdio.h>
int Mid = 0;
int NTerms = 0;
double sigma;
void update()
{
computeA(NTerms, Mid);
updateParticles(particles, NBR_OF_PARTICLES, u);
glutPostRedisplay();
glutTimerFunc(1, update, 0);
}
float maxSpeed = 0.0;
float scalex = 1.5f;
float scaley = 1.5f;
void dr... |
C | #include <stdio.h>
#include <pthread.h>
#include <unistd.h>
void *hello(void *arg)
{
while (1)
{
printf("Hello\n");
sleep(1);
}
}
int main(void)
{
pthread_t hello_thread;
pthread_create(&(hello_thread), NULL, hello, NULL);
pthread_join(hello_thread, NULL);
printf("Out... |
C | #include <stdio.h>
void fct1(int *_arr1, int *_arr2);
void fct2(int (*_arr1)[4], int (*_arr2)[4]);
/*
void fct1(int _arr1[], int _arr2[]);
void fct2(int _arr1[][4], int _arr2[][4]);
*/
int main(void)
{
int arr1[3];
int arr2[4];
int arr3[3][4];
int arr4[2][4];
fct1(arr1, arr2);
fct2(arr3, arr4);
return 0... |
C | #include <stdio.h>
main()
{
/*
ex1-2.c: In function ‘main’:
ex1-2.c:5:13: warning: unknown escape sequence: '\w'
printf ("Hello \w\orld!\n");
^
ex1-2.c:5:13: warning: unknown escape sequence: '\o'
*/
printf ("Hello \w\orld!\n");
}
|
C | #include <stdio.h>
int main()
{
int ch=1;
while(ch==1)
{
printf("%c",ch);
}
}
|
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
void importFile(char* fileName, char** p_file_contents);
void tr(char* str, char in, char out);
void tr2(char* str, char* in, char* out);
int main(int argc, char **argv)
{
char* file_contents=NULL;
importFile("dna.fa", &file_contents);
printf("%s\n",fil... |
C | /* expression_node.h
*
* Defines an Expression_Node for use in Expression and Expression_Tree.
*
*/
#ifndef EXPRESSION_NODE_H
#define EXPRESSION_NODE_H
#include "expression_token.h"
/* .................... */
/* DATA DEFINITIONS */
/* .................... */
typedef struct _expr_node {
Expression_Token* e... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <string.h>
#define max(a,b) \
({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a > _b ? _a : _b; })
int compare_binary_file(const void *a, co... |
C | // id_table.h : Creates table of ids used in the program to compile
#include <string.h>
#define MAX_ID_TABLE_SIZE 100
struct Id* id_table[MAX_ID_TABLE_SIZE];
int id_table_size = 0;
int add_id(char* name){
int i;
for (i = 0; i < id_table_size; i++) {
if (strcmp(id_table[i]->name, name) == 0)
... |
C | #include <stdio.h>
int main()
{
int age;
int vipPass ;
printf("Enter the number \n");
scanf("%d", &age);
printf("The number you have entered is %d and if you are VIP user and above age = 15 please enter positive number other than zero if not press 0 \n", age);
scanf("%d", &vipPass);
if ... |
C | /**
* |----------------------------------------------------------------------
* | Copyright (C) Tilen Majerle, 2014
* |
* | This program is free software: you can redistribute it and/or modify
* | it under the terms of the GNU General Public License as published by
* | the Free Software Foundation, either... |
C | #include<stdio.h>
int main()
{
int n1=10,n2=11;
// n1 > n2 (10 > 11) is false so using
// logical operator '>', n1 > n2 produces 0
// (0 means false, 1 means true) So, case 0
// is executed as 10 > 11 is false. Here we
// have used type cast to convert boolean to int,
// to avoid warning.
switch((int)(n1 > ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* algo_3.c :+: :+: :+: ... |
C | /*
Confeccionar una función que reciba tres enteros y nos muestre el mayor de ellos. La carga de los valores hacerlo por teclado en la función main.
*/
#include<stdio.h>
#define bool unsigned int //bool.h no existe en mi sistema por algun motivo raro
#define true 1
#define false 0
#define BUFFER_SIZE 16
bool stop... |
C | #include"inc/LCD.h"
#include "../../FreeRTOS/Includes/FreeRTOS.h"
#include "../../FreeRTOS/Includes/task.h"
/*********************************************************************************
*
* Function: LCD_init
*
* @param: void
* @return: void
*
* Description: function to initialize the pins of the LCD as out... |
C | // alloc.c
// Rediet Negash
// 111820799
#include <stdio.h>
#include <stdlib.h>
#define offsetof(st, m) ((size_t) &(((st *)0)->m))
#define containerof(ptr, st, m) ((st *) (((char*)(ptr)) - offsetof(st, m)))
#define ERRQUIT(msg) (err_quit((msg), __FILE__, __func__, __LINE__))
#define CHKBOOLEXIT(exp... |
C | #include <stdio.h>
#include <stdarg.h>
/**
* print_strings - print a string
* @separator: separator between strings
* @n: number of arguments to print (strings)
*
* Return: void
*/
void print_strings(const char *separator, const unsigned int n, ...)
{
va_list ap;
unsigned int i = 0;
char *string;
/* Initializi... |
C |
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#define MAX_LINE_SIZE 1024
#define P(_i) point_arr[_i]
#define TP(_i) tri_point_arr[_i]
#define E(_i) edge_arr[_i]
#define T(_i) tri_arr[_i]
#define FOR_EACH_P for (int i = 0; i < point_count; i++)
#define FOR_EACH_E for (int i = 1; i <... |
C | #include <stdio.h>
int main(){
int sols=0;
int d1,d2,d3,d4;
for(d1=0; d1<10; d1++){
for(d2=0; d2<10; d2++){
for(d3=0; d3<10; d3++){
for(d4=0; d4<10; d4++){
if(d1+d2-d3-d4<10 && d1+d2-d3-d4>=0)
sols++;
}
}
}
}
printf("%d solutions", sols);
} |
C | #include <stdio.h>
#include <stdlib.h>
#include <conio.h>
int computer,you;
int menu()
{
int n;
printf("\n1.select rock");
printf("\n2.select paper");
printf("\n3.select scissors");
printf("\n4.exit");
printf("\nenter your choice");
scanf("%d",&n);
return(n);
}
void setup()
{
label... |
C | #include <stdbool.h>
#include <stdio.h>
#include "mazelib.h"
/*
####################
### USEFUL NOTES ###
####################
### GO UP ###
North = (x, y-1)
### GO RIGHT ###
East = (x+1, y)
### GO DOWN ###
South = (x, y+1)
### GO LEFT ###
West = (x-1, y)
turn left: facing = (facing + 3) % 4
turn right: ... |
C | /* Structure Interface */
#include "BM.h"
int32_t numBlock;
int32_t PagePerBlock;
int32_t numBITMAPB; // number of Bytes(elements) in each bitmap
/* Initiation of Block Manager */
BM_T* BM_Init(int32_t nob, int32_t ppb, int h_count, int q_count)
{
numBlock = nob;
PagePerBlock = ppb;
numBITMAPB = (Pag... |
C | #include "SList.h"
void test()
{
SListNode* a = NULL;
SListPushBack(&a,1);
SListPushBack(&a, 2);
SListPushBack(&a, 3);
SListPushBack(&a, 4);
SListPushBack(&a, 5);
SListPrint(a);
SListPushFront(&a,0);
SListPrint(a);
SListPopBack(&a);
SListPrint(a);
SListPopFront(&a);
SListPrint(a);
SListPrint(SListFind(a,... |
C | #include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
enum test {EEN, TWEE, DRIE};
int getal[3];
int main() {
int old_stdout = dup(1);
freopen ("/dev/null", "w", stdout); // or "nul" instead of "/dev/null"
printf("asd1");
fclose(stdout);
stdout = fdopen(old_stdout, "w");... |
C | #include "hash_tables.h"
/**
* hash_table_set - adds an element to the hash table
* @ht: hash table you want to add or update the key/value to
* @key: key of new element
* @value: new element value
* Return: 1 in success case, 0 if it fails
*/
int hash_table_set(hash_table_t *ht, const char *key, const char *va... |
C | #include <LiquidCrystal.h>
#include <stdlib.h>
#include <ctype.h>
#define BotonUp 8
#define BotonDow 10
#define BotonSelect 9
#define BotonRandom 13
#define LedCorrecto 12
#define LedError 11
#define TAM 4
LiquidCrystal pantallaLcd(2,3,4,5,6,7);
int indice;
char contador = 65;
char letraRecibida;
c... |
C | /*
* kernel module helper for testing CMA
*
* Licensed under GPLv2 or later.
*/
#include <linux/module.h>
#include <linux/device.h>
#include <linux/fs.h>
#include <linux/miscdevice.h>
#include <linux/dma-mapping.h>
#define SZ_1M 0x00100000
#define CMA_NUM 10
stati... |
C | /* guess--a simple guessing game */
/* a random number between 1 and 100 is chosen.
the player is given a set of bounds and must choose a number between them.
If the player chooses the correct number, he wins.
Otherwise, the bounds are adjusted to reflect the player's guess and the game continues
the random numb... |
C | #include "lib/common.h"
#include "lib/crypto.h"
#include "lib/file.h"
#include "lib/ui.h"
#include "lib/proxies.h"
#include <stdio.h>
error_type run(int argc, char **argv, unsigned char **file_contents, size_t *file_size, metadata_type *metadata);
int main(int argc, char **argv) {
error_type error;
unsigned char ... |
C | /* piecefuncs.c : Functions for working with piece coordinates
*
* Author: David Mastronarde email: mast@colorado.edu
*
* Copyright (C) 2012 by Boulder Laboratory for 3-Dimensional Electron
* Microscopy of Cells ("BL3DEMC") and the Regents of the University of
* Colorado. See dist/COPYRIGHT for full copy... |
C | //
// value_type.h
// accs_switch
//
// Created by akihiro uehara on 2018/03/27.
//
#ifndef value_type_h
#define value_type_h
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
typedef struct SensorThreshold_t {
int highThreshold;
int lowThreshold;
} SensorThreshold;
int16_t readInt16AsLittleEn... |
C | #include "ft_printf.h"
void ft_parsing_width(const char **format, va_list ap, t_spec *sp)
{
int num;
if (**format == '*' || ft_isdigit(**format))
{
if (**format == '*')
{
num = va_arg(ap, int);
if (num < 0)
{
sp->minus = 1;
num *= -1;
}
*format += 1;
}
else
num = ft_atoi(format);
... |
C | // https://www.hackerrank.com/challenges/kangaroo
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
char* kangaroo(int x1, int v1, int x2, int v2) {
char *ret = (char *)malloc(4*sizeof(char));
if (x1 > x2) {
if (v1... |
C | #include<stdio.h>
int main ()
{
int area,perimeter,l,b,h;
printf("enter the value of length,breadth");
scanf("%d" "%d",&l,&b);
area=(1/2*l*b);
printf("area of triangle=%d\n",area);
printf("enter the value of length,breadth,height");
scanf("%d" "%d" "%d",&l,&b,&h);
perimeter=(3*l+b+h);
printf("perimeter of triangle=%d\n... |
C | #include "cache.h"
#include "oidmap.h"
#include "object-store.h"
#include "replace-object.h"
#include "refs.h"
#include "repository.h"
#include "commit.h"
static int register_replace_ref(struct repository *r,
const char *refname,
const struct object_id *oid,
int flag, void *cb_data)
{
/* Get sha1 from ref... |
C | /*
* Note: This specific file is from Learn C the Hard Way by Zed Shaw
* I used it as a tool in order to create the hashmap datastructures.
*/
#include "darray.h"
static int DArray_resize(DArray *array, size_t new_capacity);
DArray *DArray_create(size_t element_size, size_t initial_capacity)
{
DArray *array =... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* parser.champions.c :+: :+: :+: ... |
C | #include <stdio.h>
double sum(double array[], int size){
double sum = 0.0;
for(int i = 0; i<size; i++){
sum = sum + array[i];
}
return sum;
}
double kvad_sum(double array[], int size){
double sum = 0.0;
for(int i = 0; i<size; i++){
sum = sum + (array[i] * array[i]);
}
return sum;
} |
C | #include "tips.h"
#define MASK_5 0x1f // Take the first fi
#define MASK_6 0x3f
#define MASK_16 0xffff
#define MASK_26 0x3ffffff
#define MASK_UPPER 0xffff0000
#define INSTRS_START 0x00400000
#define OFFSET_MASK block_size-1
#define INDEX_MASK ... |
C | //judul:loop 100-1 dan 1-100
//dibuat oleh nila nadia
//21 okt 2014
#include "stdio.h"
//kamus:
int i,j;
//deskripsi:
main()
{
for(i=100,j=1;i>=1,j<=100;i--,j++);
{
printf("i= %d dan j= %d \n",i,j);
}
return 0;
}
|
C | #include <stdio.h>
int main(void){
int num1 = 10;
int num2 = 5;
int count = 6;
for (int i = 0; i < count; ++i)
{
/* code */
printf("%d + %d = %d\n", num1, num2, num1+num2);
printf("purple\n");
}
} |
C | #include "libft.h"
size_t ft_strlcat(char *dst, const char *src, size_t dstsize)
{
size_t x;
size_t y;
x = 0;
y = 0;
while (dst[x] != '\0' && x < dstsize)
x++;
while (src[y] && x + y + 1 < dstsize)
{
dst[x + y] = src[y];
y++;
}
if (x != dstsize)
dst[x + y] = '\0';
return (x + ft_strlen(src));
}
|
C | #include<stdio.h>
int main()
{
int f1=1,f2=1,i,n;
printf("first 10 fibonacci number is: \n");
printf("%d %d",f1,f2);
for(i=1;i<=8;i++)
{
n=f1+f2;
printf("\t%d",n);
f1 =f2;
f2=n;
}
}
|
C | #ifndef _GLOBAL_H
#define _GLOBAL_H
#define ONE_SECOND_IN_MILLI 1000
#define MIN_SPEED 0.004
#define MAX_SPEED 0.064
#define SPEED_COEFFICIENT 2
// Variaveis globais
// Camera
int cameraMode = 0;
int projecao = 0; // Variavel logica para definir o tipo de projecao ((0) Perspectiva ou (1) Ortogonal)
int posx = 0, posy... |
C | #include <math.h>
#include "../../include/sort/sort_heap.h"
#include "../../include/util.h"
/*
* HEAP SORT
*/
static void
heap_sort_sift_down(int input[], unsigned int start_i, unsigned int end_i, compar_t *compar)
{
unsigned int root_i = start_i;
while ((root_i * 2 + 1) <= end_i) {
unsigned int child_i = root... |
C | #include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "freq.h"
int Node_count(int size, char * arr)
{
int i;
int node_count = 0;
for(i=0; i<size; i++)
{
if(arr[i] != arr[i+1])
{
node_count ++;
}
}
return node_count;
}
void Al... |
C | #include <stdio.h>
#include <stdlib.h>
/******************** STRUCTURES USED **********************/
union uint16{
unsigned short value;
struct {
unsigned int n1:4; //least significant
unsigned int n2:4;
unsigned int n3:4;
unsigned int n4:4; // most significant
};
};
union nibble{
unsigned char byte;
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* vector_functions_next.c :+: :+: :+: ... |
C | #ifndef _STACK_H_
#define _STACK_H_
#include "shared.h"
#define STACK_DEFAULT_SIZE 8
typedef struct SeqStack
{
ElementType *base;
size_t capacity;
int top;
}SeqStack;
typedef struct LinkStackNode
{
ElementType data;
struct LinkStackNode *next;
}LinkStackNode;
typedef LinkStackNode* LinkStack;
/////////////////... |
C | //Program question at: http://www.codechef.com/BTCD2012/problems/T03
#include<stdio.h>
int maxio=50000;
char buf[50000], *s = buf + 50000;
inline char getc_(void) { if(s >= buf + maxio) { fread(buf,sizeof(char),maxio,stdin); s = buf; } return *(s++); }
inline int input() { char t = getc_(); int n=1,res=0; while(t!='-' ... |
C | #include <stdio.h>
#include <string.h>
#define N 80000
#define MAX_LEN 50
struct srt{
int idx;
char word[MAX_LEN];
}sign[N];
char dict[N][MAX_LEN] = {0};
int charcmp(const void * a, const void * b)
{
return *(char *)a - *(char *)b;
}
int stringcmp(const void * a, const void * b)
{
return strcmp(((s... |
C | #include<stdio.h>
#include<stdlib.h>
int main()
{
int a, i, j;
int *number;
int current=0, compla=0;
while(scanf("%d", &a)!=EOF){
number=(int *)malloc(a*sizeof(int));
for(i=0; i<a; i++){
scanf("%d", &number[i]);
}
for(i=0; i<a; i++){
current=number[i];
for(j=0; j<i; j++){
if(number[j]>current)... |
C | #include "userlib.h"
#include "malloc.h"
int apply_recursive(char* path, OpenFileId file, int octal_perm){
char *buffer = (char*)malloc(512);
while (ReadDir(buffer, 512, file) && *buffer){
if (strcmp(buffer, ".") == 0 || strcmp(buffer, "..") == 0)
continue;
int path_si... |
C | #include <string.h>
#include <ctype.h>
#include "strl.h"
#ifndef LIBBSD
/*
* strlcpy() and strlcat() are borrowed from OpenBSD source code.
*/
/*
* Copy src to string dst of size siz. At most siz-1 characters
* will be copied. Always NUL terminates (unless siz == 0).
* Returns strlen(src); if retval >= siz, t... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
//replaceblank
char * ReplaceBlank(char *s){
char *p=s;
int OldLen=0;
int blank=0;
while(*p!='\0'){
OldLen++;
if(*p==' '){
blank++;
}
p++;
}
int pOld=OldLen;
int pNew=OldLen+blank*2;... |
C | #include "morse_write.h"
#include "conversion.h"
#define RPI_GPIO_OUT 26
/* Données d'écriture */
struct write_data{
/* Flag d'attente */
int end;
wait_queue_head_t wait_queue;
/* Buffer des données ascii à écrire */
char* buffer;
size_t str_size;
size_t cur_str_pos;
/* Données d'écriture d'un caractère ASCII... |
C | #include <stdio.h>
#include <pthread.h>
__thread int tid;
void *thread_func(void* foo) {
int canary;
int tls;
asm("movl %%gs:0x14,%0\n"
"movl %%gs:0x0,%1\n"
:"=r"(canary),"=r"(tls)
);
tid = pthread_self();
printf("%x: canary value: 0x%x\n", tid, canary);
printf("%x: tls: 0x%x\n", tid, t... |
C | #include<stdio.h>
main()
{
char ch[5];
int i;
for(i = 0; i < 5; i++){scanf("%c", &ch[i]);
}
for(i == 0; i < 5; i++){
printf("%c", ch[i]);
}
return 0;
}
|
C | /*Carlos Badillo Lora*/
#include "data.h"
//#include "tabla_simbolos.h"
//#include "tabla_tipos.h"
#include <stdio.h>
# include <stdlib.h>
#include <string.h>
# include <assert.h>
// SYMTAB STG = (SYMTAB *)0;
SYMTAB *init_sym_tab () //Reserva memoria para una_tabla de simbolos vacia
{
SYMTAB *nuevosymtab;
n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.