language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | //通过函数实现查找一串数组中的最大数以及它的个数,要求最大数用return返回,个数用形参带回
#include <stdio.h>
int main()
{
int a[10] = {2, 3, 3, 2, 4, 5, 6, 6, 6, 6};
int num;
int max;
max = f(a, 10, &num);
printf("max: %d\nnum: %d\n", max, num);
return 0;
}
int f(int a[], int n, int *num)
{
int max = a[0];
int i = 0;
*num = 1;
for(i = 1; i < n; i... |
C | /*
Extensive TWI/I2C EEPROM Library - for 24LCxxx devices
version: 0.4.2
target device: Microchip 24LC256 or similar
compatibility: designed with Arduino Due
-> Ver. 0.4.2: New license.
author: Dennis Schweer (Inglorious Engineer)
Copyright (c) 2015 Dennis Schweer
license: The MIT License (MIT... |
C | #include<stdio.h>
int main()
{int n;
scanf("%f",&n);
if(n>=90)
printf("A");
else
if(n<=89&&n>=80)
printf("B");
else
if(n<=79&&n>=70)
printf("C");
else
if(n<=69&&n>=60)
printf("D");
else
if(n<60)
printf("E");
return 0;
} |
C | /**
* strings.c
* Project IFJ19
*
* Březina Jindřich (xbrezi21@stud.fit.vutbr.cz)
* Gumančík Pavol (xguman01@stud.fit.vutbr.cz)
* Kotáb Dominik (xkotab01@stud.fit.vutbr.cz)
* Moravčík Tomáš (xmorav41@stud.fit.vutbr.cz)
*
* Brief: operations for strings
*
*/
#define ALLOC_ADD 10
#include "error.h... |
C | /**
* Filename: fig7-16_pr_rlimits.c
* Author: csbonkers
* Contact: csbonkers@mail.ynu.edu.cn
* Date: 4/23/21
* Description:
* 获取并打印进程的当前资源限制
*/
#include "apue.h"
#include "sys/resource.h"
#define doit(name) pr_rlimits(#name, name)
static void pr_rlimits(const char *rname, int rtype);
int main(int a... |
C | /**
Sample program to read and count all the characters on standard input.
*/
#include <stdio.h>
#include <stdlib.h>
int main() {
int ccount = 0;
// Keep reading until we hit the EOF.
int ch;
while ( ( ch = getchar() ) != EOF )
ccount++;
// Report how many characters we found.
printf( "%d\n", ccou... |
C | #include <stdio.h>
#include <stdlib.h>
int main() {
// --- 1
int t1[] = {1, 2, 3};
for (int i=0; i<3; i++) {
printf("%p ", &t1[i]);
}
printf("\n");
// --- 1
// --- 2
int t2[3];
for (int i=0; i<3; i++) {
printf("%p ", &t2[i]);
}
printf("\n");
// --- 2
return 0;
}
|
C | typedef struct list {
struct list * prev;
struct list * next;
} *list;
#define struct_from_list(l, s, f) struct_from_field(l, s, f)
#define list_foreach(l, e) \
for (list __next, e = list_begin(l); __next = e->next, e != list_end(l); e = __next)
#define list_foreach_reverse(l, e) \
for (list __next, e ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* custom_split.c :+: :+: :+: ... |
C | #include "main.h"
/**
* print_rev- function that prints a string, in reverse, followed by a new line
* @s: pointer to string
* Return: print to string in reverse to stdout
*/
void print_rev(char *s)
{
s += _strlen(s) - 1;
for (; *s; s--)
_putchar(*(s));
_putchar(10);
}
/**
* _strlen- function that returns... |
C | #define _XOPEN_SOURCE 700
#define _REENTRANT
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char *argv[]) {
char buf;
if (argc != 2) {
printf("Nombre d'argument incorrect\n");
return EXIT_FAILURE;
}
int fd;
fd = open(argv[1], O_WRONLY);
while (rea... |
C | #include <stdio.h>
int a = 2;
void count(int b, int c)
{
int m;
static int n = 4;
a = a + 1;
m = a + b;
n = n + c;
printf("%d,%d\n", m, n);
}
void main()
{
int b = 1, c = 2;
{
int a = 3, c = 4;
count(a, c);
}
count(b, c);
}
|
C | #include <stdio.h>
#include "holberton.h"
/**
* helper - finds input from n
* @bc: check against base case
*
* @n: given num to be squared
*
* Description: helper function for sqrt recursion
* Return: natural sqrt
*/
int helper(int n, int bc)
{
if (n * n == bc)
return (n);
if (n * n > bc)
return (-1);
r... |
C | #include "wrflash.h"
#include "delay.h"
#include "uart.h"
void ONCHIP_FLASH_Unlock(void)
{
FLASH->KEYR = FLASH_KEY1; //д.
FLASH->KEYR = FLASH_KEY2;
}
//flash
void ONCHIP_FLASH_Lock(void)
{
FLASH->CR |= 1 << 7; //
}
//õFLASH״̬
u8 ONCHIP_FLASH_GetStatus(void)
{
u32 res;
res = FLASH->SR;
if(res & ... |
C |
#include<stdio.h>
float somatorio(int m, float v[]){
int i; float s =0.0F;
for(i=0;i<m;i++)
s += v[i];
return s;
}
int main (void) {
float v[] = {2.0, 3.0, 4.0};
float s = somatorio(3,v);
printf("somatorio=%.1f, media=%.1f",s,s/3);
return 0;
}
|
C | /* drawcosandline.c
cos(x) & f(x)=45*(y-1)+31
*/
#include <stdio.h>
#include <math.h>
int main(int argc, char const *argv[]) {
double y;
int x,m,n,yy;
for (yy = 0; yy <= 20; yy++)
{
y = 0.1*yy;
m = acos(1-y)*10;
n = 45*(y-1)+31;
for (x = 0; x <= 62; x++)
if (x==m&&x==n) printf("+");
... |
C | #pragma once
typedef struct _CC_TREE {
int Value;
struct _CC_TREE *Left;
struct _CC_TREE *Right;
int Height;
int FirstNode;
} CC_TREE;
int TreeCreate(CC_TREE **Tree);
int TreeDestroy(CC_TREE **Tree); //todo free la toate
int TreeInsert(CC_TREE *Tree, int Value);
int TreeRemove(CC_TREE *Tree, int Val... |
C | /*-----------------------------------------------------------------------
Creator : Morris chiou
Sensor : light sensor
File Name : EXAMPLE_TSL2561.c
Function : EXAMPLE_TSL2561
Create Date : 2017/11/01
---------------------------------------------------------------------- */
#include <mega3... |
C | #include"myheader23.h"
int main()
{
int choice, n, i, j;
int arr[MAXSIZE];
n = MAXSIZE;
printf("Enter the elements of an array:- \n");
for(i=0; i<n; i++)
{
scanf("%d",&arr[i]);
}
printf("\nYou can sort an array using following techniques:- \n");
again:
printf("1.- BUBBLE SORT\n 2.- INSERTION SORT \n 3.- SEL... |
C |
//___________________________________________________________________ VFAT DIRECTORY
//________________________________________________________ DESCRIPTION
/**
* @file vfat_directory.h
* @brief Provides tools helping in the task
* of extracting information from a directory.
* @Author Hugo Bonnome, Arthu... |
C |
/*
* Copyright (C) Igor Sysoev
* Copyright (C) Nginx, Inc.
*/
#include <ngx_config.h>
#include <ngx_core.h>
/* 基本hash 的查找*/
void *
ngx_hash_find(ngx_hash_t *hash, ngx_uint_t key, u_char *name, size_t len)
{
ngx_uint_t i;
ngx_hash_elt_t *elt;
#if 0
ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log,... |
C |
static char help[] = "Demonstrates a scatter with a stride and general index set.\n\n";
/*T
requires: x
T*/
#include <petscvec.h>
int main(int argc,char **argv)
{
PetscErrorCode ierr;
PetscInt n = 6,idx1[3] = {0,1,2},loc[6] = {0,1,2,3,4,5};
PetscScalar two = 2.0,vals[6] = {10,11,12,13,14,15};
... |
C | #include "globals.h"
// this is the array that will hold our sequence.
// This array will only contain 0, 1, 2, or 3.
uint8_t fullSequence[GLOBALS_MAX_FLASH_SEQUENCE] = {0};
// this is simply the length of the above array
uint16_t length = 0;
// this is the level we're on.
// In my code, length and level will be equal... |
C | /*
** prompt.c for in /home/rosins_m/projets/brainfuck
**
** Made by matthieu rosinski
** Login <rosins_m@epitech.net>
**
** Started on Tue May 24 11:55:19 2011 matthieu rosinski
** Last update Tue May 24 11:55:19 2011 matthieu rosinski
*/
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <unist... |
C | #include<stdio.h>
int main()
{
long long int n,a,i;
int arr[6]={1,8,4,2,6};
scanf("%I64d",&n);
if(n==0)
a=arr[0];
else if(n<5 )
a=arr[n];
else if(n%4==0)
{
a=arr[4];
}
else if(n>=5)
{
i=n%4;
a=arr[i];
}
printf("%I64d\n",a);
retu... |
C | /*
** main.c for normal in /home/ozouf_h//rt_normal
**
** Made by harold ozouf
** Login <ozouf_h@epitech.net>
**
** Started on Wed May 9 17:23:32 2012 harold ozouf
** Last update Sun Jun 3 01:32:40 2012 harold ozouf
*/
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "raytracer.h"
#include "cam... |
C | #include "avl.h"
#include "consultasFuncoes.h"
#include "declaracoes.h"
#include "hashTable.h"
#include "imprimeSvg.h"
#include "leitura.h"
#include "lista.h"
#include "locacoesData.h"
#include "parametrosData.h"
#include "pessoasData.h"
#include "quadrasData.h"
typedef struct dados {
void *valor;
} Dados;
typed... |
C | //
// Created by Stanislav on 2019-05-06.
//
#ifndef ZLASM_C_ERROR_H
#define ZLASM_C_ERROR_H
#include <stdio.h>
#include <stdlib.h>
#include "../../include/Types.h"
#define ZLASM__CRASH(msg) _crash(msg, __FILE__, __LINE__)
#define ZLASM__TOKEN_CRASH(msg, token) \
_token_crash(msg, (token->pos), (token->line), (t... |
C | /*
** count_special_char.c for in /home/januar_m/delivery/PSU/PSU_2016_minishell2/basics
**
** Made by Martin Januario
** Login <martin.januario@epitech.eu>
**
** Started on Sun Apr 9 02:13:14 2017 Martin Januario
** Last update Sun Apr 9 02:23:08 2017 Martin Januario
*/
#include <stdlib.h>
#include "my.h"
in... |
C | #include "lab1.h"
extern char sz_menu[];
const char * sz_help1[] = {
" (a^f/2+b-(f/a)+f*a^2-(a^2+b^2)",
"'1' a, b f ",
"'h' 'H'. ",
"'E' 'e'. "
};
int sz_help_data1 = sizeof(sz_help1) / sizeof(char *);
void lab1_help(){
int i = 0;
for(;i < sz_help_data1;i++){
... |
C | #include <stdio.h>
#include <stdlib.h>
struct node{
int vertex;
struct node *next;
};
// typedef is used for user defined type node
typedef struct stack node;
// Another user defined type nodeptr is pointer to node type
typedef node * nodeptr;
struct Graph{
int numVertices;
struct node **adjlist;
... |
C | /*
** EPITECH PROJECT, 2018
** fd_manager
** File description:
** manage client fd for server
*/
#include <stdio.h>
#include "server.h"
static void set_fd(t_data *serv)
{
FD_ZERO(&serv->readfs);
FD_SET(serv->fd, &serv->readfs);
FD_ZERO(&serv->writefs);
}
static int loop_fd(t_data *serv)
{
int i = 0;
int res = s... |
C | /*DESCRIPCION: PROTOTIPOS DE FUNCIONES PARA EL MANEJO DE ALGORITMOS QUE RELACIONAN LAS ESTRUCTURAS eCliente y ePrestamo
*AUTOR: CARLOS LOPEZ
*/
#ifndef LINKERSTRUCTURE_H_
#define LINKERSTRUCTURE_H_
#define QTYLINKER 3
#define EMPTY 0
#define NON_EMPTY 1
/**
* \brief : Permite dar de baja un cliente
* \param ePre... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_nm.c :+: :+: :+: ... |
C | #include <stdlib.h>
#include <stdio.h>
#include <limits.h>
/* Linked list implementation of Stack- don't need to know exact size before building out the list
Properties:
1. Push and Pop from the top O(1)
2. One struct for List Node and one struct for Stack itself
*/
// Remember linked lists are dynamic- usef... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "stack.h"
#define MAX 100 //number of items in stack
char *stack[MAX]; //stack of strings(variables)
int tos = -1; //top of stack
int varct = -1; //the number of variables in that scope
int block_varct[MAX];
int place = 0;
//make the stack
void bu... |
C | #include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "integer.h"
#include "typeid.h"
#include "endianess.h"
static struct pbd_element_vtable integer_vtable;
static int integer_to_buffer(pbd_conf conf, const pbd_element* e, char** buffer,
size_t* size) {
assert(e != NU... |
C | #include <stdio.h>
int GCD(int a, int b);
int LCM(int a, int b);
int main(void)
{
int n, sum_loop, sum_math;
int counter;
printf("This program add the numbers from zero to a given number\n");
printf("Introduce an integer number: ");
scanf("%i", &n);
counter = 0;
while(counter <= n)
{
sum_loop = sum_loop ... |
C | /**
******************************************************************************
* @file USB_Device/HID_Standalone/Src/stm32f1xx_it.c
* @brief Main Interrupt Service Routines.
* This file provides template for all exceptions handler and
* peripherals interrupt service routine.
**... |
C | #include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#define NUM_THREADS 11
#define FILE_NAME "test_case"
int *sudoku[9];
int checkRow[9][9], checkCol[9][9], checkGrid[9][9];
FILE *stream;
struct param{
int id;
int valid;
};
struct param validator[NUM_THREADS];
void *runner(struct param * p);/* threa... |
C |
#include <pthread.h>
struct pqueue_elem {
void * data;
struct pqueue_elem * next;
} pqueue_elem;
struct pqueue {
pthread_mutex_t queue_lock;
pthread_cond_t not_empty;
int queue_end;
int queue_size;
struct pqueue_elem * qhead;
struct pqueue_elem * qtail;
};
static void pqueue_init(struct pqueue * queue) {
... |
C | //
// main.c
// 6.3.12
//
// Created by 雅 on 2019/12/4.
// Copyright © 2019 雅. All rights reserved.
//
#include <stdio.h>
#include <ctype.h>
void task0(void){
printf("Task0 is called!\n");
}
void task1(void){
printf("Task1 is called!\n");
}
void task2(void){
printf("Task2 is called!\n");
}
void task3(v... |
C | #include <stdio.h>
#include <math.h>
int main(void){
int values[3];
int i,a,k,h;
for(i=0;i<3;i++){
scanf("%d",&a);
values[i]=a;
}
int x = values[0];
int z = values[2];
for(i=0; i>1-values[2];i--){
int j = values[2]+i-1;
int left = floor( j * (x/(2.0*z)) );
int right = ceil( (x-1) + -j * (x/(2.0*z)) )... |
C |
/*SDSPIģʽʵļ*/
#include "SD_Drv.h"
/*ʱ*/
void Delay_100us(void)
{
unsigned int i=8;
while(i--)
*P_Watchdog_Clear=0x0001;
}
//IOBڳʼ CS,DO,CLKΪߵƽ DIΪѵ
void SPI_IO_Init(void)
{
unsigned int tmp;
tmp=*P_IOB_Dir;
tmp |= (SPI_CS+SPI_DOUT+SPI_CLK);
tmp&=~SPI_DIN;
*P_IOB_Dir=tmp;
tmp=*P_IOB_Attrib;
tmp|=(SPI... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
const char *mode;
const char *hexstring;
if (argc == 2) {
mode = "-h";
hexstring = argv[1];
} else if (argc == 3) {
mode = argv[1];
hexstring = argv[2];
} else {
exit(1);
}
int color24 = (... |
C | #include "lib_ccx.h"
#include "ccx_common_option.h"
#include "wtv_constants.h"
#include "activity.h"
#include "file_buffer.h"
int check_stream_id(int stream_id, int video_streams[], int num_streams);
int add_skip_chunks(struct ccx_demuxer *ctx, struct wtv_chunked_buffer *cb, uint32_t offset, uint32_t flag);
void init_... |
C | /**
* ptr2-sln.c - Re-implementing strlen (Solution)
*
* Computer Science 50
* Week 5
*
* Eric Ouyang <eouyang@college.harvard.edu>
* Frederick Widjaja <fwidjaja@college.harvard.edu>
*/
#include <stdio.h>
int length(char* str);
int main(void)
{
printf("%d\n", length("Hello, world"));
printf("%d\n", l... |
C | //
// main.c
// aps105-str
//
// Created by Baochun Li on 2017-03-10.
// Copyright © 2017 Baochun Li. All rights reserved.
//
#include <stdio.h>
int main(void) {
const int LENGTH = 5;
// Declaring and initializing a string as a character array
char str[LENGTH + 1];
str[0] = 'H';
str[1] = 'e';
str[2] =... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_conversion_tools.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>
#include <errno.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/wait.h>
#includ... |
C | /*
* CS:APP Data Lab
*
* < Mertcan Asgun 63948 >
*
* bits.c - Source file with your solutions to the Lab.
* This is the file you will hand in to your instructor.
*
* WARNING: Do not include the <stdio.h> header; it confuses the dlc
* compiler. You can still use printf for debugging without includi... |
C | #ifndef SOCKECTDESCRIPTION_H
#define SOCKECTDESCRIPTION_H
void SockectDescription(){
// This call returns a socket descriptor that you can use in later system calls or -1 on error.
// =>Parameters family
// AF_INET IPv4 protocols
// AF_INET6 IPv6 protocols
// AF_LOCAL Unix domai... |
C | #ifndef BST_H_INCLUDED
#define BST_H_INCLUDED
#include<stdio.h>
#include <stdlib.h>
struct node{
int key;
struct node *left, *right;
};
struct node *newNode(int n);
struct node *insert(struct node *root, int n);
void inOrder(struct node *root);
void preOrder(struct node *root);
#endif // BST_H... |
C | #include <stdio.h>
#include <string.h>
/* bubble 정렬을 통해 문자열을 정렬한다.
인접한 두 요소의 사전상 순서를 strcmp로 비교해 정렬하고 배열의 끝까지 반복한다.
이렇게 하면 사전상 가장 뒤에 있는 단어가 가장 오른쪽으로 가게 된다.
이후 가장 오른쪽의 요소를 제외하고 반복한다. */
void bubbleSort(char *arr[], int index_R)
{
char *tmp;
for (int i = index_R; i > 0; i--) {
for (int j = 1; j < index_R; j... |
C | /*
* CS 241
* The University of Illinois
*/
#define _GNU_SOURCE
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include "libmapreduce.h"
#define CHARS_PER_INPUT 30000
#define INPUTS_NEEDED 10
static const char *long_key = "long_key";
/* Takes input string and ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <pwd.h>
#include <sys/time.h>
#include <string.h>
#include <signal.h>
#include <unistd.h>
#include <errno.h>
#include "bbgp.h"
#define BGP_PORT 179
#define MYAS 31337
#define OUR_HOLD_TIME 9
//int de... |
C | #include "stack.h"
#include<stdio.h>
int x[10];
int topIndex=0;
void push(int a){
if(topIndex < 9) {
x[topIndex] = a;
topIndex++;
}else{
printf("stack is full\n");
}
}
int pop(){
if(topIndex > 0){
topIndex--;
... |
C | #include "collision.h"
#include "forces.h"
#include <assert.h>
#include <math.h>
#include <stdlib.h>
const double FORCES_MIN_GRAVITY_DISTANCE = 50;
typedef struct gravity_aux {
double G;
body_t *body1;
body_t *body2;
} gravity_aux_t;
typedef struct spring_aux {
double k;
body_t *body1;
body_t... |
C | #include <ncurses.h>
int main(void)
{
int y,x,r;
initscr();
addstr("You Move The Cursor!\n");
addstr("Enter the Y (row) coordinate: ");
refresh();
scanw("%d",&y);
addstr("Enter the X (column) coordinate: ");
refresh();
scanw("%d",&x);
r = move(y,x);
if(r == OK)
{
mvaddstr(3,0,"You have moved the curso... |
C | //#define _CRT_SECURE_NO_WARNINGS 1
//#include<stdio.h>
//#include<string.h>
//char * my_strcpy(char * dst, const char * src)
//{
// char * cp = dst;
// while (*cp++ = *src++);
// return(dst);
//}
//int main()
//{
// char arr = "1234567";
// char*p = arr;
// printf("%s ", my_strcpy(p, "zxcvbnm"));
// return 0;
//}
#... |
C | #include<stdio.h>
#include<math.h>
#include<locale.h>
void main() {
char *locale = setlocale(LC_ALL, "");
double x,y;
printf(" x y \n"); scanf("%lf%lf", &x, &y);
printf("u=%lf", (1-sin(x+y)*sin(x+y))/(2+fabs(x-(2*x*x/(1+fabs(sin(x+y)))))));
getch();
}
|
C | //
// Created by dell on 11.10.19.
//
#include "UI.h"
// print current info
void print_curr_info() {
char cwd[1024];
char* username = getenv("USER");
time_t now;
time(&now);
printf("\nHello, %s", username);
printf("\nIt is : %s", ctime(&now));
getcwd(cwd, sizeof(cwd));
printf("And you... |
C | #include <stdio.h>
int main()
{
long int retTime = time(0) + 10; // Get finishing time.
while (time(0) < retTime);
printf("andy is an idiot\n");
return 1;
} |
C | //===-- direct_task.c - Task example with code outlining shown ----*- C -*-===//
//
// Part of the LOMP Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===---------------------------... |
C | #include <stdio.h>
int input(const char word[]);
int add(int a, int b);
int subtract(int a, int b);
int multiply(int a, int b);
double divide(int a, int b);
int main() {
int value_one, value_two;
printf("Type two numbers");
value_one = input(" value one = ");
printf("\n");
value_two = input(" value two = ");
pr... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#pragma warning(disable:4996)
void rhanoi(int n, char from, char aux, char to)
{
if (n == 1)
{
printf("%c %c\n", from, to);
return;
}
rhanoi(n - 1, from, to, aux);
printf("%c %c\n", from, to);
rhanoi(n - 1, aux, from, to);
}
void hanoi(int n)
{
rha... |
C | //No_more_space.c: Cancella gli spazi di troppo in un testo
/* * Copyright © 2020 Lorenzo Fiocco <fiocco@giallo.it>
* This program is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What The ... |
C | #include "helper.h"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
extern int* GenerateRandomArray(int start,int end,long long size);
extern void TestSorting(sortfunc_p func,char* func_name,int* arr,long long size);
extern int* ... |
C | #include<stdio.h>
int main()
{int a[2][2]={5,4,4,4};
int b[2][2]={6,7,8,9};
int c[2][2],i,j,k,sum;
printf("matrix A is:\n\t\t");
for(i=0;i<2;i++)
{for(j=0;j<2;j++)
printf("%d\t",a[i][j]);
printf("\n\t\t");
}
printf("\n matrix B is :\n\t\t");
for(i==0;i<2;i++)
{
for(j=0;j<2;j++)
printf("%d\t",b[i][j]);
printf("\n\t\t")... |
C | //https://www.hackerrank.com/challenges/acm-icpc-team/problem
#include<stdio.h>
#include<stdlib.h>
void Perform_BitwiseOR(int n, int m, int *topic[]){
int i,j,s,a,max,c;
a=s=max=0;
for( i=0; i<n; i++ ){
for( j=i+1; j<n ; j++ ){
s=0;
... |
C | #define _GNU_SOURCE
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <pthread.h>
#include <sched.h>
#include <signal.h>
#define DIF 16
#define NUM_THREADS 4
#define STACK_SIZE (1024*12600)
#pragma pack(2) // 2 ... |
C | #include <stm32f4_discovery.h>
#include <os.h>
#include <stdlib.h>
// Sleeping barber problem
#define BARBERS 2 // num of barbers
#define CUSTOMERS 4 // num of chairs in the waiting room
#define DELAY 256 // time constant
OS_MTX(doors, mtxDefault);
OS_SEM(barbers, 0);
OS_SEM(customers, 0);
OS_SEM(end_of_haircu... |
C | #include <stdio.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
#include "md5.c"
#define BLOCKSIZE 64
unsigned long b = 0; // length (bits) of input block
unsigned long kLength = 0; // length (bits) of input key
char *M; // Message
char *k; // 密钥
char *KPlus;... |
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <limits.h>
/*
int a = 5;
void changeValue() {
a = 10;
}
void process() {
static int a = 5;
a = a + 1;
printf("%d\n", a);
}
void add(int* a, int b) {
*a = *a + b;
}
*/
//int a[3][3] = { {1,2,3}, {4,5,6}, {7,8,9} };
//int a[2][3][3] = { { {1,2,3}, {4,5,... |
C | #include "jackCompiler.h"
static void del_source(void *source_void);
static void del_token(void *token_void);
void ft_free_sources(t_list **src_files)
{
if (src_files)
{
ft_lstclear(src_files, del_source);
free(src_files);
}
}
static void del_source(void *source_void)
{
t_srcFile *source = (t_srcFile *)so... |
C | /*
** list_insert.c for in /home/lejard_h/my_lib_c/list
**
** Made by hadrien lejard
** Login <lejard_h@epitech.net>
**
** Started on Fri Mar 7 15:39:47 2014 hadrien lejard
** Last update Thu Jul 10 13:44:59 2014 lejard_h
*/
#include <stdlib.h>
#include "list.h"
t_list *list_insert_after(t_list *elem, void *dat... |
C | #include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#define MAX_LENGTH 0xFF
void print_array(uint8_t *array, uint8_t array_size)
{
int i;
for( i = 0; i < array_size; i++)
{
printf("%d", array[i]);
if(i < (array_size - 1))
{
printf(",");
}
}
printf("\n");
}
uint8_t* rmNdub(uint8_... |
C | #include "NU32.h" // cache on, interrupts on, LED/button init, UART init
#include "i2c_display.h"
#include "accel.h"
// the game of snake, on an oled display. eat those pixels!
#define MAX_LEN WIDTH*HEIGHT
typedef struct {
int head;
int tail;
int rows[MAX_LEN];
int cols[MAX_LEN];
} snake_t; // hold th... |
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 | /*
** EPITECH PROJECT, 2019
** MyFTP
** File description:
** Test file of the argument parser functions
*/
#include <criterion/criterion.h>
#include "argument.h"
Test(argument_parser, no_argument)
{
argument_t args = {};
int argc = 1;
char **argv = malloc(sizeof(char *) * (argc + 1));
argv[0] = strdu... |
C | #define _GNU_SOURCE
#include <errno.h>
#include <error.h>
#include <fcntl.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#define PARAM_0 0x0001
#define PARAM_1 0x0002
#define PARAM_2 0x0004
// future proofing
#define PA... |
C | static int
depth_search(Coll * graph, DepNode * start, int *setno)
{
int i;
int find = 0;
start->setno = -3;
for (i = 0; i < start->ndeps; i++)
{
DepNode *np = find_node(graph, start->deps[i]);
if (!np)
continue;
if (np->in_cycle)
continue;
switch (np->setno)
{
... |
C | #include<stdio.h>
void printarr(int a[], int num)
{
int i;
for(i=0;i<num;i++)
printf("%d, ",a[i]);
printf("\n");
}
void insertion(int a[], int num)
{
int i, j, key;
for(i=1;i<num;i++)
{
key = a[i];
j = i-1;
while((j >= 0) &&(a[j] > key))
{
a[j+1] = a[j];
j--;
}
a[j+1] = key;
printarr(a,5);
... |
C | #ifndef MYSH_SHELL_RESOURCE_H
#define MYSH_SHELL_RESOURCE_H
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <unistd.h>
#include <errno.h>
#include <termios.h>
#include <sys/types.h>
#include "mystring.h"
typedef struct mysh_resource_tag {
mysh_string current_dir;
mysh_string home_dir;
... |
C |
#include <stdio.h>
#include <stdlib.h>
#include "Graph.h"
void keepfinding(Graph g, int src, int *x, int n){
for(int i = 0; i < n; i++){
if(GraphIsAdjacent(g,i,src) && !x[i]){
printf("%d ",i);
x[i] = 1;
keepfinding(g, i, x, n);
}
}
}
void depthFirstSearch(G... |
C | typedef int Item;
struct Node {
Item item;
Node* next;
};
typedef Node* SinglyLinkedList;
typedef Node* CircularLinkedList;
struct DNode {
Item item;
DNode* prev;
DNode* next;
};
typedef DNode* DoublyLinkedList;
|
C | #include<stdio.h>
int main(){
int N,i;
int x[100000]={0};
int y[100000]={0};
int t[100000]={0};
scanf("%d",&N);
for(i=0;i<N;i++){
scanf("%d %d %d",&t[i],&x[i],&y[i]);
}//読み込み
int flag =1;
for(i=0;i<N;i++){
int dt=t[i+1]-t[i];
int dist =abs(x[i+1]-x[i])+abs(y[i+1]-y[i]);
if(dt<dist)... |
C | /*
* wrapper exp2(x)
*/
#include <float.h>
#include "math.h"
#include "math_private.h"
static const double o_threshold= (double) DBL_MAX_EXP;
static const double u_threshold= (double) (DBL_MIN_EXP - DBL_MANT_DIG - 1);
double
__exp2 (double x) /* wrapper exp2 */
{
#ifdef _IEEE_LIBM
return __ieee754_exp2 (x);
#el... |
C | bool sameline(P3 p1, P3 p2, P3 p3) { //判断共线
return sgn(det(p1, p2, p3).len())==0;
}
bool sameplane(P3 p1, P3, p2, P3 p3, P3 p4) { //判断共面
return sgn(dot(det(p1, p2, p3), p4-p3))==0;
}
bool on_segment(P3 p, P3 a1, P3 a2) { //判断是否在线段上;包含端点
if(!sameline(p, a1, a2)) return false;
a1=a1-p, a2=a2-p; //若想不包含端点,需特判 p!=a1... |
C | #include<stdio.h>
#include<stdlib.h>
int a[200000]={};
void quicksort(int left,int right){
int k,l,r,i;
if(left >= right)
return;
k=a[left];l=left;r=right;
do{
while(a[r] >= k && r>l) r--;
a[l] = a[r];
while(a[l] <= k && l<r) l++;
a[r] = a[l];
}while(l<r);
... |
C | #include "mips.h"
#include "mmu.h"
#include "mipsop.h"
#include <stdio.h>
#include <string.h>
void print_disas_string(uint32_t inst); // from mipsinst.c
void
print_regs(struct mips_regs *r)
{
int i;
for (i=0; i<32; i++) {
fprintf(stderr, "reg[%d]=%08x ", i, r->regs[i]);
if (i%4==3) {
... |
C | /*
* xbot: Just another IRC bot
*
* Written by Aaron Blakely <aaron@ephasic.org>
**/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/select.h>
#include <time.h>
#include <errno.h>
#include "config.h"
#include "irc.h"
#include "util.h"
#include "events.h"
static time_t trespond;
int main(... |
C | #include<stdio.h>
int main(int argc, char *argv[]) {
int n, m;
int i, a = 0, b = 0;
int arr[44];
scanf(" %d", &n);
for (i = 0; i < n; i++)
scanf(" %d", arr + i);
scanf(" %d", &m);
for (i = 0; i < n; i++) {
if ( !(m % arr[i]) )
a += arr[i];
i... |
C | #include <stdio.h>
#include <stdlib.h>
#include "redesocial.h"
#include "interface.h"
#include "amizades.h"
#include "exercicios.h"
int main()
{
TRedeSocial rede;
TUsuarios user;
int opcao;
inicializar(&rede);
do
{
mensagemMenu();
printf("\n\n\tDIGITE UMA O... |
C | #include <stdio.h>
#include <stdlib.h>
#include "SingleLinkedList.h"
void create(SingleLinkedList* l){
Node* header=malloc(sizeof(Node));
header->data=0;
header->next=NULL;
l->header=header;
l->length=0;
}
void push(SingleLinkedList* l, int data)
{
Node* header = l->header;
Node* newNode=malloc(sizeof(Node))... |
C | /**
* MathAdditions.c
* KosherCocoa 2
*
* Created by Moshe Berman on 3/24/11.
* Modified by Moshe Berman on 8/25/13.
*
*
*/
#include "trigonometry.h"
/** toRadians
*
* A utility function for converting degrees to radians
*
* @param degrees The number of degrees to convert.
* @return The number ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_digit.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<math.h>
double cubic(double n);
int main(int argc, char* argv[]) {
double input;
printf("Enter the double datum to calc cubic :");
scanf_s("%lf", &input);
cubic(input);
printf("PROGRAM EXIT!\n");
return 0;
}
double cubic(double n) {
double t = pow(n, 3);
printf("The %lg's... |
C | #include "stdafx.h"
#include "stdlib.h"
#include "string.h"
#include "math.h"
struct node{
int data;
struct node *next;
};
void addNode(struct node **root, int data){
struct node *temp = (struct node*)malloc(sizeof(struct node));
struct node *current = *root;
temp->data = data;
temp->next = NULL;
if (current =... |
C | void main()
{
int n,i=1,j;
char str[51][32],t;
scanf("%d",&n);
while(i<=n)
{
scanf("%s",str[i]);
i++;
}
for(i=1;i<=n;i++)
{
for(j=1;j<=32;j++)
{
if(str[i][j]=='e'&&str[i][j+1]=='r'&&str[i][j+2]=='\0')
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.