language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <glib.h>
#include "../event_queue.h"
void test_event_queue_init()
{
event_queue *eq = event_queue_init();
event_queue_execute(eq, G_MAXUINT);
event_queue_free(eq);
}
typedef struct {
guint current_time;
guint total;
} event_queue_test_struct;
void queued(guint time, event_queue_test_struct *status... |
C | #ifndef STRUCTS_H
# define STRUCTS_H
# include <stdlib.h>
typedef char t_bool;
typedef struct s_node
{
void *data;
struct s_node *next;
} t_node;
typedef struct s_btree
{
void *data;
struct s_btree *r;
struct s_btree *l;
} t_btree;
typedef struct s_file
{
int fd;
char *name... |
C | #include<stdio.h>
int main(){
int n;
scanf("%d",&n);
while(n != 0){
unsigned long total = 0;
while(n > 0){
total += n * n;
--n;
}
printf("%lu\n", total);
scanf("%d",&n);
}
return 0;
}
|
C | #include <common.h>
int main(int argc, char **argv)
{
if (argc != 3)
errx(-1, "%s <old filename> <new filename>\n", argv[0]);
char *old = argv[1];
char *new = argv[2];
int ret;
if ((ret = rename(old, new)) < 0)
err(ret, "rename");
return 0;
}
|
C | #include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <util.h>
#include <pat.ih>
int
thr_alloc(struct thread *thr[static 2])
{
struct thread *ret;
ret = calloc(1, sizeof *ret);
if (!ret) return ENOMEM;
thr[0] = ret;
thr[1] = ret;
return 0;
}
int
thr_cmp(struct thread *lt, struct thread *rt)
{
... |
C | #include<stdio.h>
int main(){
char* tab[5][5]={{"DUFOURD","BERTRAND","BOB","BOULANGER","JAMES"},{"pierre","marley","jean","loic","alex"},{"5 rue du pic","6 rue du coeur","7 rue du carreaux","8 rue du trèfle","9 rue de l'as"},{"18","12","15","14","16"},{"20","10","18","8","19"}};
int j=0;
int i=0;
for(i=0;i<5;i++){
... |
C | /**
* See Copyright Notice in picrin.h
*/
#include "picrin.h"
#include "picrin/dict.h"
#include "picrin/cont.h"
#include "picrin/pair.h"
static int
xh_value_hash(const void *key, void *data)
{
union { double f; int i; } u;
pic_value val = *(pic_value *)key;
int hash, vtype;
UNUSED(data);
vtype = pic_vty... |
C | #include "ADC_Fun.h"
#include "Delay_Fun.h"
#include "intrins.h"
#include "Stc_Math.h"
/*----------------------------
Initial ADC sfr
----------------------------*/
void InitADC(unsigned char Port)
{
unsigned int i;
P1ASF = Port; //Open 8 channels ADC function
ADC_RES = 0; ... |
C | /*************************************************************************
DCencoder.c
Author: Josiah Snarr
Date: April 17, 2015
clientProtocal.c contains the functions to control the client handling of
incoming commands through RS232
*************************************************************************/
#incl... |
C | ////////////////////////////////////////////////////////////////////////////////
// vvprintf.c - printf-like backend
//
// Written by Rich Rademacher, UWaterloo/IQC
// October 2018
////////////////////////////////////////////////////////////////////////////////
#include <types.h>
#include <algorithm/vvprintf.h>
#inclu... |
C | #include <stdlib.h>
#include <stdio.h>
int main(void) {
char *env_variable;
env_variable = getenv("USER");
if (NULL!=env_variable) printf("USER: %s\n", env_variable);
env_variable = getenv("SHELL");
if (NULL!=env_variable) printf("SHELL: %s\n", env_variable);
env_variable = getenv("PATH");
if (NUL... |
C | #include "daed_builtins.h"
int main(void)
{
double T, a, b, N, p, V;
double k;
double res;
T = DBETWEEN_WITH_ULP(300.0, 300.0);
a = DBETWEEN_WITH_ULP(0.401, 0.401);
b = DBETWEEN_WITH_ULP(42.7e-6, 42.7e-6);
N = DBETWEEN_WITH_ULP(1000.0, 1000.0);
p = DBETWEEN_WITH_ULP(3.5e7, 3.5e7);
V = DBETWEEN_WITH_U... |
C | // splitStr3.c
// author: Sasha (Alexandre) Avreline, UBC BCS Tutor, Fall 2019
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void split_str(char *input_str, char token, char ***components_addr) {
int i = 0;
char *input_str_copy = strdup(input_str);
const char *token_string = (char[]){token, '\... |
C | #include <stddef.h>
#include <string.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <libgen.h>
extern char **environ;
int main(int argc, char *argv[])
{
char * pipfile;
int pipfile_len;
{
char * dir;
{
/* argv[1] is the path to the s... |
C | #include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdlib.h>
#include <unistd.h>
#include <strings.h>
#include <string.h>
#include <math.h>
#include <sys/time.h>
void error(char *msg)
{
perror(msg);
exit(0);
}
int main(int argc, char *argv[]... |
C | /*************************************************************************
> File Name: test.c
> Author:
> Mail:
> Created Time: 2018年08月21日 星期二 16时14分35秒
************************************************************************/
#include "../include/rsa.h"
void creatRsa(int* e , int* n , int* bytes , int* d)... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "ptable.h"
int main(int argc, char *argv[])
{
extern int debug;
int printall = 0;
int opt;
char *eep = NULL;
char *profile = "eep.xml";
while ((opt = getopt(argc, argv, "ade:f:")) != EOF) {
switch (o... |
C | /*
* Network console server
* inf138575
* PUT NSK2018
*/
#include <pthread.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdio.h>
#define BUF_SIZE 1024
#define NUM_THREADS 5... |
C | /*********************************************************************************
* Smith–Waterman algorithm
* Purpose: Local alignment of nucleotide or protein sequences
* Authors: Daniel Holanda, Hanoch Griner, Taynara Pinheiro
*
* Compilation: gcc omp_smithW.c -o omp_smithW -fopenmp -DDEBUG // debuggin... |
C | #include<stdio.h>
#include<string.h>
void substring(char [], char[], int, int);
int main()
{
char str[100]="hello";
char strnew[100],strnew1[100];
int len,i;
//printf("%s",str);
len=strlen(str);
//printf("%d",len);
for(i=1;i<len-1;i++)
{
substring(str, strnew, 1, i);
printf("%s\n",strne... |
C | #include <stdbool.h>
#include <math.h>
bool is_prime(int num){
if(num <= 3) return num > 1;
if(num % 2 == 0) return false;
if(num % 3 == 0) return false;
int i = 5;
while(pow(i, 2) <= num){
if(num % i == 0) return false;
i += 2;
}
return true;
} |
C | /*
MERGESORT
AUTORES:
JIMÉNEZ DELGADO LUIS DIEGO
SÁNCHEZ CASTRO AARÓN GAMALIEL
SÁNCHEZ TIRADO CITLALI YASMÍN
VERSIÓN 1.5
*/
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
int *cal(int arreglo[], int tamano);
void printArray(int arrTo[], int tam);
void copyArray(int *arrTo, int *arrFrom, in... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include "pa12.h"
#ifndef INIT
//head: the head of the singly linkedlist.
//length: the length of the singly linkedlist.
//This function will create and initialize the singly linkedlist with length=length,
//The values of the nodes within the singly linkedli... |
C | #include<stdio.h>
#include<stdlib.h>
#include<pthread.h>
#include<signal.h>
struct node
{
int data;
struct node *next;
}*front=NULL,*rear=NULL;
void insert(int value)
{
struct node *nu;
nu=(struct node*)malloc(sizeof(struct node));
nu->data=value;
if(front==NULL)
front=rear=nu;
else
{
rear->n... |
C | /* Alex Sluborski
CIS 190 Lab 6 part 1
10/11/18
*/
#include <stdio.h>
#include <stdlib.h>
//defines buffer
#define BUFFER 256
//function declarations
void digitCount(int *num,int *answer);
void digitSum(int *num, int*answer);
void largestDigit(int *num, int*answer);
int main(){
char string[BUFFER]; // creates string ... |
C | /* Напишете програма, която да генерира парола с малки букви (i),
специални символи (j), големи букви (k) и цифри (l), ама разбъркано.
Използвайте функции. */
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
char getSmallLetter();
char getCapitalLetter();
char getSymbol();
char getNumber();
int main... |
C | // Benchmarking the Memory Heirarchy
// Using cpuid to find out cache sizes
#include <stdio.h>
#include <stdint.h>
int main(){
// Use a loop to check all 4 levels
int i;
for(i=0;i<4;++i){
// inputting 4 into %eax gives us back cache parameters for a cache
// level specified in %ecx (pg 267)
// setting level ... |
C | #include<stdio.h>
#include <stdlib.h>
#include <time.h>
int tails(void);
void main(void)
{
int n,counter;
int coin[2]= {0};
srand( time( NULL ) );
for(n=1; n<=100; n++)
{
coin[tails()]+=1;
printf("%d ",tails());
}
printf("\nHeads times:%d\nTails times:%d",... |
C | /*
Ӻ@20200809
*/
/* negate.c -- ෴ */
int
negate (int n)
{
return -n;
} |
C | #include <avr/io.h>
#include <stdlib.h>
#include <util/delay.h>
#include <stdbool.h>
#include "display.h"
//map value of bit a to index b
uint8_t col_b_map[8] = {0, 0, 0, 0, 2, 4, 0, 0};
uint8_t col_c_map[8] = {0, 0, 1, 0, 3, 6, 0, 0};
uint8_t row_c_map[8] = {2, 3, 0, 5, 0, 0, 0, 0};
uint8_t col_d_map[8] = {7, 0, 5, ... |
C | /* ***************************************************************************
Tina Stahlstedt
stahlstt@onid.oregonstate.edu
CS362 - 400 Spring 2015
Assignment 3
Write unit tests for four functions (not card implementations or cardEffect)
in dominion.c.
Check these tests in as unittest1.c,unittest2.c, unittest3.c, a... |
C | //#include "everything.h"
#include "tab.h"
/*******************************************************************************
* COMPRESSOR DICTIONARY & FUNCTIONS
* ****************************************************************************/
//structure that defines the dictionary
typedef struct dict{
... |
C | #ifndef EMBER_PRINT_H
#define EMBER_PRINT_H 1
#include <stdbool.h>
#include <stdint.h>
/**
* @brief Prints a log message
* @param category - Currently ignored as zcl categories do not map to chip categories. Defaults to kLogCategory_Progress
* @param format - Format string to print
* */
void emberAfPrint(int cate... |
C | /*
* File: 6-size.c
* Auth: Ewar James <ewaarjames@gmail.com>
*/
#include <stdio.h>
/**
* main - Prints "with proper grammar, but the outcome is a piece of art,
*
* Return: Always 0.
*/
int main(void)
{
printf("Size of a char: %i byte(s)\n", sizeof(char));
printf("Size of an int: %i byte(s)\n", sizeof(int));
p... |
C | #include<stdio.h>
int main()
{
int arr1[20], arr2[20], array_new[40], n1, n2, size, i;
/*n1 size of first array (i.e. arr1[]), n2 size of second array(i.e. arr2[]),
size is the total size of the new array (array_new[]) */
scanf("%d", &n1); //Get the size of first array from test data and store it in n1.
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include "funciones.h"
#define CANTIDAD 1000
int main()
{
//Declaracion de estructura.
estructuraPersona persona[CANTIDAD];
//Se inicializa el array en 0.
iniciarArrays(persona, CANTIDAD);
//Se carga la estructura para probar las funcion... |
C | // O que esse algoritmo faz?
#include <stdio.h>
int main(){
while (1) { // 1!=0
printf("*");
}
return 0;
} |
C | /*=======================================================================================================*/
/*======================================PROJETO 2 - IAED 2016/2017=======================================*/
/*===========================================Ricardo Velhinho===========================================... |
C | #pragma pack(1)
struct Header{
int num;
int index;
};
struct PkgContent {
char sex;
int score;
char address [100];
int age;
};
struct Pkg {
Header head;
PkgContent content;
};
int MySend(int iSock, char * pchBuf, size_t tLen){
int iThisSend;
unsigned int iSended=0;
if(tLen... |
C | #include"seqlist.h"
//haha
void TestPushBack(){
TEST_HEADER;
SeqList seqlist;
SeqListInit(&seqlist);
SeqListPushBack(&seqlist,'a');
SeqListPushBack(&seqlist,'b');
SeqListPushBack(&seqlist,'c');
SeqListPushBack(&seqlist,'d');
SeqListPrintChar(&seqlist,"尾插元素");
}
void TestSeqListErase(){
TEST_HEADER;
SeqList ... |
C | #include <stdarg.h>
#include <string.h>
#include "config.h"
#include "console.h"
#include "trace.h"
#ifdef USE_TRACE
static const struct {
int ch;
int flag;
const char *name;
const char *desc;
} flaginfo[] = {
/* Note: not necessarily in same order as DOTRACE flags */
{ 'k', DOTRACE_KINSN, "kinsn", "Kernel-mo... |
C |
#include "demo.h"
void timer_ini(void);
extern unsigned char fd1[];
extern unsigned char fd2[];
extern unsigned char fd3[];
extern unsigned char fd4[];
/****************************************************************************
* 名 称:void timer_ini(void)
* 功 能:定时器初始化函数
* 入口参数:无
* 出口参数:无
... |
C | /* Copyright 2017 The serverX Authors. All Rights Reserved.
* Maintainer: Bytes Club (https://bytesclub.github.io)<bytes-club@googlegroups.com>
* 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... |
C | //
// Tile renderer, var width/height, 1->4bpp tiles,
// recolored with transparency
//
//! \file chr4r_drawg_b1cts.c
//! \author J Vijn
//! \date 20070621 - 20070725
//
/* === NOTES ===
* 20070725: Skipping rendering if raw == 0 helps. A lot. Also, there
is more than one way to bitunpack and split between tiles... |
C | #include <stdio.h>
#define MAX 1000001
long long g[MAX];
int phi[MAX];
int main()
{
int i, j, n;
for(i=2,phi[1]=1; i<MAX; i++)
{
if(!phi[i])
{
phi[i] = i-1;
for(j=(i<<1); j<MAX; j+=i)
{
if(!phi[j])
phi[j] = j;
phi[j] = phi[j]/i*(i-1);
}
}
}
for(i=1; i<MAX; i++)
f... |
C | #include "logic.h"
#include "main.h"
#include "Developer/Src/dev_helper.h"
#include "ProtoCommunication\Src\messages_proto.h"
#include "Developer/Src/m_timer.h"
//зависит от требуемого сигнала на входе управления двигателем и используется для установки минимальной и максимальной скважности.
#define MIN_VALUE_ARR 230... |
C | #include "common.h"
#include "device.h"
#include "lcd.h"
#include "rotenc.h"
#include "process.h"
#include "manualmode.h"
#include "uart.h"
#include "timer0.h"
//
// 基板上のボタン押下時の処理
//
static void process_on_BUTTON_0()
{
}
static void process_on_BUTTON_1()
{
}
static void process_on_BUTTON_2()
{
... |
C | /*
Notes from mycodeschool videos - Function Pointers; Function pointers and callbacks
function is a set of instructions.
Function pointers store the starting address or the entry
point of a block of memory containing instructions of a
particular function
*/
#include <stdio.h>
#include <stdlib.h>
// stdlib.h is for t... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>
#include<assert.h>
#include<string.h>
//ַ
int cmp_str(const void *a,const void *b)
{
assert(a);
assert(b);
return strcmp(*(char **)a,*(char **)b);
}
void show(char **arr,int sz)
{
int i = 0;
assert(arr);
assert(sz);
for (i = 0; i < sz; i++... |
C | #include <stdio.h>
#define TABSTOP 4
int get_line(char storage[], int limit);
int main(void)
{
return 0;
}
int get_line(char line[], int limit)
{
int i, c;
for (i = 0; i < limit - 1 && (c == getchar()) != EOF && c != '\n'
&& c != '\0'; i++)
line[i] = c;
if (c == '\n')... |
C | /*
Alumno: Vileriño,Silvio
Curso:5to 2da
Fecha: 11/5/09
*/
#include <stdio.h>
#include <stdlib.h>
int esdivisibleportres(int);
int main(){
int numero=0;
system("clear");
printf("Ingrese Numero:");
scanf("%i",&numero);
if (esdivisibleportres(numero)==0){
printf("\n%i Es Divisible por 3\n",numero);
}else{
pri... |
C | /*
* usingmacro.c
*
* Created on: 2015. 5. 11.
* Author: root
*/
#include <stdio.h>
#define SIZE 100
int main(void) {
printf("%d\n", 5 * SIZE);
printf("%d\n", 3 * SIZE);
printf("%d\n", 5 / SIZE);
printf("%d\n", 7 * SIZE);
printf("%d\n", 5 + SIZE);
return 0;
}
|
C | # include <stdio.h>
# include <ctype.h>
# define EOL '\n'
void main()
{
char c[100];
int count=0;
c[count]=getchar();
while(c[count] != EOL)
{
count++;
c[count]=getchar();
putchar(c[count]);
}
int tag;
tag=count;
count=0;
printf("\n");
printf(" The lowercase letters:\n");
while(count<=tag && c[count]>=65 && c[count]<... |
C | #include <stdlib.h>
#include <stdio.h>
/*
* 置换(排列)输出
* */
void swap(char *left,char *right);
void copy(char *left,char *right,int count);
void perm(char * ,int,int,void (*handle)(char *,int));
void out(char *,int);
int count = 0;
int main(){
char list[]={'a','b','c','d'};
int count = (sizeof list)/ sizeof... |
C | #ifndef CUSTOM_BOARD_H
#define CUSTOM_BOARD_H
/************************************************************
*----------------------custom_board.h-------------------------
* ӵҪŷֲ io1Ϊ
*-------------------------------------------------------------
* λLEDx
* LED1 P.18 LED5 P.17 LED9 P.22
* LED2 P.15 LED6 P.7 ... |
C | /*
* File: main.h
* Author: Chris Hajduk
*
* Created on October 15, 2013, 8:14 PM
*
* This file contains all GLOBAL constants needed for the code.
* Avoiding adding stuff here unless you really need to.
*
*/
#ifndef MAIN_H
#define MAIN_H
//Include Libraries
#include <p33FJ256GP710A.h>
#include <stdio.h>
#i... |
C |
#include <logging.h>
#include <fstream>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace std;
FILE* Logger::logger = NULL;
void
Logger::LogEvent(const char* event)
{
if(logger == NULL)
{
logger = fopen("logger","w");
}
fprintf(logger,"%s",event);
}
void
Log... |
C | #include<stdio.h>
#include<string.h>
void get_record() {
printf("Enter record:");
char record[128] = "";
gets(record);
}
int main(int argc,char **argv) {
get_record();
}
|
C | #include <stdio.h>
int main(){
//2.4a
int a, c;
c = 1;
c++;
a = 2 * c;
printf("%d True\n", a);//True
//False 2.4b
c = 1;
a = 2 * c++;
printf("%d False\n",a);
//True 2.4c
c = 1;
c += 1;
a = c + c;
printf("%d True\n",a);
//False 2.4d
c = 1;
a = c+... |
C | #include <stdio.h>
main()
{
int a = 10, b;
a >= 5 ? b = 100 : (b = 200);
printf("%d\n", b);
}
|
C | #include<stdio.h>
void main()
{
int a,b,div,mod;
printf("enter the values");
scanf("%d%d",&a,&b);
mod=a%b;
div=a/b;
printf("%d\t",div);
printf("%d\t",mod);
}
|
C | #include "sctpArgs.h"
void free_memory()
{
free(args);
}
static void
address(char *address, int port, struct sockaddr_in *addr)
{
int r_4;
// Try to match with IPv4
r_4 = inet_pton(AF_INET, address, &addr->sin_addr);
// IPv4 unsuccessful, try with IPv6
if (r_4 <= 0)
{
printf("Can... |
C | #include<stdio.h>
#include<ctype.h>
#include<string.h>
int main(int argc,char *argv[]) {
int i;
for (int i = argc; argc > 0; i--)
{
if (islower(argv[i]))
{
argv[i] = toupper(argv[i]);
}
else if (isupper(argv[i])) {
argv[i] = toupper(argv[i]);
}
}
}//!!!! |
C | #include<stdio.h>
#include<math.h>
/*
* main.c
*/
int main(void) {
int N,k,n,i;
float pi=3.1416,sumre=0,sumim=0,out_real[8]={0,0},out_imag[8]={0,0};
int x[32];
printf("Enter the length of sequence: ");
scanf("%d", &N);
printf("Enter the sequence: ");
for(i=0;i<N;i++){
scanf("%d",&x[i]);
}
for(k=0;k<N;k++)... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
int bigEndian() {
short test = 0x0001;
char* x = (char*) &test;
//returns 0 if big endian, return 1 if little endian
//big endian : 00 01
//little endian: 01 00
//return value: ^
return *x;
}
int main(int argc, char *argv[]){
if (strcmp (a... |
C | #include "ds/queue_array.h"
void copy_value_to_node_float(Queue_Array* queue, void* value)
{
float* temp = (float*) queue->buffer[queue->rear];
*temp = *(float*) value;
}
void copy_value_to_node_double(Queue_Array* queue, void* value)
{
double* temp = (double*) queue->buffer[queue->rear];
*temp = *(... |
C | #include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <pthread.h>
#include <semaphore.h>
/*
Written by :
Yunus Emre Ertunc
Muhammed Enes Akturk
*/
int checkDigit(char temp[]){
int length = strlen(temp);
int i = 0;
for(i = 0 ; i < length; i++){
if(isdigit(temp[i])){
r... |
C | #include <stdio.h>
#include <string.h>
#include "Utilities.h"
#include "MatricesUtilities.h"
#define INFINITY 1000
typedef struct scoreMoves{
int row;
int col;
int isMove;
int ori;
double value;
}MOVE;
MOVE alphaBeta(char **board,int sizeBoard,int position[2][2],int walls[2],int depth,const int... |
C | #include <stdio.h>
#include <pthread.h>
#include <unistd.h>
void *test_print(void *arg)//线程创建成功后会执行这个方法
{
int i;
for ( i = 0; i < 10; i++)
{
printf("cthread: test_print start--->i = %d\n", i);
}
return arg;
}
int main()
{
pthread_t main_tid;
int err = pthread_create(&main_tid, ... |
C | #include <stdio.h>
#include <Windows.h>
#include <conio.h>
#define MAX_SCREEN_WIDTH 999
#define MAX_SCREEN_HEIGHT 999
#define KB_SPACE 0x20
COORD ConsoleSize = { 200, 50 };
int main(void) {
HANDLE hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleScreenBufferSize(hConsoleOutput, COORD{ MAX_SCREEN_WIDTH, ... |
C | /*********************************************************
* Exemplo de passagem de parametro para Tasks na criação*
* Por: Fábio Souza
*********************************************************/
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/gpio.h"
#include "sdkconfig.h"... |
C | #include "stdio.h"
#include "stdlib.h"
int main()
{
char xyz[] = "648892";
long int num = atol (xyz);
printf("num: %ld \n", num );
char xyz1 [] = "90.57";
float num1 = atof(xyz1);
//%.2f print flot with two decimail number
printf("num1: %.2f\n", num1);
char xyz2 [] = "239.53425... |
C | #include <stdio.h>
#include <syscalls.h>
int main(int argc, char *argv[], char *envp[]){
int ret = -1;
if(argc>2) {
char *s = argv[2];
int n = 0;
ret = 0;
while (*s) {
if (*s >= '0' && *s <= '9') {
n = n * 10 + (*s - '0');
s++;
... |
C | #include <stdio.h>
#include <string.h>
#include <snl_md5.h>
static char *test[] = {
"",
"a",
"abc",
"message digest",
"abcdefghijklmnopqrstuvwxyz",
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
NULL
};
static char *ret[] = {
"d41d8cd98f00b204e9800998ecf8427e",
"0cc175b9c0f1b6a831c399e2697... |
C | #include <packet.h>
#include <string.h>
#include <cobs.h>
#define PACKET_HEADER 0x00
#define HEADER_INDEX 0
#define COBS_INDEX 1
#define LENGTH_INDEX 2
#define TYPE_INDEX 3
//#define PRINTF_DEBUG
void pkt_init(pkt_generic_t *packet) {
memset(packet, 0, sizeof(pkt_generic_t));
}
/* maybe only have it clear total_l... |
C | #ifndef _FUNCTIONS_WITH_QUEUE_H
#define _FUNCTIONS_WITH_QUEUE_H
#include "utilits.h"
#include <stdlib.h>
typedef struct my_struct1
{
char c;
struct my_struct1 *next;
} q_elem;
typedef struct my_struct2
{
int quantity;
q_elem *head, *tail;
} Q;
//
q_elem* create_element(char c);
//
int Q_push(Q *Queue, q_e... |
C | #include <stdio.h>
#include "common.h"
void b_dump(void) {
printf("in b, &entries = %p\n", &entries);
for (int i = 0; i < ARRAY_LENGTH(entries); i++) {
const struct table_entry *e = &entries[i];
printf("Entry %d is at %p = {key:%d, label:%s}\n",
i, e, e->key, e->labe... |
C | /*
* Reads an employee's number, his/her worked hours number in month and the
* amount he received per hour.
* Print the employee's number and salary that he/she will receive at end of
* the month with two decimal places
* ---------------------------------------------------------------------------*/
#define SA... |
C | /*<html><pre> -<a href="qh-user_r.htm"
>-------------------------------</a><a name="TOP">-</a>
usermem_r.c
user redefinable functions -- qh_exit, qh_free, and qh_malloc
See README.txt.
If you redefine one of these functions you must redefine all of them.
If you recompile... |
C | #include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<netinet/ip.h>
#include<arpa/inet.h>
#include<sys/socket.h>
#include<unistd.h>
#define PORT 8080
#define IP_ADDR "127.0.0.1"
int read_msg(int des)
{
struct sockaddr_in client;
socklen_t client_size = sizeof(client);
int number,readbytes;
for(int i... |
C |
#include "mpi.h"
#include <stdio.h>
#include <stdlib.h>
// utility functions
int ** alloc_matrix(int n, int m);
void init_matrix(int n, int m, int ** a);
void print_matrix(int n, int m, int ** a);
void init_unit_matrix(int n, int m, int **a);
// matrix operations
int ** prod_matrix(int n, int l, int m, int ** a, in... |
C |
#define fxm_1 (u8)0x01
#define fxm_2 (u8)0x02
#define fxm_3 (u8)0x04
#define fxm_4 (u8)0x08
#define fxm_5 (u8)0x10
////////////////////////0x20
#define fxm_acoustc (u8)0x40
#define fxm_dirty (u8)0x80
// For the Axe-FX Vol block, Log 20A means that the resistance is 20% at the halfway p... |
C | #include<stdio.h>
int well_ordered(int num)
{
int a[3], count=0;
for(int i=0; i<3; i++)
{
a[i]=num%10;
num/=10;
}
for(int i=0; i<2; i++)
if(a[i]<=a[i+1])
count=1;
if(count==0)
return 1;
else
return 0;
}
int main()
{
int check=0, flag=0;
printf("The list of a... |
C | #include "list.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
struct node {
char* value; //
Node* next; //
};
struct list {
Node* head;
Node* tail;
};
Node* nodeInit() {
Node* head = (Node*)malloc(sizeof(Node));
if (head == NULL) {
perror("can`t create node");
r... |
C | #include <stdio.h>
long long int N;
int binarySearch(long long int arr[], int l, int r, int x)
{
int mid = l + (r - l) / 2;
if (x <= arr[0])
{
return 0;
}
if (x >= arr[N - 1])
{
return N - 1;
}
if (r >= l)
{
// If the element is present at t... |
C | #include <math.h>
#include <stdlib.h>
#include <stdio.h>
//this function works in strong assumption of det(X) ne 0
double* jordan_main_throgh_matrix_1(double *X, double *y, int n){
int i = 0, j = 0, k = 0,
i_max, j_max;
int *ind;
ind = malloc(n*sizeof(int));
for(i=0;i<n;i++)
... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>
int main()
{
char str[10];
int count = 3;
printf("㹲Ļ\n");
while (count > 0)
{
printf("룺");
scanf("%s", &str);
if (strcmp(str,"579579")==0)
{
printf("½ɹ\n");
break;
}
else
{
printf("\n");
count--;
printf("%dλ\n", co... |
C | #include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
int main()
{
int fd = open("/root/sysprogs/cars.txt", O_RDWR | O_APPEND);
if( fd == -1)
{
perror("No need to continue as we can't open the file\n");
return 1;
}
ssize_t tw1,tw2;
const char *buf1 = "Jaguar\n";
const char *buf2 = "Tesl... |
C | #include<stdlib.h>
#include<stdio.h>
int main()
{
int IntArray[100];
int IntNum,IntMoveSteps;
int AuxiliarySpace;
scanf("%d %d",&IntNum,&IntMoveSteps);
if(IntNum>100||IntNum<1||IntMoveSteps<0)
return 1;
int i,j;
for(i=0;i<IntNum;i++)
{
scanf("%d",&IntArray[i]);
}
... |
C | /*
* =====================================================================================
*
* Filename: 111.c
*
* Description: 111
*
* Version: 1.0
* Created: Sunday 30 June 2013 07:49:19 CST
* Revision: none
* Compiler: gcc
*
* Author: Zhang Dongsheng (ma... |
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 <cs50.h>
//#include <string.h>
//#include <stdlib.h>
//#include <ctype.h>
int main(int argc, string argv[])
{
//Проверка на количетво аргументов
if (argc!=2)
{
printf("Usage: ./vigenere k\n");
return 1;
}
int messlen,keylen;//Длинна сообщения и длин... |
C | #include<stdio.h>
int factorial(int n)
{
int r;
if (n==1)
{
return 1;
}
r=n*factorial(n-1 ) ;
return (r ) ;
}
int main()
{
int n,res;
printf("***********************************n" ) ;
printf("tFactorial Recursivon" ) ;
printf("***********************************n" )... |
C | /**
* Cracking the Coding Interview Problem 8.1
* Designing the data structure for a generic deck of cards.
*
* FIRST we define a type 'Suit'.
* THEN we define a class Card.
* THEN we define a class Hand (representing one's hand of cards).
*/
// Defining a type 'Suit'.
public enum Suit {
// enum = a user-... |
C | /*******************************************************************************
* File Name: Move_Down.c
* Version 1.90
*
* Description:
* This file contains API to enable firmware control of a Pins component.
*
* Note:
*
********************************************************************************
* Copyright 2... |
C | #include <stdio.h>
void main()
{
int row, rows, a=1, i;
scanf("%d", &rows);
for(row=1;row<=rows;row++)
{
for(i=1;i<row;i++)
{
printf("%4d", a);
a++;
}
puts("");
}
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include "address.h"
#define ADDRESSFILE "addresses.txt"
void saveAddresses(AddressPtr_t* node){
FILE *fp;
fp = fopen(ADDRESSFILE, "w+");
// --- HEADER
fprintf(fp, "Name,Vorname,Strasse,PLZ,Ort\n"); //evtl. Komma?
while(*node != NULL){
... |
C | #include <stdio.h>
#include <string.h>
int main(){
char a[1001];
char b[1001];
scanf("%s\n", &a);
scanf("%s\n", &b);
int flag=0;
int l = strlen(a);
int ans;
for(int i =0;i<l;i++){
if(tolower(a[i])==tolower(b[i])){
ans = 0;
}
else if... |
C | /*
* @lc app=leetcode id=1023 lang=c
*
* [1023] Camelcase Matching
*
* https://leetcode.com/problems/camelcase-matching/description/
*
* algorithms
* Medium (56.58%)
* Total Accepted: 7.2K
* Total Submissions: 12.7K
* Testcase Example: '["FooBar","FooBarTest","FootBall","FrameBuffer","ForceFeedBack"]\n"F... |
C | #include <kilolib.h>
// Maximum of an 8-bit number (since we're using 1 byte of the message to send
// the gradient value).
#define GRADIENT_MAX 255
int own_gradient = GRADIENT_MAX;
int received_gradient = 0;
int new_message = 0;
message_t message;
void setup()
{
// If the ID is 42, the robot is the seed its gra... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.