language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
int main() {
int i, j, x, y, k, hcf, lcm;
printf("Enter two integers\n");
scanf("%d%d", &x, &y);
i = x;
j = y;
while (j != 0) {
k = j;
j = i % j;
i = k;
}
hcf = i;
lcm = (x*y)/hcf;
printf("highest common factor of %d and %d = %d\n", x, y, hcf);
printf(... |
C | #include <stdio.h>
#include "complex.h"
/* function mult2 that takes two complex structures, a and b,
and returns a complex structure representing their product.
[Recall if a = x1 + y1 i and b = x2 + y2 i,
then a * b = (x1 * x2 - y1 * y2) + (x1 * y2 + x2 * y1) i ]
*/
int main(void) {
test();
return 0;
}
comple... |
C | #include <stdio.h>
#include <string.h>
#include "../src/runtime-copy.c"
#include <assert.h>
// which indices we are currently on for one of the tensors,
// given the indices we are on for the result tensor
nat *curr_ind_tens(T *t, nat ind, int offset, nat *current_ind)
{
nat *t_ind = malloc(sizeof(nat) * (t->rank... |
C | #include "../headers/core.h"
mpi_env_t get_mpi_env(int numtasks, int root, int rank, int length){
mpi_env_t* env = (mpi_env_t*) malloc(sizeof(mpi_env_t));
env->numtasks = numtasks;
env->root = root;
env->rank = rank;
int chunk = length / numtasks;
//if i'm the last one
if(rank == (numtasks - 1)){
chunk = leng... |
C | #include <stdio.h>
int main()
{
char str[] = "Hello world";
printf("%s \n", str);
printf("%10s \n", str);
printf("%.10s \n", str);
printf("%-10s \n", str);
printf("%-15s \n", str);
printf("%15.10s \n", str);
printf("%-15.10s\n", str);
return 0;
}
|
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
typedef struct node
{
char string[100];
int freq;
struct node *next;
}Node;
int insert(Node **H,char *w)
{
Node *x;
if((*H)==NULL)
{
(*H)=(Node*)malloc(sizeof(Node));
strcpy((*H)->string,w);
(*H)->freq=1;
(*H)... |
C | #include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#define STRING_SIZE 512
#define BOLD_RED "\e[1;31m"
#define RESET "\e[0m"
typedef struct item {
int key;
char string[STRING_SIZE];
} item;
typedef struct hash_table {
item **arr;
int capacity;
} hash_table;
item dummy_it... |
C | /******************************************************
LEDԳTX2440A
÷
豸ƣTX2440-led
Գƣled
ֻһҲΪ0 1
led 0ĸȫ
led 1: ĸȫ
1ʾյƣ2ʾ
led 1 0һյ
led 4 1: յ
*******************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/ioctl.h>
int main(int argc, c... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
char space, *prime;
short low, high, temp, i, j;
freopen( "function.in", "r", stdin );
freopen( "function.out", "w", stdout );
scanf( "%hd %hd", &low, &high );
if ( low > high ) {
temp = low;
low = high;
high = temp;
}
... |
C | #include <stdio.h>
int max();
int min();
void main()
{
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
int max_s = max(a, b, c);
int min_s = min(a, b, c);
if (a+b>max_s && a+c>max_s && b+c>max_s)
{
if (a-b<min_s && a-c<min_s && b-c<min_s)
{
printf("YES");
}
else
{
printf("ERROR DATA");
}
}
else {
... |
C | #include "Decoder.h"
int deserialize_int(unsigned char * buffer, int loc) {
int value = buffer[loc] << 24;
value += buffer[loc+1] << 16;
value += buffer[loc+2] << 8;
value += buffer[loc+3];
return value;
}
short deserialize_shr(unsigned char * buffer, int loc) {
short value = buffer[loc] << 8;
value += buffer[lo... |
C | //Problem Statement :: Program to multiply two matrices
#include <stdio.h>
#define N 2
int multiplicationMatrix(int A[][N],int B[][N],int C[][N])
{
for(int i=0;i<N;i++)
{
for(int j=0;j<N;j++)
{
C[i][j] = 0;
for(int k=0;k<N;k++)
{
C[i][j] += A[i][k]*B[k][j];
}
}
}
//return C;
}
int main()
{
i... |
C | #include <stdlib.h>
#include <stdio.h>
int suma(int n)
{
if (n > 1)
return n + suma(n - 1);
else
return 1;
}
int factorial(int n)
{
if (n > 1)
return n * factorial(n - 1);
else
return 1;
}
int suma_cifrelor(int n)
{
if (n < 10)
return n;
else
return n % 10 + suma_cifrelor(n / 10);
}
int main()
{
prin... |
C | /* pamwipeout.c - read a bitmap and replace it with a gradient between two
** edges
**
** Copyright (C) 2011 by Willem van Schaik (willem@schaik.com)
**
** Permission to use, copy, modify, and distribute this software and its
** documentation for any purpose and without fee is hereby granted, provided
** that the above... |
C | /*
<imval.c>
27mar91 jm Original code.
26feb92 jm Added radecfmt code.
14aug92 jm Modified wipradecfmt() to return pointer to a static
duration string rather than a local scope one.
Routines:
float wipimval ARGS(( float **image, int nx, int ny, float xpos, float ypos, float tr[], LOGICAL *error ));... |
C | #include "D:\proga\library.h"
#include <stdio.h>
int maxflow(graph_user graphik, int first_node, int second_node){
graph_user graph = copy_graph(graphik);
int count_node = func_count_node(graph);
int metka = 1;
int i,k;
int line[count_node];
int yes[count_node]; int p = 0;
while (metka != 0){
for (i = 0;... |
C | /*
Input:4 5
Output:
2 4 6 8 10
1 3 5 7 9
2 4 6 8 10
1 3 5 7 9
*/
#include <stdio.h>
void Pattern3(int iRow,int iCol)
{
int i=0,j=0;
for(i=1; i<=iRow; i++)
{
for(j=1; j<=iCol; j++)
{
if(i%2 != 0)
{
printf("%d ",j*2);
... |
C | #define MAXFORMULA 100
void readFormula(struct treeNode *currentTreeNode, char formula[], int *index);
void printFormula(struct treeNode *currentTreeNode);
struct treeNode {
char element;
struct treeNode *leftSon;
struct treeNode *rightSon;
};
void openFile(){
char formula[MAXFORMULA];
FILE *fp;
... |
C | #include "merge.h"
#include "record.h"
//manager fields should be already initialized in the caller
int merge_runs (MergeManager * merger){
int result; //stores SUCCESS/FAILURE returned at the end
//1. go in the loop through all input files and fill-in initial buffers
if (init_merge (merger)!=SUCCESS)
return... |
C | #include "../include/shell.h"
extern size_t my_offset;
int printing_command = FALSE;
typedef void(*commandFnct)(void);
static struct {
char* name;
char* description;
PROCESS task_function;
} commands[NUM_COMMANDS] = { { "help", "Display system commands", help }, {
"echo", "Prints string", echo },
// { "shortc... |
C | //C program John Woltz
// Comp 530
// On my honor, I pledge that I have neither given nor received unauthorized aid on this assignment
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#define MAX_INPUT 80
main(){
char fileName[MAX_INPUT];
int childPID;
char *holder;
char *args[MAX_... |
C | /* дһΪַȡֱEOFóӡÿַASCIIʮֵ
* עASCIIпոַǰַǷǴӡַҪЩַ
* ǴӡַǻзƱֱӡ\n\tʹÿַš
* 磬ASCIIlCtrl+AʾΪAAעAASCֵCtrl+Aֵ64
* ǴӡַҲƵĹϵȥÿһзʱͿʼһ֮⣬ÿдӡ10ֵ
*/
#include <stdio.h>
#include <stdlib.h>
int main()
{
char ch;
FILE * fp;
fp = fopen("d:\\123.txt","r");
if(fp == NULL)
{
printf("ļʧܣ\n");
exit(1);
... |
C | # include <stdlib.h>
# include <stdio.h>
int main( int argc, char ** argv )
{
unsigned long int iFactorielle = 1;
unsigned int iNombre = 0;
unsigned int i = 0;
printf( "Entrer un nombre entre 0 et 15 : " );
scanf( "%d", &iNombre );
if( ( iNombre >= 0 ) && ( iNombre <= 15 ) )
{
for( i = 1; i <= iNombre; i++ )
... |
C | /**
* \file InputSource.h
*
* \author Raphael Montanari
* \date 23/05/2013
*
* Enum InputSource header file.
*/
#ifndef INPUT_SOURCE_H
#define INPUT_SOURCE_H
/**
* \enum InputSource
* \brief The source video input.
**/
enum class InputSource {
NONE, /**< Not capturing images. */
CAMERA, /**< Cap... |
C | #include <stdio.h>
#include <stdlib.h>
//Fazendo um programa de reajuste salarial
//Se cargo = 1 : 7% - Se cargo = 2 : 9% - Se cargo = 3 : 5% - Se cargo = 4 : 12%
int main()
{
int cargo;
float salario, reajuste, salarioa;
printf("Informe o seu cargo: ");
scanf("%d", &cargo);
printf("\nInforme seu salario atu... |
C |
#include <stdio.h>
#define max 100
struct stack
{
int top;
int a[max];
}s;
//void push(int *,int);
//int pop(int *);
//int isstackempty(int *);
//int isstackfull(int *);
//void display(int *);
int isstackempty(struct stack *s1)
{
if(s1->top==-1)
return 1;
else
return... |
C | /*
*
* Task 2 ANSI Terminal Control Sequences
*
*/
//------------------------------------------------------------------------------------
// Includes
//------------------------------------------------------------------------------------
#include "stm32f769xx.h"
#include "hello.h"
#include<stdint.h>
... |
C | #include <stdio.h>
void main(){
float a,b,c,area,t;
printf("֣");
scanf("%f%f%f,",&a,&b,&c);
printf("a=%.2f,b=%.2f,c=%.2f",a,b,c);
if(a+b>c&&a+c>b&&b+c>a){
t = (a+b+c)/2.0;
area = sqrt(t*(t-a)*(t-b)*(t-c));
printf("\n");
printf("Ϊ:%.4f",area);
printf("\n");
if(a==b&&a==c){
printf("ȱ");
} else if... |
C | #define _DEFAULT_SOURCE /* for snprintf(3) */
#include "ast.h"
#include "ramfuck.h"
#include "symbol.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
* AST allocation and initialization functions.
*/
struct ast *ast_value_new(struct value *value)
{
struct ast_value *n;
if ((n = malloc(sizeof... |
C | #include <stdio.h>
#include <stdlib.h>
int board[50];
int cache[50][50];
int ENF = -987654321;
int playGame(int left, int right){
int * ret = &cache[left][right];
int leftChoice, rightChoice;
if(left > right)
return 0;
if(*ret != ENF)
return *ret;
if(left == right)
return board[left];
leftChoice ... |
C | #include <unistd.h>
#include "../../commons/src/dbg.h"
#include "minunit.h"
#include "../src/lib/mip_route_table.h"
char *test_MIPRouteTable_create() {
MIPRouteTable *table = MIPRouteTable_create(1);
mu_assert(table != NULL, "Table pointer should not be NULL");
MIPRouteTable_destroy(table);
return NUL... |
C | /** 2014 Neil Edelman
This is the simulation of a client.
@author Neil
@version 1
@since 2014 */
#include <stdlib.h> /* malloc free */
#include <stdio.h> /* fprintf */
#include <string.h> /* str* */
#include <ctype.h> /* toupper */
#include <unistd.h> /* sleep */
#include <pthread.h>
#include "Spool.h"
#in... |
C | #include<stdio.h>
int main()
{
int numOfProcess,burstTime[10],waitingTime[10],turnAroundTime[10],averageWaitingTime=0,i,j;
do{
printf("Number of processes:");
scanf("%d",&numOfProcess);
if (numOfProcess>10 || numOfProcess <1)
{
printf("Please enter a process number b... |
C | #pragma once
#include "Joycon.h"
//Returns new Joycon struct
joycon_t make_joycon(const struct hid_device_info* dev) {
if (dev == NULL) {
perror("Device cannot be NULL pointer.");
exit(1);
}
joycon_t jc;
if (dev->product_id == JOYCON_L_BT) {
const char name[32] = "Joy-Con (L)";
strcpy_s(jc.name, sizeof(j... |
C | #include <stdio.h>
enum tresholds_t
{
TRESHOLDS_FIRST = 10,
TRESHOLDS_SECOND,
TRESHOLDS_THIRD = 20
};
void sort(int* values, int* indexes, int n)
{
int i;
int j;
for (i = 0; i < (n - 1); i++)
{
for (j = i + 1; j < n; j++)
{
if (values[i] - values[j] < 0)
{
int tmp;
tmp... |
C | #include "Epoll.h"
/**
* epoll初始化
*/
int epoll_init()
{
int epoll_fd = epoll_create(EPOLL_MAX_NUM);
if(epoll_fd < 0){
printf("epoll_create failed in %s\n", __func__);
return -1;
}
printf("\nepoll_init successful!\n");
return epoll_fd;
}
/**
* 初始化event_arg
*/
struct event_arg* eve... |
C | /* Program Description: Client process that accepts arithmetic expressions from the user,
* sends to the server and displays the result recieved from the server.
*
* Authors: Asmit De (10/CSE/53)
* Samik Some (10/CSE/93)
*
* Date: August 17, 2013
*/
#include <stdio.h>
#include <stdlib.h>
#include <st... |
C | #include <functions.h>
void test_stack(int argc,char * argv[],char** env)
{
int i=0;
// while(env[i]!=0){
// printf("%s\n", env[i++]);
// }
printf("ARGC:%d ARGV:%x\n", argc, (unsigned int)argv);
for (i = 0; i < argc; i++)
printf("Argv[%d] = %x pointing at %s \n", i, (unsigned int)argv[i], argv[i]);
}
|
C | /**
* pagerank.h to announce the functions of pagerank
*
*/
#ifndef _PAGERANK_H_
#define _PAGERANK_H_
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define LEN 1000
typedef struct graph {
char urlname[LEN];
int numberOfHyperlinks;
struct graph ** hyperlinks;
struct graph * next;
}graph... |
C | #include "stdio.h"
#include "string.h" //memcpy function defined in this lib
int main(void)
{
char a[]= "test";
char b[sizeof(a)];// need to set the size if not assign initial values
memcpy(b, a, sizeof(b)); //void *memcpy(void *str1, const void *str2, size_t n)
printf("b a... |
C |
#include "stm32f10x.h"
#include "stm32f10x_rcc.h"
#include "stm32f10x_gpio.h"
#include "iic2.h"
#include "delay.h"
/***********************************************************
* : IIC_GPIO_Config()
* : IICʼ
* :
* :
* :
* ע:
***********************************************************/
void I2C_GPIO_Config(void)
{
... |
C | #include <stdio.h>
int main(){
int n, resto, palin = 0;
int ris = 0, ex = 10;
int div;
scanf("%d", &n);
div = n/ex;
while(div != 0 && !palin){
div = n/ex;
resto = n % ex;
ris = ris*10 + (resto/(ex/10));
if(ris == n)
palin = 1;
ex = ex*10;... |
C | #include <stdio.h>
int main(int argc, char const *argv[]) {
printf("Nome do executavel: %s\n",argv[0]);
for (int i = 1; i < argc; ++i)
{
printf("Parametro #%d: %s\n",i, argv[i]);
}
return 0;
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strsplit.c :+: :+: :+: ... |
C | /*
* auth.c
*
* Created on: Jul 7, 2016
* Author: admin_user
*/
#define _GNU_SOURCE
#include <crypt.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include "ocslock.h"
#include "ocslog.h"
#include "auth.h"
void __attribute__((constructor)) initialize(void);
static int delete_entry(char ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* dict_new.c :+: :+: :+: ... |
C | // SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
/*
* Copyright 2013-2015 IBM Corp.
*/
#define BUFSZ 50
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <stdio.h>
int test_memset(char* buf, int c, size_t s);
int test_memchr(const void *ptr, int c, size_t n, void* expected);
int test_m... |
C | #include<stdio.h>
int main() {
int a[5] = {1,20,3,4,5}; // This is the array of numbers
int max_val = a[0]; // We store the max_value in a[0]
int i; // We define the loop counter
for (i = 1; i < 5; i++){ // Structure of the for loop
if (max_val < a[i]){ // if max_value is less than a[i], we change the ma... |
C | #include "do_op.h"
int choose_func(char *str)
{
if (!ft_strncmp(str, "+", 1))
return (0);
if (!ft_strncmp(str, "-", 1))
return (1);
if (!ft_strncmp(str, "/", 1))
return (2);
if (!ft_strncmp(str, "*", 1))
return (3);
if (!ft_strncmp(str, "%", 1))
return (4);
else
return (-1);
}
int main(int argc, cha... |
C | /* Internet Programming 2015/2016
*
* Assignment 1
* Authors: Baris Can Vural, Floris Turkenburg
* VUNetID: bvl250, ftg600
*/
#include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <pthread.h>
pthread_mutex_t mutex;
void display(char *str) {
char *... |
C | /* Names: Tyler Andrews, Brennan Campbell, and Tyler Tetens
* Title: Experiment #4 - Fat File System
*/
#include "AT89C51RC2.h"
#include <stdio.h>
#include "main.h"
#include "PORT.H"
#include "UART.h"
#include "SPI.h"
#include "SDCard.h"
#include "print_bytes.h"
#include "Directory_Functions_struct.h"
#in... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h>
typedef struct dado {
char categoria[200];
char inicio[11];
char fim[11];
int Km;
int id;
char placa[8];
char modelo[100];
char fabricante[200];
char disp[2];
int ocp;
char ar[2];
}dados;
void zera_id(dados... |
C | #include "holberton.h"
/**
* rev_string - invert the order of character of a string
* @s: string to change
*/
void rev_string(char *s)
{
int a, b;
char inicio, fin;
a = 0;
b = 0;
while (s[a] != '\0')
{
++a;
}
for (a = (a - 1) ; a >= b ; a--)
{
fin = s[a];
inicio = s[b];
s[b] = fin;
s[a] = inicio... |
C | #include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#define NAME_SIZE 80
int main() {
FILE *fp;
char fname[NAME_SIZE];
char ch;
printf("enter the file name: ");
if (scanf("%s", fname) == 0) {
printf("no filename entered, process exit!\n");
exit(EXIT_FAILURE);
}
if ((fp = fopen(f... |
C | struct ListNode{
int val;
struct ListNode* next;
};
/*recur: top->down*/
// struct ListNode* merge(struct ListNode* left, struct ListNode* right){
// struct ListNode dummy = {-1, NULL};
// struct ListNode* tail = &dummy;
// while(left && right){
// //insert the smaller val
// if(left->val > right->val){
// ... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include "hash_map.h"
enum
{
ITEM_EMPTY = 0,
ITEM_DELETE,
ITEM_USED,
};
struct hash_item
{
uint64_t hash_code;
int8_t flag;
int8_t key_and_val[0];
};
struct hash_map
{
hash_func _hash_function;
hash_key_eq _key_cmp_function;
ha... |
C | #include <stdlib.h>
#include <stdio.h>
typedef struct LISTA{
struct LISTA *prox;
struct LISTA *ante;
int L;
}LISTA;
void insereFim(LISTA* *list, int tamanho);
void trocaVagao(LISTA* *list, int tamanho);
void iniciaLista(LISTA* *list);
int main(void){
LISTA* list;
int N, i;
scanf("%d", &N)... |
C | #include <stdio.h>
void power2(int number, int power);
int main(void) {
printf("sizeof(unsigned int) = %d bits\n", sizeof(unsigned int) * 8);
printf("sizeof(int) = %d\n", sizeof(int) * 8);
puts("");
power2(2, 0);
power2(2, 1);
power2(2, 2);
power2(2, 3);
power2(2, 4);
}
void power2(i... |
C | /*
* NAME
* mallocWarn
* reallocWarn
*
* AUTHOR
* I. Henson
*/
#include "config.h"
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include "libstring.h"
#include "logErrorMsg.h"
/**
* @private
*/
void *
mallocWarn(int nbytes)
{
void *ptr;
if(nbytes <= 0) {
... |
C | /*
* datasize.c -- print the size of common data items
* This runs with any Linux kernel (not any Unix, because of <linux/types.h>)
*
* Copyright (C) 2001 Alessandro Rubini and Jonathan Corbet
* Copyright (C) 2001 O'Reilly & Associates
*
* The source code in this file can be freely used, adapted,
* and redistri... |
C | #include <stdio.h>
#include <stdlib.h>
int whileloop(int x);
int dowhileloop(int x);
int forloop(int x);
int main(void)
{
int x=5;
whileloop(x);
printf("-------\n");
dowhileloop(x);
printf("-------\n");
forloop(x);
return 0;
}
int whileloop(int x)
{
int y;
while(y<x)
{
... |
C | /**
* @brief Add a new colorselector to the parent
*
* @param parent The parent object
* @return The new object or NULL if it cannot be created
*
* @ingroup Colorselector
*/
EAPI Evas_Object *elm_colorselector_add(Evas_Object *parent);
/**
* Set color to colorselector
*
* @param obj Colorselector object
* @... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
int generate(char * filename,int record_length,int number_of_records){
FILE * handle = fopen(filename, "ab+");
if(handle==NULL){
perror(filename);
return 1;
}
char * record = malloc(record_length);
for(int i=0;i<number_of_records;i++... |
C | /*Implementar una función que reciba una cadena representando un número hexadecimal y
retorne el valor decimal de la misma.
La función debe invocarse desde un programa interactivo.*/
#include <stdio.h>
#include <math.h>
#include <string.h>
int HexToDeg(char hex[17]){
long long decimal;
int i = 0, val... |
C | #include <stdlib.h>
#include <dbg.h>
#include <string.h>
#include <linkedlist.h>
tNode* addNodeSpaceship(tNode** current, struct Spaceship *s) {
Spaceship *heaps = malloc(sizeof(Spaceship));
check_mem(heaps);
memcpy(heaps, s, sizeof(Spaceship));
tNode* newnode = malloc(sizeof(tNode) - 1 + sizeof(Space... |
C | #include "skiList.h"
static char skiListID;
typedef struct _pulleyNode
{
struct _pulleyNode* prev;
struct _pulleyNode* next;
}PulleyNode_t;
typedef struct _listHead{
PulleyNode_t pulley;
size_t listSize;
size_t dataSize;
void* headID;
}ListHead_t;
typedef struct _listNode{
PulleyNode_t pulley;
void* nodeID;... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "Interpreter/Interpreter.h"
#include "Interpreter/Functions.h"
#include "Parser/Parser.h"
#include "Util/StringBuffer.h"
bool check_let_args (ParseTree* args);
Value* function_append (Environment* environment, ParseTree* args)
{
// Empty list c... |
C | /*
Copyright 2012-2014 Scianta Analytics LLC All Rights Reserved.
Reproduction or unauthorized use is prohibited. Unauthorized
use is illegal. Violators will be prosecuted. This software
contains proprietary trade and business secrets.
Module: saLinearRegression
Description:
Perform Linear Re... |
C | #include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>
#include <cairo.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
static void *img_expand24(int width, int height, int stride, const void *bytes)
{
uint8_t *rgb = malloc(width*height*3);
if(rgb == NULL) return NULL;
int adjust = stride -... |
C | //
// fskmodem_waterfall_example.c
//
// This example demostrates the M-ary frequency-shift keying
// (MFSK) modem in liquid by showing the resulting spectral
// waterfall.
//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
#include <math.h>
#include "liquid.h"
// print usage/help mes... |
C | #include <stdio.h>
#define N 10
int main(void)
{
double *p, ident[N][N];
int num_zeros = N;
for (p = ident[0]; p < ident[N]; p++)
if (num_zeros == N) {
*p = 1.0;
num_zeros = 0;
} else {
*p = 0.0;
num_zeros++;
}
return 0;
}
|
C | #include<stdio.h>
void main(void)
{
int sum=100,i=0,n=100;
// printf("n=");scanf("%d",&n);
while(i<=n){
sum+=i++;
}
printf("sum 1 to %d=%d\n",n,sum);
} |
C | #include "rc/buf.h"
#include "tn/error.h"
// --------------------------------------------------------------------------------------------------------------
int rc_buf_setup(rc_buf_t *buf, uint16_t capacity)
{
TN_ASSERT(buf);
TN_GUARD(aws_byte_buf_init(&buf->bb, aws_default_allocator(), capacity));
buf->bb.buffer[0... |
C | #include <dlfcn.h>
#include <stdio.h>
typedef struct Point* (_make_point)( int x, int y);
typedef struct Point* (_free_point)(struct Point* p);
typedef double (_get_distance)( struct Point* a, struct Point* b);
int main(int argc, char *argv[]) {
void *myso = dlopen("./libpoints.dylib", RTLD_NOW);
_ma... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* spot.c :+: :+: :+: ... |
C | #include "Board.h"
/**
@name create_board
@brief stores the memory needed for a board
@param width the number of columns
@param height the number of rows
@param number_neighbours the number of live neighbours that a cell needs to start living
@param posible_neighbours an array of posible neighbours that a cell needs... |
C | #include <stdio.h>
int main(void)
{
int i;
float niz[7], suma = 0; // Promenljive u vezi zadatka
for(i = 0; i < 7; i++) {
printf("Unesite niz[%d] = ", i);
scanf("%f", &niz[i]);
}
i = 0; // Vraćanje na vrednost 0!
while(i < 7) {
suma += niz[i];
i +=... |
C | #include "getSetFunctions.h"
#include <dlog.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
void error(char *msg) {
perror(msg);
exit(0);
}
char* concat(const char... |
C | ////////////////////////////////////////////////////////////////////////////////
// Comments
// Explores whether atof() can handle negative numbers.
// Works!
////////////////////////////////////////////////////////////////////////////////
// Libraries
#include <stdio.h>
#include <stdlib.h>
///////////////////////... |
C | #include<stdio.h>
int main()
{
char str[100];
int I,J=0;
printf("Enter A String : ");
gets(str);
while(str[J] != '\0')
J++;
printf("\nReverse Of Given String Is : ");
for(I=J-1; I>=0; I--)
printf("%c",str[I]);
printf("\n");
return 0;
}
|
C | #include<stdio.h>
#include<math.h>
void main()
{
float a,b,c,p,q,d;
printf("Quadratic equation is ax^2 + bx + c=0\n");
printf("a is coefficient of x^2 and b is coefficient of x and c is constant\n");
printf("\na=");
scanf("%f",&a);
printf("\nb=");
scanf("%f",&b);
printf("\nc=");
scanf("%f",&c);
p=((+sqr... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "memo.h"
#include "matriz_vector.h"
#include "utils.h"
#include "met_num.h"
int main(int argc, char **argv) {
if(argc < 5) {
printf("Error. Ejecuta: %s [Nombre del archivo] [Número de iteraciones] [Tolerancia] [Tipo de Hessiana].... |
C | /*
* Serial drivers for ATmega640 family, with software FIFOs for
* receive and transmit.
*
* Author: Ken Tindell
* Copyright (c) 2014-2015 JK Energy Ltd.
* Licensed under MIT License.
*/
#include <udi_cdc.h>
#include "usb_serial.h"
#include <min/min_transmit_cmds.h>
/* Sending process:
* - A FIFO for sendin... |
C | #include "common.h"
sNodeTree* gNodes;
int gSizeNodes = 0;
int gUsedNodes = 0;
void init_nodes()
{
const int node_size = 32;
if(gUsedNodes == 0) {
gNodes = (sNodeTree*)xcalloc(1, sizeof(sNodeTree)*node_size);
gSizeNodes = node_size;
gUsedNodes = 1; // 0 of index means null
}
}
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <log.h>
#include "sparse_matrix.h"
t_sm_node new_node(unsigned int pos, unsigned int value)
{
t_sm_node node;
node.pos = pos;
node.value = value;
return node;
}
void free_node(t_sm_node *node)
{
/* free(*node);
*node = NULL; */
}
void print_nod... |
C | /**
************************************************************
************************************************************
************************************************************
* 文件名: EdpKit.c
*
* 作者: 张继瑞
*
* 日期: 2017-09-13
*
* 版本: V1.1
*
* 说明: EDP协议
*
* 修改记录: V1.1:将strncp... |
C | /* Public domain */
/*
* This application demonstrates use of the AG_Pane container widget.
*/
#include "agartest.h"
static AG_Window *
SettingsWindow(void *obj, AG_Pane *paneHoriz, AG_Pane *paneVert)
{
const char *actions[] = {
"EXPAND_DIV1",
"EXPAND_DIV2",
"DIVIDE_EVEN",
"DIVIDE_PCT",
NULL
};
AG_Wind... |
C | int sum(int n)
/*@
requires n >= 0 ensures res = n * (n+1) * (n+2) /3;
*/
{
if (n ==0) return 3;
else return n*(n+1) + sum(n-1);
}
|
C | #define Measure 2 //Mode select
#include <Servo.h> // Include Servo library
Servo myservo;
// These two ends are used for chao sheng bo chuan gan qi
int URECHO = 4; // PWM Output 0-25000US,Every 50US represent 1cm
int URTRIG = 5; // PWM trigger pin
int sensorPin ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
/*
表达式转换
算术表达式有前缀表示法、中缀表示法和后缀表示法等形式。日常使用的算术表达式是采用中缀表示法,即二元运算符位于两个运算数中间。请设计程序将中缀表达式转换为后缀表达式。
输入格式:
输入在一行中给出不含空格的中缀表达式,可包含+、-、*、\以及左右括号(),表达式不超过20个字符。
输出格式:
在一行中输出转换后的后缀表达式,要求不同对象(运算数、运算符号)之间以空格分隔,但结尾不得有多余空格。
输入样例:
2+3*(7-... |
C | #include <stdio.h>
int main(int argc, char *argv[]) {
int a = 2;
int b = 3;
printf("a / b = %.3f\n", a/b); // causa um Warning. Tipo de resposta incompatível. Resultado inesperado.
printf("a / b = %.3f\n", (double) a/b);
return 0;
} |
C | /*
07:˽Ƽ
鿴 ύ ͳ
ʱ: 1000ms ڴ: 65536kB
2008걱˻ᣬA˶ԱnľĿ
(1n17)ҪͳһAõĽͭĿ
ܽ
n1У1AĿnnУ
ÿһǸùijһõĽͭĿ
һոֿ
1У4ΪAõĽͭ
ܽһոֿ
3
1 0 3
3 1 0
0 3 0
4 4 3 11
*/
#include <stdio.h>
int main ()
{
int n,i,j,a[4],b[4]={0},sum;
scanf("%d",&n);
for (i=1;i<=n;i++){
for(j=1;j<=3;j++){
scanf("%d",&a[j]);
b[j]+=a[j];
sum+=a[j];
... |
C | #include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/wait.h>
#include <string.h>
#include <stdlib.h>
#include "ChildCheck.h"
#include "v1.h"
#define SIZE_ROWS 9
#define SIZE_COLS 9
int main(int argc, char* argv[]) {
if (argc < 1) {
dup2(11, STDOUT_FILENO);
printf("Er... |
C | /*
* Code generated from Atmel Start.
*
* This file will be overwritten when reconfiguring your Atmel Start project.
* Please copy examples or other code you want to keep to a separate file
* to avoid losing it when reconfiguring.
*/
#ifndef ATMEL_START_PINS_H_INCLUDED
#define ATMEL_START_PINS_H_INCLUDED
#includ... |
C | /**
* @copyright
* Copyright (c) 2016-2021 Stanislav Ivochkin
*
* Licensed under the MIT License (see LICENSE)
*/
#ifndef EMBEDJSON_AMALGAMATE
#pragma once
#include "common.h"
#endif /* EMBEDJSON_AMALGAMATE */
/**
* JSON lexer. Transforms input stream of bytes into a stream
* of tokens defined by JSON grammar.... |
C | So it looks like we need to iterate through each if statement and produce thedesired input
at that step before moving on
First thought for inputChar is to look up ASCII range
Lowest = 32 for ' '
Highest = 125 for '}'
Set up rand() to generate integers and then return the value
I originally planned to set a (min,... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line.c :+: :+: :+: ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* print_utils.c :+: :+: :+: ... |
C | #include <stdio.h>
int main()
{
double x, y; //Змінні
x = 2;
if (x>1) //Якщо х більше 1
{
y = 1;
}
else if (x < -1) //Якщо х меньше -1
{
y = -1 / x;
}
else //Для х від -1 до 1
{
y = x * x;
}
}
|
C | #include <stdlib.h>
#include <assert.h>
#include "malloc_integrity_check.h"
#define ABS(value) ( ((value) >= 0) ? (value) : (-(value)) )
extern LIST_HEAD(, mem_chunk) chunk_list;
extern mem_block_t* get_back_boundary_tag_of_block(mem_block_t* block);
extern mem_block_t** get_back_boundary_tag_address(mem_block_t* bl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.