language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/************************************************************************* > File Name: EP45.c > Author: wangshuai > Mail: ws1519704327@126.com > Created Time: 2019年12月24日 星期二 19时45分51秒 ************************************************************************/ #include <stdio.h> typedef long long int1...
C
#include <stdio.h> #include <sys/types.h> #include <stdlib.h> int main() { int *pt; int i=0; pt = (int*) malloc(sizeof(int)); *pt = 0; fork(); (*pt)++; printf("The value is: %d\n", *pt); printf("The value of the pointer is: %p\n",pt); printf("The address value of variable is: %p\n",&i); }
C
#include "../inc/ush.h" static int check_access(char *argument, int flag) { int is_access = 1; char *temp = NULL; char **splitted_path = mx_strsplit(getenv("PATH"), ':'); for (int i = 0; splitted_path[i]; i++) { temp = mx_strjoin(splitted_path[i], "/"); temp = mx_strjoin(temp, argument...
C
/** * @file PID.h * * @brief The header file for PID constants and calculations. * @details Sets the PID constants and calculate the PID value. * @author Eric Willcox * @date August 17 2013 */ #ifndef PID_H_ #define PID_H_ /** * @brief PID constants. * @details Obtain value using: * @code pidConst.Kp_H; @en...
C
#include <stdio.h> #include <stdlib.h> #include "symboltbl.h" #include "statements.h" union statement *stmts; void printSequence(union statement* seq); void printExpr(union expression* expr); int indlvl = 1; symtype exptype(union expression* expr) { if(expr == NULL) return INTEGER; // This is a readInt ...
C
// Calculate course grade for ECE 264 in Fall 2014 // // HOW TO USE: Change the scores below to reflect your scores. For // exam #4, PA12, or anything you are unsure of, enter your guess. // Then compile and run. It will display a report with a course grade. // // Note: This code is for convenience on...
C
#ifndef ORCID_H #define ORCID_H #define MIN_ORCID "0000000150000007" /* ORCID minimum pouvant être généré aléatoirement */ #define MAX_ORCID "0000000350000001" /* ORCID maximum pouvant être généré aléatoirement */ #define LEN_ORCID 16 /* vérification d'un ORCID sous forme de chaîne de 16 caractères sans tirets, renv...
C
//gcc main.c -std=c99 -O3 -s -lglfw3 -lopengl32 -lglu32 -lgdi32 // #include <GL/glu.h> #include <GLFW/glfw3.h> #include <stdlib.h> #include <time.h> #include <math.h> #define HEIGHT 1024 #define WIDTH 1280 #define BUFFER 10 struct point{ float x; float y; }; struct point points[BUFFER]; ...
C
#include "../include/operations.h" char plugin_name[80] = "divi"; m_complex* divi(m_complex *first, m_complex *second){ m_complex *ans = malloc(sizeof(m_complex)); m_complex *temp = malloc(sizeof(m_complex)); temp->re = second->re; temp->im = -second->im; first = mult(first, temp); second = mult(second, temp)...
C
#include <stdio.h> #include <sys/socket.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <netinet/in.h> #include <arpa/inet.h> //inet_ntoa() #include <regex.h> //regcomp(), regexec() enum{FALSE, TRUE}; //http://localhost:37864/index.html - sample URL //Multi-thread responses -> new request...
C
#ifndef __REAL_ADDRESS_H_ #define __REAL_ADDRESS_H_ #include <netinet/in.h> /* * sockaddr_in6 */ #include <sys/types.h> /* sockaddr_in6 */ /* Resolve the resource name to an usable IPv6 address * @address: The name to resolve * @rval: Where the resulting IPv6 address descriptor should be stored * @return: NULL if ...
C
#include <stdio.h> #include <string.h> #include "../header/BullScript.h" #include "../container/list.h" const int tblSize = 256; list_t lists[256]; size_t Hash(const char *name, int nameLength); void CreateSymbolList(void) { size_t i; for(i = 0; i < tblSize; i++){ lists[i] = List_Create(sizeof(Id...
C
/* Enhanced Message Encryption "enhMsgEnc.c" */ #include "scema.h" /* see Exhibit 2 -53 */ void Enhanced_Message_Encryption(unsigned char *msgBuf, const unsigned int numBits, const unsigned int dcchDTC, const unsigned char *rand, const unsigned char msgType, const unsigned int decr...
C
/* # This file is part of the Astrometry.net suite. # Licensed under a 3-clause BSD style license - see LICENSE */ #include <stddef.h> #include "fitsbin.h" #include "fitsioutils.h" #include "cutest.h" static char* get_tmpfile(int i) { static char fn[256]; sprintf(fn, "/tmp/test-fitsbin-%i", i); return...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <limits.h> #include <stdint.h> #include <math.h> unsigned long pilha[100]; unsigned long R[64]; unsigned long x, y; float z; unsigned long controlFpu; int xisfloat, yisfloat, zisint; FILE *saida; char flag1=0; /* 0-31 Registradores de proposito gera...
C
#include <stdio.h> #include "../list/library.h" void print_list(list l){ go_to(&l,0); size_t i; for (i=0; i<l.size; i++){ printf("%d ", current_val(&l)); next(&l); } printf("\n"); } int main(void) { /* Demo of working */ list a; init(&a); append_back(&a,4); /* 4 */ ...
C
#include <stdio.h> #include <stdlib.h> typedef unsigned char uint8_t; typedef char int8_t; typedef unsigned int uint32_t; int8_t binarySearch(uint32_t *arr, uint32_t number, uint32_t left, uint32_t right); int cmpfunc (const void * a, const void * b) { return ( *(int*)a - *(int*)b ); } int main(void) { un...
C
/*********************************************************************** *compute y = sum(sum(X.*Y)) ***********************************************************************/ #include <math.h> #include <mex.h> #include <matrix.h> #include <string.h> /* needed for memcpy() */ /******************************...
C
#include <string.h> #include <stdint.h> #include <stdlib.h> #include <stdbool.h> int compare(int a, int b) { return b - a; //all that needs to change is the order that we compare the elements }
C
#ifndef __huff_h_ #define __huff_h_ #include <stdlib.h> #include <string.h> #include <stdio.h> #include <math.h> /* Return/Error Codes */ #define OK ( 0 ) // No errors, everything as should be #define ERROR ( -1 ) // Generic error /* Function Prototypes */ void dijkstra(int * * coordinates...
C
#include <stdio.h> #include <unistd.h> #include <string.h> #include <fcntl.h> //对命名管道的操作和对文件的操作一样 int main(){ int fd=open("./myfifo",O_RDONLY); if(fd<0){ perror("open"); return 1; } char str[1024]={0}; while(1){ ssize_t s=read(fd,str,sizeof(str)-1); str[s]='\0'; if(s>0){ ...
C
#include <stdio.h> int main() { int a[20], n; printf("Introduceti numarul de elemente din vector: "); scanf("%d", &n); for (int i = 0; i < n; i++) { printf("a[%d] = ", i); scanf("%d", &a[i]); } int b[20], c[20], j = 0, h = 0, bn = 0, cn = 0; for (int i = 0; i < n; i+...
C
#ifndef PTRQUEUE_H #define PTRQUEUE_H #include <stdlib.h> #include <stdio.h> typedef struct Node{ char data; struct Node* next; } Node; typedef struct { struct Node* front; struct Node* back; } Queue; void queueInit (Queue* q); int push (Queue* q, char c); char pull (Queue* q); char front (Queue* ...
C
// // 字符串的出现次数.c // CTestProject // // Created by JasonLu on 16/10/2. // Copyright © 2016年 JasonLu. All rights reserved. // #include <stdio.h> #include <stdlib.h> //获取字符串出现的次数 int getSubStrCnt(char * str/*in*/,const char * subStr/*in*/, int * cnt/*out*/) { char *tmpStr = str; char *tmpSubStr = subStr; int s...
C
#include <stdio.h> void proc2(int * arg, int arg2); int main(int argc, char ** argv) { int n=3; printf(" AVANT proc81 \n", n); proc2(&n,0); printf(" APRÈS proc81 \n", n); printf(" == %d\n", n); return 0; }
C
/* PDS Lab Autumn 2020, Test 2, Problem 1. * Ishan Manchanda, 2nd Feb 2021 */ #include <stdio.h> #include <string.h> void censor(char* s, char* w) { // Pointer to first character of substrings char *pos; int i = 0, len = strlen(w); // strstr returns a pointer to the first character of substring (if found) // ...
C
#include "lists.h" /** * print_listint - a function that prints all the elements of * a listint_t list. * * @h: pointer to the listint_t * * Description: a function thAT PRINTS ALL * THE ELEMENTS OF A LIST INT_LIST. * Return: the number of nodes */ size_t print_listint(const listint_t *h) { int nodes = 0; w...
C
#include "holberton.h" /** * factorial - entry point * Description: returns factorial of a given number * @n: integer * Return: 0 or -1 to error */ int factorial(int n) { if (n == 0) return (1); else if (n < 0) return (-1); return (n * factorial(n - 1)); }
C
#include <stdio.h> int main(){ int a; for (a = 0; a <= 10; a++){ printf("%d, %d, %d\n", a, power(2, a), power(-3, a)); } return 0; } int power(int base, int expo){ int counter, returned; returned = 1; for (counter = 0; counter <= expo; counter++){ returned = returned * base; } return returne...
C
#include <math.h> #include <time.h> #include <pthread.h> #include <stdatomic.h> typedef struct queueRandParams { pthread_mutex_t my_mutex; int shutted_down; int size; int capacity; pthread_cond_t put_cv; pthread_cond_t get_cv; } queueRandParams; typedef struct queueRand { struct queueRand* next; struc...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* options.c :+: :+: :+: ...
C
/*f(x,y)=x^y*/ #include <stdio.h> double f(double x,int y); int main(){ double x; int y; double z; printf("Input x:"); scanf("%lf",&x); printf("Input y:"); scanf("%d",&y); z=f(x,y); printf("The value of %f^%d is %f",x,y,z); } double f(double x,int y){ double result...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include "debug.h" #include "queue.h" #define MAIN_DBG(message, ...) \ MSG("%s" message "%s", LIGHT_GREEN, ##__VA_ARGS__, RESET) #define MAIN_PRT_DBG(message, ...) \ MSG("%s" message "%s", CYAN, ##__VA_ARGS__, RESET) i...
C
#include <stdio.h> int main(){ char str[255]; printf("Digite uma String[Maximo de 255 caracteres]:\n"); gets(str); printf("\n\nVoce digitou\n%s", str); return 0; }
C
// https://www.hackerrank.com/challenges/weighted-uniform-string/problem #include <stdio.h> #include <stdlib.h> #include <string.h> int main() // O(n*26) solution { int n, j = 0, ABC[26] = {0}; char *s = (char *)malloc(512000*sizeof(char)); scanf("%s %d", s, &n); int len = strlen(s); while (j < l...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include "fun.h" int Sdvig(int *array, int *size) { int i, j = 0, m = (int) *size; if (size == 0) return 1; // for (i = 0; i < m; i++) // { // if (array[i] > 0) // j++; // } for (j = 0 , i = 0; i < m; i++) if (array[i] >= 0) ar...
C
#include <stdio.h> int main(){ int n ; int check = 0; printf("nhap so nguyen n :\n"); scanf("%d", &n); int i = 1 ; for(i; i < n/2; i++){ if(n == i*i){ check = 1; } } if(check == 1){ printf("n la so chinh phuong !"); }else{ printf("n khong la so chinh phuong !"); } getch(); return 0 ; }
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #define maxn 10020 #define maxm 200020 //ͼĶʹʽǰǷʽͼ //ȻҲԼķͼ,ٽӾٽӱ #define INF 2147483647 int ans[maxn]; struct Edge { int start, end, weight; //ñߣͬһһedgsд洢±ꡣnextΪʽѰͬһб int next; }; struct Graph { struct Edge edegs[maxm]; //head[i] ¼iΪı߼еһedg...
C
#include <stdlib.h> #include <stdio.h> int main(){ void valor1(int x); void valor2 (int *pX); int numb = 1; int *pont = &numb; //valor1(numb); valor2(pont); printf("%d\n",numb); system("pause"); return 0; } void valor1(int x){ ++x; } void valor2 (int *pX){ ++*pX; }
C
/* Reads a list of numbers from STDIN and outputs the numbers sorted. */ #include <stdio.h> #include <limits.h> #define MAXSIZE 10000000 //void print_arr(unsigned char arr[], int len); int main() { int i; // Figure out how large this array needs to be to hold the full bitmap int index_size = CHAR_B...
C
#include <inc/string.h> #include <inc/lib.h> void cputchar(int ch) { char c = (char)ch; /* Unlike standard Unix's putchar, * the cputchar function _always_ outputs to the system console. */ sys_cputs(&c, 1); } int getchar(void) { unsigned char c; /* JOS does, however, support standard _inp...
C
// Program for BFS of Graph #include<stdio.h> #include<conio.h> struct queue { int data[20]; int front,rear; }q; void add(int n) { q.rear++; q.data[q.rear]=n; } int del() { q.front++; return(q.data[q.front]); } void init() { q.rear=q.front=-1; } int isempty() { return(q.front==q.rear); } void BFS(i...
C
#include <stdio.h> #include <starbase.c.h> #include <windows.c.h> #include <structures.h> /*** New Echo Routines for the Window System ***/ /* These routines are for the brain-damaged CRX24's. They do not use offscreen memory. */ /* E_lastx and E_lasty are the last cursor position /* background holds the background f...
C
/*Crie um programa que leia dois números inteiros (num1 e num2), calcule e mostre a media*/ #include <stdio.h> int main(void) { //Criação de variáveis float calc; int num1, num2; // Pede ao usuário as notas printf("Digite as notas\n"); // Ler as notas scanf("%i %i", &num1, &num2); // Calcula a media c...
C
#include <stdio.h> #include <time.h> #include <stdlib.h> void printA(int*array,int size){ for(int i=0; i< size; i++){ printf ("%d %d\n",i, *(array +i)); } printf("\n"); } int* fillA (int* array, int size){ for (int i=0; i< size; i++){ array [i] = rand(); } return array; } int strl(char* str){ int i =0;...
C
// Data Structures Part 2: Queues // Array Implementation of Queue in C programming language - 7/19/2020 #include <stdio.h> #include <stdlib.h> #include <limits.h> //Create Queue structure struct Queue { int front, rear, size; unsigned capacity; int* array; }; //Function to create queue wi...
C
#include "LL.h" #include <string.h> //added afterwards //--------------------------------------- int LL_sorted_add(LLNode **ppList,char *c,int n){ LLNode *pSent, *pCur; pSent=pCur=*ppList; while((pCur)&&(pCur->nVal < n)){ pSent=pCur; pCur=pCur->pNext; } if (pSent==pCur){ *ppList=(LLNode*)malloc(si...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_parse.c :+: :+: :+: ...
C
#include <stdio.h> int main(){ double preco, novopreco,aumento, imposto =0; int categoria; char situacao; printf("Digite o preco:\nDigite a categoria: 1 - Limpeza, 2 - Alimentacao, 3 - Vestuario\nDigite a situacao: R - produtos que necessitam de refrigeracao e N - produtos que nao necessitam de refrigeracao\n"); ...
C
/* * Copyright (c) 2021 Kevin Townsend * * SPDX-License-Identifier: Apache-2.0 */ /** * @defgroup AHRS Attitude and Heading Reference System * * @brief Functions and structs for dealing with 'Attitude' and AHRS. * * Structs like @ref zsl_attitude are inteded to be used as 'last-mile' * represetnations, to co...
C
#include <stddef.h> #include "gsi/gsi.h" #include "gsi/person.h" /** * Inicializa uma instância de GSI * * @param gsi instância de GSI a ser inicializada */ void gsi_init(GSI* gsi) { gsi->player = NULL; } /** * Libera da memória os espaços alocados, porém NÃO desaloca da memória a instância de GSI * * @par...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> int bLookUp(int*, int, int); int* nbLookUp(int*, int, int*, int); int main(){ int i, n, k; int *intArray, *intLookup, *ans; // Read in size of array scanf("%d", &n); // Allocate space for array. intArray = (int*)malloc(n * ...
C
#include "vrshell.h" /** * _putchar - writes the character c to stdout * @c: The character to print * * Return: On success 1. * On error, -1 is returned, and errno is set appropriately. */ int _putchar(char c) { return (write(1, &c, 1)); } /** * stderr_pc - writes the character c to stdout * @c: The character...
C
#include "child.h" #include <stdlib.h> void run(struct parent *object); int main(int argc, char *argv[]) { struct parent *a; struct parent *b; a = malloc(sizeof(struct child)); child_init((struct child *)a, "abc", 1); b = malloc(sizeof(struct child)); child_init((struct child *)b, "def", 2)...
C
#ifndef CORE_IRQ_H #define CORE_IRQ_H #include "common.h" enum irqreturn { IRQ_NONE = 0, /* IRQ was not from this device */ IRQ_HANDLED = BIT(0), /* IRQ was handled by this device */ }; typedef enum irqreturn irqreturn_t; typedef irqreturn_t (*irq_handler_t)(int irq, void *data); struct irq_action { irq_handler...
C
#include<stdio.h> int i=35; void fun1(); void fun2(); void main() { printf("%d",i); fun1(); fun2(); } extern int i; void fun1() { i=i+5; printf("\n%d",i); } void fun2() { i=i-2; printf("\n%d",i); }
C
#include <stdio.h> #include <string.h> int main(void) { char s[1000]; int i, len, mid, yes; #if 0 freopen("a022.in", "r", stdin); #endif while (scanf("%s", s)!=EOF) { len = strlen(s), mid = len/2, yes = 1; for (i=0;i<mid;i++) { if (s[i]!=s[len-i-1]) { yes = 0...
C
#include <stdlib.h> #include <stdio.h> #include <sys/mman.h> #include <x86intrin.h> #include <signal.h> #include "util.h" #define NUM_PAGES 16 #define DATA_LEN 8 struct sigaction sa; FILE* outfile; int data[DATA_LEN]; int cur_data; void callback(int signo){ sigaction(SIGALRM, &sa, NULL); printf("%d\n", data[cur...
C
#include "libft.h" void ft_putstr_fd(char *str, int fd) { size_t i; if (!str) return ; i = 0; while (str[i]) i++; write(fd, str, i); }
C
#include<stdio.h> #include<stdlib.h> #define null -1 void PreOrderTraversal(int root); int tree[2][100]; struct node { int data; struct node *nextPtr; }; main() { int size, i, root, check[100] = { 0 }; char lc, rc; scanf_s("%d", &size); getchar(); for (i = 0; i<size; i++) { scanf_s("%c", &lc); getchar(); ...
C
#include "LPC23xx.h" // serial Reception routine int serial_rx(void) { while (!(U0LSR & 0x01)); return (U0RBR); } //serial transmission routine void serial_tx(int ch) { while ((U0LSR & 0x20)!=0x20); U0THR = ch; } // serial transmission routine for string of characters void string_tx(char *a) { while(*a!='\...
C
#include <stdio.h> #include <signal.h> #include <unistd.h> #include <stdlib.h> void handler_int() { write(STDOUT_FILENO, "Hmmm, want to kill me?!\n", 25); exit(0); } void handler_term() { write(STDOUT_FILENO, "Terminated...\n", 15); exit(0); } int main() { signal(SIGINT, handler_int); signal...
C
void swap(vector<int> &arr, int l, int r){ int tmp = arr[l]; arr[l] = arr[r]; arr[r] = tmp; } int partition(vector<int> &arr, int l, int r){ int pivotKey = arr[l]; int pivot = l; while(l<r){ while(l<r && arr[r]>=pivotKey) r--; while(l<r && arr[l]<=pivotKey) ...
C
//溢出和计时函数 #include<stdio.h> #include<time.h> int main(){ const int MOD = 1000000; int n,sum= 0,fac = 1; scanf("%d",&n); for(int i = 1;i<=n;i++){ fac = 1; for(int j = 1;j<=i;j++){ fac = (fac*j)%MOD; } sum = (sum+fac)%MOD; } printf("%d\n",sum); pri...
C
#include<stdio.h> #include<string.h> int main() { char s[1000],t[1000]; gets(s); gets(t); if(strcmp(s,strrev(t))==0) printf("YES"); else printf("NO"); return 0; }
C
#include <iostream> #include "Point.h" using namespace std; using d2d::Point2D; // using namespace d2d; int main() { Point2D p1(10, 10); // or d2d::Point2D p1(10, 10); cout << "(x , y) : (" << p1.x() << ", " << p1.y() << ")" << endl; return 0; } /* 可以使用"using"關鍵字指明所要使...
C
#include <stdlib.h> #include <stdio.h> int cost[10][10],i,j,k,n; int q[10],front,rare,v,visited[10]; int main() { int m; scanf("%d",&n); scanf("%d",&m); for(k=1;k<=m;k++) { scanf("%d %d",&i,&j); cost[i][j]=1; } scanf("%d",&v); printf("%d ",v); for(i=1;i<=n;i++) { visited[i]=0; } visited[v]=1; k=1;...
C
#include <stdio.h> #include <stdlib.h> #include "lists.h" /** *insert_dnodeint_at_index - insert a node at a index *@h: head of dobly linked list *@idx: position of the new node *@n: numeric value * *Return: new node */ dlistint_t *insert_dnodeint_at_index(dlistint_t **h, unsigned int idx, int n) { unsigned i...
C
#include<stdio.h> #include<stdlib.h> #include<unistd.h> #include<string.h> #include<math.h> #include<errno.h> #include "utility.h" #include "serverInfo.h" serverInfo startConfig(const char* sockPath){ FILE *f; int i = 0, j; char buf[1024]; //buffer di ricezione di una stringa char errMess[1024]; //contiene eventua...
C
#include<stdio.h> int main(){ int x=10; int* FirstPointer; void* SecondPointer=&x; FirstPointer=SecondPointer; // SecondPointer=FirstPointer; printf("%d",*FirstPointer); // printf("%d",*(int *)SecondPointer);//typecasting ofthe void pointer to the int pointer //in c assignment operation will not generate any error but...
C
/** * @file HAL_ADC.h * @brief Declaraciones a nivel de aplicación del periférico ADC (LPC845) * @author Augusto Santini * @author Esteban E. Chiama * @date 3/2020 * @version 1.0 */ /** * @defgroup ADC Conversor analógico a digital (ADC) * * # Introducción * * Este periférico como su nombre lo indica, conv...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #include "../readCSV.h" #include "../matrix.h" double* doubleTokenize(char* str, int nTokens) { double* tokens = calloc(nTokens, sizeof(double)); int i = 0; str = strtok(str, ","); while (str != NULL) { tokens[i++] = (double) atoi(str...
C
#include <stdio.h> #include <unistd.h> #include "vectornav.h" /* Change the connection settings to your configuration. */ const char* const COM_PORT = "//dev//ttyS1"; const int BAUD_RATE = 115200; int main() { VN_ERROR_CODE errorCode; Vn200 vn200; int i; errorCode = vn200_connect( &vn200, ...
C
/* 时间:2020年2月20日09:48:37 功能: for循环求1-100之间所有奇数之和 总结: 1. for 的默认作用范围是一个语句。 2. for 作用于多个语句,需要使用 {} 把多个语句括起来 */ # include <stdio.h> int main(void) { int i; int sum = 0; for (i=1; i<100; i+=2) // i+=2 等价于 i = i + 2 { sum += i; // 等价于 sum = sum + i; } ...
C
/*Bryce Egley*/ #include "linkedList.h" #include <stdio.h> #include <stdlib.h> int main(int argc, char* argv[]) { struct linkedList *lst; lst = createLinkedList(); /*create*/ printf("Creating: "); if (isEmptyList(lst)) { printf("PASSED\n"); } else { printf("FAILED\n"); } addBackList(ls...
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
#ifndef hanoi_h_ #define hanoi_h_ #include "pile_type.h" #include "pile.h" #include <stdio.h> #include <stdlib.h> /* affiche l'erreur et quitte le programme */ extern int error1(char *message); /************************************************ * \brief déplace le sommet de pile d'une pile source (*psource) ver...
C
#include <stdio.h> void start() { freopen("/home/amal/Desktop/programming/c++/practise/input_cpp.txt","r",stdin); freopen("/home/amal/Desktop/programming/c++/practise/error_cpp.txt", "w", stderr); freopen("/home/amal/Desktop/programming/c++/practise/output_cpp.txt", "w", stdout); } int main() { start(); printf...
C
/* vptest * * Verify the viewport code. * * At its simplest, the viewport code creates a 'window' inside the * display where the client can draw in its preferred co-ordinate space * and the graphics library translates that to pixels on the actual * display. * * At the moment all we can do is draw lines in the ...
C
#include <stdio.h> #include <stdlib.h> unsigned char** first; unsigned char** boxp; unsigned char* end; //int alllocated_pages; int size, work; void myinit() { int n = 1024 * 1024 * 128; boxp = (unsigned char**) malloc(n); first = NULL; end = NULL; //alllocated_pages = 0; size = n; if(boxp == NULL) { print...
C
#include "ch1.h" void spira(int n) { int i, j; for (i = 0 ; i < n ; i++) { for (j = 0 ; j < n + i ; j++) // 2n-1에서 왼쪽 공백 날린 갯수 if (j < n - i - 1) printf(" "); else printf("*"); printf ("\n"); } }
C
#include<stdio.h> char str[100]; typedef struct { char vowel; int count; }word; word wa={ .vowel='a', .count=0 }; word we={ .vowel='e', .count=0 }; word wi={ .vowel='i', .count=0 }; word wo={ .vowel='o', .count=0 }; word wu={ .vowel='u', .count=0 }; void accept(void); void counting(void); void ...
C
/* a basic implementation of quicksort on integer arrays. This particular program chooses a random element of the list to be the wall. Roger Murray, roger.h.murray@gmail.com, ANU, June 2016. */ #include <stdlib.h> #include <stdio.h> #include <time.h> #define VERIFY 0 void quicksortrand(int *A, int n); void swp(int...
C
#include <unistd.h> #include <signal.h> #include <stdio.h> #define SECOND 1 void do_nothing(); void do_int(); /* SIGINT = Interrupt jelzés. PL : Ctrl + c (unixban) signal() két része van a jelzés és a jelzés kezelő alarm() SIGALRM jelzést generál megadott masodpercek utan Ha 0 az alarm akkor az elotte f...
C
/* * circbuf.h * * Created on: Nov 21, 2017 * Author: samaustin */ #ifndef CIRCBUF_H_ #define CIRCBUF_H_ #include "circbuf.h" #include <stdint.h> #include "msp.h" typedef struct{ volatile uint16_t* buffer; //Pointer to the base of the buffer in heap volatile uint16_t* head; //Pointer to first item...
C
#include <stdio.h> // 문제1 // int main(void) // { // FILE *fp=fopen("C:\\Users\\jh\\c_practice\\201220\\mystory.txt","wt"); // fputs("#이름 : 심재형 \n",fp); // fputs("#주민번호 : 941116-1111111 \n",fp); // fputs("#전화번호 : 010-1111-2222 \n",fp); // fclose(fp); // } // 문제2 // int main(void) // { // FILE *...
C
/************************************************************************* > File Name: 261.c > Author: zhouyuan > Mail: > Created Time: 2020年08月27日 星期四 16时28分35秒 ************************************************************************/ #include<stdio.h> #include<stdlib.h> #define max_n 1000 typedef struct Stack...
C
#include "../inc/libmx.h" char *mx_nbr_to_hex(unsigned long nbr) { char *rezult = NULL; int i = 0; unsigned long buff = nbr; int size; int kek; while(buff/16 != 0) { i++; buff = buff / 16; } size = i; rezult = mx_strnew(size); for(i = size ;i >= 0;i--) { kek = nbr % 16; nbr = nbr/16; if(kek >= 0 &...
C
// 주의! 본 코드는 시간초과 코드입니다. // 죽어도 C 이진으로 안풀려서 그냥...그냥 올려봅니다. #include<stdio.h> #include<string.h> #include<stdlib.h> typedef struct sitepw{ char add[22],pw[22]; }sp; sp list[100002]; int cmp(const void *a, const void *b){ sp *A=(sp*)a,*B=(sp*)b; return strcmp(A->add,B->add); } int find(int head,int tail,char ...
C
/* * mtest.c * * memory test from ppcboot-2.0.0/common/cmd_mem.c * * Perform a memory test. A more complete alternative test can be * configured using CFG_ALT_MEMTEST. The complete test loops until * interrupted by ctrl-c or by a failure of one of the sub-tests. * * Author: Yong-iL Joh <tolkien@mizi.com> * Da...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_size.c :+: :+: :+: ...
C
#include <stdio.h> int max_of_four(int a, int b, int c, int d) { if (a > b && a > c && a > d) { printf("the highest num is %d\n" , a); } else if(b > a && b > c && b > d) { printf("the highest num is %d\n" , b); } else if(c > a && c > b && c > d) { printf("the hig...
C
/* ** my_strlen.c for my_strlen in /home/Alex.Chamardbois/CPool/CPool_Day04 ** ** Made by Alexandre Chamard-bois ** Login <Alex.Chamardbois@epitech.net> ** ** Started on Thu Oct 6 15:32:00 2016 Alexandre Chamard-bois ** Last update Thu Nov 09 11:22:36 2017 alexandre Chamard-bois */ #include <sys/types.h> size_t ...
C
int count_periods(const char *filename) { FILE *fp; int n = 0; char c; if ((fp = fopen(filename, "r")) != NULL) { while ((c = fgetc(fp)) != EOF) if (c == '.') n++; fclose(fp); } return n; }
C
#include "stdio.h" #include "main_request.h" #include <stdlib.h> #include <stdarg.h> #include <assert.h> #define MALLOC_TIMES 2 /*realise */ void print_log_level(int level){ switch (level) { case LOG_MSG_ERROR: /* code */ printf("[LOG_MSG_ERROR] "); break; case LOG_MSG_INFO: /* code */ // printf("[L...
C
#include <inttypes.h> #ifdef WITHOPENMP #include <omp.h> #endif #include "cmontecarlo.h" /** Look for a place to insert a value in an inversely sorted float array. * * @param x an inversely (largest to lowest) sorted float array * @param x_insert a value to insert * @param imin lower bound * @param imax upper bou...
C
#include <dbus/dbus.h> #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <dbus/dbus-glib.h> #include <stdbool.h> #include <pthread.h> static DBusConnection *connect; static gpointer mainloop(gpointer user_data); static void send_singal(DBusConnection *dbconn,char *buf); static DBu...
C
#include <string.h> #include <stdio.h> #include <stdlib.h> #include "dominion.h" #include "dominion_helpers.h" int main() { printf("Testing drawCard()\n"); struct gameState state; int k[10] = {adventurer, gardens, embargo, village, minion, mine, cutpurse, sea_hag, tribute, smithy}; int randomSe...
C
#include<stdio.h> #include<conio.h> #include<string.h> struct node { struct node *next; int pri; int info; }; struct node *head=NULL; struct node *ptr,*temp,*loc; void insertnode(); void traverse(); void Delete_element(int); void main() { int ch,pr; clrscr(); while(1) { printf("1.Enqueue...
C
/*** This file calculates the date for Easter on any given year between the years 1582 and 39999. It can take an input from the terminal, or it can read a file input and return the date for each year in the file. ***/ #include <stdio.h> int calculate_Easter_date(int year); /*** main is a function that will run the c...