language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | //Write a program to accept a number and print unique pairs of numbers such that multiplication of //the pair is given number
//Input: 24
//Output:
//1 * 24 = 24
// 2 * 12 = 24
// 3 * 8 = 24
// 4 * 6 = 24
#include<stdio.h>
int main()
{
int no,i = 1,mul;
printf("Enter number: ");
scanf("%d", &no);
while(i < no)... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_flags_fun.c :+: :+: :+: ... |
C | /*
BASEADO NESTE EXEMPLO, FOI POSSÍVEL ATIVAR A IRQ8 - RTC
REAL TIME CLOCK
http://math.haifa.ac.il/ronn/realtime/lab6/
clk70.c
*/
#include <stdio.h>
#include <dos.h>
int convert_to_binary(int x)
{
int i;
int temp, scale, result;
temp =0;
scale = 1;
for(i=0; i < 4; i++)
... |
C | #include <stdio.h>
#define STACK_MAX 100
typedef struct
{
/* data */
int top;
int data[STACK_MAX];
} Stack;
int push(Stack* s, int data);
int pop(Stack *s);
int main(void){
Stack my_stack;
int item;
my_stack.top = 0;
push(&my_stack, 1);
push(&my_stack, 2);
push(&my_stack, 3);
ite... |
C | #include "holberton.h"
/**
* _pow_recursion - prototype function
* Description: return the value of x raised by the power of y
* @x: our value
* @y: our power to
* Return: if y lower than 0 return -1
*/
int _pow_recursion(int x, int y)
{
if (y < 0)
return (-1);
else if (y == 0)
return (1);
else
return ... |
C | #include "../inc/table_declaration.h"
#include "../inc/html.h"
void init_table_decla()
{
int i;
prochaine_place_libre = TAILLE_TAB_HASH;
decalage_bc = 0;
for (i = 0; i < TAILLE_TABLE_DECLARATION; i++) {
Tab_dec[i].nature = -1;
Tab_dec[i].suivant = -1;
}
}
int test_place_libre()
{
... |
C | #include "include/s7lib_parser.h"
uint8_t * s7lib_parser_write_bool(uint8_t * byte_array, int byte_index, int bit_index, bool value)
{
if(value == true)
byte_array[byte_index] |= ((uint8_t) 1 << bit_index);
else
byte_array[byte_index] &= ((uint8_t) ~(1<< bit_index));
return byte_array;
}
uint8_t... |
C | #include <stdio.h>
#include "Index.h"
#include <math.h>
/*
* Initializes the rectangle and assigns all the coordinates as 0
*/
void init_Rect(struct Rectangle* newRectangle)
{
register struct Rectangle* rectangleR = newRectangle;
for (int i=0;i<4;i++)
{
rectangleR->boundary[i]=(float)0;
}
}
/*
* Computes mini... |
C | #include <stdio.h>
#include "test_helpers.h"
#include "dominion.h"
int main()
/*
test card adventurer
Reveal cards from your deck until you reveal 2 Treasure cards.
Put those Treasure cards into your hand and discard the other revealed cards.
*/
{
printf("Testing card: adventurer\n\n");
printf("Test with nor... |
C | #include <stdio.h>
int main(int argc, char *argv[])
{
int a=10;
int *p=&a;
printf("&a=0x%x\n",&a);
printf("p=0x%x\n", p);
printf("p+1=0x%x\n", p+1);
printf("&p=0x%x\n",&p);
printf("&p+1=0x%x\n",&p+1);
// printf("&(p+1)=0x%x\n",&(p+1));
return 0;
}
|
C | #include<bits/stdc++.h>
using namespace std;
string s;
int n;
int main()
{
int x=1;
while(1)
{
//memset(dp,-1,sizeof(dp));
cin>>s;
if(s[0]=='-')
break;
n=s.length();
int ans=0;
stack<char>st;
for(int i=0;i<n;i++)
{
if(st.empty()&&s[i]=='}')
{
ans++;
st.push('{');
... |
C | /*====================================================================*
*
* void copyquote (SCAN * content, char buffer [], signed length);
*
* scan.h
*
* copy the current token to a user supplied buffer of specified
* length; the token is assumed to be enclosed in quotes of some
* kind which are dis... |
C | #include <string.h>
#include <stdlib.h>
int startX, startY;
int goalX, goalY;
int head, tail;
bool visited[MAP_HEIGHT][MAP_WIDTH];
//y, x,parent, manhattendistance, distance from start
int queue[MAP_HEIGHT*MAP_WIDTH][5];
struct Node {
int x;
int y;
};
void reset() {
for (int y = 0; y < MAP_HEIGHT; y++)
for (i... |
C | /*
** EPITECH PROJECT, 2020
** CPE_lemin_2019
** File description:
** GEt nb of rooms
*/
#include "lemin.h"
size_t get_nb_rooms(char ***array3d)
{
size_t nb_rooms = 0;
for (size_t i = 0; array3d[i]; i++) {
if (word_array_len(array3d[i]) == 3)
nb_rooms++;
}
return nb_rooms;
}
|
C | #include<stdio.h>
int main()
{
int N,i,j=1,sum=0,cnt=0,flag=0;
int Number[1001]={0};
double A[6]={0};
scanf("%d",&N);
for(i=0;i<N;i++)
{
scanf("%d",&Number[i]);
}
for(i=0;i<N;i++)
{
switch(Number[i]%5)
{
case 0:
if(Number[i]%2==0)
{
A[1]+=Number[i];
}
break;
... |
C | /* declaration de fonctionnalites supplementaires */
#include <stdlib.h> /* EXIT_SUCCESS */
#include <stdio.h> /* printf */
/* declaration constantes et types utilisateurs */
/* declaration de fonctions utilisateurs */
/* fonction principale */
int main()
{
/* declaration et initialisation variables */
int a... |
C | /*
*堆栈的链表方式实现
×
*/
#ifndef _STACK_LINKED_LIST_H_
#define _STACK_LINKED_LIST_H_
#define ERROR -1
#define SUCCESS 0
#include <malloc.h>
typedef int ElementType;
typedef struct SNode * Stack;
struct SNode{
ElementType Data;
Stack Next;
};
Stack CreateStack();
int Push(Stack S,ElementType x);
ElementType Pop(Sta... |
C | /*
** EPITECH PROJECT, 2021
** copy_tab.c
** File description:
** copy_tab function
*/
#include "../../include/my.h"
#include <stdlib.h>
char **copy_tab(char **tab)
{
char **tab_cpy;
int len = 0;
for (; tab[len]; len++);
tab_cpy = malloc(sizeof(char*) * (len + 1));
for (int i = 0; i < len; i++)
... |
C | #include "holberton.h"
#include <stdio.h>
/**
*print_diagsums - prints the sum of the two diagonals of a square matrix
*
*@a: pointer that contains the address of the beginning of the matrix
*@size: size of the square matrix
*
*Return: nothing
*/
void print_diagsums(int *a, int size)
{
int i, j;
int d1 = 0, d... |
C | #ifndef _DIRECTORY_H_
#define _DIRECTORY_H_
#include <time.h>
#include "../file/file.h"
#include "../utils/utils.h"
typedef struct directory {
char* name;
char* fullpath; // caminho completo do diretório
struct directory* preview; // diretório irmão anterior
struct directory* next; // próximo... |
C | /*
************ RANDOM.H ***********
This include file contains routines for getting a uniformly distributed
random variable in the interval [0,1], a gaussian
distributed random variable with zero mean and unity variance,
an exponential distributed random variable, and a
and a cauchy distributed random variable with
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* create_bitmap.c :+: :+: :+: ... |
C | /*****************************************************
Given an unsorted integer array, find the first missing positive integer.
For example,
Given [1,2,0] return 3,
and [3,4,-1,1] return 2.
Your algorithm should run in O(n) time and uses constant space.
*******************************************************/
#in... |
C | #pragma once
#include <stdint.h>
static inline uint32_t bswap16(uint16_t val) {
return ((val & 0xff00) >> 8) |
((val & 0x00ff) << 8);
}
static inline uint32_t bswap32(uint32_t val) {
return ((val & 0xff000000) >> 24) |
((val & 0x00ff0000) >> 8) |
((val & 0x0000ff00) << 8) |
... |
C | // Created by Kyle Goodale. See header for details
#include "processControlBlock.h"
#include "memory.h"
#include <stddef.h>
#include <stdlib.h>
#include <printf.h>
int ProcessCount = 0; // How many processes we currently have
const int MAX_PROCESSES = 10;
const int MAX_MEM_PER_PROC = 100; // How many lines each proce... |
C | /*
** EPITECH PROJECT, 2018
** CPE_BSQ_bootstrap_22018
** File description:
** load a content of a file and put it in memory
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include "./../include/my.h"
#include "./../include/bootstrap.h"
char *load_file_in_mem(char const *fi... |
C | #include<stdio.h>
int main(){
float a,b=50.0,c=1.0,s=0.0;
for (a=0;a<=2;a++)
{
if (a>0)
c*=2;
s+=(1+2*a)/c;
}
printf("The sum of the numbers is %f",s);
return 0;
} |
C | #include <stdio.h>
#define xcat(x,y) x##y
#define xxcat(x,y) cat(x,y)
int main()
{
int a = (xcat(xcat(3, 0), xcat(2, 0)));
printf("a");
return 0;
}
|
C | #pragma once
typedef unsigned long DWORD;
typedef unsigned int UINT;
struct TriMeshFace
{
TriMeshFace() {}
TriMeshFace(DWORD I0, DWORD I1, DWORD I2)
{
I[0] = I0;
I[1] = I1;
I[2] = I2;
}
DWORD I[3];
};
struct GRIDCELL {
Vec3 p[8]; //position of each corner of the grid in ... |
C | #include "assets/colour/colour.h"
STATUS_CODE game_surface__init(Game* game)
{
SDL_Color bg_colour = BG_COLOUR;
#if SDL_BYTEORDER == SDL_BIGENDIAN
#endif
u32 bg_bitmask = (bg_colour.a | (bg_colour.r << 16) | (bg_color.g << 8) | bg_color.b)
if (SDL_MUSTLOCK(game_surface)) {
if (SDL_LockSurface(game_surface) < 0)... |
C | //
// Created by hugbr on 2016/1/21.
//
#include <stdio.h>
#include <stdlib.h>
typedef struct node{
int data;
struct node *next;
}Qnode;
typedef struct queue{
Qnode *begin,*end;
}Queue;
Queue * init(){
Queue *q = malloc(sizeof(Queue));
Qnode *t = malloc(sizeof(Qnode));
t->next = NULL;
q-... |
C | //******************************************************************************
// MSP430FR69xx Demo - eUSCI_B0 I2C Master TX bytes to Multiple Slaves
//
// Description: This demo connects two MSP430's via the I2C bus.
// The master transmits and receive data via I2C to / from slave addresses 0x02
// This is ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#define M_PI 3.14159265358979323846
#define TWO_PI 6.2831853071795864769252866
#define c 0.817
#define Gmax 5000
#define error 0.00001
#define ranf() ((double)rand()/(1.0+(double)RAND_MAX)) //intervalo uniforme de [0,1)
#define e1(... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>
//int fib(int n)
//{
//
// if (n == 3)
// count++;
// if (n <= 2)
// return 1;
// else
// return fib(n - 1) + fib(n - 2);
//
//}
//int fib(int n)
//{
// int a = 1;
// int b = 1;
// int c = 0;
// while (n > 2)
// {
// c = a + b;
// a = b;
//... |
C | #include<stdio.h>
int cost[20][20],parent[20]={0};
void main()
{
int n,i,j,ne=1,min,mincost=0,u,v,a,b;
printf("enter the number of nodes\n");
scanf("%d",&n);
printf("enter the cost matrix\n");
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
{
scanf("%d",&cost[i][j]);
if(cost... |
C | /*
* Author: Joshua Curtis
* randomtestadventurer.c
* random test for adventure card
*/
#include "dominion.h"
#include "dominion_helpers.h"
#include "rngs.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <time.h>
int main() {
struct gameState G;
struct gameState testG;
... |
C | #include <stdio.h>
#include <conio.h>
#include <math.h>
#include <stdlib.h>
int main()
{
float x[20], y[20], f, s, h, d, p;
int j, i, n;
printf("enter the number of elements: ");
scanf("%d", &n);
printf("enter the elements of x:\n");
for (i = 1; i <= n; i++)
{
scanf("%f", &x[i]);
}
printf("enter t... |
C | #include <stdlib.h>
#include <string.h>
#include "derivedStack.h"
#ifndef NULL
#define NULL ((void *)0)
#endif
const void *OBJ_bsearch_ex_(const void *key, const void *base_, int num,
int size,
int (*cmp) (const void *, const void *),
... |
C | #include<stdio.h>
void main()
{
int i;
float a,b,c;
while (i>0)
{
printf("please enter the value of first side a\n");
scanf("%f",&a);
printf("please enter the value of second side b\n");
scanf("%f",&b);
printf("please enter the value of third side c\n");
... |
C | /*******************************************************************************
*
* lib-util : A Utility Library
*
* Copyright (c) 2016-2018 Ammon Dodson
* You should have received a copy of the license terms with this software. If
* not, please visit the project homepage at:
* https://github.com/ammon0/lib-uti... |
C | /* HASH HASH OPERATOR */
#include<stdio.h>
#include<stdlib.h>
#define CAT1(x, y) (x##y)
#define CAT2(x, y) (x##_##y)
int main()
{
system("clear");
int int_val = 4;
float float_val = 2.54;
int bird_count = 20;
printf("int val : %d\n", CAT1(int, _val));
printf("flaot val : %f\n", CAT2(float, val));
printf("bi... |
C | #include "platform.h"
struct KeyState {
unsigned char m_IsPressed;
unsigned char m_IsTriggered;
unsigned char m_WasPressed;
unsigned char m_Reserved;
};
static struct KeyState m_Keys[3];
int isMouseLeftButtonPressed(void)
{
return m_Keys[0].m_IsPressed;
}
int isMouseLeftButtonTriggered(void)
{
return m_... |
C | #include "stack.h"
#include<stdio.h>
void CreateStack(StackType *s) {
s->top = -1;
}
int StackEmpty(StackType s) {
return(s.top==-1);
}
int StackFull(StackType s) {
return(s.top==MAX-1);
}
void Push(EntryType item , StackType *s) {
if(s->top == MAX-1)
printf("Error: Stack Ov... |
C | #include "binary_trees.h"
/**
* deepTree - Binary tree node
*
* @tree: tree to measure
* Return: deep of the tree
*/
int deepTree(const binary_tree_t *tree)
{
int deep = 0;
while (tree != NULL)
{
deep++;
tree = tree->left;
}
return (deep);
}
/**
* _binary_tree_is_perfect - function that checks if a b... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define TRUE 1
#define FALSE 0
#define TAM 1000
#include "empleados.h"
int initEmployees(eEmpleado listaEmpleados[],int tamanioArray)
{
int retorno;
retorno=-1;
for(int i=0;i <tamanioArray; i++)
{
listaEmpleados[i].isEm... |
C | #include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv) {
float c, f;
puts("Introduza a temperatura em graus Fahrenheit: ");
scanf("%f", &f);
c = (f - 32) * 5/9;
printf("A temperatura em graus Centigrados e: %f\n", c);
return 0;
}
|
C | #include "header.h"
static void execute(t_queue *work, t_builtin_command *my_command) {
t_queue *p = work;
int status;
for (; p; p = (*p).next) {
(*p).command = mx_tokenCut((*p).command, 0, mx_strlen((*p).command));
(*p).command = mx_substitute((*p).command, my_command);
status = m... |
C | #ifndef LIST_H
#define LIST_H
#include <stdbool.h>
typedef struct _doubly_node DoublyNode, Node;
typedef struct _doubly_linked_list DoublyLinkedList, List;
Node *Node_create(int val);
List *List_create();
void List_destroy(List **L_ref);
bool List_is_empty(const List *L);
void List_add_first(List *L, int val);
void... |
C | /*
* Programa servidor:
* Recebe uma string do cliente e envia o tamanho dessa string.
*
* Como compilar:
* gcc -Wall -g server.c -o server
*
* Como executar:
* server <porto_servidor>
*/
#include "inet.h"
int main(int argc, char **argv)
{
int sockfd, connsockfd;
struct sockaddr_in server, clie... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
#include "struct.h"
#include <omp.h>
//function which initiates the qs struct
TAD_istruct init2(TAD_istruct qs){
int i;
//runs through all the cube's and author's block inside the hash table andpercor... |
C | /*
ID: saitorl1
LANG: C
TASK: dualpal
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
void swap(char* a, char* b)
{
char temp = *a;
*a = *b;
*b = temp;
}
void reverse(char str[], int length)
{
int start = 0;
int end = length - 1;
while(start < end) {
swap(&str[start], &st... |
C | #include "holberton.h"
#include <stdlib.h>
/**
* array_range - creates an array of integers
*
* @min: start range
* @max: end range
*
* Return: the pointer to the newly created array
*/
int *array_range(int min, int max)
{
int i;
int *intArrayAddress = NULL;
if (min > max)
return (NULL);
intArrayAddress ... |
C | // conio.c written by Magi.bbs@tsunami.ml.org
//
// for porting my five chess from borland c to unix
//
// Date: 98/3/18
#include <termios.h>
static int bgcolor=30;
static int high=0;
void cputs(char *buf)
{
printf("%s",buf);
}
void textcolor(int color)
{
printf("\x1b[1;%d;%dm",bgcolor,color);
}
void textback... |
C | #include <stdint.h>
#include "lib.h"
#include "testlib.h"
#define SIZE_OF_TEST 100
uint64_t* __var(test_ctx_t* ctx, run_idx_t r, const char* varname) {
var_idx_t idx = idx_from_varname(ctx, varname);
return ctx->heap_vars[idx].values[r];
}
#define VAR(ctx, r, var) __var(ctx, r, var)
UNIT_TEST(test_concretizat... |
C | #include<stdio.h>
int main()
{
char name[30];
float sa;
double se,TOTAL;
gets(name);
scanf("%f %lf",&sa,&se);
TOTAL = sa + (se * 15)/100;
printf("TOTAL = R$ %0.2lf\n",TOTAL);
return 0;
}
|
C | #include "input.h"
#include "future.h"
#include <stdio.h>
#include <string.h>
deck_t * hand_from_string(const char * str, future_cards_t * fc) {
deck_t * hand = malloc(sizeof(*hand));
hand->cards = NULL;
hand->n_cards = 0;
while(str != NULL && *str != '\0') {
if (*str == ' ') {
... |
C | #include "simply.h"
#include <stdio.h>
#include <sys/times.h>
#include <unistd.h>
#define N 1000000000
main(int argc, char *argv[]){
double w, result = 0.0, temp;
int i,myid,nproc;
struct SIMPLY_status myStatus;
struct tms a;
int t1,t2,t3,t4;
t1 = times(&a);
simply_init(&argc,&argv);
simply_comm_rank(&my... |
C | #include "circularLinkedList.h"
#include <stdio.h>
#include <stdlib.h>
struct Node
{
ET Element;
Pos Prev;
Pos Next;
};
/**---- BASIC LIST OPERATION ----**/
List
makeEmpty()
{
List L = malloc(sizeof(struct Node));
L->Next = NULL;
L->Prev = NULL;
return L;
}
void
insert(ET elem, List L, Pos position)
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: ... |
C | #include <stdio.h>
#define MaxTree 10
#define Null -1
#define ElementType char
#define Tree int
struct TreeNode
{
ElementType Element;
Tree left;
Tree right;
} T1[MaxTree], T2[MaxTree];
Tree BuildTree(struct TreeNode T[])
{
int N, j;
scanf("%d\n", &N);
int ROOT = Null;
if (N)
{
... |
C | /* 1) Elaborar um programa para ler valores inteiros (incluindo valores positivos e negativos) até
que o valor zero seja informado. O valor zero não deverá ser considerado. Informar o maior e
o menor entre os valores positivos lidos e apresentar a média dos valores negativos
informados.
Obs.: verificar que não sejam re... |
C | /* ************************************************************************** */
/* LE - / */
/* / */
/* option.c .:: .:/ . .:: ... |
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 | #include <stdio.h>
#include <stdlib.h>
#include "lista.h"
lista cria_lista(){
lista l;
l = (lista)malloc(sizeof(TLista));
if(l){ //(lista!=NULL)
l->first = NULL;
l->last = NULL;
l->sizeLista=0;
}
return l;
}//cria_lista;
void termina_lista(lista l){
TNodoLista *p;... |
C | #include <stdio.h>
#define IN 1 /* inside a word */
#define OUT 0 /* outside a word */
int main()
{
/* Exercise 1-11:
Test the word count program on ' ', new lines, and tabs, including multiple spaces, new lines, and/or tabs in a row. This assumes that other symbols do not denote separation of words, such a... |
C | #define _BSD_SOURCE // usleep()
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dlfcn.h>
#include "game.h"
const char *GAME_LIBRARY = "./libgame.so";
struct game {
void *handle;
ino_t id;
struct game_api api;
struct game_state *state;
};
static void game_... |
C | //mpicc questao3.c -o questao3
//mpirun -np 4 ./questao3
#include <stdio.h>
#include <stdlib.h>
#include <mpi.h>
int calculaPrimos(int n){
int k, j, i=3, soma=2;
for(k = 2; k < n; k++ ){
for(j = 2; j < i; j++){
if(i%j==0)
break;
}
if(j==i){
soma+=i;... |
C | #include "img2.h"
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char **tmp_strsplit(char *s, char c)
{
char **res;
int i;
i = -1;
if (!s || !strlen(s))
return (0);
res = malloc((strlen(s) / 2 + 1) * sizeof(char*));
s = _strdup(s);
while (*s)
{
while (*s == c)
{
*s = ... |
C | #include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdbool.h>
#include "ordenacao.h"
#include "utils.h"
bool twosum_bruteforce(int *v, int n, int x)
{
}
int main(int argc, char** argv)
{
int v[] = {2, -1, 5, 8, 7, 4};
int n = 6;
twosum_bruteforce(v, n, 14);
retu... |
C | #ifndef UTILS_TIME_H
#define UTILS_TIME_H
#include <time.h>
#include <sys/time.h>
#define RFC3339_SIZE 26 /* 2006-01-02T15:04:05+00:00 */
/* rfc3339 formats a cdtime_t time as UTC in RFC 3339 zulu format with second
* precision, e.g., "2006-01-02T15:04:05Z". */
int rfc3339(char *buffer, size_t buffer_size, tim... |
C | //
// xSemaphore.h - x-platform semaphore for iOS & Android (POSIX)
// AudioFetchSDK
//
// Copyright © 2019 Beach Cities Software, LLC. All rights reserved.
//
#ifndef xsemaphore_h
#define xsemaphore_h
#include <stdint.h>
#include <sys/time.h>
#include <sys/types.h>
#include <errno.h>
#if __APPLE__
#define __USE_... |
C | // File: c/pointers/function-pointer/compare.c
// Created by hengxin on 17-11-22.
// Illustration of "function pointer" using c "qsort"
#include <stdio.h>
#include "../../../c/array/array.h"
int compare(const void *a, const void *b) {
return (*((int *) a)) - (*((int *) b));
}
int compare_reverse(const void *a, c... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <stdbool.h>
double twoDecs(double n)
{
return (int)(n*100)/100.0;
}
double rand2dot2(bool printDetails)
{
int num = rand();
double doubleNum = (double) (num % 10000) / 100; //to put in form xx.yy e.g. 73.56%
... |
C | #include <stdio.h>
int main(void) {
printf("char:\t%d\n", 'a' != EOF);
printf("EOF:\t%d\n", EOF != EOF);
return 0;
}
|
C | /*====================================================*\
Vendredi 8 novembre 2013
Arash HABIBI
Image.c
\*====================================================*/
#include "Image.h"
//------------------------------------------------------------------------
Color C_new(unsigned char red, unsigned char green, unsig... |
C | /*
* Acess2 C Library
* - By John Hodge (thePowersGang)
*
* perror.c
* - perror() and friends
*/
#include <errno.h>
#include <stdio.h>
void perror(const char *s)
{
fprintf(stderr, "%s: Error (%i)\n", s, errno);
}
|
C | #include "cachelab.h"
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include <getopt.h>
#include <stdlib.h>
#define MAXFILELEN 100
#define MAXCMDLEN 20
struct Line{
int valid;
int tag;
int lru; //we use lru algo
};
struct Set{
struct Line *lines;
};
struct Cache{
... |
C | /* $Id: topSchedule.C,v 1.4 2003-01-13 04:34:30 fateneja Exp $ */
/* File sections:
* Service: constructors, destructors
* Solution: functions directly related to the solution of a (sub)problem
* Utility: advanced member access such as searching and counting
* List: maintenance of lists or arrays of objects
*/
#... |
C | #include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include "inter-code.h"
Operand* newOperand(OperandKind kind) {
Operand *p = (Operand*)malloc(sizeof(Operand));
p->kind = kind;
p->name = p->text = NULL;
return p;
}
Operand* newVarOperand() {
static int cnt = 0;
Operand *p = newOperand(VARIABLE);
p->id... |
C | typedef struct string_class string_class_t;
typedef struct string string_t;
extern string_class_t String;
struct string_class {
string_t * (* new) (char *);
void (* init) (string_t * self, char *);
void (* delete) (string_t * self);
string_class_t * (* klass) (string_t * self);
char * (* ... |
C | /*main.c*/
#include <stdio.h>
#include "add.h"
#include "sub.h"
int main(void)
{
int a = 10, b = 12;
float x= 3.2f,y = 9.8f;
double m=3.2,n=6.4;
printf("x=%f,y=%f\n",x,y);
float sumf=add_float(x,y);
float subf=sub_float(x,y);
printf("float x+y IS:%f\n",sumf);
printf("float ... |
C | /***************************************************************************//**
*
* @file OLED.h
* @brief Header file for OLED Display (SSD1305)
* @author Embedded Artists AB
* @author Geoffrey Daniels, Dimitris Agrafiotis
* @version 1.0
* @date 14 March. 2012
* @warning Initialize I2C or SPI, and GPIO... |
C | /* fs.c */
#include <stdio.h>
#include <conio.h>
#define FILE_NUM 10
#define FILE_SIZE (1024*10)
#define PUT_PROMPT printf("FS#")
const char file_system_name[] = "fs.dat";
FILE *fp;
struct inode{
char file_name[512];
int file_length;
};
struct inode *p;
... |
C | /**
* \file
* A very simple Contiki application showing how Contiki programs look
* \author
* mds
*/
#include "contiki.h"
#include <stdio.h> /* For printf() */
#include "dev/leds.h"
#include "ieee-addr.h"
#include <string.h>
#include "dev/serial-line.h"
#include "dev/cc26xx-uart.h"
#include "buzze... |
C | #include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
// Nom des différentes extensions
char fig[5]=".fig\0",
lfig[11]="_liste.fig\0",
res[5]=".res\0",
hach[13]="_hachage.res\0",
abr[9]="_abr.res\0";
// Change l'extension de chaine par ext
char *changeExtension(char *chaine, char *e... |
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 | #include <stdio.h>
int main(void) {
//khai bao bien R
double R;
R = 2.5 ;
//khai bao bien PI
const double PI = 3.14;
double CV, DT;
printf ("R=%1.f", R);
printf ("\n");
printf ("PI=%2.f", PI);
//chu vi
CV = (double) 2*R*PI;
//dien tich
DT = (double) R*R*PI;
printf ("\n\n");
printf("2*R*... |
C | #include<stdio.h>
#include<string.h>
void subset(int,int);
void display();
int x[10],count;
char str[10];
int main()
{
int n;
printf("enter string \n");
scanf("%s",str);
n=strlen(str);
subset(0,n-1);
printf("%d",count);
return 0;
}
void subset(int k,int n)
{
if(k==n)
{
x[k]=1;
display(n);
... |
C | #include <stdio.h>
#include <stdlib.h>
struct node* create_node(int);
struct node* search_node(struct node *, int);
struct node
{
int info;
struct node *next;
};
int isLoop(struct node *s)
{
struct node *p, *q;
p = q = s;
do
{
p = p->next;
q = q->next;
q = (q->next !... |
C | #include<stdio.h>
void sum(int x,int y);
main()
{
int a,b;
a=10,b=20;
sum(a,b);
}
void sum(int x,int y)
{
int z;
z=x+y;
printf("result=%d",z);
}
|
C | /* Filter header
*
* 2017-02-17 Scott Lawrence
*
* Filter console input to provide a backchannel for data transfer
*/
#ifndef __FILTER_H__
#define __FILTER_H__
////////////////////////////////////////
/* pass-through */
#define kPS_IDLE (0)
/* Start command? */
#define kEscKey (0x1b)
#define kPS_ESC (1)
... |
C | #include <stdio.h>
//[]
void SwapValue(int iNum1, int iNum2);
void SwapRef(int * pNum1, int * pNum2);
void main()
{
/*
ϴ ?
1. Լ Լ ܺ
2. Ҵ
Լ Ű
1. Call by Value
- ȣ
-츮 Լ ȣߴ
- '' ´.
2.Call by Reference(address)
- ȣ(ּҿ ȣ)
-ͺ Ű Ͽ 'ּ ' ´.
... |
C | // main function for program
#include "main.h"
// main function
int main(int argc, char **argv) {
// check arguments
options args = {.valid = 0,.help=0,.promiscuous=0,.toTerminal=0,.toFile=0,.filter=0};
parseArguments(&args, argc, argv);
if (!args.valid) {
// argument parser determined arguments were invalid
... |
C | /*
* File: main.c
* Author: apurv
*
* Created on 6 August, 2010, 8:45 PM
*/
#include <stdio.h>
#include <stdlib.h>
/*
*
*/
int main2(int argc, char** argv) {
//forkDemo1();
//forkDemo2();
//forkDemo3();
//waitDemo1();
//execDemo();
//sharedMemoryDemo();
//system("clear");
/... |
C | #include "stm32f4xx_i2c.h"
#include "adpd.h"
#include "i2c.h"
#define ADPD_SLAVE_ADDR 0x64
/******************************************************************************
* FIFO data ready interrupt
*/
void
EXTI0_IRQHandler( void )
{
}
/*************************************************************************... |
C | #include"myheader18.h"
int main()
{
FILE *fptr1, *fptr2;
char filename[30], str[100];
int len, i, j=0, flag =0, len1, in; //in--to read the words of file
snode *top = NULL;
printf("Enter file name : ");
memset(filename,0,30*sizeof(char));
fgets(filename,29,stdin);
len = strlen(filename);
if('\n' == filename... |
C | #pragma strict_types
#include "../def.h"
inherit MASTER_ROOM;
void create_object(void);
void reset(int arg);
void create_object(void)
{
set_short("A well on the farm (n)");
set_long("A small flat lawn in a corner of the farm, where a well " +
"has been built. The well is built of stone and stands... |
C | #include <stdio.h>
#include <string.h>
#define MAX_LENGTH 155
void eliminateZeros(char number[]);
int result(char numOne[] , char numTwo[]);
void eliminateZeros(char number[])
{
int pos = 0;
int zeroCount = 0;
for(int i=0; number[i] != '\0'; i++) // Get the Zero Count
{
if(number[i] != '0') {... |
C | // Eric Johnson
// Lab1a - 2
// #8 from textbook. Write program to print a conversion table from feet to meters using
// the temperature conversion program as starting point.
// Header File
// REFERENCE: http://www.cs.colorado.edu/~main/chapter1/temperature.cxx
// File: temperature.cxx ... |
C | /*
Main source file for ezOS initializations
Author: Boris Kim
*/
#include "ezOS.h"
/**********************************************GLOBAL VARIABLES********************************************/
// scheduler
extern scheduler_t scheduler;
// TCB's
extern tcb_t tcb[NUM_TCB];
extern tcb_t main_tcb;
/***************... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.