language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include "holberton.h"
/**
* _strncat - concatenates only n bytes of source into destiny
*
* @dest: destiny string
*
* @src: source string
*
* @n: number of bytes to be concatenate
*
* Return: destiny
*
*/
char *_strncat(char *dest, char *src, int n)
{
int a;
int b;
for (a = 0; dest[a] != 0; a++)
{
}
... |
C |
/** \brief Realiza la suma de dos numeros y devuelve el resultado
* \param x Es un numero a ser ingresado
* \param y Es un numero a ser ingresado
* \return El resultado de la suma
*
*/
float suma(float x, float y);
/** \brief Realiza la resta de dos numeros y devuelve el resultado
* \param x Es un n... |
C | #include <stdio.h>
#include <math.h>
#include <ctype.h>
#include <string.h>
#define MAXLINE 80
void escape(char s[] , char t[]);
void rev_escape(char s[] , char t[]);
//unsigned pow(unsigned a, unsigned base);
/* prunsigned longest input line */
char line[MAXLINE];
int main() {
char v[10000];
char s[10000];
i... |
C | #include <stdlib.h>
//#include <time.h>
#include "screen.h"
#include <signal.h>
#include "sound.h"
#include <stdio.h>
#include "comm.h"
int main(int argc, char **argv){
if(argc>1){ //if the user has given some command line argument
printf("Test tone generator\n");
int fR, fL, ch;
float duration;
printf("No. o... |
C | #include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int getMortarLocation(double* loc_val)
{
FILE *fp = fopen("g_result.txt", "r");
char buf[256];
char *array[20];
while (fgets(buf, sizeof(buf), fp))
{
if (strstr(buf, "$GPGLL"))
{
int count = 0;
char *token;
... |
C | /*
* 123.cpp
*
* Created on: 2010-12-18
* Author: 378073652
*/
int main(){
char a[30000],b[30000];
int c[10000],d[10000],e[1005],la,lb,i,j,sa=0,sb=0,max=0;
for(i=0;i<=1004;i++) e[i]=0;
cin>>a;
cin>>b;
la=strlen(a);
lb=strlen(b);
c[0]=atof(a);
for(i=0;i<la;i++){
if(a[i]==',')
... |
C | #ifndef _BTREE_H_
# define _BTREE_H_
typedef struct btree
{
struct btree *left;
struct btree *right;
void *item;
} btree_t;
btree_t *btree_create_node(void *item);
void btree_apply_prefix(btree_t *root, int (*applyf)(void *));
void btree_apply_infix(btree_t *root, int (*applyf)(void *));
void btree_apply_... |
C | #pragma once
#include <ksmooth/smoother.h>
typedef enum { KSMOOTH_KERNEL_GAUSSIAN } ksmooth_kernel;
typedef enum { KSMOOTH_OK, KSMOOTH_INVALID_BOUNDS } ksmooth_status;
// create new Nadaraya-Watson smoother
ksmooth_nw_smoother_t ksmooth_new_nw_smoother(ksmooth_kernel k);
// set concurrency level for smoother. If no... |
C | /**
* This is the solution to the PlusMinus problem in Algorithms domain of HackerRank
* Question can be found here : https://www.hackerrank.com/challenges/plus-minus
*/
#include<stdio.h>
int main ()
{
int n;
scanf("%d",&n);
int arr[n],i;
float a,b,c,p=0,ne=0,z=0;
for(i=0;i<n;i++)
{
... |
C |
#pragma once
#include "Vector3.h"
__declspec(align(16)) class Face
{
public:
DEFINE_NEW_DELETE_ALIGNED
Face(void);
Face(const int indices[3], const Vector3& faceNormal);
Face(int i0, int i1, int i2, const Vector3& faceNormal);
inline Vector3 GetFaceNormal(void) const
{
return faceNormal;
... |
C | /*Naresh i Technologies For Any Doubts contact Mr.Balu Email:balu.bhig@gmail.com */
#include <stdio.h>
#include <conio.h>
/*Naresh i Technologies For Any Doubts contact Mr.Balu Email:balu.bhig@gmail.com */
#define size 10
int main()
{
int arr[size];
int i,m;
int min(int*);
clrscr();
printf("\nEnter %... |
C | /* COMP 211, Spring 2019
* Homework 8
*
* Queues
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "comp211.h"
#include "hw8.h"
/* Make a non-linear collection of nodes.
*
* Given the string s, first make a linear sequence of qnodes corresponding to
* the sequence s. Then choose some ... |
C | #include <stdio.h>
//逻辑与 &&
//逻辑或 ||
//逻辑非 !
int main(void)
{
int score;
int age;
printf("please input a number: \n");
scanf("%d %d", &score, &age);
//逻辑或 只要有一个条件成立 整个表达式就为真
if (score < 0 || score > 100)
{
printf("The score is out of range\n");
}
/*
* 判断年龄在13至... |
C |
#include <stdlib.h>
#include <stdio.h>
#include "IO_Map.h"
#include "PDD/UART_PDD.h"
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
#define SERIAL_BASE_UART_BASE_PTR (UART1_BASE_PTR) /**< which UART to use */
//#define SERIAL_BASE_UART_BASE_PTR (UART3_BASE_PTR) /**< which UART to use */
/*!
* Semapho... |
C | //////////////////////////////////////////////////////////////////////////////
// Filename: C:\work\ringbuf\drivers/test_v1_00_a/examples/test_v2_1_0_app.c
// Version: 1.00.a
// Description: test (new FSL core) Driver Example File
// Date: Fri Oct 10 21:57:52 2008 (by Create an... |
C | /**************************************************************************************
* Author: Hayden Krile
* Course: EGR 226 - 905
* Date: 03/19/2021
* Project: Lab9Part1
* File: main.c
* Description: This program connects to the MSP432 and uses three pushbuttons and interrupts
* ... |
C | #ifndef motor_h
#define motor_h
bool DEBUG_motor = true;
bool motorChange = false;
int motorDir = 0; // 0=off, 1=Forward, 2=reverse
int motorpinA = 3; // PCF PIN
int motorpinB = 4; // PCF PIN
int motorInt = 7; // PCF PIN
int stallcnt = 0; // counter for stall
int stallReset = 500000; // r... |
C | /// Write a C program to find the largest of three numbers.
#include <stdio.h>
int main ()
{
int a,b,c;
printf("Enter Three Number :");\
scanf("%d %d %d",&a,&b,&c);
if(a>b&&a>c){
printf("%d is larger than three Number",a);
}
else if(b>a&&b>c){
printf("%d is large than three Num... |
C | #include "stdio.h"
#include "string.h"
#include "stdlib.h"
#include "Table.h"
#include "Emulate.h"
extern struct emulation table[];
/*
The purpose of this file is to hold the function Emulate Tokens. The function is responsible for returning
to the main file a char** that holds tokens that have been emulate... |
C | //WAP to print natural numbers from 1 to n using while loop
#include<stdio.h>
int main()
{
int i,n;
printf("Enter the value of n : ");
scanf("%d",&n);
i=1;
printf("Natural numbers are : ");
while(i<=n)
{
printf("\n%d",i++);
}
return 0;
}
|
C | #include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <pthread.h>
#include <ctype.h>
#include <stdbool.h>
#include "game.h"
struct gameargs {//Structure of game data
char word[30];
int ga... |
C | /*#15. Program for Making A user defined String compare Function. */
#include<stdio.h>
#define MAX 30
char mytolower(char ch)
{
if(ch<='A' && ch>='Z')
ch=(ch+32);
return(ch);
}
int mystrcmp(char str1[],char str2[])
{
int i;
for(i=0;str1[i]!='\0' || str2[i]!='\0';i++)
{
... |
C | #ifndef BIP_BUF_H_
#define BIP_BUF_H_
/* Author: Domen Puncer Kugler <domen@cba.si>. License: WTFPL, see file LICENSE */
#include <types.h>
struct bip_buf {
u8 *data;
unsigned size;
volatile unsigned head; /* points to first free byte */
volatile unsigned tail; /* points to first used byte */
volatile unsigned ... |
C | /* lab7.c
* Denzel Murdaugh <--- replace with your word!
* Denzelm <--- replace with your user word!
* ECE 223 Spring 2016
* MP7
*
* NOTE: You must update all of the following comments!
*
* Propose:
*
* Assumptions:
*
* An outline for the intera... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
char *src = "ashdheadjsuwtjdijfkitailkdkdk";
char head[5] = "head";
char tail[5] = "tail";
char *temp1 = (char *)malloc(sizeof(char) * 100);
char *temp2 = (char *)malloc(sizeof(char) * 100);
int inttemp = 0;
printf("src ... |
C | #ifndef DOMAIN
#define DOMAIN
typedef struct
{
char name[50];
char continent[15];
long long population;
}Country;
Country create_country(char name[],char continent[],long long population);
char* get_name(Country* c);
char* get_continent(Country* c);
long long get_population(Country* c);
#endif |
C | /**
* @file
* @author Kelemen Tamas <kiskele@krc.hu>
* @brief Macro definitions used in cli.c
*/
#ifndef CLI_H
#define CLI_H
#include "multipath.h"
#define strstart(src, pattern) strncmp(src, pattern, strlen(pattern)) ///< Src string begins with pattern
#define REGEX_IPV4 "([[:digit:]]{1,3})\\.([[:digit:]]{1,... |
C | #include <apue.h>
#include <myerror.h>
static void my_exit1(void);
static void my_exit2(void);
int main()
{
if (atexit(my_exit1) != 0)
err_sys("can't register my_exit1");
if ( atexit(my_exit2) != 0)
err_sys("can't register my_exit2");
if ( atexit(my_exit2) != 0)
err_sys("can't register my_exit2");
... |
C | #include "mock_queue.h"
#include "stdio.h"
enum UIEvent* events;
uint32_t numberOfEvents = 0;
uint32_t currentEvent = 0;
void setEvents(uint32_t newNumberOfEvents, enum UIEvent* newEvents) {
events = newEvents;
numberOfEvents = newNumberOfEvents;
}
long xQueueGenericReceive( void * xQueue, void * pvBuffer, ... |
C | #include<stdio.h>
int main()
{
int turn,n;
for(n=1;n<4;n++)
{
while(1)
{
while(turn!=0);
printf("\nI am Process-1 and I am in Critical section");
turn=1;
printf("\nI am Process-1 and I am in Remainder section");
break;
}
while(1)
{
while(turn!=1);
printf("\nI am P... |
C | #include<stdio.h>
#include<sys/types.h>
#include<unistd.h>
#include<string.h>
void eprint()
{
char error_message[30] = "An error has occurred\n";
write(STDERR_FILENO, error_message, strlen(error_message));
}
int main(){
printf("Welcome to WIscosin SHell");
char command[100];
char path[100]="/bin/";
char *args[... |
C | /************************************************************
* Program : HTTP Downloader
* Description : Program to get HTTP header info.
* Version : 0.04
************************************************************
* by Philip "5n4k3" Simonson
************************************************************... |
C | #include<stdio.h>
int main()
{
int N,a,b,c,d,e,f;
scanf("%d",&N);
a=N/3600;
b=N%3600;
c=b/60;
d=b%60;
e=d/60;
f=d%60;
printf("%d:%d:%d",a,c,f);
return 0;
} |
C |
#include "server.h"
int encrypt_and_send(byte * msg , const int length){
if(encType == PLAIN) //send plain text
{
if(writeInPipe(outputChannel, (byte *) msg , length) < 0)
{
fprintf(stderr , " **** Communication phase write error **** \n\n");
return -1;
}
return 0;
}
if(encType == RSA512){
... |
C | #include "libft.h"
/*Allocate (with malloc(3)) and returns a “fresh” string ending
with ’\0’ representing the integer n given as argument.
Negative numbers must be supported. If the allocation fails,
the function returns NULL.
*/
static size_t n_length(int n)
{
size_t i;
i = 1;
while (n /= 10)
i++;
return (i)... |
C | #include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<queue>
using namespace std;
const int N=3;
const int N2=9;
class puzzle
{
public:
int f[N2];
int space;
string path;
bool operator<(const puzzle &p)const
{
for(int i=0;i<N2;i++)
{
if(f[i]==p.f[i])continue;
return f[i]>p.f... |
C | #include<stdio.h>
#include<math.h>
#define Euler 2.71828182846
int pG = 0, lG = 0;
int main(void)
{
char operador;
int a,b,c;
int i, N;
//pG = lG = 0;
scanf("%d", &N);
char vet [N];
for(i = 0 ; i < N; i++)
{
scanf("%d %c %d",&a,&operador,&b);
scanf("%d %c",&c,&operador);
if((double) c/Euler > a && c > b)
{
pG++;
ve... |
C | #include <pthread.h>
#include <stdio.h>
#include <fcntl.h>
pthread_mutex_t lock_file = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t cond;
pthread_mutex_t lock_cond = PTHREAD_MUTEX_INITIALIZER;
static int cnt = 0;
void *cb(void *arg) {
pthread_mutex_lock(&lock_file);
int fd = open("test.log",O_WRONLY|O_APPEND|O_CREAT)... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
int main(int argc, char** argv) {
if (argc != 2) {
fprintf(stderr, "usage: %s input\n", argv[0]);
exit(1);
}
FILE* in = fopen(argv[1], "r");
char* line = calloc(100, sizeof(char));
uint64_t *mem = calloc(100000, sizeof(uint64_t)... |
C | #include <unistd.h>
#include <stdio.h>
#include "Settings.h"
#include "voiture.h"
#include "sharedmem.h"
#include "logger.h"
#include "randomLib.h"
#include "course.h"
// Essais et qualifs
void essai(SharedInfo shared, int index, int tempsTotalMax, Settings settings) {
Voiture voiture;
double vitesseMoyenne = ... |
C | // Noah Avizemer
// COP 3223, Fall 2018
// no886776
#include "assignment03.h"
#include <stdio.h>
//temp stores original value so that order can be switched
void sort_ascending(int *a, int *b, int *c)
{
int temp;
if(*b < *a && *b < *c)
{
temp = *b;
*b = *a;
*a = temp;
}
if (*c < *a && *c < *b)
{
temp = *c... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "set.h"
#define SETSIZE 1
#define ZEROSIZE 0
set* set_init(void)
{
set *s;
s=(set *)calloc(SETSIZE, sizeof(set));
if(s==NULL){
ON_ERROR("Creation of Set Failed\n");
}
s->ua=arr_init();
s->sz=ZEROSIZE;
return s;
}
set* set... |
C | /*
License: zlib license
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, ... |
C | #include "bpnn_fit.h"
#include "bpnn_config.h"
#include <stdlib.h>
#include <assert.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#define T bpnn_t
#define D IN_N
#define Q HIDDEN_N
#define L OUT_N
#include "CFICheck.h"
#include "enclave.h"
struct T
{
doub... |
C | /* Mapped-memory Writer program
* Version: February 7, 2017
*/
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
#include "mmap.h"
/* return a uniformly generated random number in the range [low,high]
*/
int random_range (un... |
C | /*
* =====================================================================================
*
* Filename: test_Q_stricmp.c
*
* Description:
* =====================================================================================
*/
#include <stdio.h>
int Q_stricmpn(const char *s1, const char *s2, int ... |
C | #include <stdio.h>
#include <stdlib.h>
#define SIZE 256
int main(int argc,char *argv[])
{
FILE *fs;
FILE *fa;
char temp[SIZE];
size_t bytes;
if(argc<3)
{
fprintf(stderr,"Usage: %s filename\n",argv[0]);
exit(EXIT_FAILURE);
}
if((fs=fopen(argv[1],"rb"))==NULL)
{
fprintf(stderr,"I could not open the file... |
C | #include <stdio.h>
#include <sys/types.h>
#include <signal.h>
#define SIGOK 10
pid_t pid_child;
void forever(){
while(1);
}
void createProcess (void (*F) (void)){
pid_t pid_child = fork();
if(pid_child){
return;
}else{
F();
}
}
int sendSignal(int sig){
if(pid_child)
... |
C | #include<stdio.h>
int main()
{
char str[100001],a[100001];
int t,min,deletions,flag,k,counter,initial,len;
char i,j;
scanf("%d",&t);
while(t--)
{
scanf(" %s",str);
flag=0;
for(k=1;str[k];k++)
if(str[k]!=str[k-1])
flag=1;
... |
C | /* CpSc 210
source: https://people.cs.clemson.edu/~rlowe/cs1070/examples/IO/Printf/printf1.c
printf() example for formated output.
This example demonstrates numerous options for formatting data
that is displayed from a program.
*/
#include <stdio.h>
#include <stdlib.h>
int main() {
int a=5;
... |
C | /**
* 复制输入到输出
* gcc -o exe\copy2.exe copy2.c
*/
#include <windows.h>
#define BUFSIZE 256
int main(){
char buf[BUFSIZE];
int n;
while((n = read(0, buf, BUFSIZE)) > 0)
write(1, buf, n);
return 0;
}
|
C | #ifndef HEADER
#define HEADER
#include "header.h"
#endif
int main() {
socket_t server_socket;
int port = 9002;
soc_set_ip(&server_socket, "0.0.0.0");
soc_set_port(&server_socket, port);
// Create the server socket
server_socket.id = socket(AF_INET, SOCK_STREAM, 0);
// Define the server a... |
C | #include "cs.h"
/* create a Householder reflection [v,beta,s]=house(x), overwrite x with v,
* where (I-beta*v*v')*x = s*e1 and e1 = [1 0 ... 0]'.
* Note that this CXSparse version is different than CSparse. See Higham,
* Accuracy & Stability of Num Algorithms, 2nd ed, 2002, page 357. */
CS_ENTRY cs_house (CS_ENTRY ... |
C | #include "logger.h"
#include <stdarg.h>
#define RED "\x1B[31;1m"
#define GRN "\x1B[32;1m"
#define YEL "\x1B[33;1m"
#define BLU "\x1B[34m"
#define MAG "\x1B[35;1m"
#define CYN "\x1B[36m"
#define WHT "\x1B[37;1m"
#define RESET "\x1B[0m"
static Logger logger = {.log_fd = {[LOG_RAW] = STDOUT_FILENO,
... |
C | #include <stdio.h>
int count=0;
void step(int n,char a,char b,char c)
{
if(n==1)
{
count++;
printf("%c->%c\n",a,c);
}
else
{
step(n-1,a,c,b); //moving the top n-1 discs to B rod
step(1,a,b,c); //moving the bottom last disc to C rod
step(n-1,b,a,c); ... |
C | #include <stdio.h>
// Assignment - 1, Section - 2.
/** Please read the instructions in the comment and
write the code accordingly.
This assignment will test your understanding with console input and output.
Just in case if you do not know the meaning of the term 'console', we typically
indicate it to mean keyboar... |
C | /**
* @file
*
* API for basic view LittlevGL implementation
*/
#ifndef SRC_UI_VIEWS_LVGL_VIEW_H_
#define SRC_UI_VIEWS_LVGL_VIEW_H_
#include "ui/views/basic_view.h"
#include "lvgl.h"
/**
* Initialize basic view structure
* @return 0(ERR_OK) on success, zero otherwise
*/
uint32_t lvgl_basic_view_create(ui_view_... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
char * generateRandXOR(char* hash, int r);
void R(char* in, char* out, int r);
void pass_hash(char *in, char *out);
void E(char *in, char *out);
void chopN(char *str, size_t n);
const int MAX_PASSWORD_LENGTH = 12;
int mai... |
C | #include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <s2e.h>
int main(int argc, char **argv)
{
if(argc < 2) {
puts("Usage: ./symio program_path [args]");
return 0;
}
int n;
char buf[1024];
puts("[Get crash input....]");
... |
C | #include <stdio.h>
#include <stdlib.h>
/*
* Definition of a struct that contains an int value
*/
typedef struct container* Container;
// TRIVIA: Guess what the struct size is
//
// Structs on my machine are 8 bytes aligned
// On my macOS (64 bit), pointers are 8 bytes.
// Integers are 4 bytes. Which means the to... |
C | /* name.h - fopen */
/* Constants that define the name mapping table sizes */
#define NAMPLEN 32 /* max size of a name prefix */
#define NAMRLEN 32 /* max size of a replacement */
#define NAMLEN 80 /* maximum size of a file name */
#define NNAMES 14 /* number of prefix definitions */
/* Definition of the nam... |
C | #include "displayRoad.h"
/* @function
* Creates an image that shows the road from
* the point of view of the car
*
* @param
* int horizonAbs : abscissa of the horizon point
* int horizonOrd : ordinate of the horizon point
* car carPosition : position of the car
* int hori... |
C | #include <stdio.h>
#include <ctype.h>
//TODO Global variables
int main(int argc, char* argv[])
{
//Driver Class
//Variable calls
compress();
decompress();
return 0;
}
void compress(){
//-------------------------------------------
//Variables
char fileString[1];
FILE *fptrIn;
... |
C | #include <stdio.h>
#include <ctype.h>
int count_words(const char* str)
{
int number_of_words = 0;
int is_prev_space = 1;
for (int i = 0; str[i] != '\0'; ++i)
{
if (is_prev_space && !isspace(str[i]))
number_of_words += 1;
is_prev_space = isspace(str[i]);
}
return n... |
C | /*********************************************************************/
/* Homework Assignment 5, for EECS 22, Fall 2018 */
/* */
/* Author: Jordan Bonecutter */
/* ... |
C | #include<stdio.h>
int main()
{
int i, initial=1, mid=1 , term, pri;
printf("Enter the number of terms :\n");
scanf("%d", &term);
for(i=1; i<=term; ++i)
{
printf("\n%d" ,initial);
pri=initial+mid;
initial=mid;
mid=pri;
}
return 0;
} |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* lsttest_main.c :+: :+: :+: ... |
C | #include <stdio.h>
void main()
{
int a,b,c,d,e;
scanf("%d",&a);//һ10-9999Ҵչ4λ
{
b=a%10;
c=(a%100)/10;
d=(a%1000)/100;
e=(a%10000)/1000;
printf("a:%d change to:%d%d%d%d\n",a,b,c,d,e);
}
printf("\n");
}
|
C | #ifndef FILESYS_H
#define FILESYS_H
#define DEVNAME "/dev/fd0H1440" /*Ҫ豸ļ,ʾ1.44MB*/
#define DIR_ENTRY_SIZE 32 /*Ŀ¼С*/
#define SECTOR_SIZE 512 /*ÿС*/
#define FAT_ONE_OFFSET 0X200 /*һFATʼַ*/
#define FAT_TWO_OFFSET 0X1400 /*ڶFATʼַ*/
#define ROOTDIR_OFFSET 0X2600 /*Ŀ¼ʼַ*/
#define DATA_OFFSET 0x4200 /*ʼַ*/
/* λ... |
C |
#include "list.h"
t_node *cur;
t_node *start;
void init()
{
cur = NULL;
};
int add(int data)
{
int flag=0;
t_node *p = cur;
if(cur==NULL){
flag=1;
}
cur = (t_node *)malloc(sizeof(t_node));
if (!cur)
return -1;
cur->data = data;
cur->next = ... |
C | #include <stdio.h>
#define NUM 4
int main (void)
{
int i, no;
int a[NUM];
printf("数据个数:%d\n", NUM );
for (i = 1;i <= NUM; i++)
{ printf("%d号:", i);
scanf("%d", &a[i-1]);
}
putchar('{');
for (i = 1; i<= NUM; i++)
printf("%d, ",a[i-1]);
putchar('}');
return 0;
} |
C | /**
* \file
* Describes a path through a tree.
*/
#include "address.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ENDL "\n"
#define LOG(...) fprintf(stderr,__VA_ARGS__)
#define TRY(e) do{if(!(e)) { LOG("%s(%d): %s()"ENDL "\tExpression evaluated as false."ENDL "\t%s"ENDL,__FIL... |
C | #include <stdlib.h>
#include <stdio.h>
/* https://github.com/RPISEC/MBE/blob/master/src/lab05/lab5B.c */
/* gcc -fno-stack-protector --static -o exp2 exp2.c */
int main(int argc, char **argv)
{
char buffer[128] = {0};
int size = atoi(argv[1]);
if(size > 64) {
printf("Too large\n");
exit(1... |
C | typedef struct file{
char name[32];
struct file *next;
int sector;
char properties[4];
int size;
}file;
typedef struct ffolder{
char name[32];
int sector;
int insector;
int upsector;
int next;
int filesector;
char properties[3];
int size;
}ffolder;
typedef struct fol... |
C | #include <stdio.h>
#include <stdlib.h>
#include <arpa/inet.h>
int main(void)
{
unsigned long a = 0x11223344;
unsigned short b = 0x1234;
//以字节为单位
//主机序转网络序 32位
printf("htonl(%p): %p\n", a, htonl(a));
//主机序转网络序 16位
printf("htons(%p): %p\n", b, htons(b));
//网络序转主机序 32位
printf("nt... |
C |
#include <stdlib.h>
#include <stdio.h>
#include <malloc.h>
#include <string.h>
#include "tcb.h"
/**
* diese funktion printet uns mal die Pointer von dem verwendeten Stack
* reines Debugging
*/
int tcb_contextprint(){
long stackp = 0;
long basep = 0;
__asm__ __volatile__ ( "mov %%ebp, %%eax":"=a" (basep));
__as... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_added_algo.c :+: :+: :+: ... |
C | #include "main.h"
/**
* end_func - terminates _printf() in the error cases
* @inv: the arguments inventory with most commonly used arguments
* Return: -1 always
*/
int end_func(inventory_t *inv)
{
int ret_value;
if (inv)
{
ret_value = inv->error ? -1 : inv->buf_index;
if (inv->i)
puts_mod(inv->buffer, ... |
C | #include "loadRanking.h"
/**
*Llegeix un fitxer ranking i posa a players[10][21], nivells[10], minuts[10] i segons[10]
*les dades guardades al fitxer.
*/
int readRankingInfo(char players[][21], int *nivells, int *minuts, int *segons) {
FILE *fp;
int i;
char line[200];
char *token;
fp = fopen("ranking.txt","r")... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_s_processor.c :+: :+: :+: ... |
C | #include "asm.h"
/*
* Address mode table.
* This table is indexed by the number
* that gets put in the r/m field,
* and holds a word containing a bit for
* each index register.
*/
int amodes[] = {
(1<<reg(BX)) + (1<<reg(SI)),
(1<<reg(BX)) + (1<<reg(DI)),
(1<<reg(BP)) + (1<<reg(SI)),
(1<<reg(BP)) + (1<<reg(D... |
C | /* Steve Phillips
2009.07.15
"The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
Find the sum of all the primes below two million."
The reasoning and the logic here is correct and precise, but I'm
running into memory issues. composite_array needs to be much
larger than size INPUT (INPUT^2?).
... |
C | /*
这段程序运行时,在刚开始阶段发现第一次从TEMPR task转到HMI task 的时候,有Char Array 乱码。之后的运行不再有这个问题。以后有debug工具后研究。
I (0) TEMPR: ventMachine name from HMI is QBDZ-001
I (10) TEMPR: In_Air_Temperature is 25.000000
W (200) HMI: ventMachine name from XXXX is �
��G�?|H�?
W (200) HMI: In_Air_Temperature is 20.100000
*/
typedef struct Vent_machine_S... |
C | /*
* rt_lists.c
*
* Created on: 2 oct 2016
* Author: osannolik
*/
#include "rt_lists.h"
static volatile list_sorted_t delayed[RT_PRIO_LEVELS];
volatile list_sorted_t ready[RT_PRIO_LEVELS];
static void update_next_wakeup(void);
static list_item_t *list_sorted_next_item(list_item_t *item);
static list_item... |
C | #include <stdio.h>
int main(void)
{
char thing = 45;
printf("%c",thing);
return 0;
}
|
C | /*******************************************************************************
* File Name: Swd_PhysicalLayer.h
* Version 3.0
*
* Description:
* This header file contains the macro definitions, function declarations for the
* physical layer of the SWD protocol. These include -
* a.) Setting a output pin high or... |
C | #include "arrayFlightCode.h"
int initFlights(FlightCode* list, int len){
int i;
int errorCode=-1;
if(list != NULL && len > 0)
{
for(i=0; i<len; i++)
{
list[i].isEmpty = EMPTY;
errorCode=0;
}
}
return errorCode;
}
void addFlightHardcode(FlightCode list[], int len)
{
int id[4]={1133,1218,1301,1353};
... |
C | #include<stdio.h>
int main()
{
int a,b;
a=6,b=a-2;
if(a>b)
printf("%d is greater than %d.\n",a,b);
return(0);
}
|
C | /*
** pen.c for pen in /home/bougon_p/rendu/gfx_tekpaint
**
** Made by bougon_p
** Login <bougon_p@epitech.net>
**
** Started on Fri Jan 8 02:24:14 2016 bougon_p
** Last update Wed Jan 27 03:18:30 2016 THEIS Paul
*/
#include "paint.h"
void fill_line(t_data *data, int cond)
{
t_bunny_position *pos;
if ((pos... |
C | #ifndef ENCRYPT_H
#define ENCRYPT_H
#include <stdint.h>
#include "aes.h"
#include <string.h>
/** AES */
void Encrypt(unsigned char * arg, unsigned int cont){
//define qual tamanho de chave a ser usado baseado no DEFINE escolhido na aes.h
#ifdef AES128
printf("AES 128 em uso...\n");
uint8_t ke... |
C | /* xblock.c - xbinsert, xbdelete */
#include <conf.h>
#include <kernel.h>
#include <dos.h>
#include <proc.h>
#include <mem.h>
/*------------------------------------------------------------------------
* xbinsert -- insert an XBLOCK into the current process memory list
*-------------------------------------------... |
C | // C program for implementation of selection sort
#include <stdio.h>
void swap(int *xp, int *yp)
{
int temp = *xp;
*xp = *yp;
*yp = temp;
}
void selectionSort(int arr[], int n)
{
int i, j, min_index;
for(i = 0; i < n - 1; i++){
min_index = i;
for(j = i + 1; j < n; j++){
if(arr[j] < arr[min_index]){... |
C |
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <libnetconf.h>
#ifdef __GNUC__
# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))
#else
# define UNUSED(x) UNUSED_ ## x
#endif
#define CAPABILITY_PREFIX "urn:ietf:params:netconf:"
#define ARGUMENTS "f:hl:p:c:vd"
void... |
C | #include "hb_array.h"
#include "hb_memory/hb_memory.h"
#include <string.h>
//////////////////////////////////////////////////////////////////////////
typedef struct hb_array_t
{
void * data;
hb_size_t size;
} hb_array_t;
//////////////////////////////////////////////////////////////////////////
hb_result_t h... |
C | #include <stdio.h>
void main(){
int x,pos,p,t=0,r=0;
scanf ("%d",&pos);
for(x=1;x<=pos;x++){
scanf("%d",&p);
if(p<50){
t++;
}
else if(p>50 && p<85){
r++;
}}
printf("%d %d",t,r);
} |
C | //
// Created by fred on 2020-03-06.
//
#include "string.h"
#include "stdlib.h"
#include <stdio.h>
char * addBinary(char * a, char * b){
unsigned int length1 = strlen(a);
unsigned int length2 = strlen(b);
char res_arr[length1 + length2 + 1];
for (int i = 0; i < length1; i++) {
res_arr[i] = a[i]... |
C | #include<stdio.h>
#include<conio.h>
#include<graphics.h>
void multiply(float a[3][3],float b[3][3],float c[3][3]){
int i,j,k;
float sum=0;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
for(k=0;k<3;k++){
sum=sum+a[i][k]*b[k][j] ;
}
c[i][j]=sum;
sum=0;
}
}
return;
}
void main(){
int ... |
C | /****************************************************************************
* The 'FASTQ_PAIR_ARRAY' structure group was used to store a array of
* paired FASTQ reads, including basic operation function as well.
*
* This file was written by Haibin Xu, December 2011.
*********************************************... |
C | #include <sys/socket.h>
#include <sys/types.h>
#include <sys/times.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <pthread.h>
#define RD_BUFF_MAX 1024
#define CLIENT_MAX 10
struct myhttp_header {
char me... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
/************************************************************************/
/* */
/************************************************************************/
/*********************************... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.