language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstmap.c :+: :+: :+: ... |
C | /* ˽ָйص㣬Ϥĵַ */
#include <stdio.h>
#include <stdlib.h>
int main(){
int a=100, b, *p=&a; // һָpѱaĵַָp
printf("a=%d\tp_address=%x\t*p=%d\n", a, p, *p); // *pʾaĵַΪ100
printf("\n");
b=*p; // ൱b=a
printf("b=%d\n", b); // ʱb=a=100
printf("\n");
a=200; // a
printf("... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <stdint.h>
#define TABLE_SIZE 200000000000
bool is_even(unsigned long n)
{
return (n % 2 == 0);
}
unsigned long next_value(unsigned long n, unsigned long *table)
{
if (n < TABLE_SIZE && table[n]) {
return table[n];
}
... |
C | #include <stdio.h>
#include <stdlib.h>
#include "DataStructures.h"
void printStructure(names*, char*);
int main(void) {
names min, max;
char *minLabel = "min structure";
char *maxLabel = "max structure";
min.nameA = 50;
min.nameB = 20;
min.nameC = 33;
max.nameA = 100;
max.nameB = 55;
max.nameC = 77;
p... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* solve_b.c :+: :+: :+: ... |
C | #include "libTinyFS.h"
#include "libDisk.h"
#include "TinyFS_errno.h"
int num_blocks;
int disk_num = -1;
int open_files;
int total_files;
fileDescriptor next_fd = 0;
fileEntry **file_table;
openFile **open_file_table;
freeBlock* head;
void *checkedCalloc(int size) {
void *data = calloc(1, size);
if (data == NU... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "revbit.h"
int main(void) {
unsigned int i;
float x[] = {0,1,2,3,4,5,6,7}; /* Teszt adatsor felvétele. */
for(i=0;i<8;++i){
printf("x[%d]=%6.4f\n",i,x[i]); /* Teszt adatsor kiírása. */
}
printf("\nBit-reversal shorting...\n\n");
revbit_shor... |
C | #define uchar unsigned char // 8-bit byte
#define uint unsigned int // 32-bit word
// DBL_INT_ADD treats two unsigned ints a and b as one 64-bit integer and adds c to it
#define DBL_INT_ADD(a,b,c) if (a > 0xffffffff - (c)) ++b; a += c;
#define ROTLEFT(a,b) (((a) << (b)) | ((a) >> (32-(b))))
#define ROTRIGHT(a,b) (((... |
C | //
// main.c
// 记忆游戏
//
// Created by 黄梓伦 on 3/15/16.
// Copyright © 2016 黄梓伦. All rights reserved.
//
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <stdbool.h>
#include <ctype.h>
int main(int argc, const char * argv[]) {
int digits = 3; //初始化打印的随机数个数
int tries = 1;
int delay = 1;
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../src/tor_string.h"
char msg[] = "test tor_string.c";
void test(void) {
char *p;
int use = 0;
int size = 0;
sprintfcat(&p, &use, &size, "12345");
printf("%s:%d:%d:%ld\n", p, use, size, strlen("12345"));
sprintfcat(&p, &use... |
C | #include <math.h>
#include <stdio.h>
double f(double x)
{
double rez;
if(x<=2)
{
rez = x*x+3*x+5;
}
else if(x<8)
{
rez = 3*x;
}
else
{
rez = pow(2.718, x)+2;
}
return rez;
}
double g(double x, double y)
{
double rez;
rez = 3*x*x + (sin(x)/pow(y, 1/4.));
return rez;
}
void afis(int pas, doubl... |
C | //for string
size_t BKDRHash(const T *str)
{
register size_t hash = 0;
while (size_t ch = (size_t)*str++)
{
hash = hash * 131 + ch; // 也可以乘以31、131、1313、13131、131313..
// 可将乘法分解为位运算及加减法可以提高效率,如将上式表达为:hash = hash << 7 + hash << 1 + hash + ch;
}
retur... |
C | /* we bulid a multi link stack at here.
* the stack number is SIZE*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define SIZE 100
typedef int TYPE;
struct node{
TYPE data;
struct node* next;
};
struct node* top[SIZE];
void init()
{
memset(top,'\0',sizeof(top));
}
int push(TYPE value,int i)
{
struct nod... |
C | #include "../definitions/defs.h"
#include "polykeys.h"
typedef struct
{
U64 key;
unsigned short move;
unsigned short weight;
unsigned int learn;
} S_POLY_BOOK_ENTRY;
long NumEntries = 0;
S_POLY_BOOK_ENTRY *entries;
const int PolyKindOfPiece[13] = {
-1, 1, 3, 5, 7, 9, 11, 0, 2, 4, 6, 8, 10};... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* parser_validating.c :+: :+: :+: ... |
C |
#include "problem4.h"
#include <stdio.h>
#include <math.h>
Triangle getLarger(Triangle first, Triangle second)
{
Triangle t;
// Fill in this function
// You'll want to replace this with something that returns a meaningful
// result.
float area1, area2;
area1 = fabs(((first.a.x)*(first.b.y - first... |
C | /************************************
ACH2024 - Algoritmos e Estruturas de Dados II
Implementacao de Grafos utilizando Listas de Adjacencia
(vetor de ponteiros no qual cada posicao indexa um vertice e
contem o ponteiro para a cabeca de sua lista de adjacencia)
*************************************/
... |
C | #include<stdio.h>
#include<stdlib.h>
struct node
{
int info;
struct node *link;
};
struct node *addatbeg(struct node *start,int data)
{
struct node *tmp;
tmp=(struct node *)malloc(sizeof(struct node));
tmp->info=data;
tmp->link=start;
start=tmp;
return start;
}/*End of addatbeg()*/
struct node *ad... |
C | #include <cs50.h>
#include <stdio.h>
int main() {
int i, j, rows;
while(true){
rows = get_int("Height: ");
if(rows >= 0 && rows <=23){
for(i = 1; i <= rows; i++){
for(j = 1; j <= rows+1; j++){
if(j <= rows-i){
printf(... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putcolors.c :+: :+: :+: ... |
C | #include <stdio.h>
int factorial(int);
int main(void) {
int y = 0;
for (int i = 0; i <= 100; i++) {
y += i;
printf("\n%d ---Iterativa---> %d", i, y);
}
printf("\nEl factorial de 100 es %d", factorial(100));
return 0;
}
int factorial(int n) {
int r;
if (n == 1) {
... |
C | #include "async_serial_1.h"
#include <avr/io.h>
void async_serial_1_init(SerialSpeed speed){
switch(speed){
case SERIAL_SPEED_9600:
//Clear double speed bit and errors
UCSR1A = 0;
UBRR1 = 103;
break;
case SERIAL_SPEED_19200:
UCSR1A = 0;
UBRR1 = 51;
break;
case SERIAL_SPEED_384... |
C | //
// pointer.c
// Hello
//
// Created by Hui Zhou on 6/8/14.
// Copyright (c) 2014 Hui Zhou. All rights reserved.
//
#include <stdio.h>
#define ALLOCSIZE 10000 /* size of available space */
static char allocbuf[ALLOCSIZE]; /* storage for alloc */
static char *allocp = allocbuf; /* next free position */
... |
C | /*
Get the system time.
which can be accurate to seconds (for general events),
one decimal place (for triggering events),
or milliseconds (for sampling)
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/timeb.h>
#include <sys/types.h>
#include <time.h>
#include "../incl... |
C | #include <stdio.h>
int main(){
int n,x=1,i;
scanf("%d",&n);
while (x<=n){
for(i=1;i<x;i++){
printf("%02d ",x);
}
printf("%02d",x);
printf("\n");
x++;
}
printf("\n");
x=1;
while (x<=n){
for(i=1;i<x;i++){
printf("%02d ",i);
}
printf("%02d",i);
printf("\n");
... |
C | #include<stdio.h>
void main(){
int a;
char ch;
printf("Enter number:\n");
scanf("%d",&a);
printf("%d is ascii of %c\n",a,a);
}
|
C | /*
* ingresos.h
*
* Created on: 17 oct. 2021
* Author: MariaElena
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
int UTN_validarNumeroEnteroIngresado(char *pIngreso);
int UTN_validarNumeroFlotanteIngresado(char *pIngreso);
int UTN_validadCaracterIngresado(char ingreso);
... |
C | //Variant 5
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
#include "func.h"
int main(int argc, char *argv[])
{
const char *prog_name = argv[0];
if (argc != 2)
{
printf("usage: %s num\n", prog_name);
return EXIT_FAILURE;
}
FILE *file = fopen(argv[1], "r");
if (file == 0)
{
... |
C | /*
* PostDims.c
*
* Created: 16-Feb-17 15:00:24
* Author: Andreas
*/
#include <avr/io.h>
#define F_CPU 3868400
#include <util/delay.h>
#include <avr/cpufunc.h>
#include <avr/interrupt.h>
#include <stdio.h>
#include <string.h>
#include "memoryHandler.h"
#include "localMemoryHandler.h"
#include "smsHandler.h"
#include... |
C | #include <stdio.h>
int main(void) {
int data;
printf("Digite uma data no formato DDMMAAAA, onde DD corresponde ao dia, MM ao mês e AAAA ao ano: \n");
scanf("%d", &data);
printf("%d de %d de %d\n", (data / 1000000), ((data / 10000) % 10), (data % 10000));
return 0;
}
|
C | /*
* MaxIntegerInFile.c
*
* Created on: 05/09/2012
* Author: Jens
*/
#include <stdio.h>
static const char filename[] = "ECG.txt";
int MaxIntegerInFile() {
int max;
int i1;
int success;
FILE *file = fopen(filename, "r");
fscanf(file, "%i", &i1);
max = i1;
do {
success = ... |
C | #include<stdio.h>
#include<string.h>
int main()
{
int A[3][3];
printf("Please input array-A,sir/madam: \n");
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
scanf("%d", &A[i][j]);
}
}
printf("the array is:\n");
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_map_parser.c :+: :+: :+: ... |
C | #include <stdio.h>
void trace(int A[], int N);
void bubbleSort(int A[], int N);
int main(){
int A[100],N;
scanf("%d",&N);
for(int i=0; i<N; i++){
scanf("%d", &A[i]);
}
trace(A,N);
bubbleSort(A,N);
trace(A,N);
}
void trace(int A[],int N){
for(int i=0; i<N; i++){
print... |
C | #include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <ctype.h>
#include <string.h>
#include <assert.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include "parse.h"
static void wrtype(FILE *fd, Type *val);
static void rdtype(FILE *fd, Type **dest);
static void w... |
C | /**
* @file fun.h
* @author 311305
* @ Cryptography Encryption Algorithms
*/
#ifndef __FUN_H
#define __FUN_H
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
/*function prototypes for all functions*/
/**
* Perform ceaser encryption algorithm
* @param[in] value1
* @param[in] value2
* @pa... |
C | #include <stdio.h>
#include <math.h>
#include <complex.h>
#define E 2.71828
int main()
{
char inflexao = 0;
double complex z;
double y;
puts("Os valores (pontos) da funcao sao:");
for (int x = -10; x <= 10; x++)
{
z = cpow(x, E);
y = cabs(z);
if (creal(z) < 0)
... |
C | #include "Tmisc.h"
// --------------------------------------- MATRIX OPERATIONS FUNCTIONS ---------------------------------------------- //
/* Function for matrix multiplications: matrixA with mxn dimension, matrixB with pxq dimension */
void multiply_matrix( int m, int n, int p, int q, float mA[m][n], float mB[p... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <assert.h>
#include <limits.h>
typedef struct Node {
int val;
struct Node* left;
struct Node* right;
} node;
node* newNode(int val);
void insert*(node** root, int val);
void countNode(node* root);
void inorderPrint(node* root);
void preorderPr... |
C | #include <string.h>
#include <stdlib.h>
#include "interpreter.h"
#include "common.h"
#include "opcodes.h"
#include "typesys.h"
struct ts_TYPE_REGISTRY {
char* name;
struct ts_TYPE* type;
struct ts_TYPE_REGISTRY* next;
};
static struct ts_TYPE_REGISTRY* global_registry = NULL;
static uint32_t type_id = 3;
v... |
C | #include "shell.h"
int k_number_of_bg=0;
int pid_foreground_process = -1;
char foreground_process_name[30];
void handler(int signum)
{
pid_t pid1;
int status1;
// pid = wait(NULL); //process id of the exited child process
pid1 = waitpid(-1, &status1, WNOHANG);
if(pid1>0)
{
for(int j=0; j<k... |
C | #include<stdio.h>
#include<stdlib.h>
#define MAX 20
void push(int stack[],int item);
void pop(int stack[]);
void display(int stack[]);
int stack[MAX];
int TOP;
int main()
{
int k,item,x;
do
{
printf("1.PUSH 2.POP 3.DISPLAY\n");
scanf("%d",&k);
switch(k)
{
case 1: printf("\nEnter the item to be added:... |
C | #include<stdio.h>
int main()
{
int *arr[5];
int a=10,b=20,c=30,d=40,e=50;
int i;
arr[0]=&a;
arr[1]=&b;
arr[2]=&c;
arr[3]=&d;
arr[4]=&e;
for (i=0;i<5;i++)
{
printf("ADDRES OF [%d]=%d\tVALUE OF *[%d]=%d=\n=",i,arr[i],i,*arr[i]);
}
return 0;
}
|
C | #include<stdio.h>
#include<math.h>
int f(int n)
{
if(n==1)
return 1;
for(int i=2;i<=sqrt(n);i++)
{
if(n % i==0)
return 0;
}
return 1;
}
|
C | /*
* AUTHOR
* Copyright (C) 2012, Joan Maspons, joanmaspons@gmail.com
* based on negative binomial distribution code from The R Core Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Founda... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* operator.c :+: :+: :+: ... |
C | #include "monty.h"
/**
* op_pall - prints out the stack
* @stack: the stack
* @line_number: the line
*/
void op_pall(stack_t **stack, unsigned int line_number)
{
stack_t *temp;
(void)line_number;
if (!*stack)
return;
temp = *stack;
while (temp != NULL)
{
printf("%d\n", temp->n);
temp = temp->next;
}
}
|
C | // 程序填空,不要改变与输入输出有关的语句。
// 输入2个整数,分别将其逆向输出。
// 要求定义并调用函数 fun(n),它的功能是返回 n 的逆向值,函数形参 n 的类型是int,函数类型是int。例如,fun(123)的返回值是321。
// 输入输出示例:括号内是说明
// 输入:
// 123
// -910
// 输出:
// 123的逆向是321
// -910的逆向是-19
#include <stdio.h>
int fun(int n);
int main(void)
{
int m1,m2;
scanf("%d%d", &m1, &m2);
printf("%d的逆向是%d\n... |
C | #include "push_swap.h"
static void exit_all(t_list **stack_a, t_list **stack_b, bool err)
{
if (stack_a)
ft_lstclear(stack_a, free);
if (stack_b)
ft_lstclear(stack_b, free);
if (err)
ft_putstr("Error\n");
exit (0);
}
int main(int argc, char **argv)
{
t_list *stack_a;
t_list *stack_b;
stack_a = NULL;
st... |
C | List Reverse(List L)
{
if(L->Next == NULL || L->Next->Next == NULL)
return L;
List p = L->Next; //Already reserved
List q = p->Next; //Not resserved yet
p->Next = NULL;
while (q)
{
List t = q->Next;
q->Next = p;
p = q;
q = t;
}
L->N... |
C | #include<stdio.h>
#include<stdlib.h>
//int main()
//{
// int ch;
// printf("һַ:\n");
// while ((ch = getchar()) != EOF)
// {
// if (ch >= 'a'&&ch <= 'z')
// {
// ch = ch - 32;
// printf("%c\n", ch);
// }
// else if (ch >= 'A'&&ch <= 'Z')
// {
// printf("%c\n", ch + 32);
// ch = ch + 32;
// }
// else
// ... |
C | #include<stdio.h>
int main() {
int F[20] = { 1,1 };
for (int i = 2; i <= 19; i++) {
F[i] = F[i - 1] + F[i - 2];
}
for (int i = 0; i <= 19; i++) {
if (i % 5 == 0)
printf("\n");
printf("%12d",F[i]);
}
return 0;
}
|
C | #include "infi.h"
#include <stdlib.h>
#include <assert.h>
#define MID(a, b) ((a + b) / 2.0)
#define DELTA(a, b, n) ((b - a) / n)
/**
* This function will return the middle values of the x between [a,b].
* @param a left x bound
* @param n number of sums
* @param dx the change in range [a,b]
* @return pointer to t... |
C | /* lamap - fast two-way and three-way admixture likelihood functions
Copyright (C) 2013 Giulio Genovese
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#define x 4
#define y 2
#define z 5
pthread_t tid[x*z];
pthread_attr_t attr;
int iret[x*z];
key_t key = 1234;
int *matrix;
void *hitung(void *arguments);
int main(void){
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* check_first_rdir_a.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
int buscaBinaria(int A[], int inicio, int fim, int valor);
int main() {
int V[]={1,2,3,4,5,6,7,8};
int result;
result = BB(&V[7],1,7,2);
printf("%d\n", result);
return 0;
}
int buscaBinaria(int A[], int inicio, int fim, int valor){
int meio;
while(inicio <= fim){... |
C | /*
* MinPerimeterRectangle
* Find the minimal perimeter of any rectangle whose area equals N.
*/
int solution(int N)
{
int biggest_factor = 1;
int i = 1, j;
while (i*i <= N) {
if (N % i = 0) biggest_factor = i;
i++;
}
j = N/biggest_factor;
return 2*(j + biggest_factor)... |
C | /*
* File: paging.h
* Description: Describes the 4-level page mapping
* *****************************************************************************
* Copyright 2020 Scott Maday
* Check the LICENSE file that came with this program for licensing terms
*/
#pragma once
#include "memory.h"
typedef uint64_t pa... |
C | #include "SizeBuffer.h"
#include "StringBuilder.h"
#pragma pack(push)
#pragma pack(1)
PLAIN_OLD_DATA(_SizeBufferMetadata)
{
_SizeBuffer buffer[0];
uint64_t capacity;
uint64_t size;
char data[0];
};
#pragma pack(pop)
NAMESPACE_METHOD_IMPLEMENT(SizeBuffer, EvaluatePhysicalSize, uint64_t, uint64_t capaci... |
C |
#include "unit_test.h"
// Used by __puthex*
char * lut = "0123456789ABCDEF";
// Base address of the memory mapped IO region
volatile uint32_t * __mmio_base = (uint32_t*)0x00001000;
//! Direct access to mtime
volatile uint64_t * __mtime = (uint64_t*)0x00001000;
//! Direct access to mtimecmp
volatile uint64_t * ... |
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct humanBeing {
char name[10];
int age;
float salary;
} humanBeing;
void main() {
humanBeing p1, p2;
printf("input person1's name, age, and salary: \n");
scanf("%s %d %f", p1.name, &p1.... |
C | #include <stdio.h>
#include <windows.h>
void main()
{int i,o;
int a[2][3]=
{
{999,9999,9999},
{999,999,999}
};
for(i=0;i<2;i++)
{
for(o=0;o<3;o++)
{
printf("%d ",a[i][o]);
}
printf("\n");
}
Sleep(1000);
for(i=0;i<2;i++)
{
for(o=0;o<3;o++)
{
a[i][o]=0;
printf("%d ",a[i][o]);
}
printf("\n");
}
... |
C | ///////////////////////////////////////////////////////////////
//
// dumpscreen.h
//
// - dump screen utility to grad screen from OpenGL
//
// by Philip Fu (cwfu@acm.org)
//
// 3/4/2003 2:22P
//
// All rights reserved
//
///////////////////////////////////////////////////////////////
#ifndef _DUMPSCREEN_H
#d... |
C | /**************************************************************/
/* Thomas Fox, CS 4352, Client program Due: 4/8/93 */
/* */
/* The client sends a message to the server and then waits */
/* for a reply. The server MSGKEY is fixed in this stage. ... |
C | #include "binary_trees.h"
/**
* print_num - Prints a number
*
* @n: Number to be printed
*/
void print_num(int n)
{
printf("%d\n", n);
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <stdbool.h>
// Bericht ber den Energieverbrauch
// DEBUG
// Energy Consumption(mJ)
// 140,469.360
//
// RELEASE
// Energy Consumption (mJ)
// 59,315.186
#define MIN 10
#define MAX 200
float random_float(const float min, const float max)
{
if (max... |
C | /* Time parser for skim.me
* By Xiang Zhang @ New York University
* Version 0.1, 03/28/2012
*
* Usage: ./dtime [method]
* [method]: 0: GMT
* 1: Local time
* The program accepts input from stdin, and write to stdout
* each row output is: hindex,stamp,sec,min,hour,mday,mon,year,w... |
C | #include"Library.h"
void text_add(FILE* f, fpos_t* end) {
printf("Enter your numbers please:\n");
char bufer;
fsetpos(f, &end);
while (1) {
scanf("%c", &bufer);
if (bufer == '\n') {
fprintf(f, "%c", ' ');
fgetpos(f, &end);
break;
}
fprintf(f, "%c", bufer);
}
fgetpos(f, &end);
... |
C | #ifndef FUNCIONES_H_INCLUDED
#define FUNCIONES_H_INCLUDED
typedef struct{
char titulo[200];
char genero[200];
int duracion;
char descripcion[300];
int puntaje;
char linkDeImagen[300];
int estado;
}ePelicula;
/** \brief Limpia pantalla.
*/
void fLimpiar();
/** \brief Pide e... |
C | #include"Main.h"
void Search_infor1()
{
STU a[10],b,c[10];
int i = 0,n,m=0;//mжǷڸѧ
printf("-------------------\n");
printf("ѧѧ:");
scanf("%s",b.num);
FILE* fp;
fp = fopen("StuInform.txt", "r");
while (1)
{
if (!feof(fp))
{
fread(&a[i], sizeof(STU), 1, fp);
i++;
}
else break... |
C | #include <stdio.h>
int main( void)
{
float a , b , c , max;
printf( "enter 3 sides to know if they can represent a triangle: " );
scanf( "%f%f%f" , &a , &b , &c );
max = a;
if ( b > a ){
max = b;
}
if ( c > max ){
max = c;
}
if ( a + b + c > 2 * max ){
prin... |
C | #include <stdio.h>
#include <unistd.h>
#include <sys/time.h>
int main() {
struct timeval Arxi;
struct timeval Telos;
gettimeofday(&Arxi, NULL);
gettimeofday(&Telos, NULL);
long int Resta = Telos.tv_usec - Arxi.tv_usec;
printf("%ld\n", resta);
return 0;
}
|
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <CUnit/Basic.h>
#include "binary_heap.h"
// Useful method to construct and return a node with a given key and name
HeapNode HeapNodeConstructor(int key, char* name)
{
HeapNode hNode;
hNode.key = key;
hNode.item = malloc ((strlen(name) +... |
C | #pragma once
bool AND(bool x, bool y) // &
{
return x & y;
}
bool NAND(bool x, bool y) // sheffer, |
{
return !(x & y);
}
bool OR(bool x, bool y) // V
{
return x | y;
}
bool XOR(bool x, bool y) // +
{
return x ^ y;
}
bool NOT(bool x) // ¬, alt + 170
{
return !x;
}
bool NOR(bool x, bool y) // ... |
C | #include "mp4.h"
int read_hmhd_box(mp4_bits_t *bs, hmhd_box_t *hmhdbox)
{
hmhdbox->struct_size = hmhdbox->boxheader->struct_size;
hmhdbox->maxPDUsize = mp4_bs_read_u16(bs);
hmhdbox->avgPDUsize = mp4_bs_read_u16(bs);
hmhdbox->maxbitrate = mp4_bs_read_u32(bs);
hmhdbox->avgbitrate = mp4_bs_read_u32(bs);
hmhdbox->r... |
C | #define tipo char
#include "pila.h"
#include <string.h>
typedef long unsigned int size_t;
int main() {
Pila p;
create(&p);
char pala[50];
fgets(pala, 50, stdin);
size_t tam = strlen(pala);
char c;
for(size_t i = 0; i < tam - 1; i++) {
c = pala[i];
//printf("%c %d\n", c, c);
if(c == 40 || c == 91 || c == ... |
C | #include <stdio.h>
int fun(char *restrict x, char *y)
{
char *a = x, *b = y;
*x = 6;
*a = 7;
*y = 8;
*b = 9;
return 0;
}
int main(int argc, char **argv)
{
char a, b;
fun(&a, &b);
fprintf(stdout, "a = %d, a = %d\n", a, b);
return 0;
}
|
C | /* Copyright Statement:
*
*/
#ifndef MP3_WAV_H
#define MP3_WAV_H
#include <stdio.h> /*for FILE pointer*/
/*********************
STRUCTURE
*********************/
struct
{
unsigned char riffheader[4];
unsigned char WAVElen[4];
struct
{
unsigned char fmtheader[8];
unsigned char fmtlen... |
C | #define _POSIX_C_SOURCE 200112L
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
// esempio di tokenizzazione di stringhe con strtok_r
void tokenizer_r(char *stringa) {
char *tmpstr;
char *token = strtok_r(stringa, " ", &tmpstr);
while (token) {
printf("%s\n", token);
token = strtok_... |
C | typedef struct simple_stack {
struct stack_element* top;
} simple_stack;
void stack_init(simple_stack* stack);
void stack_free(simple_stack* stack);
void stack_push(simple_stack* stack, int value);
int stack_pop(simple_stack* stack);
int stack_height(simple_stack* stack);
|
C | //#include <stdio.h>
int twice(int x) {
//fprintf(stderr, "twice(%d)\n", x);
return x * 2;
}
int sum(int x, int y) {
//fprintf(stderr, "sum(%d, %d)\n", x, y);
return x + y;
}
|
C | #include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "redblack-tree.h"
typedef struct
{
long long val;
int num;
int size;
} data_t;
void pushup(redblack_tree_t* tree, redblack_tree_node_t* node)
{
assert(node == tree->nil || ((data_t*)(node->data))->num != 0);
(... |
C | #define F_CPU 2000000UL
#include <avr/io.h>
#include <util/delay.h>
#include <stdlib.h>
void init(void)
{
// allow power to stabilize
_delay_ms(250);
// port settings
PORTE.DIR = 0xFF;
PORTE.OUT = 0xA5;
return;
}
int main(void)
{
unsigned char c;
init();
// write your code here
while(1)
{
PORTE.O... |
C | /*
* Statemachine2 is table driven.
*/
#include "i2c.h"
#include "mma8541.h"
#include "touchSen.h"
#include <stdio.h>
#include "statemachine1.h"
#include "led.h"
static int Current_state=0;
static int Current_event=0;
typedef enum states2{
sReadXYZ2,
sDisplay2,
sPollSlider2,
sDisconnect2,
nextS... |
C | #include <stdio.h>
struct stu
{
int num;
char * name;
char sex;
float score;
};
void main()
{
struct stu boy2;
struct stu boy1 = {102, "Zhang Ping", 'M', 78.5};
boy2 = boy1;
printf("Number=%d\nName=%s\n", boy2.num, boy2.name);
printf("Sex=%c\nScore=%.1f\n", boy2.sex, boy2.score);
}
|
C | #include "CD4067.h"
//ʼ
void CD4067Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOE, ENABLE);
//DCBA
GPIO_InitStructure.GPIO_Pin = (GPIO_Pin_3|GPIO_Pin_2|GPIO_Pin_1|GPIO_Pin_0);
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructur... |
C | #include <unistd.h> //Needed for I2C port
#include <fcntl.h> //Needed for I2C port
#include <sys/ioctl.h> //Needed for I2C port
#include <linux/i2c-dev.h> //Needed for I2C port
#include "smbus.h"
#include "smbus.c"
#include <stdio.h>
#include <stdlib.h>
void main(){
int file;
int adapter_nr = 0; /* probably... |
C |
int main()
{
int m,n;
int MT[21][21];
int Tx[401],Ty[401],x,y;
int i,j,k=0;
cin>>m>>n;
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)cin>>MT[i][j];
}
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
if(i+1<m && i-1>=0 && j+1<n && j-1>=0)
{
if(MT[i][j]>=MT[i+1][j] && MT[i][j]>=MT[i-1][j] && MT... |
C |
void rhap(p,n)
int n;
double p[];
{ int i,mm;
double t;
void rsift();
mm=n/2;
for (i=mm-1; i>=0; i--)
rsift(p,i,n-1);
for (i=n-1; i>=1; i--)
{ t=p[0]; p[0]=p[i]; p[i]=t;
rsift(p,0,i-1);
}
return;
}
static void rsift(p,i,n)
int i,n;
double p[];
{ int ... |
C | /*26. If a char is one byte wide, an integer is 2 bytes wide and a long integer is 4 byte wide, then
will the following structure always occupy 7 bytes?*/
struct ex
{
char ch ;
int i ;
long int a ;
}e ;
void main()
{
printf("size of strucure %d",sizeof(e));
}
|
C | #include <stdio.h>
int main(int argc, char *argv[])
{
int v[10], maior_elemento, posicao;
for (int i = 0; i < 10; ++i) {
printf("Digite o %d valor: ", i + 1);
scanf("%d", &v[i]);
}
maior_elemento = v[9];
posicao = 9;
for (int i = 9; i >= 0; --i) {
printf("%d, ", v[i]);
if (maior_elemen... |
C | #include <pthread.h>
#include <stdio.h>
int value = 0;
void *runner(void *param); /* the thread */
int main(int argc, char *argv[])
{
pid t pid;
pthread t tid;
pthread attr t attr;
pid = fork();
if (pid == 0) { /* child process */
pthread attr init(&attr);
pthread create(&tid,&attr,runner,NULL);
pthread join(tid,NULL);... |
C | //Own module files
#include "subFunction.h"
#include "CException.h"
#include "OperatorChecker.h"
#include "Token.h"
#include "unity.h"
// Library
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <malloc.h>
#define startChar (strO->str[*startColumn])
//#include <assert.h>
//assert( funcName != NULL)... |
C | #pragma once
#include <cassert>
#include <stdio.h>
#include "Platform.h"
//Include known-size integer files, based on compiler. Some compilers do not have these
//files, so they must be created manually.
#if defined(__GNUC__) || defined(__clang__) || (defined(_MSC_VER) && _MSC_VER >= 1600)
#include <stdint.h>
#elif d... |
C | #include "type.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
symbolTable *initTable(char *token, int line, char *type, node *astPointer){
symbolTable *newnode = (symbolTable *)malloc(sizeof(symbolTable));
newnode->token = (char *)malloc(sizeof(char)*(strlen(token)+1));
strcpy(newnode->token... |
C | #include"stdio.h"
#include"conio.h"
#include"stdlib.h"
#define maxsize 100
typedef char datatype;
typedef struct node
{ datatype data;
int ltag,rtag;
struct node *lchild,*rchild;
}bitree;
bitree *CREATREE(void)
{
datatype ch;
int front,rear;
bitree *root,*s;
bitree *Q[maxsize];
root=NULL;
front=1;rear=0;
ch... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* links.c :+: :+: :+: ... |
C | #include "difference_of_squares.h"
unsigned int sum_of_squares(const unsigned int number)
{
return number * (number + 1) * (2 * number + 1) / 6;
}
unsigned int square_of_sum(const unsigned int number)
{
const unsigned int sumOfNumbersUpToInput = number * (number + 1) / 2;
return sumOfNumbersUpToInput * sumOfNu... |
C | #include <stdio.h>
int getPairsCount(int arr[], int n, int sum)
{
int i,j,count=0;
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if((arr[i]+arr[j])==sum)
{count++;}
}
}
return count;
}
int main()
{
int i,T, n, k, a[100];
scanf("%d",&T);
while(T--)
{
scanf("%d",&n);
scanf("%... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.