language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #ifndef _findTagInner_C
#define _findTagInner_C
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* findTagInner(const char* text, const int startIndex, int* lastPosition, int* lineNumber)
{
int currentPosition = startIndex;
int found = 0;
int textLength = strlen(text);
int tagStartPositi... |
C | /*
* Purpose: Create a scanner to analyze lexical tokens
* Function List: scanner_init(), char_class(), get_next_state(), iskeyword(),malar_next_token(), aa_func02(), aa_func03(), aa_func05(), aa_func08(), aa_func10(), aa_func11(), aa_func12()
*/
/* The #define _CRT_SECURE_NO_WARNINGS should be used in MS Visual ... |
C |
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include "timer.h"
void say_hello(void *arg);
void print_value(void *arg);
void print_rectangle(void *arg);
void sigintr_handler(int signo);
int main(void)
{
/* 初始化闹钟 */
if (timer_init() != 0) {
fprintf(stderr, "init timer failed.\n");
... |
C |
#include <unistd.h>
int main (int argc, char **argv)
{
int i = 0;
while (argv[0][i])
{
write (1, &argv[0][i], 1);
i++;
}
return (0);
}
|
C | #include "holberton.h"
#include <stdlib.h>
/**
*string_nconcat - concate 2 strings
*@s1: string1
*@s2: string2
*@n: amount
*
*Return: pointer with the concatenated strings
*/
char *string_nconcat(char *s1, char *s2, unsigned int n)
{
char *concat;
unsigned int sz1, sz2, i, j, k;
sz1 = sz2 = 0;
if (s1 != NU... |
C | #include <stdio.h>
#include <stdlib.h> //for system()
#include <ctype.h> //for toupper
#include <time.h>
/*I have coded it for gcc */
void display_score();
void update_score(char nm[100],int sc);
int highest_score();
int score = 0;
int main()
{
char user_asnwer;
char start_option,ch1;
char name[100]... |
C | #define LINUX
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/proc_fs.h>
#include <linux/timer.h>
#include <linux/kthread.h>
#include <asm/uaccess.h>
#include <linux/spinlock.h>
#include <linux/string.h>
#include "mp2_group1.h"
#include "mp2_given.h"
static struct mp2_task... |
C | /*
* Created by Adrienne Slaughter
* CS 5007 Summer 2019
* Northeastern University, Seattle
*
* This 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, either version 3 of the License, or
* (at you... |
C | #define MAX 255
int findIndentation(DIR* dp, struct dirent* entry, struct stat buf, char* path, char* dir, int max, int low, int i); // Prototypes
void readDirectory(DIR* dp, DIR* dp2, DIR* dp3, char* path);
void accessAuthority(struct stat buf);
int sort(const void* a, const void* b);
void readDirectory(DIR* dp, DIR... |
C | #include <stdio.h>
void ordenar (int* n1, int* n2, int* n3){
int aux = *n1;
int aux2 = *n2;
int aux3 = *n3;
if(*n1 > *n2){
*n1 = *n2;
*n2 = aux;
if(*n2 > *n3){
*n2 = *n3;
*n3 = aux2;
}
}else{
if(*n1 > n3){
*n1 = *n3;
*n3 = aux;
if(*n1 > *n2){
*n1 = *n2;
*n2 = aux3;
}
}
}
}
... |
C | //
// main.c
// mycompress
//
// Created by Martin Prebio on 29.10.12.
// Copyright (c) 2012 Martin Prebio. All rights reserved.
//
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "compress.h"
#define COMPRESSED_SUFFIX ".comp"
extern int errno;
int main(int argc, const char * argv[])
{
FILE... |
C | /*
ʵ7-1-8 Ԫ 15 ֣
Ҫд˳n˳μǰ֮ÿԪصĸʽ
ʽ
ĵһиn1<n10һиnԿոָ
ʽ
˳μǰ֮ÿԪصĸʽּһĩжո
10
5 1 7 14 6 36 4 28 50 100
-4 6 7
-8 30 -32
24 22 50
*/
#include<stdio.h>
#define return return
int main() {
int N;
scanf("%d",&N);
int numbers[N];
for(int i=0; i<N; i++) {
scanf("%d",&numbers[i]);
}
if(N>1) {
for(int i=1; i<N; i++) ... |
C | #include <stdio.h>
int multiply(int factor1, int factor2);
void print(int number);
main()
{
int x = 10, y = 20, z;
z = multiply(x, y);
print(z);
}
int multiply(int a, int b)
{
int c;
c = a * b;
return c;
}
void print(int param)
{
printf("%d\n", param);
}
|
C | /*题目1:输入一个英文句子,反转句子中单词的顺序,但单词内字符的顺序不变。为简单起见,标点符号和普通字母一样处理。例如输入字符串“I am a student”,则输出“student. a am I”
第一步:反转句子中所有的字符。比如反转"I am a student."中所有的字符得到".tneduts a ma I",此时不但反转了句子中单词的顺序,连单词内的字符顺序也翻转了。第二步再反转每个单词中字符的顺序。*/
//第一步:
void Reverse(char* pBegin,char* pEnd)
{
if(pBegin==NULL||pEnd==NULL)return;
while(pB... |
C | /*
** EPITECH PROJECT, 2019
** my_str_to_word_array.c
** File description:
** ..
*/
#include "gomoku.h"
#include <stdlib.h>
#include <stdio.h>
void my_free_tab(char **tab)
{
int y = 0;
while (tab[y] != NULL)
free(tab[y++]);
free(tab);
}
int my_delim(char s, char *lim)
{
int i = 0;
... |
C | #include<stdio.h>
int main(void)
{
struct car{
int year;
char *model;
char *make;
};
struct car new_car;
struct car old_car;
struct car parking_lot[10];
new_car.year=2013;
new_car.model="A5";
new_car.make="Audi";
old_car.year=1920;
old_car.model="fiesta";
old_car.make="ford";
parking_lot[0] = new_car;
parking... |
C | #include <stdio.h>
#include "types.h"
#include "tab.h"
void saisir_tab(struct tableau*tab) {
int i;
for(i=0; i<tab->size; i++) {
printf("valeur ?");
scanf("%d", &tab->values[i]);
}
}
void afficher_tab(struct tableau*tab) {
int i;
for(i=0; i<tab->size; i++) {
printf("%3d ", tab->values[i]);
}
... |
C | // ----------------------- MALLOC AND ITERATE TAG SEQUENCE --------------------------------------------------------------
// iteratetagsequence needs to be able to malloctagsequence for next subset ....
// these two functions recursively call each other
EPt *malloctagsequence(CS tag, EPt *parent);
VPt iteratetagsequen... |
C | /*************************************************************************
> File Name: src/user.c
> Author: xiaofan
> Mail: jianghu_xiaofan@foxmail.com
> Created Time: 2016Äê11ÔÂ22ÈÕ ÐÇÆÚ¶þ 15ʱ17·Ö14Ãë
************************************************************************/
#include "struct.h"
#inc... |
C | #include "csapp.h"
#include "file_server.h"
int main(int argc, char **argv) {
// Local variables
int index;
char *host;
unsigned short port;
unsigned int secret_key;
char *file_name;
char result[RESPONSE_LENGTH - RESPONSE_PAYLOAD_START];
unsigned int result_length;
// Make sure th... |
C | #include<stdio.h>
int main()
{
int n,i,j,cnt[100][100],count[100]={1},a[100],temp,b,c,k,l;
scanf("%d",&n);
for(i=0;i<10;i++)
{a[i]=i;
cnt[i][0]=i;}
for(j=0;j<n;j++)
{
scanf("%d %d",&c,&b);
printf("countinit %d",count[c]);
if(a[b]>a[c])
{... |
C | #include <stdio.h>
#include <cs50.h>
#include<ctype.h>
string ari(string);
string ari(string s) {
int score,chr=0,word=0,sent=0,i=0;
float Score,Chr,Word,Sent;
while(s[i]!='\0') {
if(isalnum(s[i]))
chr++;
if(s[i]==' ')
word++;
if((s[i]=='.' && (s[i+1]==' ' || s[i+1]=='\0')) || s[i]=='?' || s[i]=='!')
se... |
C | #include "matrix.h"
// ! @throws EXCEPTION
void matrix_put
(t_matrix *this, int row_index, int col_index, double value)
{
if (this == NULL)
RAISE(NULL_POINTER_EXCEPTION);
if(row_index > this->rows || col_index > this->cols)
RAISE(INDEX_OUT_OF_BOUNDS_EXCEPTION);
this->data[row_index][col_index] = valu... |
C | #include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <stdlib.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include "audio.h"
#include "contient.h"
#include "filters.h"
void die(char *s) {
perror(s);
exit(1);
}
int main... |
C | //Receba do usuario um vetor com 10 posicoes. Em seguida, deverão ser impressos na tela o maior e o
//menor elemento desse vetor.
#include <stdio.h>
int main()
{
#define n 10
int A[n];
// le os valores
for (int i = 0; i < n; i++)
{
printf("Valor %d = ", i);
scanf_s("%d", &A[i]);
}
... |
C | #include <stdio.h>
#include <stdlib.h>
#define BLOCK_SIZE (4 * 1024)
#define DISK_SIZE (BLOCK_SIZE * 64)
/*
* disks are not byte addressable. It is read at sectors.
* In this simulation of hard disk, the size of each sector is 512 bytes.
*
* The total count of sector is = DISK_SIZE/SECTOR_SIZE
* ... |
C | int tempodequeda;//Essa varivel ir ser responsvel por definir o tempo padro que a pea levar para cair, e pode ser ajustado pela dificuldade do jogo.
void capa()//Essa funo puramente esttica, mostra o nome do jogo.
{
printf("--------------------------------------------------------\n");
printf("-----------... |
C | #include "findFuncs.h"
unsigned long hashFunc(unsigned char *str)
{
unsigned long hash = 5381;
int c;
while (c = *str++)
hash = ((hash << 5) + hash) + c;
return hash;
}
Bucket *findNumber(Bucket *bucket, char *num, int *pos){
int i;
*pos = -1;
Bucket *tmpBucket = bucket;
while(bucket != NULL){
for (i = 0... |
C | // https://www.interviewbit.com/problems/min-jumps-array/
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
// /**
// * @input A : Integer array
// * @input n1 : Integer array's ( A ) length
// *
// * @Output Integer
// */
// int jump(int* a, int n) {
// // if (a[0] == 0 && n > 1)
// // {
// ... |
C | //
// Parse.c
//
// $Author: whythluckystiff $
// $Date: 2003/07/29 16:54:35 $
//
// Copyright (C) 2003 why the lucky stiff
//
#include <string.h>
#include "syck.h"
#include "CuTest.h"
//
// 1. Test the buffering -- read 4 bytes at a time
//
void
TestSyckReadString( CuTest *tc )
{
SyckParser *parser;
char *t... |
C | /* Enter your solutions in this file */
#include <stdio.h>
#include <assert.h>
#include <math.h>
int max(int [], int);
int min(int [], int);
float average(int [], int);
int mode(int [], int);
int factors(int, int []);
int max(int a[], int n)
{
int max=a[0];
for(int i=1;i<n;i++)
{
if(a[i]>max)
... |
C | 作者:旮沓曼
链接:https://www.zhihu.com/question/264036496/answer/552352729
来源:知乎
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
#include <Windows.h>
BOOL SetPrivilege(LPCSTR lpPrivilegeName, WINBOOL fEnable)
{
HANDLE hToken;
TOKEN_PRIVILEGES NewState;
LUID luidPrivilegeLUID;
if(!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJ... |
C | #include<stdio.h>
void main()
{
int a,b,c;
printf("\n enter the numbers");
scanf("%d\t%d",&a,&b);
c=a;
a=b;
b=c;
printf("\n the values after swapping:%d\t%d",a,b);
getch();
}
|
C | int ft_strncmp(char *s1, char *s2, unsigned int n)
{
unsigned int indice;
indice = 0;
while ((s1[indice] != '\0' || s2[indice] != '\0') && indice < n)
{
if (s1[indice] != s2[indice])
return ((unsigned char)s1[indice] - (unsigned char)s2[indice]);
indice++;
}
return (0);
}
|
C | #include<stdio.h>
int main()
{
int i,temp,N=8;
int A[]={10, 15, 20, 25, 30, 35, 44, 55};
printf("The Array before Reversal is:\n");
for(i=0;i<N;i++)
printf("%d\t",A[i]);
printf("\n");
for(i=0;i<N/2;i++)
{
temp=A[i];
A[i]=A[N-1-i];
A[N-1-i]=temp;
}
printf("The Array after Reversal is:\n");
for(i=0;i<N... |
C | /*
* PROGRAMA DONDE REALIZA N PROCEDIMIENTOS DE LA SERIE FIBONACCI
*/
#include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<unistd.h>
#include<pthread.h>
void fibonacci_algo(int num_hilo,int tope);
void *funcion_hilo(void * parametro);
int *num_top;
int main(int argc, char*argv[])
{
int x;
pthread_t ... |
C | #include <serial.h>
#include <console.h>
#include <string.h>
#define BAUD 115200
// Due to removeing x12 and Enabling of clk doubleing on BRT_CLK
// (see AUXR_BRTx12_bit && PCON_SMOD_bit )
#define BAUD_CLKS (CPU_CLK_HZ / 16 / BAUD)
#define PCON_SMOD0_bit (1 << 6) // Double Baud rate of the UART CLK
#define PCON_SMO... |
C | #include "devicetree.h"
#include "uart.h"
#include "util.h"
unsigned long int align4(unsigned long int size)
{
unsigned long int residual = size % 4;
if(residual > 0)
return size + (4 - residual);
else
return size;
}
unsigned int convert_bigendian(void *ptr)
{
// ex. 1234 -> 4321
unsigned char *byte... |
C | //compare two array
#include<stdio.h>
#include<string.h>
int main(){
int arr1[]={21,34,41,22,35};
int arr2[]={61, 34, 45, 21, 11};
int i,j,n1,n2;
n1=(arr1);
n2=strlen(arr2);
for(i=0;i<n1;i++){
for(j=0;j<n2;j++){
if(arr1[i]==arr2[j]){
printf(" %d " ... |
C | /*
* File: main.c
* Author: Nibin chacko
*
* Created on 11 June, 2020, 8:43 AM
*/
#include <xc.h>
#include<string.h>
#include"clcd.h"
#pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled)
static void init_config(void) {
init_clcd();
}
void main(void) {
init_config();
... |
C | #include <stdio.h>
#include <stdbool.h>
#include <string.h>
#define INFINITY 9999
int n, m, test = 1;
void mst_prim(int graph[][n], int parent[]) {
int i, v, w, v0, w0, cost;
for (w=0; w<n; w++)
parent[w] = -1;
parent[0] = 0;
while(1) {
cost = INFINITY;
for (v=0; v<n; v++)
if (parent[v] !... |
C | /* Author: dpere048
* Partner(s) Name:
* Lab Section: 021
* Assignment: Lab #3 Exercise #1
* Exercise Description: [optional - include for your own benefit]
*
* I acknowledge all content contained herein, excluding template or example
* code, is my own original work.
*/
#include <avr/io.h>
#ifdef _SIMULATE_
... |
C | #include <CUnit/CUnit.h>
#include <CUnit/Console.h>
#include <stdlib.h>
#include "qc_queue_char.h"
qc_queue_t* queue;
static int initialize() {
queue = qc_queue_init();
if (queue == NULL) return 1;
return 0;
}
static int cleanup() {
free(queue);
return 0;
}
static void test_queue_get_size() {
... |
C | #include<stdio.h>
#include<conio.h>
void main()
{
int s=0;
printf("\n enter the number");
scanf("\n%d",&s);
if(s>=1)
printf("\n the number is positive");
else if(s==0)
printf("\n the number is zero");
else
printf("\n the number is negative");
}
|
C | #include<stdio.h>
void main()
{
int a[5];
printf("5");
int i,b;
for(i=1;i<=5;i++)
{
scanf("%d",&a[i]);
}
printf("ûгֵΪ");
for(b=0;b<=9;b++)
{
if(b!=a[1]&&b!=a[2]&&b!=a[3]&&b!=a[4]&&b!=a[5])
{
printf("%d",a[i]);
}
}
}
|
C |
//
// Created by: Victor Herrera-Ramirez and Brendan Currie
// under the direction of Dr. Shankar as a 'final project'.
//
// Date: 4-22-2017
// Version 1.03
//
// This program will take the inputs of a joystick and
// map them to a 3 x 3 matrix of leds. The leds will light
// on and off depending on the direction of ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* lists.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<malloc.h>
typedef struct QUEUE
{
int * pBase;//定义一个数组 用于保存数组的首地址
int front;
int rear;
}QUEUE;
void init(QUEUE *); //初始化队列元素
bool en_queue(QUEUE *,int val); //入队
void traverse_queue(QUEUE *); //遍历队列
bool full_queue(QUEUE *); //队列已满
bool out_queue(QUEUE *,int *); //出队
bool empty_queue(QUE... |
C | /*
You have purchased an expensive electronic device on the following credit plan: no down payment,
an interest rate of 18% per year (and hence 1.5% per month), and monthly payments of $50. The
monthly payment of $50 is used to pay the interest, and any remainder is applied to the principal.
Hence, if the price of the ... |
C | #include <stdlib.h>
#include <stdio.h>
int main(void) {
printf("Current %d\n", 1);
int rc = fork();
if(rc == 0) {
printf("Current %d\n", 2);
} else if(rc > 0) {
// wait(NULL);
printf("Parent %d\n", 3);
} else {
printf("Error");
}
return 0;
}
|
C | #include "../inc/libmx.h"
void mx_printint(int num)
{
if (num == 0)
{
mx_printchar('0');
return;
}
if (num < 0)
{
mx_printchar('-');
num *=-1;
}
int num_copy = num;
int count = 0;
while (num_copy != 0)
{
num_copy /= 1... |
C | #include<stdio.h>
int main(int argc,char* argv[])
{
if(argc<3)
{
printf("Please input the old file name and new file name\n");
return 1;
}
if(rename(argv[1],argv[2])==0)
printf("%s has been renamed to %s.\n",argv[1],argv[2]);
else
printf("cann't change %s.\n",argv[1]);
return 0;
}
|
C | #include<stdio.h>
#include<stdlib.h>
typedef struct node
{
int destination,weight,frequency;
struct node *link;
}node;
typedef struct mh
{
int location,weight;
}mh;
int visited[5500],minCount;
mh min[300000];
node *newNode(int dest,int weight)
{
node *temp=(node *)malloc(sizeof(node));
temp->destination=dest;
tem... |
C | #include<stdio.h>
int main()
{
int a[11]={45,36,36,48,6,455,55,78,55,545,63},x,i=0;
printf("enter the number you want to search\n");
scanf("%d",&x);
a[11]=x;
while(a[i]!=a[11])
{
i++;
}
if(i==11)
{
printf("item not found");
}
else
printf("the entered element is at the loc=%d\n",i+1);
}
|
C | #include <stdio.h>
/***********************************************************************************/
/* Please see bubble sort(the easiest way to sort) in */
/* [Introduction to Algorithms, chapter 2] http://book.douban.com/subject/1885170/ */
/* Download from http://pan.baidu.com/s/1d... |
C | #include <stdio.h>
#include <stdlib.h>
char *findCharactere (char caractere, char *str);
int main(int argc, char *argv[]){
char frase[80];
char chr, *pointer;
printf("Digite uma frase:");
gets(frase);
printf("Digite um caractere:");
chr = getche();
pointer = findCharactere (c... |
C | w// NBK s185205 02346, F20, DTU
#include "mpi.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <omp.h>
#include "readBMP.h"
#include "writeBMP.h"
#define MASTER 0
#define WINDOW_SIZE 5
void createImageArray(char *, PIXEL_ARRAY *);
void averagingFilterNaive(PIXEL_ARRAY *, ... |
C | #include <stdio.h>
int majorityElement(int* nums, int numsSize) {
int cur = nums[0];
int i = 1;
int cnt = 1;
for (i; i < numsSize; ++i) {
if (cur == nums[i])
++cnt;
else {
--cnt;
if (!cnt) {
cur = nums[++i];
... |
C | /*
* arrayUtils.h
* MakeMatrix
*
*/
#ifndef ARRAYUTILS_H
#define ARRAYUTILS_H
/** Print a text representation of a 2D float array to stdout.
*
* @param arr a pointer to the 2D array
* @param rows the number of rows in the array
* @param cols the number of columns in the array
*/
void printArray(float ... |
C | /* ANANYA RAVIPATI
pprimes.c
To compile code -> gcc pprimes.c -pthreads -o pprimes
To run ./pprimes <num> <nthreads>
Reference used- https://computing.llnl.gov/tutorials/pthreads/#Thread
*/
#include <omp.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
/* Define globally accessible variables and ... |
C | #include <stdlib.h>
/**
* @file my_string.h
*
* @brief Contains declarations Strlen, Strcmp, Strcat, Strtok
*
* @author Igor Kochetkov, DCAM MIPT (System Programming Base Chair) Student
*
* @date 10/03/2020
*/
#ifndef TASK_2_ONEGIN_MY_STRING_H
#define TASK_2_ONEGIN_MY_STRING_H
/**
* This function find len... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct student{
const char *name;
const char *major;
int reg;
struct student *next;
} student;
void traverse_reverse(student *end){
student *i = end;
for(; i!=NULL; i->next){
printf("Name: %s\n Major:%s \n Reg: %d\n", i->name, i->major, i... |
C | #include<stdio.h>
#include<stdlib.h>
#include<sys/mman.h>
#include<malloc.h>
#include<unistd.h>
#include<string.h>
#include<signal.h>
char *array;
void handler(){
printf("%s\n", array);
}
int main(int argc, char **argv){
int k;
int size = 100;
signal(SIGUNUSED, handler);
array = (char *)malloc(s... |
C | /*!
* @brief サーバ側のプログラム
*
* @file server.c
* @author 2012-C3-group03
* @version 1.0
*/
#include <limits.h>
#include <memory.h>
#include <netdb.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "lib/macro.h"
#include "lib/netutil.h"
#include "lib/typegame.h"
#define... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main (int argc, char *argv[]) {
if (argc == 1) {
printf("my-grep: searchterm [file ...]\n");
exit(1);
}
if (argc == 2) {
char* line = NULL;
size_t length = 0;
while (!(getline(&line, &length, stdin) == -1)) {
if (!(strstr(line, argv[1]) =... |
C | typedef struct{
//Stores the current, unfiltered sensor value
float rawValue;
//Circular array with previous filtered values
float prevValues[3];
//avg of last 3 filtered values
float avg;
}LRE_filter;
//Placeholder instance of the LRE_filter object
static LRE_filter FooBar;
/**
* initialize filter structur... |
C | #include <stdio.h>
#include <string.h>
#include "LexicalAnalyzer2.h"
FILE *fp;
char* token;
int Program();
int declarations();
int dataType();
int identifierList();
int assignStat();
int Program() {
token = getNextWord(fp);
if(strcmp(token, "main")==0) {
printf("\nParsed main");
... |
C | /* ************************************************************************** */
/* */
/* :::::::: */
/* ft_overflowunsigned.c :+: :+: ... |
C | /*
** EPITECH PROJECT, 2017
** my_ls
** File description:
** Recuparates the flags and directories' names.
*/
#include <dirent.h>
#include "my.h"
#include "struct.h"
#include "const.h"
static int add_flag(char *add, char *flags, int nb_flags)
{
for (int i = 1 ; add[i] ; i++) {
if (!in_str(add[i], flags) && in_str(... |
C | //3.2(12)
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
int n = 1;
while (1)
{
printf("Enter the number N: "); scanf("%d", &n);
if (n > 0)
{
int** array = (int**)malloc(n * sizeof(int*));
for (int i = 0; i < n; i++)
array[i] = (int*)malloc(n * sizeof(int));
for (in... |
C | /********************************************************
* Copyright (C) 2017 All rights reserved.
*
* Filename:CalcExe.c
* Author :yhd
* Date :2017-04-30
* Describe:The following functions are mainly used for
* the calculation of calculator values
*
*********************************... |
C | #include <math.h>
double f(double x)
{
return ((x+2)/sqrt(2*x)-x/(sqrt(2*x)+2)+2/(x-sqrt(2*x)))*((sqrt(x)-sqrt(2))/(x+2));
} |
C | #include "../include/hs_ringbuffer.h"
#include <string.h>
#include <stdio.h>
#include <memory.h>
int main(int argc, char** argv) {
static int buffer_length = 1024;
static const char* buffers[] = {
"worinima",
"worinimama",
"123456789012345678901234567890",
"我日你妈妈",
"坚持每天打飞机"
};
struct hs_ringbuffer* hr =... |
C | #include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <fcntl.h>
main()
{
int fd, num;
// fd=open("/dev/my74hc595", O_RDWR, S_IRUSR|S_IWUSR); //可读写方式打开设备文件
fd=open("/dev/my74hc595-0", O_RDWR); //可读写方式打开设备文件
if(fd!=-1)
{
read(fd, &num, sizeof(int)); //读取设备变量
printf("The my74hc595 is %d\n", num);
p... |
C |
#define __DELAY_C_
#include "stm32f10x.h"
#include "delay.h"
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
static __IO uint16_t TimingDelay;
//static u8 fac_us=0;//usʱ
//static u16 fac_ms=0;//msʱ,ucos,ÿĵms
#define SYSTEM_CLOCK 72 //ϵͳƵ
//ʼӳٺ
void delay_init(void)
{
... |
C | /*Calcularla superficie de un círculo. La operación se realizará una vez comprobado
que los valores ingresados sean correctos.*/
#include <stdio.h>
#include <conio.h>
#define PI 3.1416
int main() {
int r;
printf("ingrese radio del circulo: ");
scanf("%d", &r);
while(r<0){
printf("el radio no puede ser nega... |
C | #ifndef _MAP_UTIL_H_INCLUDED_
#define _MAP_UTIL_H_INCLUDED_
#define CAPACITY_UPPER_LIMIT 140000
#include <stdbool.h>
// Here the return type of a hash function is assumed to be unsigned = uint32_t
// If you want to change it, you can run find&replace for unsigned in map
// related files, just be careful not to mix t... |
C | //CPU code functions and prototypes.
double std_rand();
bool MetropolisStep (double delta_max, double T);
int getN();
void getKernelInputs(
int* Lx,int* Ly,int* Lz,
dtype*Hx,dtype*Hy,dtype*Hz,
dtype*J,dtype*isingAxisX,dtype*isingAxisY,
dtype*T);
void fillKernelArrays(KernelInputs& input)
{
//First lets check to s... |
C | /**
* TP n°: 5
*
* Titre du TP : Nested loop join disk
*
* Date : 10 Nov 2017
*
* Nom : Lefranc
* Prenom : Joaquim
* email : lefrancjoaquim@gmail.com
*
* Nom : Skoda
* Prenom : Jérôme
* email : contact@jeromeskoda.fr
*
* Remarques :
*/
#include "diskReader.h"
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
... |
C | #include <stdio.h>
#include <math.h>
#include <locale.h>
/*
1) The circles are equal
2) They don't touch
3) External touch
4) Inner touch
5) One circle inside another
6) Сrossing at 2 points
*/
void main() {
setlocale(LC_ALL, "rus");
float x1, y1, r1, x2, y2, r2, M, m, dl;
printf("Circle 1 (x1, y1, r1) = ");
s... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#define handle_error(msg) do { perror(msg); exit(EXIT_FAILURE); } whi... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "practice2_9.h"
int m, n; // Թά
int arc[20][20]; // Թ
MazeType maze;
void MainPractice2_9(void) {
char cmd;
Initialization();
do {
ReadCommand(&cmd);
Interpret(cmd);
}while(cmd != 'q' && ... |
C | // Bastian : Fichier contenant les fonctions utilisées dans le main pour l'affichage et autre
#ifndef __F_main_H__
#define __F_main_H__
#include <stdbool.h>
#define TAILLE_MAX 100
// minimum et maximum des paramètres d'indexation
#define MIN_INDEXATION_AUDIO 10
#define MAX_INDEXATION_AUDIO 250
#define MIN_INDEXATIO... |
C | #pragma once
void conv2d(double ** output, double ** input, double ** kernel, int N, int K);
void init(double ** res, double ** image, double ** kernel, int n, int k);
void conv2d(double ** output, double ** input, double ** kernel, int N, int K)
{
// Fill output matrix: rows and columns are i and j respectiv... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){
char user[] = "user";
char textToCopy[] = "test";
char commandString[100];
if(!strcmp(getenv("USER"), user))
sprintf(commandString, "echo '%s' | xclip -selection clipboard", textToCopy);
system(commandString);
... |
C | #include "conn.h"
#include "parse.h"
static void addCGI(cgi_node *node, pool* p);
static void removeCGI(cgi_node *node, pool* p);
void init_pool(int http_fd, int https_fd, pool *p) {
p->list_head = NULL;
p->list_tail = NULL;
p->cgi_head = NULL;
p->cgi_tail = NULL;
FD_ZERO(&p->ready_set);
FD_... |
C | /*
** ETNA PROJECT, 02/11/2018 by hauteb_m
** sokoban.c
** File description:
** sokoban functions
*/
#include <include/lib_sokoban.h>
#include <include/obstacles.h>
#include <include/utils.h>
#include <include/sokoban.h>
void print_map(char **map_content)
{ int i = 0;
while (*map_content[i] != '\0') {
... |
C | #include<stdio.h>
long long a[1000000]={0},b[1000000];
void rayhan(){
int i,j,c;
for(i=2;i<=sqrt(999999);i++){
for(j=2;i*j<=999999;j++){
a[i*j]=1;
}
}
a[0]=1;
a[1]=1;
}
long long abu(long long x){
int s=0;
while(x!=0){
s+=x%10;
x=x/... |
C | /*
* util.c -- utility functions used in common across commands.
*
*/
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "util.h"
/*
* upper_power_of_two: Returns the nearest upper power of 2 number to
* the argument passed in. We only use it for size_t... |
C | #include "button.h"
void insert_button_tail(button *b, button *new)
{
new->prev = b;
new->next = b->next;
b->next->prev = new;
b->next = new;
}
button *create_item()
{
button *item;
item = calloc(1, sizeof(button));
if (item == NULL) {
printf("create button item error\n");
... |
C | /*
** EPITECH PROJECT, 2017
** my_revstr
** File description:
** my_revstr
*/
#include "../../include/my.h"
char *my_revstr(char *str)
{
int j = my_strlen(str) -1;
char temp = 0;
int i = temp;
while (i < j) {
temp = str[i];
str[i] = str[j];
str[j] = temp;
i++;
j--;
}
return (str);
}
|
C | //mycp app by changmin, ckdals0115@naver.com
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<string.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#define MAX 64
void main(int argc,char* argv[]){
int original, copy, r_size;
char buf[MAX];
struct stat attribute;//stat 구조체선언 mode_... |
C | //-------------------------------------------------------------------//
// Math Helpers
//
// Copyright 2001 A better Software.
//-------------------------------------------------------------------//
#ifndef MATH_HELPERS_H
#define MATH_HELPERS_H
#include <math.h> // For atan2()
static double s_pi = acos(-1);
... |
C | #include "hash.h"
// ^^^ Consider storing the hash value of a position in state, and then when we make a move figure out what things need to get xored
// This function uses strtoull
void initHashVals(char *fileName) {
if (fileName == NULL) {
fileName = DEFAULT_RANDOM_NUMBER_FILE;
}
FILE *fp = fopen(fileName, "... |
C | #include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
#include <semaphore.h>
struct job {
/* campo link al siguiente trabajo para la lista enlazada. */
struct job* next;
/* otros campos extra que podría usar el trabajo... */
int k;
};
/* Una lista enlazada de trabajos pendientes. */
struct job* job_... |
C | // en este programa voy a hacer algunos experimentos con caracteres
#include <stdio.h>
int main(){
char name[50];
printf("introduzca su nombre: ");
gets(name);
printf("tu nombre es: %s",name);
return 0;
}
|
C | //int mergesort (void *base, size_t nmemb, size_t size, int (*compar ) (const void *, const void * ))
#include <stdio.h>
#include <stdlib.h>
int my_compare_int (const void *a, const void *b) {
int first = *((int *)a);
int sec = *((int *)b);
if (first < sec) {
return -1;
} else if (first > se... |
C | // Copyright 2015 Universidade Federal de Minas Gerais (UFMG)
#ifndef STACK_H_
#define STACK_H_
// Tipo dos elementos na pilha.
typedef char StackType;
// Tipo de dado stack (Pilha).
// Para garantir o ecapsulamento, 'struct StackStruct' só é definido em stack.c.
typedef struct StackStruct* stack;
// Cria uma pilha... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* history.c :+: :+: :+: ... |
C | #include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char const *argv[]) {
int nota_m = 0;
int nota_f = 0;
int alumnos_m = 0;
int alumnas_f = 0;
printf("Ingresar datos de 5 alumnos (SEXO NOTA): ");
while ((alumnas_f + alumnos_m) < 5) {
printf("\nAlumno #%d: ", (alumnos_m + a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.