language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include<stdio.h>
#include<string.h>
#include<stdbool.h>
int main()
{
char word[100];
scanf("%s", &word);
bool con = true;
for(int i = 1; i < strlen(word); i++)
{
if(word[i] >= 'a' && word[i] <= 'z')
{
con = false;
break;
}
}
if(con)
{
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf_utils.c :+: :+: :+: ... |
C | #include<stm32f4xx.h>
#include<stm32f4xx_gpio.h>
#include<stm32f4xx_rcc.h>
#include<stm32f4xx_usart.h>
#include<misc.h>
void InitializeGPIO()
{
GPIO_InitTypeDef PortD;
RCC_AHB1PeriphClockCmd (RCC_AHB1Periph_GPIOD , ENABLE);
PortD.GPIO_Pin = GPIO_Pin_13;
PortD.GPIO_Mode = GPIO_Mode_OUT;
PortD.GPIO_Speed =... |
C | #include "disassembler/disassembler.h"
#include <assert.h>
#include <base/print_format.h>
#include <stdbool.h>
#include <stdio.h>
#define MNEMONIC "%-8s"
const char *indirect_memory_encoding_to_string(enum indirect_memory_encoding encoding) {
static const char *mapping[8] = {
"bx+si", "bx+di", "bp+si", "bp+d... |
C |
#include<stdio.h>
struct process
{
int pid;
int status;
int priority;
int at;
int bt;
int ct;
int wt;
int tt;
};
void main()
{
int i, time = 0, burst_time = 0, current,n;
char c;
float w_time = 0;
float t_time = 0;
float avg_w_time;
floa... |
C | #include <stdio.h>
#define file_in "../numeri.txt"
#define file_out "../output.txt"
int main() {
FILE *fp_in, *fp_out;
int x1, x2, x3, max, min, n_scartati = 0, check;
if ((fp_in = fopen(file_in, "r")) == NULL) {
printf("Errore nell'aperture file input.\n");
return 1;
}
if ((fp_out... |
C | /*
============================================================================
Roll no.:23103
Name:Abhishek Agashe
Class:SE-9
Batch:E-9
Problem Statement:Perform following String operations without pointers to arrays
(without using the library functions):
a) substring
b) palindrome
c) compare
d) copy
e) Reverse.
==... |
C | #define _CRT_SECURE_NO_WARNINGS 1
void bubble_sort() {
? int a[] = {1, 34, 23, 55, 22, 11};
int i,j,k;
for(i=0;i<5;i++)
{
for(j=0;j<5-i;j++)
if(a[j]>a[j+1])
{
k=a[j];
a[j]=a[j+1];
a[j+1]=k;
printf("%d\n", a[j]);
// a[j] ^= ... |
C | #pragma once
#include<stdio.h>
#include <device_functions.h>
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include<iostream>
#include<math.h>
#include"Matrix.h"
__device__ double norm( double* mat, int col,int matrow, int matcol) {
double ans = 0;
for (int i = 0; i < matrow; i++) {
a... |
C | #include "ext2.h"
#include "utility.h"
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#define BYTE 8
#define KB 1024
#define SB_OFFSET 1024
#define EXT2_S_IFDIR 0x4000
// Global filesystem structure
static EXT2 *ext2fs = ... |
C | #include<stdio.h>
int main(){
int a=1,b=2,c=3,d=4,e=5,f=6,g=7,h=8,i=9,j=10;
printf("%d",a);
printf("%d",b);
printf("%d",c);
printf("%d",d);
printf("%d",e);
printf("%d",f);
printf("%d",g);
printf("%d",h);
printf("%d",i);
printf("%d",j);
return 0;
}
|
C | #include<stdio.h>
#include<string.h>
#pragma warning(disable:4996)
struct student{
char name[20];
int korean, english, math;
double average;
}; //ݷ!!! ü ٸ Ÿ
int main()
{
struct student s1; //ü
struct student s2 = { "ڳ", 90, 78, 86 }; //ü
s1.korean = 100; //ü ʱȭ~
s1.english = 100;
s1.... |
C | /*
* This file is part of HuDK.
* ASM and C open source software development kit for the NEC PC Engine.
* Licensed under the MIT License
* (c) 2016-2021 MooZ
*/
#include "tilemap.h"
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "../utils/log.h"
void tilemap_destroy(tilem... |
C | /*
* week5.2.c
*
* Created: 22-3-2016 11:25:00
* Author : sander
*/
#include <avr/io.h>
#include "uart0.h"
#include "lcd.h"
char character;
void wait( int ms )
{
for (int tms=0; tms<ms; tms++)
{
_delay_ms( 1 ); // library function (max 30 ms at 8MHz)
}
}
// s... |
C | //
// sysmem.c
//
//
// Created by Neil Singh on 6/25/17.
//
//
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/fcntl.h>
#include <sys/errno.h>
#include <sys/mman.h>
extern unsigned int sys_errno();
extern unsigned int sys_brk(void* addr);
extern void* sys_sbrk(int offset);
extern void* sys_mmap(vo... |
C | /* Atividade 28 - Binrio */
#include <stdio.h>
#include <locale.h>
void inverter(unsigned int n) {
if(n < 10) printf("%u", n);
else {
printf("%u", n % 10);
inverter(n / 10);
}
}
int main() {
setlocale(LC_ALL, "Portuguese");
unsigned int n;
printf("\n Digite n: ");
scanf("%u", &n);
printf("\n Dgitos... |
C | /*
* sensereversal.c
*
* Created on: Feb 17, 2015
* Author: harshit
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "sensereversal.h"
void SenseReversalOpenMP_BarrierInit(long num_threads, SenseReversalOpenMP_Barrier* barrier){
int i;
barrier->count = num_threads;
barrier->mysense... |
C | // all the lines that start with a hash are treated by the preprocessor (cpp)
// to include header files such as this ones, macros extension or conditional rendering
#include <unistd.h>
#include <stdio.h>
#include <string.h>
int main(void)
{
char c[19];
sprintf(c, "Hello World!\n");
write(1, c, strlen(c));
retu... |
C | #ifndef PUBLIC_FUNCTION_H
#define PUBLIC_FUNCTION_H
#include <QString>
#include <QDebug>
inline void RecoverData(unsigned char* psrc, unsigned char* pdst, int len)
{
unsigned char i;
for(i = 0; i < len; i ++)
{
pdst[len - i - 1] = psrc[i];
}
}
inline void RecoverSelfData(unsigned char* pdat, ... |
C | #include <stdio.h>
/**
* A função piso_log_2 recebe um inteiro N > 0 e devolve piso(log_2 N), ou seja, devolve
* o único inteiro i tal que 2^i <= N < 2^(i+1).
*/
int piso_log_2(int N) {
int i, n;
i = 0;
n = N;
while (n > 1) {
// n == N / 2^i
n = n / 2;
i++;
}
return i... |
C | #include <stdio.h>
#include <stdlib.h>
void
min_swaps (int arr[], int n)
{
int min = 0;
int max = 0;
int l = 0;
int r = 0;
int i = 0;
min = arr[0];
max = arr[0];
for (i = 1; i < n; i++) {
if (arr[i] <= min) {
min = arr[i];
r = i;
... |
C | /*
* bmp.c
*/
#include "FImage.h"
#include <stdio.h>
long FImageLoad_BMP(self,filename)
image self;
char *filename;
{
char buf[1024];
if (filename == 0 || strlen(filename) == 0 ||
strequal("-",filename) || strequal("stdin",filename))
sprintf(buf,"bmptopnm");
else
sprintf(buf,"bmpt... |
C | #include <stdio.h>
#include <stdlib.h>
int power(int base, int exp){
int res = base;
while (exp > 1){
res *= base;
exp--;
}
return res;
}
int main(){
int N, D, i, j, res, min, max;
scanf("%d %d", &N, &D);
int T[N][2];
for (i = 0; i < N; i++)
for (j = 0; j < 2; j++)
scanf("%d", &T[i][... |
C | /*
============================================================================
Name : ps_hs_b_omp.c
Author : Adrian Kempf
Version :
Copyright :
Description : Prefix-sums with blocked Hillis-Steele algorithm.
Did not expect all processors to be free --> block number
could be below 40.
===... |
C |
#define arm2index(x) x-(regexEngine_max_bit_length-regexEngine_bit_start)
#define shift_to_bit32(x) ((31-x)*sizeof(char))
#define shift_by_bits32(x) (x*sizeof(char))
int32_t string_to_bin(int len, char * s) {
int32_t x = 0;
for(int i = 0; i < len; i++) x = (x << 1) | (s[i] == '1' ? 1 : 0);
return x;
}
uint64_t ... |
C | //
// main.c
// rc4
//
// Created by Grace Akpan on 9/8/16.
// Copyright © 2016 Grace Akpan. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SIZE 256
typedef unsigned char uns8;
typedef unsigned short uns16;
static uns8 state[SIZE];
int i;
uns8 j;
// function declara... |
C | #define FUSE_USE_VERSION 31
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <fuse.h>
#include <errno.h>
#include <string.h>
#include <pthread.h>
#include <sys/types.h>
#include <linux/limits.h>
static char wd[PATH_MAX];
static int sleepy_open(const char *path, struct fuse_file_info *fi)
{
return ... |
C | // 用一组连续地址的存储单元实现队列
// 会出现插入一个新元素,造成数组越界,而破坏程序
// 且删除的元素,内存有没有使用,基于此
// 将队头和队尾连在一起,形成循环队列
// 循环队列使用一位数组实现
// 必须为它设置一个最大队列长度
// 其中如何判断队列是否为满和空的状态
// 1. 增加一个标志位
// 2. 约定一个在队头的上一个的存储单元,即队尾的下一个存储单元不使用
#include <stdlib.h>
#include <string.h>
#define QUEUE_MAX_SIZE 100
typedef struct Element
{
int data;
}Element;
type... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <pthread.h>
#include <poll.h>
#include <sys/ioctl.h>
#include "Gpio_func.h"
int main ()
{
int device_one;
int arg[2];
long long retval;
// Set multiplexer pins
mux_gpio_set(77, 0);
mux_gpio_set(34, 0... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "teste.h"
#define TAMANHO 5
int main(){
Filme f, *a=&f;
char valor[20];
a->opcao = 0;
a->inicio = 0;
a->fim = 0;
a->vazia = 1;
while(a->opcao != 4){
menu(a);
getchar();
switch(a->opcao){
case ... |
C | #include <stdio_ext.h>//LINUX
//#include <stdio.h>//WINDOWS
#include <stdlib.h>
#include <string.h>
#include "arrayEmployees.h"
#include "utn.h"
int main()
{
Employee employee[CANT_EMPLEADOS];
int indiceBuscado;
int salirPrograma=FALSE;
int opcion;
int opcionCase2;
int opcionCase4;
i... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf_conv_03.c :+: :+: :+: ... |
C | #include "threading.h"
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
// Optional: use these functions to add debug or error prints to your application
#define DEBUG_LOG(msg,...)
//#define DEBUG_LOG(msg,...) printf("threading: " msg "\n" , ##__VA_ARGS__)
#define ERROR_LOG(msg,...) printf(... |
C | #include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int makethread(void *(*fn)(void *), void *arg)
{
int err;
pthread_t tid;
pthread_attr_t attr;
err = pthread_attr_init(&attr);
if (err != 0)
{
return err;
}
err = pthread_attr_setd... |
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 | #include <clink/clink.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char **argv) {
if (argc > 2 || (argc == 2 && strcmp(argv[1], "--help") == 0)) {
fprintf(stderr,
"usage: %s [compiler (default $CXX)]\n"
" list #include paths used by a C++ compiler\n",
... |
C | //#include<stdio.h>
//
////void swap1(int a, int b)
////{
//// int tmp = a;
//// a = b;
//// b = tmp;
////}
////
////void swap2(int* pa, int* pb)
////{
//// int tmp = *pa;
//// *pa = *pb;
//// *pb = tmp;
////}
//
//int main()
//{
// //int i = 10;
// //char c = 'y';
//
// //int* pi = &i;
// //char* pc = &c;
//
// //prin... |
C | //Sohaib Wasif
//0874921
//07/02/2020
//CIS*3490
//A2-1.1
//Brute force for inversion
int bruteInv(int x [], int s)
{
int cnt = 0;
for(int i = 0; i<s-1; i++){
for(int j = i+1; j < s; j++){
if(x[i] > x[j]){
cnt++;
}
}
}
return cnt;
} |
C | #include <stdio.h>
int help()
{
system("cls");
printf("\n-------Welcome to QUIZ GAME-------");
printf("\n-------How To Play-------");
printf("\n___________________________");
printf("\n >> You will be given 4 options and you have to press A, B ... |
C | #include <conio.h>
void out_char(unsigned int data){
unsigned char output;
output = data &255;
printf("%c",output );
}
void out_data(unsigned int data){
printf("%u", data);
}
unsigned int input(){
unsigned int input_data;
if (_kbhit()){
input_data = (unsigned int)_getch();
}
else{
input_data = 0;
}
re... |
C | int fact(int n);
int main()
{
int n=4;
int i = fact(n);
print_t(n);
print_t(i);
return 0;
}
int fact(int n)
{
if(n==1) return 1;
else
{
return n*fact(n-1);
}
}
|
C | #include <stdio.h>
#define R_RT 0
#define R_WG 1
long double power(int x, int y)
{
long double p = 1;
if (y > 0)
for (int i = 0; i < y; i++)
p = p * x;
if (y < 0)
for (int i = 0; i > y; i--)
p = p / x;
return p;
}
int main(void)
{
int a, n, num;
long ... |
C | #include "monty.h"
/**
* _mod - will perfom the second element module the top one
*
* @stack: double pointer to the start of the stack
* @line: current line number
*
* Return: void
*/
void _mod(stack_t **stack, unsigned int line)
{
int elems = 0;
stack_t *curr;
if (*stack == NULL)
m_error_handler(13, line... |
C | #include<stdio.h>
#include<stdlib.h>
/*
* ṹ嶨ʹ
*/
struct student {
char name[21];
int age;
int score;
char addr[51];
};
//ͬʱ
//struct student {
// char name[21];
// int age;
// int score;
// char addr[51];
//}stu = { "",18,100,"вƽ·22" };
int main_stu01() {
//ṹ
//ṹ ṹ
//struct ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* start_bfs_head.c :+: :+: :+: ... |
C | #include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define FLAGS O_WRONLY|O_CREAT|O_TRUNC
#define MODE S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH
int main(void){
const char* pathname;
int fd;
char pn[30];
printf("Input the pathname:[<30 strings]"... |
C |
#include "Sort.h"
void sort(int *v, int size) {
int i, j;
for (i = 0; i < size; i++) {
for (j = i+1; j < size; j++) {
if (v[i] > v[j]) {
int aux = v[i];
v[i] = v[j];
v[j] = aux;
}
}
}
}
|
C | //
// main.c
// Project 2
//
// Created by Daniel Choi on 10/2/19.
// Copyright © 2019 Daniel Choi. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "RecursiveDescent.h"
#include "TableDriven.h"
#include "ExpressionTree.h"
int main(int argc, const char * argv[]) {
c... |
C | /*
Time: O(n)
Space: O(n)
* Note: The returned array must be malloced, assume caller calls free().
*/
int* productExceptSelf(int* nums, int numsSize, int* returnSize) {
*returnSize = numsSize;
int *result = (int *)malloc(sizeof(int)*numsSize);
memset(result, 1, numsSize*sizeof(result[0])); /... |
C |
#ifndef INCL_HELPER_FUNCTIONS
#define INCL_HELPER_FUNCTIONS
#include "arduino.h"
#include "robot_functions.h"
#include <EEPROM.h>
inline int servoAngleToDuty(int angle);
inline void debugSerialBegin();
inline void debugPrint(const char* message);
inline void debugPrintln(const char* message);
inline void debugPrint... |
C | #include <stdio.h>
void change_value(int a, int vlaue) {
a = value;
printf("%d in change_value \n", a);
}
int main(void) {
int a = 10;
change_value(a, 30);
printf("%d in main \n", a);
return 0;
}
// 매개 변수는 오른쪽에서 왼쪽으로 쌓이고 위에서 밑으로 쌓인다.
void change_value(int x, int val) {
x = val;
printf("x : %d in change_va... |
C | /*
* pid.c
*
* Created on: Mar 28, 2018
* Author: atmelfan
*/
#include "pid.h"
float pid_update(pid* pid, float set, float actual, float dt){
/*Calc error and update running integral*/
float error = set - actual;
pid->integral_val += error*dt;
/*Limit integral value*/
if(pid->integral_val > PID_MAX_I... |
C | /*****************************************************************************
* bit_sets.c
*
* Randy Miller
*
* Counts the number of bits set
*****************************************************************************/
#include "main.h"
#include <stdio.h>
#include <stdlib.h>
#define BITS_PER_BYTE 8
/... |
C | /* wallclock.h for CIS*3090
B. Gardner, 24-Oct-11
#include or copy/paste the following functions into your program.
They implement Pilot's PI_StartTime(), PI_EndTime() style of timing.
This version gets accurate wall clock time from an OpenMP library function,
rather than clock() which returns CPU time. To call it... |
C | #include<stdio.h>
#include<stdbool.h>
#include <stdlib.h>
/*
* Created by Rebecca D'souza on 30/03/18
* */
int top = -1;
struct Queen{
int row;
int column;
int id;
};
struct Queen stack[1000];
void print(struct Queen queen){
printf("Queen %d is placed at [%d,%d]\n",queen.id,queen.row,queen.column);
}
... |
C | #pragma once
/*
Defines the function pointer as a type for convenience
This function is intended to provided the linked list
with the way to destruct/free up the void* data
IF the data needs special way to free up
*/
typedef void(*destruct_data_function)(void*);
/*
Each node contains a void* data so that it can ... |
C | #include <stdio.h>
int main ( void )
{
int min, max, sumValue = 0, minValue = 999999;
scanf( "%d %d", &min, &max );
for( int i = 1; i <= 100; ++ i )
{
int powValue = i * i;
if( powValue > max ) break;
if( min <= powValue && powValue <= max )
{
if( minValue > ... |
C | //***********************************************************************/
// Author : Garry
// Original Date : May,28 2004
// Module Name : string.h
// Module Funciton :
// This module and string.cpp countains the
// ... |
C |
/*
Title- Write a C program to accept string with multiple spaces from user and print it with a sinlge space as
a delimiter.
Eg:
Input String:
_____India_____is_my_________country___________________
Output String:
India_is_my_country
(Consider _ as space)
Author- Bhakare Mahesh Santosh
ID- 492
Batch- TechnOrbit(PPA-8)... |
C | #include <stdio.h>
#include <string.h>
int contavogais(char *nome){
//DESENVOLVER A LOGICA DE CONTAR VOGAIS
int i, tam, cont=0;
tam=strlen(nome);
for (i=0;i<tam;i++){
if( nome[i]=='a' ||
nome[i]=='e' ||
nome[i]=='i' ||
nome[i]=='o' ||
... |
C | #include <lib500.h>
#include <stdio.h>
// this is copied directly from turbo.asm
// with only small modifications
word read_bit() FASTNAKED {
__asm
load_threshold:
ld hl, 0x6800
xor a
; counts the HIGH (positive) semiwave
read_bit_loop_H:
inc a
bit... |
C | #include <stdio.h>
#include <stdlib.h>
typedef int ElementType;
typedef struct Node *PtrToNode;
typedef PtrToNode Stack;
struct Node
{
ElementType Element;
PtrToNode Next;
};
/* START: fig3_40.txt */
int IsEmpty( Stack S )
{
return S->Next == NULL;
}
/* END */
/* START: fig3_41.txt */
Stack CreateStack( void )... |
C | #include <stdio.h>
#include <stdlib.h>
// Structure for each node.
struct node
{
int data;
struct node *link;
};
// Global variables
struct node *front = NULL, *rear = NULL;
int **graph;
int total_node;
int *visited;
int *node_name;
// int graph[100][100];
// int graph[100][100]={
// {0,1,1,1,0},
// ... |
C | /*
* Interface para o programa de séries.
*
* Autores:
* Allan Silva Domingues 9293290
* Eduardo Garcia Misiuk 9293230
* Raul Wagner Martins Costa 9293032
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "db.h"
#include "utils.h"
int main (int argc, char *argv[]) {
SERIES_DATABASE *d... |
C | /**
* COP3514 Project 10
* This program is a modified version from project 9.
* In this program, the LinkedList maintains order
* and includes an option to delete entries from it.
*
* @author John Cameron (jcameron2)
*/
#include "car.h"
#include "readline.h"
#include <stdio.h>
#include <stdlib.h>
#include <strin... |
C | #include <stdint.h>
#include <time.h>
enum CARD_STATE {
CARD_STATE_NULL,
CARD_STATE_DATALESS,
CARD_STATE_ACTIVE
};
struct CardTimestampData {
time_t time;
uint32_t price;
uint32_t amount;
};
struct Card {
uint8_t state;
char name[64];
struct CardTimestampData data[365*20]; //20 ye... |
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 | #include <stdio.h>
#include <math.h>
int main() {
int nTestcase;
int src, dst;
int distance, sqrtDistance;
int i;
scanf("%d", &nTestcase);
for (i = 0; i< nTestcase; i++) {
scanf("%d %d", &src, &dst);
distance = dst - src;
sqrtDistance = (int)sqrt(distance);
if (distance == sqrtDistance * sqrtDistance)... |
C | // dracula.c
// Implementation of your "Fury of Dracula" Dracula AI
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "DracView.h"
#include "Game.h"
#include "Map.h"
#include "Places.h"
#include "Queue.h"
#include "Set.h"
typedef enum DRACULA_MESSAGE {
PLACING_TRAP,
PLACING_VAMPIRE,
HIDING,
DOUBLE... |
C | #include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include "main.h"
const float inf = (float) 99999999.0;
const float undefined = (float) 67108864.0;
const float BIG_DIGIT = (float) 88888888.0;
typedef struct {
float *array;
size_t used;
size_t size;
} Array;
typedef struct {
float **array;... |
C | #include <stdio.h>
#include <stdlib.h>
#include "lang_oop_coordinates.h"
/*
* Author : Diego Pacheco
* DataStructure : Language-C
* Problem : OOP
* Complexity : -
* Source : -
*/
static void coordinate_setx(Coordinate *this, int x){
if (this!=NULL){
this->x=x;
}
}
static void coor... |
C | //
// AVL树.c
// C数据结构与算法学习
//
// Created by 冯才凡 on 2019/11/8.
// Copyright © 2019 冯才凡. All rights reserved.
//
#include "AVL树.h"
#include <stdlib.h>
#define Max(x,y) ((x)>(y) ? (x) : (y));
/*
单旋、双旋: https://juejin.im/post/5d62064c6fb9a06b2c329a6f
*/
// 返回节点高度
int avlHeight(AVLPosition P) {
if (NULL == P... |
C | #include <stdio.h>
#include <stdlib.h>
#include "LinkedList.h"
#include "Controller.h"
#include "Employee.h"
#include "menu.h"
/****************************************************
Menu:
1. Cargar los datos de los empleados desde el archivo data.csv (modo texto).
2. Cargar los datos de los empleados des... |
C | #include <stdio.h>
#include <stdlib.h>
void inizializzaArrayRandom(double v[], int dim, double max_value);
void vec_print(double v[], int dim);
void vec_print(double v[], int dim);
double* vec_sum(double v[], int dim);
double* vec_rec(double v1[], double v2[], int dim1, int dim2);
int main(int argc, char **argv) ... |
C | #include "ds/queue_array.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void enqueue(Queue_Array* queue, void* value)
{
if (queue == NULL) {
printf("error: queue doesn't exists. please create one before enqueueing.\n");
return;
}
queue->rear++;
if (queue->front == -1)... |
C | #include "gui/window.h"
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include "input/input.h"
#define GLV_MAJOR 3
#define GLV_MINOR 3
#define WINDEF_TITLE "[NEW DOCUMENT]"
/** window_t is a wrapper around the GLFWwindow with some additional data.*/
struct window_t {
uint flags;
GLFWwindow* gwin; /**< ... |
C | #include "seqlist.h"
int main(void)
{
seq_plist l;
datatype data;
int ret;
l = init_seqlist(); //初始化顺序表
while(1){
printf("请输入整数:");
ret = scanf("%d",&data);
if(ret == 0) //输入为字符
break;
else if(data > 0){ //输入为正整数
insert_seqlist(data,l);
show_... |
C | #include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <glob.h>
#define PAT "abcd"
int main()
{
glob_t globres;
int i,err;
err = glob(PAT, GLOB_NOCHECK, NULL, &globres);
if(err)
{
printf("ERRO... |
C | bool isprime(int n)
{
if(n==2)return true;
else if(n%2==0)return false;
for(int i=3;i*i<=n;i+=2)if(n%i==0)return false;
return true;
}
|
C | /*while do_while 循环语句*/
#include <stdio.h>
int main(void)
{
int a = 100;
while (a > 1) //while(判断条件),True——执行下程序段,False——跳过
{
printf("%d>1\n", a);
a = a - 1;
}
do //do_while :至少执行一次循环,之后再判断while
{
printf("a=%d\n", a);
a = a + 1;
} while (a < 100); //注意分号
... |
C | #include "bitvector.h"
#include <string.h>
static unsigned int getIndex(unsigned int bitnum) {
return bitnum / ELEMENT_SIZE;
}
static unsigned int getMask(unsigned int bitnum) {
return 1 << (bitnum % ELEMENT_SIZE);
}
void vBitVectorClearAll(bitvector_t* vector) {
memset((void*) vector, 0, sizeof(bitvector_t))... |
C | /* Programming Exercise 11-11 */
// Write a program that reads in up to 10 strings or to EOF, whichever comes first. Have it
// offer the user a menu with five choices: print the original list of strings, print the strings
// in ASCII collating sequence, print the strings in order of increasing length, print the
// st... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(int argc, char* argv[]){
long long n;
if(argc != 2){
printf("Enter a binary number: ");
return EXIT_FAILURE;
}
else{
sscanf(argv[1], "%lld", &n);
int decimal = 0, i = 0, retenue = 0;
while(n != 0){
r... |
C |
int panduan(char a){
int result=0;
if((a>='a'&&a<='z')||(a>='A'&&a<='Z')||(a>='0'&&a<='9')||(a=='_'))
result=1;
return result;
}
int first(char b){
int result=0;
if((b>='a'&&b<='z')||(b>='A'&&b<='Z')||(b=='_'))
result=1;
return result;
}
int main(int argc, char* argv[])
{
int i,n,j,len,flag;... |
C | #define _GNU_SOURCE
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <fcntl.h>
#include <time.h>
#include <sched.h>
#include "../cacheutils.h"
#define CORE1 1
#define CORE2 0
#define CACHE_HIT_THRESHOLD 65
#define WINDOW_SIZE 1000
#define OFFSET (64 * 21)... |
C | #include <stdio.h>
int main(void){
int total = 0;
int n_iter = 1000000;
#pragma omp parallel for
for(int i=0; i<n_iter; i++){
total++;
}
printf("Value: %d", total);
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
/*
Ajai Gill
1015577
10/14/2018
Assignment 4
*/
typedef struct node{
int bFactor;
char *key;
int frequency;
struct node *left, *right;
}AVL_Node;
void BuildTree(AVL_Node **root, FILE *file);
AVL_Node *SearchTree(AVL... |
C | #include <stdio.h>
#include <stdlib.h>
#include "simulation.h"
float rand_float(float min,float max)
{
float rand_normal=(float)rand()/(float)(RAND_MAX);
return min+(max-min)*rand_normal;
}
simulation_t* simulation_new(unsigned int width,unsigned int height,unsigned int max_particles)
{
simulation_t* simulation=mall... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* lm_create_hole.c :+: :+: :+: ... |
C | TEST(DwMap, DwMap)
{
DwMap<int, DwString> m;
EXPECT_TRUE(m.isEmpty());
for(int i = 0; i < 10000; i++)
{
m[i] = DwString::number(i, 16);
}
EXPECT_FALSE(m.isEmpty());
EXPECT_EQ(10000, m.count());
}
TEST(DwMap, iterator)
{
DwMap<int, DwString> m;
m[100] = "aaa";
m[200] = ... |
C | /*
Goal: Building a command line calculator.
Example:
I/P = 5 / 2 + 3 - 4 x 2 =
O/P = -2.5
Requirements:
1) Accepts a maximum of 80 characters input.
2) Every valid expression entered, must end with an '=' sign to be computed.
3) The only valid operations are '+' , '-' , '/' and 'x'.
4) The calculator m... |
C | /* Dane Kirkpatrick
* 1004843
* dkirkpat@uoguelph.ca
*/
#ifndef NAME
#define NAME
struct name_data
{
int size;
struct name_basics * array;
struct node *nconst_root;
struct node *primaryName_root;
};
struct name_basics
{
char *nconst;
char *primaryName;
};
struct name_data * get_name(cha... |
C | #include <stdio.h>
#include <stdint.h>
#include <math.h>
void print_sin_cos(double step) {
for (double x=0;x<=1;x+=step) {
printf("sin(%f)=%f\n", x, sin(x));
printf("cos(%f)=%f\n", x, cos(x));
}
}
int main()
{
double step = 0;
printf("Enter the desired step (e... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/wait.h>
#define SLEEP_TIME 1
int main(int argc, char* argv[]) {
if (argc < 4) {
printf("Not enoughr arguments, consumer got %d arguments", argc);
}else{
char* pipeFilename = argv[1];
char* f... |
C | /*
Redo exercise 4 using a switch .
*/
#include<stdio.h>
int main()
{
char ch;
int period_sub = 0, excla_sub = 0;
printf("Enter the characters:\n");
while ( (ch=getchar()) != '#' )
{
switch(ch)
{
case '.': printf("!");
period_sub++;
case '!': printf("!!");
... |
C | #include "mount.h"
#include "inode.h"
#include "unixv6fs.h"
int test(struct unix_filesystem *u)
{
int err = 0;
int numeroInode = 0;
int numeroSecteur = 0;
int offset = 0;
struct inode inodePourTest;
printf("\nEntrez le numero de l'inode: ");
scanf("%d", &numeroInode);
err = inode_read(... |
C | /* misc.c - common routines
*
* adftools - A complete package for maintaining image-files for the best
* Amiga-emulator out there: UAE - http://www.freiburg.linux.de/~uae/
*
* Copyright (C)2002-2015 Rikard Bosnjakovic <bos@hack.org>
*/
#include <adflib.h>
#include <ctype.h>
#include <errno.h>
#include <stdlib.h>
... |
C | #include <sys/mman.h>
#include <unistd.h>
#include "lib.h"
#include <dispatch/dispatch.h>
dispatch_semaphore_t semaphore;
#ifdef __APPLE__
#include <dispatch/dispatch.h>
#else
#include <semaphore.h>
#endif
struct rk_sema {
#ifdef __APPLE__
dispatch_semaphore_t sem;
#else
sem_t sem;
#endif... |
C | /*
Advanced Programming
BlackJack Homework - Sockets
Salomón Charabati
October '19
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <netdb.h>
#include "sockets.h"
// Include own sockets library
#include "sockets.h"
#include "blackjack.h"
#define SERVICE_PORT 8642
#define... |
C | int main()
{
int n,i,j,b,c,d,e,f;
char a[1000][1000];
scanf("%d",&n);
for(i=0;i<n;i++){
for(j=0;j<n;j++){
scanf("%d",&a[i][j]);
}}
c=-1;
for(i=0;i<n;i++){
for(j=0;j<n;j++){
if(a[i][j]==0)
{c=i;d=j;
break;}}
if(c!=-1){break;}
}
e=-1;
for(i=n-1;i>=0;i--){
for(j=n-... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.