language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
int nok(int a, int b) {
int m = a * b;
while (a != 0 && b != 0) {
if (a > b)
a %= b;
else
b %= a;
}
return m / (a + b);
}
int main() {
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
int a, b;
scanf("%d %d", &a, &b);
printf("%d", nok(a, b));
return 0;... |
C | #include <ltrace.h>
#include <unistd.h>
#include <user_syscall.h>
#include <errno.h>
/// The link() function shall create a new link (directory entry) for
/// the existing file, path1.
///
/// The path1 argument points to a pathname naming an existing
/// file. The path2 argument points to a pathname naming the new
//... |
C |
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n;
scanf("%d", &n);
long ar[n];
long count=0;
for (int i=0; i<n; i++){
scanf("%ld", &ar[i]);
//printf ("%ld ", ar[i]);
}
//printf ("\n");
for (int i=0; i<n; i++){
for (int j=i; j<n;... |
C | // pointer11.c
// Created by roohom on 2018/11/16.
// 2018/11/16 20:07
//使用指向数组的指针
#include <stdio.h>
int arraySum(int array[], const int n)
{
int sum = 0,*ptr;
int *const arrayEnd = array+n;
for (ptr = array; ptr < arrayEnd; ++ptr) {
sum +=*ptr;
}
return sum;
}
int main(void)
{
in... |
C | #include<stdio.h>
#include<sys/types.h>
#include<string.h>
#include<netinet/in.h>
#include<sys/socket.h>
int main()
{
char fname[200],buf1[2000];
int s2=socket(AF_INET,SOCK_STREAM,0);
if(s2==-1)
printf("socket creation failed");
struct sockaddr_in s;
s.sin_family=AF_INET;
s.sin_port=4300;
s.sin_addr.s_addr=INADDR_ANY;
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
// Adapted from https://github.com/TryItOnline/brainfuck
int main(int argc, char *argv[]) {
if (argc > 1 && strcmp(argv[1], "-v") == 0) {
puts("1.0.0");
return 0;
}
FILE *fp = fopen("/tmp/code.c", "w");
if... |
C | #ifndef _TABLE_H
#define _TABLE_H
typedef enum
{
FALSE,
TRUE
} t_booleen;
typedef struct
{
int decouverte;
int mine;
int nb_mines;
int drapeau;
int affichage;
} t_case;
/*
int number_cases(int nb_rows, int nb_columns);
int number_mines(int nb_rows, int nb_columns);
void put_mines(int nb_rows, int nb_... |
C | /*
Este programa imprime un mensaje de prueba.
*/
// Ficheros de cabecera
#include <stdio.h>
// Funcion main
int main(){
printf("Todo funciona ok\n");
return 0; //devuelto por el main, lo puede recoger otro programa
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
char * scale = "$@B%8&WM#*oahkbdpqwmZO0QLCJUYXzcvunxrjft/\\|()1{}[]?-_+~<>i!lI;:,\"^`'. ";
int numScale;
typedef struct
{
size_t width;
size_t height;
unsigned char * data;
} image;
unsigned char luminanceFromRGB(unsigned char... |
C | /*************************************************************************************
* 12 April 2021
* COMP2017 Assignment 2 - VM
* Owen Yang
* 500550430
* DESCRIPTION: HEADER FILE FOR vm.c
*************************************************************************************/
#ifndef V
#define V
#inc... |
C | #include <stdio.h>
#include <math.h>
double mean(double data[], int size){
double total = 0;
for(int i = 0; i < size; i++){
total += data[i];
}
return total / size;
}
double standardDeviation(double data[], int n){
double std = 0;
double toSub = 0;
double subFrom = 0;
for(int i = 0; i < n; i++){
toSub += ... |
C | #include "funcs.h"
#include <stdio.h>
int ins_test_i(int*arr, int size, node_t *node) {
for (int i = 0; i < size; i++) {
if (node == NULL) {
return 1;
}
else if (*((int*)node->data + i) != arr[i]) {
return 1;
}
}
return 0;
}
int ins_test_c(char*arr, int size, node_t *node) {
for (int i... |
C | /*
*
* spoj PALAVRMG - Palavras Ordenadas
*/
#include <stdio.h>
#include <ctype.h>
int tamanho(char *s){
int i=0;
while (s[i]!='\0') {
i++;
}
return i;
}
int main()
{
int n;
char s[43];
scanf("%d",&n);
while(n--)
{
int i=0,j=0,a=0,b=0;
scanf("%s",s);
for (int i = 0; i < tamanho(s); i++) ... |
C | /*
* pktlook1.c : Look at the contents of a packet
*/
#include <stdio.h>
FILE *in;
char pkthdr[58];
char msghdr[14];
char datef[21];
char fromstr[100],tostr[100],subjstr[100];
int i,n,c;
int orignode,destnode,orignet,destnet;
int month,pktver;
char *months[24]; /* should be 12 */
char digits[] = "0123456789... |
C | /*
* Copyright 2016 Nathaniel Graff
*/
#include <stdint.h>
#include <string.h>
#include "KeccakNISTInterface.h"
#include "KeccakSponge.h"
HashReturn Init(HashState * state, uint32_t hashBitLen)
{
HashReturn returnVal;
switch(hashBitLen) {
case 0: // Default parameters, arbitrary length output
... |
C | #include "unity.h"
#include "unity_fixture.h"
#include "atimagem.h"
TEST_GROUP(Imagem);
// Antes de testar
TEST_SETUP(Imagem)
{
e4c_context_begin(E4C_TRUE);
}
// Após testar
TEST_TEAR_DOWN(Imagem)
{
e4c_context_end();
}
// Testes para JPEG
TEST(Imagem, testImagem_JPEG_Abrir_Vazio)
{
int erroCorreto = 0;
// ... |
C | /*
============================================================================
Name : population.c
Author : Dakota Townsend
Version :
Copyright : Your copyright notice
Description : calculate population
============================================================================
*/
#include ... |
C | /*
* vi: sw=4 ts=4 noexpandtab
*/
#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sqlite3.h>
#include "common.h"
#include "db.h"
#include "ov.h"
#ifndef QF_DEFAULT
#define QF_DEFAULT "%v"
#endif
#define QUERY_BUFSIZE 4096
static void query_printf(const char *fmt, const cha... |
C | /*
SMAL
Copyright (c) 2011 Kurt A. Stephens
RAW ALLOC SPEED.
*/
#include "my_cons.h"
#include "roots_conservative.h"
#if 0
static
int my_count_object(smal_type *type, void *ptr, void *arg)
{
// fprintf(stderr, " type %p obj %p\n", type, ptr);
(* (int *) arg) ++;
return 0;
}
#endif
static
unsigned lon... |
C | #include<stdio.h>
int main()
{
int i,a[20],n;
printf("Enter the element of array");
for(i=0;i<3;i++)
scanf("%d",&a[i]);
printf("enter the number which you are search ");
scanf("%d",&n);
for(i=0;i<3;i++)
{
if(a[i]==n){
printf("%d number position is =%d",n,i+1);break;
}}
return ... |
C | #include <stdio.h>
#include <stdlib.h>
#define N 10
//函数原型
// 数组遍历
void Traversal(int *, int, void (*pf)(int *));
// 选择排序(函数指针用于实现比较升/降序)
void SelectionSort(int *, int, int (*)(int, int));
// 插入排序(函数指针用于实现比较升/降序)
void InsertSort(int *, int, int (*)(int, int));
// 递归快速排序
void QuickSort(int *, int, int, int (*)(int, in... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strsplit.c :+: :+: :+: ... |
C | #include<stdio.h>
/*********************
* practice 1
********************/
#define SECOND_PER_MIN 60.0
void pra_1(void)
{
float hours = 0.0;
float minutes = 0.0;
float seconds = 0.0;
printf("input minutes(<=0 to quit):");
//scanf_s("%d",&minutes); vs下提供的安全输入,可以指定边界
scanf("%f",&minutes);
while(minutes>0)
{... |
C | /*
* @@name: target_ptr_map.2c
* @@type: C
* @@compilable: yes
* @@linkable: yes
* @@expect: success
* @@version: omp_5.0
*/
#include <stdio.h>
#include <stdlib.h>
#define N 100
#pragma omp declare target
int *p;
extern void use_arg_p(int *p, int n);
extern void use_global_p(int n);
#pragma om... |
C |
IF value inline
NAME*
NAME_Clone(
const NAME* old
)
{
NAME* obj;
if (!old) return 0;
obj = NAME_Create();
NAME_Resize(obj, old->Size);
memcpy(obj->Items, old->Items, old->Size * sizeof(ITEM));
return obj;
}
END
IF own
NAME*
NAME_Clone(
const NAME* old
)
{
int i;
NAME* obj;
if (!old) return 0;
obj = NA... |
C | /**
*\file SL.h
*\author G. Fuhr
*\version 2.0
*\date 11 Fevrier 2008
*
* fichier d'en-tete pour les fonctions du perser de fichier ini
*
*/
#ifdef __cplusplus
extern "C" {
#endif
#ifndef SL_SL_H
#define SL_SL_H
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "../../inputs/hea... |
C | /*
libnbb - Nothing But Blits
Copyright (C) Ben "GreaseMonkey" Russell, 2013
All rights reserved.
See LICENCE-libnbb.txt for full licence (it's 2-clause BSD).
*/
#include <string.h>
#include "nbb.h"
/*
Reference implementation of a direct, block-byte-aligned alpha blit.
*/
void blit_rgba8_aligned_alpha(blimg_t *dest... |
C | #include <stdio.h>
#include <ctype.h>
int nscanf(char string[], int n) { // recebe uma string ate o primeiro \n.
int i = 0;
while ( (string[i] = fgetc(stdin)) != '\n' && i < n)
i++;
string[i] = '\0';
return i;
}
int checa_elemento(char letra, char string[]) { // dada uma string e um simbolo, verifica se o... |
C | /*
Project Lyrebird
Description: This program decrypts an encrypted text file using
the following decryption algorithm:
1) Remove extra symbols added every 8th character
2) Transform every group of 6 characters into a base 41 integer C
3) Apply the transformation M = C^d mod n where d is 1921821779 and n is 429443481... |
C | /*@ pre (> C$1 1) @*/
/*@ rel_out (=> (= result$1 1) (= result$2 1)) @*/
extern int __mark(int);
int mono(int *res, int C) {
int max = 0;
int elect = 0;
res[1]++;
for (int i = 1; __mark(0) & (i <= C); ++i) {
if (max < res[i]) {
max = res[i];
elect = i;
} else if... |
C | #include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
const int MIN_CHAR = 65; // A
const int MAX_CHAR = 90; // Z
unsigned int rand_interval(unsigned int min, unsigned int max) {
// reference https://stackoverflow.com/a/17554531
int r;
const unsigned int range... |
C | #include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "hash.h"
#define HASHSIZE 10
struct nlist *hashtab[HASHSIZE];
unsigned hash(char *word) {
unsigned hashval;
for (hashval = 0; *word != '\0'; word++) {
hashval = *word + 31 * hashval;
}
return hashval % HASHSIZE;
}
struct nlist *lookup(char *... |
C | #include "logger.h"
FILE* OpenLogger(const char* filename)
{
FILE* fp = NULL;
errno_t err;
if ((err = fopen_s(&fp, filename, "a")) != 0)
{
fprintf(stderr, "[-] fopen_s error.\n");
return NULL;
}
return fp;
}
void CloseLogger(FILE* fp)
{
fclose(fp);
}
|
C | #include <stdio.h>
void dropBomb(void); /* prototype */
int main()
{
printf("Press Enter to drop the bomb:");
getchar();
dropBomb();
printf("Yikes!\n");
return(0);
}
void dropBomb()
{
int x;
for(x=20;x>1;x--)
{
puts(" *");
}
puts(" BOOM!");
}
|
C | #include"family_money_head.h"
int save_member(char(*names)[20], char(*account_name_member))//Ա
{
FILE *fp;
int i = 0;
fp = fopen(account_name_member, "wb");
if (fp == NULL){
printf("ļsave_memberС\n");
system("pause");
exit(0);
}
for (i = 0; strlen(names[i]) != 0; i++){
fwrite(names[i], sizeo... |
C | #ifndef __BASIC__
#define __BASIC__
/**
* @file basics.h
*
* @brief contains standard type definitions for C
*
* Types Enum - CTypes
* Integer Types - 8bit, 16bit, 32bit, 64bit signed and unsiged
* Char Types - word, line, page
* Pointer Types - void * and const void * typedefs
*
* NULL define
* TRUE and F... |
C | #include <stdio.h>
/* int 型とメンバ hh (時) と mm (分) からなる構造体型 time を宣言する */
typedef struct time {
int hh;
int mm;
} TIME;
/* (1) 時刻 t1 の 0 時からの分数を返す */
int calcMinutes(TIME t1) {
return t1.hh*60 + t1.mm;
}
/* (2) 0 時からの分数 mm に対応する時刻を返す */
TIME calcTime(int mm) {
TIME p1;
p1.hh=mm/60;
p1.mm=mm%60;
return ... |
C | #include "message_elements.h"
void changeToQNameFormat(unsigned char* qname, char* hostname)
{
int host_length = strlen(hostname) + 2;
char host_copy[host_length];
strcpy(host_copy, hostname);
strcat((char *) host_copy, ".");
int qname_position = 0, hostname_position;
for(hostname_posit... |
C | #include <bits/stdc++.h>
using namespace std;
string solve() {
int n;
cin >> n;
vector<string> arr(n);
int minl = 1e4;
for(int i=0; i<n; i++) {
cin >> arr[i];
if(arr[i].size() < minl) {
minl = arr[i].size();
}
}
string result =... |
C | #include <stdio.h>
int main(){
float preco, aum, precofim, imp;
int cat;
char sit;
printf("preo: ");
scanf("%f", &preco);
printf("Situao:\nR-necessita refrigerao\nN-No necessita refrigerao\n");
scanf(" %c", &sit);
printf("categoria:\n1-limpeza\n2-Alimentao\n3-vesturio\n");
scanf("%d", &cat);
if(p... |
C | #include "common.h"
#include <ncurses.h>
#include <string.h>
#include "screen.h"
#define LOGO_X 1
#define LOGO_Y 1
#define PROPS_X 1
#define PROPS_Y 8
#ifdef DEBUG
bool render_mode;
#endif
void draw_logo();
void screen_init() {
render_mode = false;
initscr();
raw();
keypad(stdscr, TRUE);
noecho();
int stat = ... |
C | #include "sdstring.h"
#include <stdio.h>
#include <string.h>
#include <assert.h>
int main(int argc, char **argv) {
const char *msg = "Hello";
sdstring *str = sdstring_new(msg);
/* test new */
assert(sdstring_len(str) == strlen(msg));
assert(sdstring_avail(str) == strlen(msg));
assert(sdstring_... |
C | /*
** EPITECH PROJECT, 2018
** 42sh
** File description:
** auto_complete
*/
#include "autocompletion.h"
#include "my.h"
#include "prompt.h"
#include "shell.h"
#include <dirent.h>
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unist... |
C | #include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
void
cat(int f, char *s)
{
char buf[8192];
long n;
while((n=read(f, buf, (long)sizeof buf))>0)
if(write(1, buf, n)!=n)
perror("write error copying %s: %r", s);
if(n < 0)
perror("error reading %s: %r", s);
}
int
main(int a... |
C | #include <stdio.h>
#include <stdlib.h>
#define SIZE 15
int isEmpty();
int isFull();
void push(int);
void pop();
void display();
int stack[SIZE], top=-1;
void main()
{
int ch,x;
while(1)
{
printf("\nMENU\n");
printf("1. Push\n2. Pop\n3. Display\n4. Exit\n");
printf... |
C | #include "msp.h"
/****| pinint | *****************************************
* Brief: initialization of pins used for the motor
* param:
* n/a
* return:
* n/a
*************************************************************/
void pinint(){
P2->SEL0 &= ~BIT4;
P2->SEL1 &= ~BIT4; //clear select regi... |
C | #include<stdio.h>
#include<stdlib.h>
struct node{
int data;
struct node* left;
struct node* right;
};
struct node* createnode(int val){
struct node* node = (struct node*)malloc(sizeof(struct node));
node->data = val;
node->left = node->right = NULL;
return node;
}
void print_inorder(struct node* no... |
C | /*
* SoundFX.h
*
* Created on: Apr 25, 2018
* Author: d
*/
#ifndef SOUNDFX_H_
#define SOUNDFX_H_
typedef enum{FLANGER, CHORUS, TREMOLO, SLAPBACK, DISTORTION, CLEAN} FXType;
/********************************************************************************************/
/*************************************... |
C | #include<stdio.h>
#include<conio.h>
void main()
{
int a[10],i,k,n,j,temp;
clrscr();
printf("enter the array size");
scanf("%d",&n);
printf("enter the array elements");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
printf("enter the kth value");
scanf("%d",&k);
for(i=0;i<k;i++)
{
for(j=n-1;j>=0;j--)
{
temp=a[n-1];
a[n-1]=a[j]... |
C | /*
**
** Made by Thomas LE MOULLEC
**
** Started on Fri Feb 24 12:54:12 2017 Thomas LE MOULLEC
** Last update Sun Feb 26 16:33:27 2017 Thomas LE MOULLEC
*/
#include "nm.h"
int get_size_section(unsigned char *str, int i)
{
int result;
result = 0;
while (i > 0 && (str[i] == ' ' || str[i] == '/' || str[i] ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
void imprimirMatriz(char** m);
void movimientoJugador(char** m);
void movimientoOrdenador(char** m);
char comprobarMatriz(char** m);
int main(int argc, char** argv) {
char** matriz;
int i = 0, j = 0, turno = 0;
/*****... |
C | /* code to generate pi value by randomly generating points lying in a unit
* square, then count the no. of points lying in the circle of diameter one
* inside it app. = (pi*(1/2)^2) / (1^2) = 1/4*pi. Hence we will get pi by
* multiplying with 4 the ratio of points insde circle to the total points
*/
#include <pth... |
C | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
/* printf("Hello World\n"); */
/* int x = 5;
x += 43;
*/
/*
Igaza'bo'l lehetne ilyet is tru"kko"zni. :)
#define bool int
#define true 1
#define false 0
#define TRUE true
#define FALSE false
*/
int leap_year(const int year);
unsigned long long number_of_divisor... |
C | #ifndef MM_UTILS_H_
#define MM_UTILS_H_
#ifndef __WORDSIZE
#define __WORDSIZE (__SIZEOF_LONG__ * 8)
#endif // ifdef __WORDSIZE
#define BITS_PER_LONG __WORDSIZE
#define BITS_PER_HALF_WORD (__WORDSIZE / 2)
/*
* Returns @size bytes allocated by portable version of mmap(2).
*
* Supported Platforms:
* - Linux
* - ... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int matriz[3][3];
int i,j;
int maior;
int linha,coluna;
printf("informe os numeros da matriz");
for(i=0;i<3;i++){
printf("digite os valores da linha %d\n",i+1);
for(j=0;j<3;j++){
scanf("%d",&matriz[i][j]);
... |
C | #include <stdio.h>
#include <stdlib.h>
#include "lists.h"
/**
* reverse - reverse a single linked list from pointer in ahead
* @head_ref: pointer to start the reverse until NULL
* Return Nothing
*/
void reverse(listint_t ** head_ref)
{
listint_t *prev = NULL;
listint_t *current = *head_ref;
listint_t *... |
C | #include <sys/socket.h>
#include <sys/types.h>
#include <sys/un.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
// Create client socket
int client_socket = socket(AF_UNIX, SOCK_STREAM, 0);
if (client_socket < 0) {
perror("Error: Could not create client socket.\n");
exit(1);
}
// C... |
C | #include <stdlib.h>
#include <stdio.h>
#include <omp.h>
void saxpy(int n,
float a,
float *x,
float *restrict y)
{
for (int i = 0; i < n; ++i)
y[i] = a * x[i] + y[i];
}
int main(int argc, char **argv)
{
double ti, te;
int N = 1000000;
if (argc > 1)
N = atoi(argv[1]);
float *x = (fl... |
C | #ifndef MATHS_H
#define MATHS_H
#ifndef NULL
#define NULL 0
#endif
#ifndef PI
#define PI 3.1415926f
#endif
inline float sqr(float n) {
return n * n; }
struct vector {
float i, j, k;
vector();
vector(const vector& v);
vector(float i, float j, float k);
vector(float f);
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include "mpi.h"
int main(int argc, char* argv[])
{
// Initialize MPI.
int nprocs, myid;
MPI_Status status;
MPI_Init(&argc,&argv);
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
MPI_Comm_rank(MPI_COMM_WORLD, &myid);
// Initialize the... |
C | void setup();
void run_h(int, int, int);
void run_s(int, int, int);
void main(){
setup();
while(1){
run_s(128, 0, 100);
run_h(128, 4, 100);
}
}
void setup()
{
OSCCON = 0x70;
ANSELA = 0x00;
TRISA = 0x00;
PORTA = 0x00;
APFCON.TXCKSEL = 0;
APFCON.RXDTSEL = 0;
... |
C | #include <stdio.h>
#include <stdlib.h>
int main(){
unsigned int num;
int *arr;
int sum;
scanf("%d", &num);
arr = (int*) malloc(sizeof(int)*(num*3));
for (int i=0; i<num; i++){
scanf("%d %d",&arr[(2*i)+1], &arr[(2*i)+2]);
}
for(int j=0; j<num; j++){
sum = arr[(2*j)+1] + ... |
C | /*
* BreedRepo.c
* Created on: 20 may. 2020
* Author: mdangelo
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdio_ext.h>
#include "BreedRepo.h"
int _getBreedEmptyIndex(Breed breeds[], int breedTop);
int _getBreedIndexById(Breed breeds[],int breedId, int breedTop);
void breedRp_initializeBreeds(Breed bree... |
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>
void error(const char *msg) { perror(msg); exit(0); } // Error function used for reporting issues
void sendMsg(char *msg, int socketFD){
int charsWr... |
C | int su(int k)
{int i,t;
t=1;
for(i=2;i<k;i++)
{
if(k%i==0)
{t=0;
break;}
}
return (t);
}
int main()
{int n,i,j,k;
k=0;
scanf("%d",&n);
for(i=2;i<n-1;i++)
{if(su(i)==1&&su(i+2)==1)
{k=1;
printf("%d %d\n",i,i+2);
}
}
if(k==0)
printf("empty");
return 0;
}
|
C | #include "../includes/libft.h"
char *ft_strrchr(const char *s, int c)
{
size_t i;
int last_c;
i = 0;
last_c = 0;
while (s && s[i])
{
if (s[i] == c)
last_c = i;
i++;
}
if (last_c == 0)
return (NULL);
return ((char *)&s[last_c]);
}
|
C | /*
Determine min and max value in an array (direct approach).
Lecture: IE-B1-SO1 (Software construction 1)
Author: Marc Hensel
*/
#include <stdio.h>
void minMax(const int a[], int n, int *min, int *max);
int main(void)
{
int a[] = { 20, 1, 6, 4, 22, 1, 25, 10, 16 };
int min, max;
minMax(a, sizeof a / sizeof a[0]... |
C | //
// Created by Wangdawei on 2018/11/11.
//
#include <stdlib.h>
#include "player.h"
#include <string.h>
#include <stdio.h>
#define MIN(a, b) a > b ? b : a
Player *initialize_player() {
const char *country[] = {"WEI", "SHU", "WU", "QUN"};
Player *ret = calloc(1, sizeof(Player));
ret->hand = calloc(1, siz... |
C | #include<stdio.h>
int my_strchr(char*, char);
main()
{
char ch,s[19],*p;
int i=0;
printf("enter the string....");
scanf("%s",s);
printf("enter the char...");
scanf(" %c",&ch);
i=my_strchr(s,ch);
if(i=='\0')
printf("char is not found");
else
printf("char is found %d\n",i);
}
int my_strchr(char *p,char ch)
{
int i;
f... |
C | #include<stdio.h>
#include<conio.h>
int main()
{
int year, ans;
printf("\nEnter the year you want to check is a leap year or not: ");
scanf("%d", &year);
if(year%4==0)
{
if(year%100 == 0 && year%400 == 0)
{
printf("%d is a leap year. ", year);
}
... |
C | /*************************************************
Resizes a BMP file to a specified factor
**************************************************/
#include <stdio.h>
#include <stdlib.h>
#include "bmp.h"
int main(int argc, char *argv[])
{
// ensure proper usage
if (argc != 4)
{
fprintf(stderr... |
C | #ifndef _parser_h
#define _parser_h
#include "STD\std_types.h"
/**********************************************************
;
; Name: ParserReadStringFile
;
; Purpose: reads a string to a given buffer until it
; reaches the stopat tCHAR. Will also return
; if it reaches a newline
;
; Input: the f... |
C | #include <stdio.h>
#include <stdlib.h>
char dic_to_hex(int num, int deg);
int main( ){
int a = 0;
scanf("%d",&a);
char num[5];
num[0]=dic_to_hex(a,4);
num[1]=dic_to_hex(a,3);
num[2]=dic_to_hex(a,2);
num[3]=dic_to_hex(a,1);
printf("%s", num);
return 0;
}
char dic_to_hex(int num, int deg){
int r... |
C | #include <sccd/core/fp.h>
#include <sccd/core/ec.h>
#include <sccd/core/util.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef RIOT_BOARD
const int test_iterations = 3;
#else
const int test_iterations = 100;
#endif
void test_fp_random(void) {
printf("test fb random\n");
for (int a = 0; a < test_... |
C | /*
* =====================================================================================
*
* Filename: stack.c
*
* Description: where we load our data and function with it
*
* Version: 1.0
* Created: 2016/06/10 17时14分44秒
* Revision: none
* Compiler: gcc
*
* ... |
C | #ifdef CS333_P2
#include "types.h"
#include "user.h"
int
testuidgid(uint val1, uint val2){
uint uid, gid, ppid;
uid = getuid();
printf(2,"Current UID is: %d\n",uid);
printf(2,"Setting UID to %d\n", val1);
if(!setuid(val1))
printf(2,"UID is Valid\n");
else
printf(2,"UID is ... |
C | #ifndef VECTOR_H__
#define VECTOR_H__
#include <stdlib.h>
#define vector_t(type) struct {int len, cap; type t; type *a;}
#define vector_init(v) ((v).len = (v).cap = 0, (v).a = NULL)
#define vector_push(v, x) do { \
if ((v).len == (v).cap) { \
(v).cap *= 2, (v).cap++; \
(v).a = realloc((v).a, sizeof(__typeof((v).... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* read_file_game_1.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<conio.h>
main()
{
int no;
printf("enter any no");
scanf("%d",&no);
int*ptr=&no;
printf("%u\n",ptr);
ptr++;
printf("%u\n",ptr);
ptr--;
printf("%u\n",ptr);
}
|
C | /* trie-build2.c
*
* This program builds a trie based on data on standard input. It
* produces a trie as specified by the --trie argument.
*
* It is very similar to the trie-build.c, the main difference is
* the small memory footprint. In contrast to trie-build.c the
* trie-build2.c program holds only a small pa... |
C | # include "inc.h"
# include "adminlogin.h"
int AdmtLogin()
{
int i,j;
int time = 3;
pStu pHead = NULL;
char Name[50];
char Passwd[20];
while( time )
{
i = 0;
system("clear");
liukong(6);
printf("\t\t\t您还有%d次机会\n", time);
printf("\t\t\t输入用户名:");
scanf("%s", Name);
getchar();
s... |
C |
/* @(#)s_fabs.c 5.1 93/09/24 */
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided t... |
C | /*
* student.c
* Multithreaded OS Simulation for CS 2200, Project 4
*
* This file contains the CPU scheduler for the simulation.
*/
#include <assert.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "os-sim.h"
#include "student.h"
/*
* current[] is an array of pointers ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define DEFAULT_SIZE 128
typedef unsigned long hkey_t;
typedef struct node {
hkey_t key;
void *data;
size_t data_size;
struct node* next;
} node_t;
typedef struct {
node_t *nodes;
size_t size;
size_t filled_buckets;
} hash_table... |
C | /*
* Copyright (c) 2018-2019 Analog Devices, Inc. All rights reserved.
*
* A clipper is used to apply a polynomial clipping function to an incoming signal
* and is the core of many distortion and tube amplifier simulation algorithms.
*
* This implementation includes an optional upsampling / downsampling componen... |
C |
#include <allegro5/allegro.h>
#include <allegro5/allegro_primitives.h>
#include <stdio.h>
#include <math.h>
#define true 1
#define false 0
void move_circle(float* x, float* y, float velX, float velY) {
float x_dist = velX - *x;
float y_dist = velY - *y;
float distance = sqrt(x_dist * x_dist + y_dist * y_dist);... |
C | #include<stdio.h>
#include<conio.h>
void main()
{
int a[60],n;
printf("\n enter the limit");
scanf("%d",&n);
printf("\n enter the elements");
for(i=0;i<=n;i++)
scanf("%d",&a[i]);
b=a[0];
for(i=1;i<=n;i++)
{
if(b<a[i])
{
b=a[i];
}
}
printf("highest element:%d",b);
s=a[0];
for(i=1;i<=n;i++)
{
if(s>a[i])
{
s=a[i];
}
}
pr... |
C | //flags.c - флаги
#include "../../include/sudlib.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char flags (int argc, char *argv [])
{
char modify = DEFAULT;
char *validFlags [FLAGQ] = {"-help", "-solution", "-girandola", "-windoku", "-diagonal"};//флаги
char *descriptionFlags [FLAGQ] = {"... |
C | /*
** map.h for life
**
** Made by barthelemy delemotte <delemo_b@epitech.eu>
*/
#ifndef _MAP_H_
# define _MAP_H_
/*
** datas types
*/
typedef char t_cellule;
typedef t_cellule **t_map;
/*
** cellule states
*/
enum
{
DEAD = 0,
CEL_NEW,
CEL_OLD,
CEL_DYING,
CEL_SHORT,
CEL_OUT_RANGE
};
# d... |
C | /*
* COPYRIGHT: See LICENSE in the top level directory
* PROJECT: HPCsim
* FILE: HPCsim/Exceptions.h
* PURPOSE: Exceptions handling
* PROGRAMMER: Pierre Schweitzer (pierre@reactos.org)
*/
#include <setjmp.h>
#include <signal.h>
#include <execinfo.h>
extern __thread jmp... |
C | #include "../utils/myhead.h"
/* problem
* description find the longest sequence starting under 10^6
* apparently there were overflow errors when regular ints were used!
*/
long long int sequence(int start)
{
int length = 1;
long long int n = start;
while(n>1)
{
lengt... |
C | #define os_putchar(c) asm volatile ("mov eax, %0; push 0x01; int 0x80" : : "r" (c) : "eax");
#define os_print_integer(x, y) asm volatile ("mov eax, %0; mov ecx, %1; xor edx, edx; push 0x06; int 0x80" : : "r" (x), "r" (y) : "eax", "ecx", "edx");
#define os_print_string_i(s) asm volatile ("jmp 2f; 1: .asciz \""s"\"; 2: ... |
C | #include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
void main(){
pid_t pid; //variable to store process id
pid_t ppid; //variable to store parent process id
sleep(5);
pid = getpid(); // returns pid
ppid = getppid(); //returns parent pid
printf("The process id is : %d\n" , pid);
... |
C | //1. passing individual elements
#include<conio.h>
#include<stdio.h>
#include<String.h>
struct student
{
int rno;
char name[30];
float percent;
}s1;
void display(int r, char *n,float p);
int main()
{
printf("Enter the roll no\n");
scanf("%d",&s1.rno);
printf("Enter name\n");
scanf("%s",&s1.name);
printf("Enter ... |
C | /*
** EPITECH PROJECT, 2019
** my_octal_long.c
** File description:
** octal long
*/
#include "my.h"
int my_put_octal_long(unsigned long nb, int n)
{
if (nb >= 8)
n = my_put_octal_long(nb / 8, n);
my_putchar(nb % 8 + '0');
n++;
return (n);
}
int my_octal_long(va_list ap, int n, char const *st... |
C | //
// Created By Hikari Software
//
// Y-Enterprise
//
//
#include <stdio.h>
#include <stdlib.h>
struct TreeNode {
int val;
struct TreeNode *left;
struct TreeNode *right;
};
int my_power(int n, int power) {
if(power==0) {
return 1;
}
if(power==1) {
return n;
}
if(... |
C | #include "binary_trees.h"
/**
* check_binary_tree_is_leaf - check if a node is a leaf
* @node: pointer to the node to check
* Return:1 if a leaf, and 0 is not leaf
*/
int check_binary_tree_is_leaf(const binary_tree_t *node)
{
if (node != NULL && node->left == NULL && node->right == NULL)
return (1);
return (0... |
C | /*
* Snake 3d -- Main.c
*
* Qui c'e' lo scheletro del programma
*
*/
#include "share.h"
/*
* funcizione che funge da ciclo principale
* vengono gestiti gli eventi, gli update ed alla fine viene disegnato tutto
*/
void TimerFunc(int value){
loop();
glutPostRedisplay();
if(programData.exit){
exit(0)... |
C | /*
** my_strcapitalize.c for my_strcapitalize.c in /home/edwin/Librairie
**
** Made by edwin
** Login <edwin.rocha-carvalho@epitech.eu>
**
** Started on Mon Jan 23 15:03:16 2017 edwin
** Last update Mon Jan 23 15:12:44 2017 edwin
*/
#include "library.h"
char *my_strcapitalize(char *str)
{
int i;
i = 0;
whi... |
C |
#include"session.h"
#include"ftpproto.h"
#include"privparent.h"
void begin_session(session_t *sess)//会话功能
{
pid_t pid = fork();
if(pid == -1)
ERR_EXIT("session fork");
if(pid == 0)
{
handle_child(sess);//ftp 服务进程
}
else //nobody 进程,nobody是系统中比较特殊的用户,主要用于协助ftp服务进程(孙子进程),是内部私有的... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.