language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /*
* cmo.h
*
* Created on: 23/03/2021
* Author: CRISTIANMIRANDA
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "cnnDeepC.h"
#include "deep_learning_CMO.h"
void cmo_NHWC_l2_normalize(matrix_NHWC *s)
{
float sum = 0;
for(int i=0; i < s->w*s->h*s->n*s->c; i+... |
C | #include "game.h"
void InitBoard(char board[ROWS][COLS], int rows, int cols,char set)
{
int i = 0;
int j = 0;
for (i = 0;i < rows;i++)
{
for (j = 0;j < cols;j++)
{
board[rows][cols] = set;
}
}
}
void DisplayBoard(char board[ROWS][COLS], int row, int col)
{
int i = 0;
int j = 0;
printf("--------------... |
C | #include<stdio.h>
int main(void)
{
auto int x=10; /*auto variable is declared here */
{
auto int x=15; /* value of variable changes in other block */
{
printf("\n%d",x); /* takes value of x fRom inner block */
}
printf("%d",x);
}
}
|
C | #include <stdio.h>
typedef unsigned long long MarkWord;
typedef unsigned int Bit;
#define BIT_0 0b0
#define BIT_1 0b1
void Print_MarkWord(const MarkWord *markWord) {
int bit_size = sizeof(MarkWord) * 8;
for (int i = 0; i < bit_size; ++i) {
Bit bit = *markWord >> (bit_size - 1 - i) & 0x01;
prin... |
C | /*
* xilly_fiforead.c
* Read data out of a xillybus FIFO and into a Matlab array
*/
#include "mex.h"
#include <errno.h>
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <unistd.h>
uint8_t do_read(void *buffer, size_t buf_size, int read_fd) {
size_t... |
C | /**********************************************************************
*
* Filename: buttonPi1.c
*
* Description: Button device driver.
*
* Notes: This file is specific to the Raspberry Pi1 board.
* Now only (SW1 GPIO18) is Enable.
* If you want other Sws(SW0,SW2,SW3),Correct unsigned int b... |
C | /* dumpvalue() service, which prints to Standard Output the value of
an xmlrpc_value.
We've put this in a separate module in hopes that it eventually can be
used for debugging purposes in other places.
*/
#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "config.h" /*... |
C | #include <stdio.h>
#define IN
#define OUT
#define INOUT
void PRINTlist(IN void *src);
void *SetArounStu(IN int Len, INOUT void **src);
void *ArounStu(IN void *src);
void *PRINTlist(IN void *src)
{
int i = 0;
if(src != &src)
{
pirntf("src = %p\n", src);
src = **src;
}
return src;
}
void *SetArounStu(IN i... |
C |
// --- conteúdo do arquivo list.h a ser apresentado para o usuário ---
typedef void* List; // tipo "fantasia"
typedef void* ItemList; // tipo "fantasia"
typedef void* KeyItem; // tipo "fantasia"
// listCreate
// ----------
// Create a list.
//
// Return a pointer to a list; or return NULL, in error case.
List ... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef struct Node
{
int data;
struct Node* left, *right;
}Nodes;
int count=0;
int countall(struct Node*root)
{
if(root==NULL)
return 0;
if(root!=NULL)
{
countall(root->left);
count++;
countall(root->right);
}
return count;
}
/*i... |
C | #include <stdio.h>
#include <stdlib.h>
#include "pilha_privado.h"
pilha *
Init (int t)
{
//Aloca espaco para o indicador de estado dos elementos
pilha *aPilha = malloc (sizeof (pilha));
aPilha->topo = 0;
aPilha->size = t;
aPilha->datas = malloc (t * sizeof (void *));
// Informa que a pilha foi iniciali... |
C | #ifndef __OS_H__
#define __OS_H__
#include <kernel.h>
#include <klib.h>
/*------------------------------------------
spinlock.h
------------------------------------------*/
struct spinlock {
int locked;
const char *name;
};
#define SPINLOCK_INIT(NAME) \
(struct spinlock) { \
.locked = 0,... |
C | //
// RedPacket.h
// algorithm
//
// Created by 宋春宇 on 2020/11/21.
//
#ifndef RedPacket_h
#define RedPacket_h
#include <stdio.h>
#include <time.h>
/*
微信红包算法
2倍均值算法,每个人期望一样,越后面的人方差越大
min =
max = (剩余钱数-(min*剩余人数))/剩余人数 * 2
*/
int getMoney(int remainPeople, int remainMoney)
{
if (remainPeople <= 1)
{... |
C | #include <iostream>
#include <stdio.h>
#include<math.h>
#include <clocale>
int main()
{
int a, b, h,x;
double y;
setlocale(0, "rus");
printf("Введите число а\n");
scanf_s("%d", &a);
printf("Введите число h\n");
scanf_s("%d", &h);
printf("Введите число b\n");
scanf_s("%d", &b);
x = a * h *... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/sctp.h>
#include <arpa/inet.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
/********************************************************************************... |
C | #include <stdio.h>
#include <assert.h>
#include <stdbool.h>
#include <string.h>
#include <stdlib.h>
#include <openssl/sha.h>
#include <openssl/hmac.h>
#include "utils.h"
#define MAX_LINE 2048
#define SHA1_HASH_LENGTH 40
int main(int argc, char** argv)
{
const char* secret;
secret = getenv("TRACKING_SECRET")... |
C | /*
* Delta programming language
*/
#include "delta/delta.h"
#include <sys/time.h>
/**
* @category modules/core/date
*
* @brief Return current Unix timestamp.
* @syntax number time ( )
*
* Returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970
* 00:00:00 GMT).
*
* ... |
C | /***************** b.c file ************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
main(int argc, char *argv[ ])
{
int i = 0;
printf("proc %d in b.out: argc=%d\n", getpid(), argc);
// Print argv
while(argv[i] != NULL)
{
printf("argv[%d] = %s\n", i, argv[i]);
... |
C | #include <stdio.h>
#include <stdlib.h>
int isprime(int a){
int i,j;
int flag=0;
for(i=2;i<a;i++){
if(a%i==0){
flag++;
return 0;
}
}
if(flag==0){
return 1;
}
} |
C | #ifndef TEXT_COMPONENT_H
#define TEXT_COMPONENT_H
#include "ecs.h"
//TEXT DATA COMPONENT
struct TextComponent
{
FontType fontType; //the font type to be used to display text
int size; //the characters size of the text in points (not pixels)
char* text; //the actual text to be displayed
};
//INIT
vo... |
C | /*
Name=Javed Ahamed
Glue Logon=jahamed
UID=109365000
Sec=0202
*/
/*"I pledge on my honor that I have not given or received any unauthorized
assistance on this assignment."*/
/*The purpose of this project was to implement a generic Table structure that
*could store non predetermined data types and one that has the ab... |
C | /*PAT Advance 1005. Spell It Right (20)*/
/*Author:Andy Yang*/
/*Email:andyyang0212@hotmail.com*/
#include<stdio.h>
#include<stdlib.h>
int main(){
char num[101];
int sum,i;
int a[3];
scanf("%s",num);
i = 0;
sum = 0;
while(num[i]!='\0'){
sum += num[i] - '0';
i++;
}
a[2] = sum / 100;
a[1] = (sum - a[2]*100... |
C |
void FilterStack (StackType *Stack, int Element)
{
StackType TempStack;
CreateStack(&TempStack);
int TempElement=0;
while(!EmptyStack(*Stack))
{
Pop(Stack,&TempElement);
if(TempElement!=Element)
{
Push(&TempStack,TempElement);
}
}
while(!EmptyStack(TempStack))
{
Pop(&TempStack,&TempEl... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main() {
srand((unsigned int)time(NULL));
char chArr[10] = { '\0' };
char get = '\0';
int cnt = 0;
for (int i = 0; i < 10; i++) {
chArr[i] = rand() % ('Z'-'A') +'A';
printf("%3c", chArr[i]);
}
printf("\n");
while (cnt < 10) {
c... |
C | /*File : operl.c*/
/*pemakaian beberapa operator terhadap bir*/
int main ()
{
/*KAMUS*/
int n = 10; /*1010*/
int x = 1; /*1*/
int y = 2; /*10*/
/*ALGORITMA*/
printf("n = %d \n", n);
printf("x = %d \n", x);
printf("y = %d \n", y);
printf("n & 8 = %d \n", n & 8); /*1010 AND... |
C | #include <stdio.h>
extern double wartosc (double a, double b, double x, int n);
int main()
{
printf("%lf\n", wartosc(4,3,3,2));
return 0;
}
|
C | #include <stdio.h>
#include <threads.h>
#include <pthread.h>
#include <stdlib.h>
static int num[1000];
pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
void Readnum()
{
if(pthread_mutex_lock(&mtx) != 0)
{
perror("pthread_mutex_lock");
exit(EXIT_FAILURE);
}
for(int i = 0; i< 1000; i++)
{
printf("Read num i... |
C | #include <assert.h>
#include <float.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "evaluate.h"
// seems to be good enough
#define MY_EPSILON 0.0000000000000001L
// #define MY_EPSILON LDBL_EPSILON
// adapted from
// https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2... |
C | #include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <string.h>
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
/*
* 错误处理函数
*/
static void display_error(const char *on_what)
{
perror(on_what);
exit(1);
}
int main(int argc, char *argv[])
{
... |
C | /*
* File: uart_fifo_tests.c
* Purpose: UART FIFO tests. All of these test use one UART
* as a transmitter sending to a second UART in order to test
* that the TxFIFOs and RxFIFOs are both working. A scope should
* also be used to double check correct operation.
*
*/
... |
C | #ifndef __RECORD_H
#define __RECORD_H
#include <string.h>
#include <stdio.h>
struct record
{
char *id;
char *value;
};
typedef struct record *Record;
typedef char *Key;
struct index
{
Key id;
int active;
long int fileIndex;
};
typedef struct index *Item;
// Cria um Record
Record RECORDcreate(ch... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#define MAX 100//κڵMAXĴС
int N,M;//NԴMʾ
int need[MAX][MAX];//P[i]jԴ
int available[MAX];//ijԴĿ
int max[MAX][MAX];//P[i]Դj
int allocate[MAX][MAX]= {0}; //p[i]jԴѷԴ
int finish[MAX]= {0}; //P[i]Ƿִн
int request[MAX][MAX];//̶ijԴ
int Flag[MAX]= {0};/... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAXSIZE 40
#define TRUE 1
#define FALSE 0
typedef struct
{
char string[10];
} Elemtype;
typedef struct
{
Elemtype data[MAXSIZE];
int top;
}SeqStack;
//½һջ
SeqStack *InitStack (){
SeqStack *S;
S=malloc(sizeof(SeqStack));
S->top =-1;
r... |
C | #include <stdio.h>
#include <math.h>
struct punto {
double x;
double y;
};
double dist(struct punto punto1, struct punto punto2);
int main(){
struct punto punto1;
struct punto punto2;
scanf ("%lf %lf", &punto1.x, &punto1.y);
scanf ("%lf %lf", &punto2.x, &punto2.y);
double distancia;
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* sprite.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int count=0;
int partition(int*,int,int);
void quickSort(int*,int,int);
void increment(int);
int partition(int *a, int start, int end)
{
int pivot = a[start];
int pIndex = start;
int i, temp;
for (i=start+1;i<=end;i++)
{
if (a[i]<pivot)
{
pIndex = pI... |
C | /* EEEN20060 Communication Systems, Link Layer Protocol Design
This is the application program for file transfer.
The application layer protocol is very simple:
the first byte of each block transferred is a header value,
identifying the type of block. This requires that the link
layer protocol prese... |
C | #include "apue.h"
#include <errno.h>
static int
pipe_buf_max(int fd)
{
#ifdef _PC_PIPE_BUF
long val;
errno = 0;
if ((val = fpathconf(fd, _PC_PIPE_BUF)) < 0) {
if (errno != 0) {
if (errno == EINVAL) {
fprintf(stdout, " (not supported _SC_PIPE_BUF)\n");
} else... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
freopen("1232.txt","r",stdin);
//while(1)
//{
int N, i;
scanf("%d", &N);
int* prefix = malloc(N * (N + 1) * sizeof(int));
int tmp;
scanf("%d", prefix);
for(i = 1; i < N; i++)
{
scanf("%... |
C | #include<stdio.h>
int main()
{
char string1[50],string2[50],*str1,*str2;
int i,equal = 0;
printf("Enter The First String: ");
scanf("%s",string1);
printf("%s\n",string1);
printf("Enter The Second String: ");
scanf("%s",string2);
printf("%s",string2);
str1 = string1;
str2 = st... |
C | #include <stdio.h>
#include <stdlib.h>
int hash(char c, int j, int k) {
return (c - 65 + j + k);
}
int main() {
int casos_de_teste = 0;
int linhas_a_seguir = 0;
int i = 0;
int j = 0;
int k = 0;
char caractere;
int soma_total = 0;
scanf(" %d", &casos_de_teste);
for (i = 0; i < casos_de_teste; ++i) {
// p... |
C | #include <stdio.h>
#include <sys/wait.h>
#include <sys/types.h>
int main()
{
pid_t pid, child;
int data=10;
int state;
pid=fork();
if(pid<0)
printf("fork fail. (process id : %d) ", pid);
printf("fork success. (process id : %d) \n", pid);
if(pid==0) /* child process */ {
data+=10;
printf("child data : %d \... |
C | #include "6845crt.h"
/*
* DECLARES DEFINITIONS USED BY 6845 CRT DRIVER
*/
#define SCREEN_CX 80
#define SCREEN_CY 25
#define VIDEO_BUFFER_ADDRESS 0xb8000
#define VIDEO_BUFFER_SIZE ((SCREEN_CX*SCREEN_CY)*2)
#define DEFAULT_ATTRIBUTE 7
#define KEY_LF '\n'
#define KEY_CR '\r'
#define KEY_TA... |
C | #include <stdio.h>
#include <limits.h>
int main()
{
printf("signed char min: %d\t max: %d\n", SCHAR_MIN, SCHAR_MAX);
printf("signed short min: %d\t max: %d\n", SHRT_MIN, SHRT_MAX);
printf("signed int min: %d\t max: %d\n", INT_MIN, INT_MAX);
printf("signed long min: %ld\t max: %ld\n", LO... |
C | //6518568 Ziyang Cheng
#include <math.h>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
/* parameters */
int RAND_SEED[] = {1,20,30,40,50,60,70,80,90,100,110, 120, 130, 140, 150, 160, 170, 180, 190, 200};
int NUM_OF_RUNS = 5;
static int POP_SIZE = 200; //global param... |
C | #include <stdio.h>
#include <stdlib.h>
struct link
{
int num;
struct link *next;
};
int main()
{
int i,x;
struct link *head=NULL,*p=NULL,*pr=NULL,*temp;
p=(struct link*)malloc(sizeof(struct link));
if(p==NULL)
{
printf("no enough memory to allocate!\n");
exit(0);
}
i... |
C | #include "ent_test.h"
int
table_null_sets_einval (void)
{
errno = 0;
assert (ent_table_len (NULL) == 0);
assert (errno == EINVAL);
errno = 0;
assert (ent_table_column (NULL, test_int8column) == NULL);
assert (errno == EINVAL);
errno = 0;
ent_table_free (NULL);
assert (errno == EINVAL);
errno = 0;
ent_tab... |
C | #include<stdio.h>
#include<string.h>
void my_strncpy(char [], char [], int );
int main()
{
int num;
char str1[20],str2[20];
printf("enter source string\n");
gets(str1);
printf("enter num\n");
scanf("%d",&num);
my_strncpy(str1,str2,num);
printf("copied string is:%s \n",str2);
return 0;
}
void my_strncpy(cha... |
C | // LOGIN HEADER
#ifndef _LOGIN_H_
#define _LOGIN_H_
#include "General.h"
struct staff {
char username[100];
char password[100];
char fullname[100];
char dob[20];
int gender;
int type;
};
struct lecturer {
char username[100];
char password[100];
char fullname[100];
char dob[20];
int gender;
int type;
ch... |
C | /* 20.c Programma ar datu izvadi (data out)
Programmas autors: Sandis Mālnieks 193NIC058
Programma veidota 2019. gada 23. novembrī
Versija: 1.0
Programma mani iztaujā un veic aprēķinus lietojot user-functions */
#include <stdio.h>
void f61() /* Void datu tips nozīmē, ka funkcija neko neatgriež (kā procedure in Pascal... |
C | #include "SortedLinkedDictionary.h"
struct _SortedLinkedDictionary {
Node* _element;
int _size;
int _capacity;
};
void SortedLinkedDictionary_deleteLInkedChain(SortedLinkedDictionary* _this);
SortedLinkedDictionary* SortedLinkedDictionary_new(int maxsize) {
SortedLinkedDictionary* _this = NewObject(SortedLinkedD... |
C | #include<stdio.h>
int main()
{ int t;
scanf("%d",&t);
while(t--)
{ int n;
scanf("%d",&n);
char x[n];
scanf("%s",x);
int a=0;
for(int i=0; i<n; i++)
{ if(x[i]=='1') {a++;}
}
printf("%d\n",(a+ (a*(a-1)/2)));
}
return ... |
C | /*************************************************************************************
* File name : Polynomial.h
* Description : 研究一元n次多项式的算法实现.
* Creator : XU ZAN
* Creation date : Tue. Dec. 09, 2014
* Copyright(C) 2014 All rights reserved.
*
**************************************************************... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line.c :+: :+: :+: ... |
C | #ifndef _BASIC_ALGORITHMS_H_
#define _BASIC_ALGORITHMS_H_
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "openbest-ds/config-ds.h"
/** outer array for indirect sorting using real values */
real* outer_array;
/** outer array for indirect sorting using temp_t values */
temp_t* outer_arrayT;
/** ou... |
C | //
// Created by Administrator on 2021/4/30.
//
#include <stdio.h>
#include <string.h>
#include "..\str\str.h"
/*将str1字符串中第一次出现的str2字符串替换成str3*/
void replaceFirst(char *str1, char *str2, char *str3) {
char str4[strlen(str1) + 1];
char *p;
strcpy(str4, str1);
if ((p = strstr(str1, str2)) != NULL)/*p指向s... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define LOWER 0
#define UPPER 100
int cmpfunc(const void *a, const void *b) {
return (*(int *)a - *(int *)b);
}
int randint() {
return rand() % (UPPER - LOWER + 1) + LOWER;
}
int *array(int size) {
int *a = (int *)malloc(sizeof(int) * size);
fo... |
C | #ifndef MATRIX_H
#define MATRIX_H
#include "vector.h"
/* Square matrix */
typedef struct
{
int n; // Matrix size
double *data; // Matrix data a_{i,j} = data[i*n+j]
} matrix;
// Create and destroy matrix
matrix createMatrix(int n) ;
matrix createMatrixFromData(double *data, int n) ;
void destroyMatrix(mat... |
C | /*
copyright: Boaz segev, 2016
license: MIT
Feel free to copy, use and enjoy according to the license provided.
*/
#ifndef LIB_SERVER_H
#define LIB_SERVER_H
#define LIB_SERVER_VERSION "0.3.1"
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <stdint.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h... |
C | #include <stdio.h>
#include <pthread.h>
int isPrime(int n, int i) {
if (i == 1) return 1;
else
{
if (n % i == 0) return 0;
else
{
return isPrime(n, i - 1);
}
}
}
void *func1() {
int n = 2;
printf("Print all prime numbers from 2 to 1.000.000: ");
w... |
C | #include
#include
void main()
{
int n,j,a[50],i=0;
clrscr();
printf("\n enter the value :-");
scanf("%d",&n);
while(n!=0)
{
a[i]=n%2;
i++;
n=n/2;
}
printf("\n binary conversion\n");
for(j=i-1;j>=0;j--)
printf("%d",a[j]);
getch();
} |
C | typedef struct node_t {
int key;
struct node_t* parent;
struct node_t* left;
struct node_t* right;
void* data;
} node_t;
typedef struct bst_t {
node_t* root;
} bst_t;
node_t* create_node(int key, void* data);
void inorder_bst_walk(bst_t* bst);
node_t* bst_search(node_t* node, int key);
node_t... |
C | #pragma once
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define BUFFER 100
#define MAN 'M'
#define WOMAN 'W'
#define TRUE 1
#define FALSE 0
typedef int BOOL;
typedef struct _HUMAN
{
char name[BUFFER];
int age;
char sex;
}HUMAN;
void fread_fwrite()
{
char* FILE_NAME = "fread_fwrite.txt";
FILE* fi... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "List.h"
static void __addAtFront(ListPtr list, NodePtr node);
static void __addAtRear(ListPtr list, NodePtr node);
static NodePtr __removeFront(ListPtr list);
static NodePtr __removeRear(ListPtr list);
static NodePtr __removeNode(ListPtr list, NodePt... |
C | #include <stdio.h>
#include<string.h>
int main() {
//code
int num;
scanf("%d",&num);
while(num--)
{
char str[101];
scanf("%s",str);
int count=0,i,j;
for(i=0;i<strlen(str);i++)
{
if(str[i]!='1')
continue;
for(j=i+1;j<strlen(str);j++)
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
#define MAX_L 16
int s1,s2;
char buffer[MAX_L];
//char str[MAX_L];
void server_connection()
{
struct sockaddr_in server_endp... |
C | int main()
{
int n,a,b,c=0;
scanf("%d",&n);
a=n;
if(n==1){
printf("End");
}else{
for(;1<a;){
if(a==1){break;}else{
if(a%2==0){
b=a;
a=a/2;
printf("%d/2=%d",b,a);
printf("\n");}else{
if(a%2==1){
b=a;
a=a*3+1;
printf("%d*3+1=%d",b,a);
printf... |
C | /*
* Copyright (c) 2012-2014 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr.h>
#include <sys/printk.h>
#include <drivers/gpio.h>
void main(void)
{
printk("Hello World! %s\n", CONFIG_BOARD);
const struct device *gpio_dev;
gpio_dev = device_get_binding("GPIO_0");
// S... |
C | #include <stdio.h>
int main(){
char a = 127;
int b = 'a';
printf("%d", a+b);
} |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <wait.h>
#include "zemaphore.h"
//--------------------------initializes the specified zemaphore to the specified value
void zem_init(zem_t *s, int value) {
s->counter = value;
s->lockdo... |
C | /*
Author: Scarlett Jones (ScarlettJones@my.unt.edu)
Date: 10/2/14
Instructor: Mark Thompson
Purpose: Add in the missing code. Learn how to use switch statements.
*/
/* This preproccessor directive tells the preproccessor to include a copy of the standard input/output library, found in the usual place. */
#include <s... |
C | #include "eval.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
double eval(const char *org)
{
int i, j, cnt, f;
double tmp;
char str[STR_LENGTH], str2[STR_LENGTH], val[16];
strinit(str, org);
for (i = 1; str[i] != '\0'; i++)
{
if (str[i] != '(') continue;
i... |
C | /***************************************************************************
vidhrdw.c
Functions to emulate the video hardware of the machine.
***************************************************************************/
#include "driver.h"
#include "vidhrdw/generic.h"
static int video_control;
static int colo... |
C | /* LC3 simulator file.
* Complete the functions!
* This is a front-end to the code you wrote in lc3.c
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lc3.h"
void cmd_registers(lc3machine* mach);
void cmd_dump(lc3machine* mach, int start, int end);
void cmd_list(lc3machine* mach, int start, ... |
C | /* Copyright 2016 Marcus Geiger. All rights reserved. Use of this
* source code is governed by a Apache 2.0 license that can be found
* in the LICENSE file.
*/
#include "config.h"
#include <stdint.h>
#include <math.h>
float pressure_to_altitude(int32_t p)
{
// TODO most of this is constant
const float p0 ... |
C | #include <stdio.h>
#include <unistd.h>
int main()
{
printf("Befor Fork..\n");
pid_t pid = fork();
if(pid < 0)
{
printf("error occured when call fork()\n");
}
if(pid == 0 )
{
printf("I am the child\n");
}
else if(pid > 0)
{
printf("I am the parent!\n");
}
return 0;
}
|
C | #include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
void LimpaBuffer()
/* Limpa buffer de entrada para fgets */
{
while(getchar()!='\n');
return;
}
int main (void)
{
long long int cont, c, ParIgual, F, M;
char NumSex[1000000], Numero[2];
cont = 1;
while(scanf("%s", Numero) != EOF)... |
C | /*
* kdc2bmp.c - Converts an uncompressed DC-120 .kdc file to a .bmp file
*
* The 848x976 CCD data is converted to 1272x976.
*
* The CCD data starts at offset 15680 in the .kdc file, and
* is stored one row at a time. Each row is rotated by a
* pseudo-random number (in kdcoff below).
*
* Once the data is unro... |
C | #include <stdio.h>
#include <assert.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
const char *szCommand = "<not yet set>";
FILE *szLogFile = NULL;
void cleanup()
{
if ( szLogFile )
{
if ( fclose( szLogFile ) == EOF )
{
(void) fprintf(
stderr,
"%s: st... |
C | #include "holberton.h"
/**
* _memcpy - main function
* @dest: destination file
* @src: source file
* @n: number of bytes
* Return: dest
*/
char *_memcpy(char *dest, char *src, unsigned int n)
{
unsigned int zulu;
for (zulu = 0; zulu < n; zulu++)
{
dest[zulu] = src[zulu];
}
return (dest);
}
|
C | /**
******************************************************************************
* @file clock.c
* @brief STM8S clock initialization
* @author Alexey Chernysh
* @version V0.2
* @date 09-09-2016
******************************************************************************
*/
#include "common.h"
/**... |
C | #include <stdlib.h>
int main() {
int arr[] = {4,3,2,1};
int key = 0;
int it = 0;
for (int i = 1; i < 4; ++i) {
key = arr[i];
it = i - 1;
while (key > arr[it]) {
arr[it + 1] = arr[it];
}
}
} |
C | #include "sereal.h"
static inline void *realloc_or_raise(void *p, u32 n) {
u8 *buf = realloc(p,n);
if (!buf)
rb_raise(rb_eNoMemError,"memory allocation failure for %d bytes",n);
return buf;
}
static inline void *alloc_or_raise(u32 s) {
return realloc_or_raise(NULL,s);
}
... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
int main(int argc, const char * argv[]) {
int is_debug = 0;
const char *text;
const char *yandex_api_key;
... |
C | /*************************************************************************
* Copyright 2016 Jarrod N. Bakker
*
* 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 at
*
* http://www.apache.or... |
C | #include <stdio.h>
int main() {
char word[51];
scanf("%s", word);
int length = 0;
char temp;
while(word[length]!= '\0') {
length++;
}
// sort the word alphabetically
for (int i = 0; i < length - 1; i++) {
for (int j = 0; j < length-1; j++) {
if (word[j] > wor... |
C | #include<stdio.h>
#include"que.h"
typedef struct Priority{
int priority;
} Priority;
typedef struct Task{
int taskid;
Priority priority;
} Task;
typedef struct MultiQ{
Queue * q;
// Assuming that array index denotes priority
int length;
} MultiQ;
Task cast(Element e, int Priority);
MultiQ ... |
C | /*
** command_team.c for PSU_2016_zappy
**
** Made by Guillaume CAUCHOIS
** Login <guillaume.cauchois@epitech.eu>
**
** Started on Mon Jun 26 16:25:27 2017 Guillaume CAUCHOIS
** Last update Thu Jun 29 14:50:32 2017 Guillaume CAUCHOIS
*/
#include "server/command.h"
#include "server/socket.h"
void command_tna(t_ser... |
C | #include<stdio.h>
int main(void){
int e, y;
scanf("%d %d", &e, &y);
if(e==1) printf("%d\n", 1867+y);
else if(e==2) printf("%d\n", 1911+y);
else if(e==3) printf("%d\n", 1925+y);
else if(e==4) printf("%d\n", 1988+y);
else{
if(1988<y) printf("H%d\n", y-1988);
else if(1925<y) printf("S%d\n", y-1925);
else if... |
C | /*
Assignment 7
Exercise #1 and Exercise #18
Exercise #1:
Program accepts several words from user input and determines the smallest and largest words according to the dictionary.
Exercise #18:
Program accepts a data from the user in the from mm/dd/yyyy and then displays it in the form month dd, yyyy.
*/
#include ... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#define _CRT_NONSTDC_NO_DEPRECATE 1
/*
题目描述
密码要求:
1.长度超过8位
2.包括大小写字母.数字.其它符号,以上四种至少三种
3.不能有相同长度大于等于2的子串重复
输入描述:
一组或多组长度超过2的子符串。每组占一行
输出描述:
如果符合要求输出:OK,否则输出NG
input
021Abc9000
021Abc9Abc1
021ABC9000
021$bc9000
output
OK
NG
NG
OK
*/
#include "stdio.h"
#include "stdlib.h"
#include... |
C | #include <stdio.h>
#include <io.h>
#define MAX_SONG_NUM 200
extern char songs[MAX_SONG_NUM][50];
//path·µ.mp3ļ
int getPlaylist(char *path)
{
long Handle = 0;
int songNum = 0;
struct _finddata_t FileInfo;
//if((Handle=_findfirst(".\\music\\*.mp3",&FileInfo))==-1L)
if((Handle=_findfirst(strcat(path,"... |
C | #include <stdio.h>
#include <mpi.h>
int main( argc, argv )
int argc;
char **argv;
{
int rank, size; // Initialise the variables for use
MPI_Init( &argc, &argv ); // Initialise MPI
MPI_Comm_size( MPI_COMM_WORLD, &size ); // Get the communicator size and rank for the current process
MPI_Comm_rank( MPI... |
C | #include "shell.h"
char *triple_join(char *front, char *middle, char *back, char del)
{
char *dest;
int len;
dest = NULL;
len = ft_strlen(front) + ft_strlen(middle) + ft_strlen(back);
dest = ft_strnew(len);
if (front)
dest = ft_strcpy(dest, front);
if (middle)
dest = ft_strcat(dest, middle);
if (back)
... |
C | #include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include "treap.h"
int main() {
unsigned int N, i, M, j, num;
p_no resultado = cria_arvore();
srand((unsigned) time(NULL)); /* Coloca o horario atual como seed do gerador de numeros */
scanf("%u", &N);
for (i = 0; i < N; i++) {
scan... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include "get_next_line.h"
char *erase_nl(char *line2, char *dst)
{
int i = 0;
if (!dst)
return ("");
while (line2[i])
{
if (line2[i] == '\n')
{
line2[i] = '\0';
break ;
}
i++;... |
C | #include<stdio.h>
#include<stdlib.h>
int main(void)
{
int x, y,z=1;
printf("пJƤΫ\n");
scanf_s("%d%d", &x, &y);
while (y >= 1)
{
y--;
z = z*x;
}
printf("%d", z);
} |
C | #include "stdio.h"
#include "stdlib.h"
#include "math.h"
/*
Create N points on a sphere aproximately equi-distant from each other
Basically, N points are randomly placed on the sphere and then moved
around until then moved around until the minimal distance between the
closed two points is minimaised.
Pa... |
C | /*
This program will help approximate a definite integral for a function using left, right, and mid-point Riemann sums.
*/
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
bool validateInput(double left, double right, int n)
{
return !(left < -10.0 || right > 10.0 || right <= left || n <= 0);
}
double ... |
C | #include <stdio.h>
#include <stdlib.h>
#define M_PI 3.14159265358979323846
float areaCirculo(float radio);
int main ()
{
float radio;
printf("\nIndique el radio del cuadrado\n\n");
scanf("%f", &radio);
printf("\n\nEl area es %.3f", areaCirculo(radio));
return 0;
}
float areaCirculo(float radio)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.