language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
#include <string.h>
#include "myfs_lib.h"
#include "vdisk.h"
#define BUF_SIZE 500
int main(int argc, char** argv) {
// Fetch the key environment vars
char cwd[MAX_PATH_LENGTH];
char disk_name[MAX_PATH_LENGTH];
unsigned char buf[BUF_SIZE];
myfs_get_environment(cwd, disk_name);
// Ope... |
C | #include<stdio.h>
#include "E:\B.Harish\Sem 4\Os\Lab\CPU Scheduling\circularQueue.h"
#include<stdlib.h>
void enQProcessAtThisTime(int timer,process qcopy[],int n)
{
for(int i=0;i<n;i++)
{
if(qcopy[i].at==timer)
{
enqueue(qcopy[i]);
printf("\nEnqueued P%d Successfully\n",... |
C | #include <stdio.h>
char *ft_strdup(char *src);
int main()
{
char str[] = "hieu tran";
printf("%s\n", ft_strdup(str));
return (0);
}
|
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
int main()
{
printf("I am %d\n", getpid());
pid_t pid = fork();
printf("fork returned: %d\n", pid);
printf("I am %d\n", getpid());
return 0;
} |
C | //
// LCBXXZDChapterTwoAlgorithmDesignTwelve.c
// DataStructurePractice
//
// Created by ly on 2018/5/17.
// Copyright © 2018年 LY. All rights reserved.
//
#include "LCBXXZDChapterTwoAlgorithmDesignTwelve.h"
LinkList * findCommonTailStoreLocationLinkList(LinkList *first ,LinkList *second) {
LinkList *firstNex... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#define INPUT 0
#define OUTPUT 1
int main()
{
int file_descriptors[2];
pid_t pid;
//message to send
char *msg = "I have a dream";
char buf[256];
int read_count;
int result;
//create a pip... |
C | #include <stdio.h>
int main()
{
double a;int b;double c;
printf("Input capital, year:");
scanf("%lf,%d",&c,&b);
char d;
printf("Compound interest (Y/N)?");
scanf(" %c",&d);
switch(b)
{
case 1:a=0.0225;break;
case 2:a=0.0243;break;
case 3:a=0.0270;break;
ca... |
C | #include <mbgl/util/uv-messenger.h>
#include <mbgl/util/queue.h>
#include <stdlib.h>
typedef struct {
void *data;
void *queue[2];
} uv__messenger_item_t;
void uv__messenger_callback(uv_async_t *async) {
uv_messenger_t *msgr = (uv_messenger_t *)async->data;
uv__messenger_item_t *item;
QUEUE *head... |
C | #include <string.h>
#include <stdio.h>
#include "searchd/math-search.h"
#include "codec.h"
#define LINEAR_ARRAY_LEN 1024
#define TEST_NUM 10
#define STRUCT_MEMBERS (sizeof(struct math_score_res) / sizeof(uint32_t))
int main()
{
int i;
size_t res;
struct math_score_res test[TEST_NUM];
uint32_t linear[LINEAR_ARRAY_... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstmap.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<stdbool.h>
#include<stdlib.h>
#include"helpers.h"
#include<time.h>
int*selection_sort(int input_array[])
{
int length_of_array = 10;
printf("Length of array: %d",length_of_array);
int pointer = 0;
int small;
int iteration = 1;
do
{
small = pointer;
for (in... |
C | //-*-coding:utf-8-*-
//----------------------------------------------------------
// module: shm
//----------------------------------------------------------
#include <stdio.h>
#include <sys/shm.h>
#include <sys/stat.h>
int main(){
const int shared_segment_size = 0x6400;
int segment_id = shmget(IPC_PRIVATE, s... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf_u1.c :+: :+: :+: ... |
C | /* -*-mode: C; fill-column: 78; c-basic-offset: 4; -*- */
/*
* Copyright 2005 by Eric House (xwords@eehouse.org). All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; e... |
C | //
// A struct representing a point with a direction
//
#ifndef RUOEG_UTILS_POINT_H_
#define RUOEG_UTILS_POINT_H_
#include "Direction.h"
struct Point
{
Point() : x(0), y(0), dir(Direction::None), x_mod(0), y_mod(0) {};
Point(int x_, int y_) : x(x_), y(y_) {};
int x;
int y;
Direction dir;
// Variables used to m... |
C | #ifndef __CASE__H__
#define __CASE__H__
#include <stdio.h>
#include <stdlib.h>
#include "plateau.h"
typedef struct Position {
int ligne;
int colonne;
} Position;
typedef enum Couleur {
ROUGE = 1,
NOIR = 2,
VIDE = 0
} Couleur;
typedef struct Case {
Position pos;
... |
C | /*interface*/
#include<stdio.h>
#include<string.h>
/*interface implementation*/
/*client*/
int main() {
int n;
scanf("%d",&n);
int score[2];
score[0]=0;
score[1]=0;
char team[2][10+1];
int nteam=0;
int i;
for(i=0; i<n; i++) {
char name[10+1];
scanf("%s",name);
... |
C | #include <stdlib.h>
#include <pthread.h>
#include "czmq.h"
#include "util.h"
static void client_task(void *args, zctx_t *ctx, void *pipe)
{
thr_info *info = (thr_info *) args;
const char *connect = info->bind_to;
size_t msg_size = info->msg_size;
int msg_count = info->msg_count;
int perf_type = in... |
C | #include "bgr_image_transformations.h"
#define PROCESS_MATRIX_ERROR(status) { \
if ((status) != kMatrixOperationOk) { \
if ((status) == kMatrixOperationMemoryError) { \
return kBgrImageTransformationMemoryError; \
} \
return kBgrImage... |
C | #include <stdio.h>
#include <math.h>
int main() {
// In arithmetic operations, numbers has priority from left to right.
printf("Basic Arithmetic Operations\n\n");
int a=10;
int b=-3;
printf("Sum: %d \n", a+b);
printf("Sub: %d \n", a-b);
printf("Product: %d ... |
C | #include <stdio.h>
#include <stdlib.h>
//should make a standard FIFO queue
//using a linkedlist
//nodes used for the queue
typedef struct jobNode{
struct jobNode *next;
int timestamp;
int job_ID;
}job;
//the queue structure: one node for the head, and one for the tail
typedef struct Queue{
job *head;
job ... |
C | /*
3. Accept Character from user and check whether it is digit or not (0-9).
Input : 7
Output : TRUE
Input : d
Output : FALSE
*/
#include<stdio.h>
#include<stdlib.h>
#define TRUE 1
#define FALSE 0
typedef int BOOL;
BOOL ChkDigit(char ch)
{
if( ch >= 48 && ch <=57)
{
re... |
C | //
// maxInWindow.h
// offer
//
// Created by dudu294396112@qq.com on 2019/1/22.
// Copyright © 2019年 wz_0818@163.com. All rights reserved.
//
#ifndef maxInWindow_h
#define maxInWindow_h
/*
给定一个数组和滑动窗口的大小,返回每个滑动窗口的最大元素
*/
/*
输入:数组n,滑床大小k
输出:元素的集合,用vector
如果用暴力方法,对每个滑动窗口进行比较,则复杂度为O((n-(k-1))*k) = O(kn-k^2+... |
C | #include<stdio.h>
#include<string.h>
void fun(char[],char[]);
int main()
{
char arr1[20]="abcdef";
char arr2[10]="ghij";
int i;
fun(arr1,arr2);
printf("after fun call arr1 in main:%s\n ",arr1);
printf("\n after fun call arr2 in main:%s\n ",arr2);
return 0;
}
void fun(char arr1[],char arr2[])
... |
C | #include <stdio.h>
//6 2 34 1
int Max(int arr[], int n)
{
int i, temp;
for(i=0; i<n; i++)
{
if(arr[i]>arr[i+1]){
temp = arr[i];
}
else{
temp = arr[i+1];
}
}
printf("%d", temp);
return temp;
}
int main()
{
int arr[10];
printf("How many numbers... |
C | #include<stdio.h>
#include<assert.h>
char* my_strcpy(char* dust, const char* str)
{
char* ret = dust;
assert(dust != NULL);//断言
assert(str != NULL);
//把str指向的字符串拷贝到dust指向的空间,包含'\0'字符
while (*dust++ = *str++)
{
;
}
return ret;
}
int main()
{
char arr1[] = "********";
char arr2[] = "bit";
printf("%s\n", my_s... |
C | /* Authenticating a user against the shadow password file */
// Enter the user name, and then enter the corresponding password.
// If both of them is correct, print out the user ID.
#define _BSD_SOURCE /* Get getpass() declaration from <unistd.h> */
#define _XOPEN_SOURCE /* Get crypt() declaration from <unistd... |
C | #include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <stdlib.h>
#include <stdio.h>
#include <linux/soundcard.h>
#include <termios.h>
#define LENGTH 10
#define RATE 9600
#define SIZE 8
#define CHANNELS 1
#define RSIZE 8
struct fhead
{
unsigned char a... |
C | #include <pthread.h>
#include <stdio.h>
pthread_t id1, id[10];
int num, i, j, k;
int th, b[3][3], a[3][3];
int res[3][3];
void *mul(void *p)
{
int from, to;
num = (int)p;
from = (num * 3) / th;
to = (num + 1) * 3 / th;
for (i = from; i < to; i++)
{
for (j = 0; j < 3; j++)
{
... |
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 | /***
*mbsnextc.c - Get the next character in an MBCS string.
*
* Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
*
*Purpose:
* To return the value of the next character in an MBCS string.
*
*******************************************************************************/
#ifde... |
C | //
// main.c
// BellhamFord
//
// Created by ZhuZiyi on 3/31/16.
// Copyright © 2016 ZhuZiyi. All rights reserved.
//
//
// main.c
// HFT
//
// Created by Shang Liu on 3/30/16.
// Copyright © 2016 Shang Liu. All rights reserved.
//
#include <stdio.h>
#define inf 1000
#define currencyNumber 5
int main(int a... |
C | /*++
Module Name:
XStrSafe.h
Abstract:
A set of safe string functions.
History:
10/10/2012 ChiChen Re-purposed.
Internal:
--*/
#ifndef __XSTRSAFE_H_INCLUDED__
#define __XSTRSAFE_H_INCLUDED__
#pragma once
#include <XType.h>
#ifndef RESULT_SUCCESS
#define... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#define N_THREADS (8)
/**
* @param input, input gray-scale image, 0x00 to 0xFF
* @param width, width of the image
* @param height, height of the image
* @param threshold, pixel value to generate a 1bit image
* @return uint8_t*, 1bit image of 0x00 or 0xFF with... |
C | #include <stddef.h>
typedef struct {
char* name;
double value;
} identifier;
typedef struct {
identifier* identifiers;
size_t size;
size_t capacity;
} identifiers_table;
identifiers_table* create_table();
void destroy_table(identifiers_table*);
char* lookup(identifiers_table*, double);
void add_identifier(ident... |
C | //ʾdp33
//ѡ:ʹٶ,չ
//ѡ֮ǰ
#include <stdio.h>
//ʾcf34
int cf34(int x, int y)
{
return (2 * x + 5 * y + 100);
}
/////////////////////////
int main( )
{
int val;
val = cf34(23, 456);
printf("val=%d\n", val);
return 0;
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "Structure.h"
void main() {
LIRE_DATA();
//init();
system("color a");
/////////////////////////////////////////////
int choix=0;
printf("********************************************************\n");
printf("* Structure: Caracteristiq... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: ... |
C | /* dither.c
* Dithering
* (c) 2000-2002 Karel 'Clock' Kulhavy
* This file is a part of the Links program, released under GPL.
*/
#include "cfg.h"
#ifdef G
#include "links.h"
#include "bits.h"
#ifdef HAVE_ENDIAN_H
#include <endian.h>
#endif
#ifdef HAVE_MATH_H
#include <math.h>
#endif
/* The input of dithering ... |
C | #include <string.h>
#include "benchmark.h"
/* The implementation */
#include "tommyhashtbl.h"
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
#include "objs.c"
static tommy_hashtable * tommy_hashtable_alloc (unsigned n)
{
tommy_hashtable * ht = calloc (1, sizeof (* ht));
tommy_hashtable_init (ht, n);
re... |
C | # include <stdio.h>
int i = 0 ;
void val( ) ;
int main( )
{
printf ( "main's i = %d\n", i ) ;
i++ ;
val( ) ;
printf ( "main's i = %d\n", i ) ;
val( ) ;
return 0 ;
}
void val( );
|
C | #ifndef WORLD_H
#define WORLD_H
#include "space.h"
#include "object.h"
#include "player.h"
#include "npc.h"
#include "types.h"
#include "interface.h"
typedef struct _World World;
/***************************************************
* Function: world_Ini Fecha: 15-10-2016
* Autores: Segmentation Fault ... |
C | #include "Assert.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){
char myOp[3];
int val1 = 3;
int val2 = 3;
int result;
memset(myOp, '\0', 3);
strcpy(myOp,"==");
result = Assert(val1, val2, myOp);
memset(myOp, '\0', 3);
strcpy(myOp,">=");
result = Assert(val1, val2, myOp);
... |
C | #include<stdio.h>
int main()
{
int x[100],n,m,lower,upper,mid,i,p,f;
printf("Enter the number of elements in the array ");
scanf("%d",&n);
printf("Enter %d elements in the array ",n);
for(i=0;i<n;i++)
scanf("%d",&x[i]);
printf("Enter the element to be searched ");
scanf("%d",&m);
lower=0;
upper=n-1;
while(l... |
C | // 04-06-08 [Angor] Creacion
#include "./path.h"
inherit GORAT("room_base.c");
create () {
::create();
replace_program();
SetIntShort("el sendero al faro de Gorat");
SetIntLong(
"Las ltimas rampas de este sendero al faro que quedan al oeste para llegar "
"a la cima de esta colina son bastante ms empin... |
C | #include <stdlib.h>
#include <stdio.h>
#include "font.h"
#define asc2idx(asc) (asc-32)
void prsym(int idx) {
int iline;
char *(*symbol)[SYMBOL_HEIGHT] = &alphabet[idx];
for(iline = 0; iline!=SYMBOL_HEIGHT; ++iline){
puts((*symbol)[iline]);
puts("\n");
}
}
void printLine (int line, int argc2, char **argv2){
... |
C | //
// Created by 89674 on 2019/7/17.
//
#ifndef BASE_LEARN_SORTALGORI_H
#define BASE_LEARN_SORTALGORI_H
/**
* 几种常见的排序算法
*/
// 1. 快速排序
void quickSort(int arr[], int left, int right)
{
if (left < right)
{
int key = arr[left]; //比较点,这是第一个坑,将left位置的value存入key中,坑就出来了
int i = ... |
C | #include <stdio.h>
double f(double argument) {
return argument + 2;
}
double g(double a) {
return a - 1;
}
|
C | #ifndef __board_h__
#define __board_h__
#include <stdbool.h>
#include <stdint.h>
#define RIGHT 0
#define LEFT 1
#define UP 2
#define DOWN 3
/* Board size */
#define SIZE 4
typedef struct Board {
uint32_t board[SIZE][SIZE];
int score;
} Board;
typedef struct Change {
int score_diff;
bool moved;... |
C | #include<unistd.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<string.h>
#include<fcntl.h>
#include<event2/event.h>
// 对操作的回调函数
void write_cb(evutil_socket_t fd,short what,void *arg)
{
// 写管道的操作
char buf[1024] = {0};
static int num = 0;
sprintf(buf,"hello,world==%d\n",num++)... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<errno.h>
#include<string.h>
#include<locale.h>
#include<time.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
void errif(int condition, char* msg)
{
if (condition)
{
printf("%s: %s\n", msg, strerror(errno));
// retur... |
C | #include<stdio.h>
void find_greatest(int *vote_count,int *status,int candidates,int *winner1,int *winner2)
{
int temp=-32767,i,winner=-1;
for(i=1;i<=candidates;i++)
{
if(vote_count[i]>temp&&status[i]==0)
{
temp=vote_count[i];
winner=i;
}
}
... |
C | #include <stdio.h>
#include <string.h>
#include "ece454rpc_types.h"
int ret_int;
return_type r;
return_type nop(const int nparams, arg_type* a) {
if(nparams != 0) {
/* Error! */
r.return_val = NULL;
r.return_size = 0;
return r;
}
ret_int = 189998;
r.return_val = (void *)(&ret_int);
r.return_size = sizeo... |
C | /*
Максимальное и минимальное число, которое могут хранить переменные типа int
Диапазон значений переменной типа int ограничен
Такие переменные могут принимать значения от -2147483648 до 2147483647 включительно
Почему такие значения?
Потому что все переменные типа int имеют фиксированный разм... |
C | /*
** vector_rotation.c for rtv1 in /home/bourhi_a/tmp/RTV1/src/forms
**
** Made by amine bourhime
** Login <bourhi_a@epitech.net>
**
** Started on Wed Jan 22 18:52:07 2014
** Last update Fri Jan 24 02:07:41 2014
*/
#include <rtv1.h>
void rotate_vector_x(t_dpoint *vector, double rad_angle)
{
double tmp;
... |
C | /**ʾfork
* This program forks a separate process using the fork() system calls.
*$ gcc -o newproc_posix newproc_posix.c
*$ ./newproc_posix
* ۲죺1ABCֱ˼Σ 2CУֵǶ٣ Ϊʲô
**/
#include <stdio.h>
#include <stdlib.h> //for malloc
#include <string.h> //for mesmset,strcpy
#include <unistd.h>
#include <sys/types.h>
int main... |
C | /*
* Header file for bheap.c.
*
* This file is copyright 2005 Simon Tatham.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the... |
C | #include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <arpa/inet.h>
#include "UDPCommon.h"
Status DoOperation (Message *message, Message *reply, int s, SocketAddress serverSA);
void getMessage(Message *newMsg);
v... |
C | /*
============================================================================
Name : EjercicioIntegrador.c
Author :
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
============================================================================
* Ejercicio... |
C | //
// main.c
// ADE
//
// Created by Josselin on 06/02/2020.
// Copyright © 2020 Josselin. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <unistd.h>
#include <time.h>
#include <sys/time.h>
void createT(int n, int m, double *c, double **a, double *b, double **T, int base[... |
C | #include<stdio.h>
void main()
{
int a[i];
printf("enter the digit");
scanf("%d",a[i]);
for(i=0;a[i]!='null';i++)
{
if(a[i]>='1'&&a[i]>='9')
{
printf("not special charater");
}
elseif(a[i]>='a'&&a[i]<='z')
{
printf("not special charater");
}
else
{
count++;
}
printf("%d",count);
}
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
/*
Description: Given an array (1000 max) of int,
return a array of the prime numbers
Prime number is a number > 1 that has no positive divisor
other than 1 and itself
Author: Anyes Taffard
*/
const int debug = 0; //1: debug mode... |
C | /*
* This question is worth [20] points.
*
* Complete the following code so that it first forks a child and waits for it
* to terminate. During this time, the child process executes the binary
* /bin/ls and passes it the argument /bin so that it correctly lists the
* directory /bin. All output to the standard ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "shellcode-64.h"
#define TARGET "../targets/target6"
#define NOP 0x090
#define NOPSLIDE 8
int main(void)
{
char *args[3];
char *env[1];
int ripAddr = 0x2021fe68;
int shellAddr = 0x104ee28;
int overflowSize = ... |
C | #include <stdio.h>
#include <unistd.h>
#include <mpi.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
//Example compilation
//mpicc -O3 sort_act1_fhe2.c -lm -o sort_act1_fhe2
//Example execution
//mpirun -np 3 -hostfile myhostfile.txt ./sort_act1_fhe2
void generateData(int * data, int SIZE);
int compfn... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
/*
* Create a C program that runs a bash command received as a command line argument - popen.
*/
int main(int argc, char** argv) {
if (argc < 2) {
printf("Invalid command\n");
exit(1);
}
char* buf = (char*)malloc(100* sizeof(char))... |
C | /*
* Testing ADT Dynamic Strings
* Authors: Josias Cavalcante, Valney Junior
* Last edit: May, 2021
*/
#include "dstring.h"
#include <stdio.h>
#include <stdlib.h>
int main(void){
// Create a dynamic string made by a multiple concatenation of dynamic strings.
//dstring sint = dstring_newInt(54321);
dstring sr... |
C | /***
* @brief sieve.h function declarations and definitons to
* implement the sieve algorithm to find
* prime numbers
*
* @author Josh Bussis
* @date 2020/11/18
*/
#ifndef SIEVE_H__
#define SIEVE_H__
#include <stdlib.h>
/* FUNCTION DECLARATIONS */
int sieve(int max, i... |
C | #include"stack.h"
#include"stack.c"
#include<stdio.h>
int main()
{
int i;
for(i=0;i<10;++i)
push(i);
for(i=0;i<10;++i)
printf("%d,",pop());
return 0;
} |
C | /**
* main.c
* I2C1 DS1307 ( RTC)
* Nokia5110
* , define.
* PLL, 24 .
* 8 .
* .
* Keil 5.20
* STM32F100RB
* DS1307 ( Tiny RTS I2C)
* Nokia5110
* V.0.01 RTC DS1307
* 09.06.2016
* 27.06.2016
* ()
* 1 DS1307
*/
#include "def_f100x.h"
#include "PLL.h"
#include "SysTick.h"
#in... |
C | #include <stdlib.h>
#include <stdio.h>
#include <openjpeg.h>
#include <libgen.h>
#include <string.h>
#include "util.h"
#include "file.h"
char* open_img_source(char* file_path,long* length){
FILE *reader;
unsigned char *src;
reader = fopen(file_path, "rb");
if(!reader){
printf("Can't open file\n... |
C | #include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#define MAX_STR_SIZE 64
int main(int argc, char* argv[]){
for(int i = 0; i < strlen(argv[1]); i++){
argv[1][i] = tolower(argv[1][i]);
}
printf("%s\n",argv[1]);
return EXIT_SUCCESS;
} |
C | #ifndef __THREADPOOL_H_
#define __THREADPOOL_H_
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <signal.h>
#include <assert.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#define DEFAULT_TIME 1 /*默认时间10s*/
#define MIN_WAIT_TASK_NUM 10 /*当任务数超过了它,就该添加新线程了*/
#define ... |
C | #include "my_printf.h"
t_var_args g_var_args[] =
{
{'s', var_s},
{'c', var_c},
{'i', var_i},
{'d', var_d},
{'o', var_o},
{'u', var_u},
{'x', var_x},
{'X', var_xx},
{'%', var_percent},
{0, 0}
};
static void call_select_var(t_struct *st, va_list *list, char *str,
int *pos)
{
int i;
if (str... |
C | #include "../elf.h"
void*
elf_get_section(void* elf, const char* name, size_t* szp) {
int si = elf_section_find(elf, name);
if(si != -1) {
if(szp)
*szp = elf_section_size(elf, si);
return elf_section_offset(elf, si);
} else {
if(szp)
*szp = 0;
}
return 0;
}
|
C | #include<stdio.h>
int show(int num)
{
if(num%2==0)
return 1;
else
return 0;
}
int main()
{
int num;
printf("enter num\n");
scanf("%d",&num);
printf("\n%d",show(num));
return 0;
} |
C | #include <string.h>
char *findstr(char *str, char *tgt) {
int len=strlen(tgt);
for(; *str; str++)
if (!strncmp(str, tgt, len)) return str;
return NULL;
}
|
C | #include <wiringPi.h>
#include <softPwm.h>
int main (void) {
int intensity = 0;
wiringPiSetupGpio();
pinMode (18, PWM_OUTPUT);
pinMode (23, OUTPUT);
pinMode (24, OUTPUT);
for(;;){
for(intensity=0; intensity<1024; intensity++){
pwmWrite(18,intensity);
delay(1);... |
C |
#define FRAMES 64
#define PROCESSOS 20
#define PAGINAS_VIRTUAIS 50
#define WORKING_SET 4
#define TEMPO_NOVAREQ 3
#define TEMPO_NOVOPROC 3
#define INF 0x7FFFFFFF
// tempo, com minutos e segundos, para guardar o relógio
typedef struct tempo {
int m;
int s;
} tempo;
// frame da memória, ... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "garith.h"
int main(int argc, char **argv){
/*Plan: test multiplication by creating table of powers of some element.*/
/*Have sage verify the correctness*/
gf2128 elt;
gf2128 pow;
unsigned char coeffs[128];
bzero(coeffs,128);
coeffs[1]=1... |
C | #include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <sys/wait.h>
#include <stdlib.h>
void child_p(char **);
void read_args(char *, char **, char *);
int check_in(char **);
main(){
while(1){
printf("$");
char s[100];
char *args[10];
read_args(s, args," \n");
pid_t pid = fo... |
C | #include <stdio.h>
/*my memcopy fucntion*/
int main(void) {
int x = 3490;
int *p = &x;
int **q = &p;
int ***r = &q;
int ****s = &r;
int *****t = &s;
printf("%d -> x\n\a",x);
printf("%p -> &x\n\a",&x);
printf("%d -> *p\n\a",*p);
printf("%p -> &p\n\a",&p);
printf("%d -> **q\n\a",**q);
printf("%p -> &q\n\a"... |
C |
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
float maxx (float x, float y)
{
float w,b,c,z,d;
if(x>y)
z= x-y;
else
z= y-x;
b = exp(-z);
w = log(1+b);
c = x+w;
d = y+w;
if(x>y)
return(c);
else
return(d);
}
|
C | #include "ipcserverclient.h"
#define NUM_THREADS 2
#define USAGE_STRING "Usage: receiving_client_key message_to_send (Example: 42 hello)\n"
#define INIT_USAGE "Invalid arguments.\nUsage: ./client.out running_server_key new_client_key\n"
/**
* Receives a message from the message queue and puts it in a buffer
* @para... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
//ҲһԶ
int arr[10] = { 0 };
printf("%d\n", sizeof(arr)); //40
printf("%d\n", sizeof(int[10])); //40
int a = 10;
sizeof(int); //Ե
sizeof(a); //Ե
//ôˣʲôأ
//ͣȥʣµIJ
// int arr[10],ô;int [10]
}
#include<stdio.h>
void tes... |
C | // TheDieIsCast.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdio.h>
#define SIZE 51
int Case;
int W, H;
char Picture[SIZE][SIZE];
int Visited[SIZE][SIZE];
int Output[SIZE * SIZE];
int count;
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};
void init... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* move.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <mysql.h>
#include "databases.h"
void database_init(char* server, char* user, char* password, char* database)
{
conn = mysql_init(NULL);
if(!mysql_real_connect(conn,server,user,password,database,0,NULL,0))
{
exit(1);
}
}
void set_table(char* table_nam... |
C | /**********************
* Transitive closure *
**********************/
#include "graph.h"
graph g;
int n;
void warshall(graph &g);
void read(){
int i, j;
cin >> n;
g = graph(n);
while(1){
cin >> i >> j;
if( cin.eof() ) break;
g.insert(i, j, 1); g.insert(j, i, 1);
}
}
main(){
read(); /* rea... |
C | #include <stdio.h>
#include <math.h>
const long double polinom0 [10] = {0.00L, 1.84949460e2L, -8.00504062e1L, 1.02237430e2L, -1.52248592e2L, 1.88821343e2L, -1.59085941e2L, 8.23027880e1L, -2.34181944e1L, 2.79786260L};
const long double polinom1 [10] = {1.291507177e1L, 1.466298863e2L, -1.534713402e1L, 3.145945973L, -4.1... |
C | #include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <pthread.h>
#include <omp.h>
#include "timer.h"
/*
********************************************************NOTES FOR USE**********************************************************
- run with gc... |
C | // Grupo: Bruno, Guilherme e Italo
#include <stdio.h>
#include <math.h>
void imprime (int ano, int mes, int dia, int merito, int demerito){
printf("%d-", ano);
if(mes < 10){
printf("0%d-", mes);
}
else{
printf("%d-",mes);
}
if(dia < 10){
printf("0%d ", dia... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int *cMarks, i, nStud;
float sum = 0.0;
puts("How many students: ");
scanf("%d", &nStud);
cMarks = malloc(sizeof(int) * nStud);
if (cMarks != NULL)
{
for ( i = 0; i < nStud; i++)
{
printf("Enter C Marks for stu... |
C | #include<stdio.h>
int main()
{
int pinos0=0;
float pinos1=0;
int p =0;
printf("Digite o Número de pinos derrubados na primeira jogada!");
scanf("%d", &pinos0);
if(pinos0 == 12)
{
printf("Parabéns voçẽ fez 30 Pontos!");
}
else if( pinos0 % 2 == 1)
{
printf("Digite uma segunda jogada! ");
s... |
C | /*
求1到100的和
*/
#include <stdio.h>
int main(void) {
int i = 1;
int sum = 0;
/*do{
sum=sum+i;
i++;
}
while(i<=100);
printf("它们的和是%d\n",sum); */
/*while(i<=100);
{
sum=sum+i;
i++;}
printf("它们的和是%d\n",sum); */
for (i = 1; i <= 100; i++)
{ sum = sum... |
C | #include <stdio.h> /*puts*/
#include "heap.h"
void TestCreate();
int IsBeforeInt(const void *data1, const void *data2, void *param);
void TestPush();
int IsMatchInt(const void *data1, const void *data2);
int main()
{
TestCreate();
TestPush();
return 0;
}
void TestCreate()
{
heap_t *heap = NULL;
... |
C | /****************************************************************
****
**** This program file is part of the book
**** `Parallel programming with MPI and OpenMP'
**** by Victor Eijkhout, eijkhout@tacc.utexas.edu
****
**** copyright Victor Eijkhout 2012-9
****
**** MPI Exercise to illustrate pipelining
****
*... |
C | #include<stdio.h>
int main()
{
int n,year,week,days;
printf("Enter the no : ");
scanf("%d",&n);
year=n/365;
week=(n%365)/7;
days=(n%365)%7;
printf("%d = %d years, %d weeks and %d days",n,year,week,days);
return 0;
}
|
C | #include <stdio.h>
int main(void){
int l, x;
l = 0x40000000;
printf("l = %d (0x%x)\n", l, l);
x = l + 0xc0000000;
printf("l + 0xc0000000 = %d (0x%x)\n", x, x);
x = l * 0x4;
printf("l * 0x4 = %d (0x%x)\n", x, x);
x... |
C | #include "wdg.h"
/*
: ʼŹ
:
u16 pr ԤƵϵ
u16 rlr װֵ(0xFFF)
*/
void IWDG_Init(u16 pr,u16 rlr)
{
IWDG->KR=0x5555; //д¼Ĵ
IWDG->PR=pr; //ԤƵϵͳ
IWDG->RLR=rlr; //װֵ
IWDG->KR=0xAAAA; //IWDG_RLRеֵͻᱻ¼ص
//ӶŹλ
IWDG->KR=0xCCCC; //Ź
}
/*
: ʼŹ
:
u... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.