language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /**
* Dileep Reddy
* Lab 10 Post-Lab
* 10/28/2021
* Program to find highest and lowest string in alphabetical order
*/
#include <string.h>
#include <stdio.h>
int main(int argc, char const *argv[])
{
char current_word[20], smallest_word[20], largest_word[20];
int len = 0;
while (len != 4)
{
... |
C | #define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <stdio.h>
#include "app.h"
typedef struct {
char *prefix;
HWND window;
} window_with_prefix_data_t;
BOOL CALLBACK window_with_prefix_callback(HWND window, LPARAM lParam) {
window_with_prefix_data_t *find = (window_with_prefix_data_t *)lParam;
char title[... |
C | /*
* mainc
*
*
* 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 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope th... |
C | #include "BinaryTree.h"
#include <stdlib.h>
static BinaryNode* currentNode = NULL;
void commit(void){
currentNode = NULL;
}
BinaryNode* newBinaryNode(int data){
BinaryNode* btree = (BinaryNode*)calloc(1, sizeof(BinaryNode));
btree->data = data;
if(NULL == currentNode){
currentNode = btree;
}
else{
currentNo... |
C | #include <stdio.h>
#include <conio.h>
main()
{
int l1,l2,i,n,k,cub_dig,sum_cub=0;
printf("enter the limits");
scanf("%d",&l1);
scanf("%d",&l2);
for(i=l1;i<=l2;i++)
{
n=i;
while(n!=0)
{
k=n%10;
cub_dig=k*k*k;
sum_cub=sum_cub+cub_dig;
n=n/10;
}
if(sum_cub==i){
printf... |
C | #include <stdio.h>
void change(double * a, double * b, double * c);
void main(void)
{
double a, b, c;
printf("Enter the first number: \n");
scanf("%lf", &a);
printf("Enter the second number: \n");
scanf("%lf", &b);
printf("Enter the third number: \n");
scanf("%lf", &c);
printf("The nu... |
C | /* C Example */
#include <stdio.h>
#include <mpi.h>
MPI_Status status;
int ROWS_IN_ORIGINAL_ARRAY=1200;
int COLS_IN_ORIGINAL_ARRAY=1024;
int main (int argc, char **argv)
{
int rank, size;
MPI_Init (&argc, &argv); /* starts MPI */
MPI_Comm_rank (MPI_COMM_WORLD, &rank); /* get current process id */
MPI_... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define MAX_N 20
void stampaMatrix (int* matrice[][MAX_N], int righe, int colonne, int i,int j);
int min(int a, int b);
void stampaSottoMatrix (int* matrice[][MAX_N], int r, int c, int dim);
int main(int argc, char* argv[])
{
if(argc !... |
C |
#include <sys/poll.h>
#include <pthread.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <assert.h>
#include "../debug/debug.h"
#include "event.h"
#include "locking.h"
#ifdef HAVE_SYS_EPOLL_H
#include <sys/epoll.h>
struct event_slot_e... |
C | // CSparse/Source/cs_cumsum: cumulative sum
// CSparse, Copyright (c) 2006-2023, Timothy A. Davis. All Rights Reserved.
// SPDX-License-Identifier: LGPL-2.1+
#include "cs.h"
/* p [0..n] = cumulative sum of c [0..n-1], and then copy p [0..n-1] into c */
double cs_cumsum (int *p, int *c, int n)
{
int i, nz = 0 ;
... |
C | /* Conversions between function and object pointers are not permitted
in any version of ISO C, even with casts, except for the special
case of converting a null pointer constant to function pointer
type. Likewise, comparisons between function and object pointers
are not permitted. PR c/11234. */
/* Origi... |
C | /*
** EPITECH PROJECT, 2018
** my_getnbr
** File description:
** wesh
*/
#include "../include/my.h"
int my_getnbr(char *str)
{
int nb = 0;
int i = 0;
int neg = 1;
while (str[i] && str[i] != '\n'){
nb = (nb * 10) + (str[i] - '0');
i = i + 1;
}
nb = nb * neg;
return (nb);
} |
C | /*
* chatterbox Progetto del corso di LSO 2017/2018
*
* Dipartimento di Informatica Università di Pisa
* Docenti: Prencipe, Torquati
*
*/
/**
* Stefano Russo 544341
*
* stefanoruss97@gmail.com
*
* Si dichiara che il contenuto di questo file e' in ogni sua parte opera
* originale dell'autore
*/... |
C | /*
** my_memset.c for my_elem in /home/landai_n/rendu/Prog-elem/get_next_line-2018-landai_n/Lib/src
**
** Made by Nathanael Landais
** Login <landai_n@epitech.net>
**
** Started on Wed Dec 4 21:07:35 2013 Nathanael Landais
** Last update Wed Dec 4 21:47:20 2013 Nathanael Landais
*/
void my_memset(char *var, int... |
C | /*
1. find all the subarrays and add min from each array.
To get the min of each subarray, array can be sorted first then select the first elment as it would be min of all in a subarraya.
==============================================================================
HOLD ON
==========================================... |
C | /*
In 1984, Michael Crichton wrote a security program in BASIC that was published in Creative Computing magazine.
The program would ask the user to type a phrase of their choice, record the intervals between the keystrokes, then ask them to retype the phrase.
If the timings differed by too much, the program would iden... |
C | #include <unistd.h>
int ft_putchar(char c)
{
write(1, &c, 1);
return(0);
}
void asci()
{
unsigned char kaba;
kaba = 0;
while (kaba <= 127)
{
ft_putchar(kaba);
kaba++;
}
}
int main()
{
asci();
ft_putchar('\n');
return(0);
} |
C | // Author : Syed Mujtaba
// TE-11
// Dining Philosophers using Semaphores
// Compile using -lpthread flag
// http://p.ip.fi/p8MF
#include <sys/types.h>
#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
#include <pthread.h>
#include <semaphore.h>
in... |
C | #include "functions.h"
#include <stdlib.h>
char * getFilenameFromPath(const char * path){
int pathCharCounter = 0;
int filenameCharCounter = 0;
int i;
//Count the number of characters the path contains.
while (path[pathCharCounter] != '\0'){
pathCharCounter++;
}
//Count the numb... |
C | /*
* This is the file in which you'll write the functions required to
implement
* a stack using two queues. Make sure to add your name and
@oregonstate.edu
* email address below:
*
* Name: Katrine Chow
* Email: chowk@oregonstate.edu
*/
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#ifndef TYP... |
C | /***********************************************************************************************************
PROGRAM TO SORT THE DETAILS OF A BOX
BY,
VK. MANOJ KUMAR
CB.EN.U4CSE17040
****************************************************************************************************... |
C | #include <stdio.h>
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
#define TEST_FUNCTION(arr, val, ind) (printf("%s", find((arr), ARRAY_SIZE((arr)), (val)) == (ind) ? "Test PASSED!\n" : "Test FAILED!\n"))
extern int find(int *array, int size, int value);
int main(void) {
int array1[] = {7};
TEST_FUN... |
C | //Addition of two polynomials
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct poly{
int coef;
int exp;
struct poly *next;
};
struct poly *first1=NULL,*first2=NULL,*first3=NULL,*curr,*last;
struct poly *create();
struct poly *createnode(struct poly*,int,int);
struct poly *add(struc... |
C | #include <stdio.h>
int main(void) {
int a,i,b=1;
printf("\n enter the number");
scanf("%d",&a);
for(i=1;i<=5;i++)
{
b=a*i;
printf("%d\n",b);
} return 0;
}
|
C | /**
* generate.c
*
* Generates pseudorandom numbers in [0,MAX), one per line.
*
* Usage: generate n [s]
*
* where n is number of pseudorandom numbers to print
* and s is an optional seed
*/
#define _XOPEN_SOURCE
#include <cs50.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
// upper limit on ran... |
C | #include <stdio.h>
int reverse(int x){
int value = 0;
while (x != 0){
value *= 10;
value += x % 10;
x = x/10;
}
return value;
}
int main(){
printf("%d\n", reverse(12345));
return 0;
}
|
C | #include <iostream>
#include <algorithm>
#include <vector>
#include <list>
struct yes { char c; };
struct no { char c; yes c1; };
template <typename T> yes test_have_sort(decltype(static_cast<void (T::*)()>(&T::sort)));
template <typename T> no test_have_sort(...);
template <typename T> yes test_have_range(decltype(st... |
C | //
// JS_memory.c
// MemoryCTRL
//
// Created by Tony on 14-2-21.
// Copyright (c) 2014年 Tony. All rights reserved.
//
#include "../header/JS_Memory_CTRL.h"
List JS_InitializeMemoryList(char * Init_address,int block_size){
if(NULL==Init_address)
return NULL;
List Init_list=(List)Init_address;
I... |
C | #include "stdio.h"
#include "stdlib.h"
int main(){
int n = 0, u_n;
printf("u_0 = ?");
scanf("%d", &u_n);
while(u_n != 1){
if(u_n%2) u_n = 3*u_n+1;
else u_n = u_n/2;
//printf("%d\n", u_n);
n++;
}
printf("%d\n",n);
}
|
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <limits.h>
#include <math.h>
#include <ctype.h>
int numSquares(int n) {
while (n % 4 == 0) {
n /= 4;
}
if (n % 8 == 7) {
return 4;
}
for (int i = 0; i * i <= n; ++i) {
int j = sqrt(n - i... |
C | #include <stdio.h>
int main(void) {
int input_number, i, sum = 0;
printf("Enter the number");
scanf("%d", &input_number);
for(i = 1; i < input_number; i++){
if(input_number%i == 0){
sum += i;
}
}
if(sum == input_number){
printf("%d is a perfect number", input_number);
}else{
p... |
C | #include "ct/ct.h"
#include "ct/udp_protocol.h"
#include <stdio.h>
#define NETTESTSERVER NULL
int nettestserver(struct ctnode *from, struct ctnode *to) {
printf("server\n");
// receive incoming messages using the from node
printf("from-socket: %d\n", from->socket);
printf("to-socket: %d\n", to->socket);
asse... |
C | /*! @copyright (c) 2017-2022 King Abdullah University of Science and
* Technology (KAUST). All rights reserved.
*
* STARS-H is a software package, provided by King Abdullah
* University of Science and Technology (KAUST)
*
* @file include/starsh-minimal.h
* @version 0.3.1
* @aut... |
C | #include<regx52.h>
#define CONTROL P1 //ʾƶ˿
#define SHOW P0 //ʾ˿
const unsigned char leter[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80}; //0000000100000010,000001000000100000010000001000000100000010000000ܵƵλ
void delayms(int xms){
int i = 0;
int j = 0;
for(i = xms; i > 0; i--)
for(j = 110; j > 0; j--);
}
void s... |
C | #include <stdio.h>
#include <stdint.h>
extern uint8_t loBitsTable[];
extern uint8_t hiBitsTable[];
void generatefont(void);
typedef struct{
union{
uint8_t bytes[64];
uint8_t rows[21][3];
};
} spriteMatrix_t;
void PrintBits (uint32_t l) {
int8_t i;
uint32_t mask = (uint32_t)1 << (8*si... |
C | #include <stdio.h>
int main(void) {
int a = 0, b = 0;
scanf("%d %d", &a, &b);
//
int sum = 0;
// k++ k = k + 1,
// ++
for (int k = a; k <= b; k++){
sum = sum + k;
//
//
}
printf("%d\n", sum);
return 0;
}
|
C | #include<stdio.h>
int main()
{
float b;
int w;
scanf("%d",&w);
scanf("%f",&b);
if((w+0.5)<b)
{
if(w%5==0)
{
b=b-w-0.50;
}
}
printf("%0.2f",b);
return 0;
} |
C | /* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt_private.h"
/**
@file lt... |
C | #ifndef __LLVM_CODEGEN_H
#define __LLVM_CODEGEN_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <llvm-c/Core.h>
#include <llvm-c/ExecutionEngine.h>
#include <llvm-c/Target.h>
#include <llvm-c/Analysis.h>
#include <llvm-c/BitWriter.h>
#include "util.h"
#include "parser.h"
#include "vector.h"
#in... |
C | /* Author: Dominic van der Zypen
* Pearson hashing with 2 changes
* 1) 64 bit or more, not just 8 bit.
* 2) No table lookup, but (simple) bijection with bit rotation and
* bit swapping in the bytes constituting the fixed-length hash output.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include... |
C | #include <ncurses.h>
#include <unistd.h>
#include "characters.h"
#include "main.h"
#include "sprites.h"
/*Função para mostrar a wave na tela e apagar a última wave mostrada*/
void print_wave(
int a,
int b,
int enemy_qty,
int enemy_line,
struct Tplayer *player,
int max_x,... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <stdarg.h>
/* external libraries required by pgcloader */
#include "libs/libconfig/libconfig.h"
#include "libs/libcsv/csv.h"
#include <libpq-fe.h>
#include <iconv.h>
/* internals */
#include "loader.h"
#includ... |
C | #include <stdio.h>
#include <stdlib.h>
int NrOfBanknotes(int ron)
{
int counter=0;
while(ron)
{
if(ron>=500)
{
counter+=ron/500;
ron%=500;
}
if(ron>=200&&ron<500)
{
counter+=ron/200;
ron%=200;
}
if(ron>=1... |
C | /*
** EPITECH PROJECT, 2018
** play_music_loop.c
** File description:
** julien.ollivier@epitech.eu
*/
#include "music.h"
static int turn_off_music(sfMusic **music)
{
if (!music)
return 0;
if (!*music)
return 0;
sfMusic_destroy(*music);
return 1;
}
static int turn_on_music(sfMusic **music, char *path)
{
if ... |
C | /*
* JerryBoreeMain.c
*
* Created on: Nov 30, 2020
* Author: ise
*/
#include "Defs.h"
#include "Jerry.h"
#include "HashTable.h"
#include "LinkedList.h"
#include "KeyValuePair.h"
#include "MultiValueHashTable.h"
#include <math.h>
//for the findTheBestHashNumber func.
int roundNo(float num)
{
return num <... |
C | #include <stdio.h>
#include <stdlib.h>
// Prototypes :
void OptLign(int nbLign, char* buffer, FILE* f);
void OptChar(int nbChar, char* buffer, FILE* f);
// Main :
int main(int argc, char*argv[], char*env[]){
FILE* f;
if(argv[argc-1][0] == '-')
f = stdin;
else
f = fopen(argv[argc-1],"r+");
char* buffer... |
C | /*
ACM Craft 성공분류
시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 512 MB 35920 6065 3839 19.667%
문제
서기 2012년! 드디어 2년간 수많은 국민들을 기다리게 한 게임 ACM Craft (Association of Construction Manager Craft)가 발매되었다.
이 게임은 지금까지 나온 게임들과는 다르게 ACM크래프트는 다이나믹한 게임 진행을 위해 건물을 짓는 순서가 정해져 있지 않다. 즉, 첫 번째 게임과 두 번째 게임이 건물을 짓는 순서가 다를 수도 있다. 매 게임시작 시 건물을 짓는 순서가 ... |
C | /* Author: gjohn010
* Partner(s) Name:
* Lab Section: 022
* Assignment: Lab #3 Exercise #1
* Exercise Description: [optional - include for your own benefit]
*
* I acknowledge all content contained herein, excluding template or example
* code, is my own original work.
*/
#include <avr/io.h>
#ifdef _SIMULATE_
... |
C | /*
** EPITECH PROJECT, 2019
** my_printf
** File description:
** my_putstr with additionnal octal base
*/
#include "my.h"
void my_format(char *str)
{
while (*str) {
if (*str < 32 || *str >= 127) {
my_putstr("\\");
if (*str < 8)
my_putstr("00");
if (*str ... |
C | //Accept N numbers from user and return product of all odd elements.
#include<stdio.h>
#include<stdlib.h>
int ProductOdd(int arr[],int iLength)
{
int i,iMult=1;
if((arr==NULL)||(iLength==0))
{
return -1;
}
for(i=0;i<iLength;i++)
{
if(!(arr[i]%2==0))
{
iMult=iMult*arr[i];
}
}
if(iMult==1)
{
return... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* tools.c :+: :+: :+: ... |
C | /*
Definicion de funciones.
*/
#include "Def_Fun.h"
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
void Asig_O(float peso, float estatura, char * msj)
{
int Conf = 0;/*Inicializamos*/
float IMC=0;
/*Valida Datos*/
if(Val_Dat(peso , estatura)==0)
strcpy(msj,"Datos Er... |
C | #pragma once
/* An axis-aligned bounding box (AABB), with some collision math */
struct engBoundingBox {
engBoundingBox(): x(0), y(0), width(0), height(0)
{}
engBoundingBox(int x, int y, unsigned int width, unsigned int height): x(x), y(y), width(width), height(height)
{}
int x;
int y;
int width;
int height;... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define TAILLE 4
//Laetitia Monnier
//Prototype
int verifNbAllumette(int , int);
void affichePyramide(int[TAILLE]);
int iaTirage(int);
int iaLigne(int[TAILLE]);
void tour(int, int[TAILLE], int*);
int main()
{
int tabPy[TAILLE];
int compteur = 0, totalP... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* uint.c :+: :+: :+: ... |
C | #include "bssalloc.h"
#include <stdio.h>
void BSS_Alloc_Data_init(BSS_Alloc_Data *d) {
d->cptr = d->pool;
}
int BSS_Alloc_Data_owns_d(BSS_Alloc_Data *d, void *p) {
return ((char*) p >= d->pool && (char*) p <= d->cptr);
}
int BSS_Alloc_Data_owns(void *p) {
return BSS_Alloc_Data_owns_d(&bss_data, p);
}
v... |
C | #include <stdio.h>
int a=100,b=20;
int * go() //^w
{
return &a;
}
int main ()
{
printf("%d",*(go())); // *( ) Xe
}
|
C | #include "common.h"
#include <assert.h>
#include "structs.h"
/*
** List Functions
*/
List* NewList() {
List* list = (List*)calloc(1, sizeof(List));
return list;
}
void InitList(List* list) {
list->head = NULL;
list->tail = NULL;
list->size = 0;
}
void AddToList(List* list, ListItem* item) {
if (!list || !it... |
C | /******************************************************************************
* File Name : poly_compute.h
* Date First Issued : 08/02/2015
* Board :
* Description : Compute polynomial routine to compensate something
***********************************************************************... |
C | #include <stdio.h>
int searchInsert(int A[], int n, int target) {
int l, r, m;
l = 0;
r = n - 1;
while (l <= r) {
m = (l + r) / 2;
if (A[m] == target) {
return m;
}
else if (A[m] < target) {
l = m + 1;
}
else {
... |
C | //#pragma once
#ifndef NO7RECONSTRUCTBINARYTREE_H
#define NO7RECONSTRUCTBINARYTREE_H
struct TreeNode {
int m_nValue;
TreeNode* m_pLeft;
TreeNode* m_pRight;
TreeNode(int val, TreeNode* left, TreeNode* right) {
this->m_nValue = val;
this->m_pLeft = left;
this->m_pRight = right;
}
};
extern TreeNode* Reconstr... |
C | #include <stdio.h>
#include <stdlib.h>
int
main (int argc, char *argv[])
{
int i = 1024;
int j = 19;
int start = 2;
int end = 6;
j = j << start;
int rmask = (1 << (end + 1)) - 1;
int lmask = ~((1 << start) - 1);
i = (i & (~(rmask & lmask))) | j;
printf("Final value: %d\n", i);
return 0;
}
|
C | #ifndef _REALMATRIX_H_
#define _REALMATRIX_H_
#include "common.h"
#include "image.h"
typedef struct _realmatrix {
real **val;
int ncols,nrows;
} RealMatrix;
RealMatrix *CreateRealMatrix(int ncols,int nrows);
void DestroyRealMatrix(RealMatrix **mat);
RealMatrix *CloneRealMatrix(RealMatrix *mat);
void ... |
C | #include<stdio.h>
#include<stdlib.h>
/**
** Thiago André Cardoso Silva
** Aulas particulares de programação (para iniciantes)
** Instagram: @programador_who
** Cel: (085) 999273805
*/
int fatorial();
int main(int argc, char const *argv[]) {
int numero = 5;
int resposta = fatorial(numero); // CHAMADA DA FUNCAO
pr... |
C | /*
** my_tablen.c for in /home/januar_m/delivery/PSU/PSU_2016_minishell2
**
** Made by Martin Januario
** Login <martin.januario@epitech.eu>
**
** Started on Tue Mar 14 13:16:41 2017
** Last update Tue Mar 14 13:17:30 2017
*/
#include <stdlib.h>
int my_tablen(char **tab)
{
int idx;
idx = 0;
if (tab =... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/wait.h>
/*
Robson de Arruda Silva - 2019013624
Sistemas Operacionais - 05/09/2020
Processo Pai: Recebe dois parâmetros na inicialização. O processo pai cria dois processos filhos e
envia o primeiro parâmetro para o filho ... |
C | /*
wiring_shift.c - shiftOut() function
Part of ebox
*/
//#include "wiring_private.h"
#include "ebox.h"
uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder) {
uint8_t value = 0;
uint8_t i;
for (i = 0; i < 8; ++i) {
digitalWrite(clockPin, HIGH);
if (bitOrder == LSBFIRST)
value |= digita... |
C | #include "hash_tables.h"
/**
* hash_table_set - adds an element to the hash table
* @ht: the hash table you want to add or update the key/value to
* @key: is the key
* @value: value associated with the key
* Return: 1 on success, 0 otherwise
*/
int hash_table_set(hash_table_t *ht, const char *key, const char *val... |
C | #include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include "FilaIntDeque.h"
int insereNumeroAleatorio(FilaInt *f, int quantNumeroAdd);
void main(){
srand(time(NULL));
int n;
FilaInt f;
inicializaFila(&f, 10);
insereNumeroAleatorio(&f, 10);
imprimiFila(f);
removerInicioFila(&f, &n);... |
C |
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
double F1 (double z)
{
return z;
}
double F2 (double z, double y)
{
return ((-0.6*z)-8*y);
}
void main()
{
double x=5;
double y=0.55;
double z=0.45;
double h=0.5;
double res_f1, res_f2;
double ym1, zm1,
ym2,zm2,
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <ctype.h>
#include "Employee.h"
#include "utn.h"
/** \brief To indicate that all position in the array are empty,
* this function put the flag (isEmpty) in TRUE in all
* position of the array
* \param list Employee* Pointer to array of employees
* \p... |
C | /******************************************************************************
* Copyright (C) 2017 by Alex Fosdick - University of Colorado
*
* Redistribution, modification or use of this software in source or binary
* forms is permitted as long as the files maintain this copyright. Users are
* permitted to mod... |
C | /******************************************************************************************************************************************
* ļ: IOUART_TX.c
* ˵: GPIOģUART
* ע: 9600
* 汾:
* ¼:
****************************************************************************************************************************... |
C | /*
A search engine query program
Daniel Moder, Summer 2016
*/
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
#include <stdbool.h>
#include <unistd.h>
#include "../common/index.h"
#include "../lib/hashtable/hashtable.h"
#include "../lib/set/set.h"
#include "../lib/counters/counters.h"
... |
C | #include<stdio.h>
#define MAX 100
#define INT_MIN -9999
int a[MAX]={[0 ... MAX-1]=INT_MIN};
int rear=MAX-1,front=0,len=0;
void insert(int val) //O(1)
{
if(len==MAX)
{
printf("\nQueue Full\n");
return;
}
rear=(rear+1)%MAX;
a[rear]=val;
len++;
printf("\n %d is added\n",val);
}
void del() //O(1)
{
if(len==0)... |
C | #include<stdio.h>
void main()
{
int a[15],i,n;
printf("Enter the size of array");
scanf("%d",&a[i]);
printf("Enter the elements");
scanf("%d",&n);
for(i=0;i<N;i++);
{
printf("%d%d",a[i],i);
}
}
|
C | #include <stdio.h>
int main(){
char palabra[30];
FILE * pArchivo;
pArchivo = fopen("un_archivo.txt","w");
if(pArchivo != NULL){
printf("Ingrese una palabra: \n");
//scanf("%s",palabra);
gets(palabra);
fflush(stdin);
fputs(palabra, pArchivo);
fclose(pArchivo);
}
else printf("Error en la ape... |
C | #include <stdio.h>
// Function: int ungetc (int c, FILE *stream)
// The ungetc function pushes back the character c onto the input stream
// stream. So the next input from stream will read c before anything else.
// If c is EOF, ungetc does nothing and just returns EOF. This lets you call
// ungetc with the return v... |
C | #include"tt_glob.h"
struct test_s{
int i;
int j;
};
int main(int argc,char *argv[])
{
struct test_s s;
char op = *argv[1];
char *key = argv[2];
char *value;
int len;
s.i = 0;
s.j = 1;
switch(op){
case 'G':
if((value = iod_get(key,&len)) != NULL){
printf("%d bytes get from tt\n",len);
printf("va... |
C | #include"stdio.h"
#include"math.h"
#define pi 3.1415926
int main()
{
float r, h,l,s1,s2,v1,v2;
printf("圆半径:");
scanf("%f",&r);
printf("圆柱高:");
scanf("%f",&h);
l=2*pi*r;
s1=pi*pow(r,2);
s2=4*pi*pow(r,2);
v1=(4.0/3.0)*pi*pow(r,3);
v2=s1*h;
printf("圆周长:%6.2f\n",l);
printf("圆面积:%6.2f\n",s1);
printf("球表面积:%6.2f... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <inttypes.h>
#include <unicode/ustdio.h>
#include <unicode/ustring.h>
#include "ternary_search_tree.h"
#define U2(X) u ## X
#define U(X) U2(X)
#define MAX_WORD_LENGTH 50
#define INDENT 6
#define COLOR u"\033[34m"
#define COLOR2 u... |
C | #include<avr/io.h>
#include<util/delay.h>
unsigned char data=0x32, control;
void uart_init()
{
UBRRL=0x33;
UBRRH=0x00;
UCSRA=0x20;
UCSRB=0x18;
UCSRC=0x86;
}
void delay(int time)
{
while(time--)
_delay_ms(1);
}
void waveform(int on, int off)
{
PORTD=PORTD&0x7F;
delay(on);
PORTD=PORTD|0x80;
delay(of... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAX 1000 // I initialize a global variable for the length of the array
int main(){
FILE* fp; // I initialize all the other variables starting from the file pointer pointer
char string[MAX]; // the s... |
C | #include<stdio.h>
#include<math.h>
#include<stdlib.h>
struct answer
{
float Q[50][50];
float R[50][50];
};
struct answer *givan(int n,int p,int q,int k,float ** mat)
{
int i=0,j=0,z=0;
float r=0,cos=0,sin=0,a=0,b=0;
float **I=NULL, **ans;
struct answer *temp;
I=(float **)malloc(sizeof(float *)... |
C | #include <stdio.h>
enum DAY{SUN, MON=5, TUE, THR, FRI, SAT} yesterday, today = 1;
int main(void) {
enum DAY tomorrow;
tomorrow = today + 1;
printf("SUN is %d\n", SUN);
printf("MON is %d\n", MON);
printf("TUE is %d\n", TUE);
printf("yesterday is %d\n", yesterday);
yesterday = (enum DAY) (today - 2);
prin... |
C | #include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <pnm.h>
float gaussian(float sigma, float k) {
return exp(-k*k/(2*sigma*sigma));
}
void process(char* ims_name, char* imd_name, int sigma_s, int sigma_g) {
pnm ims = pnm_load(ims_name);
int width = pnm_get_width(ims);
int height = pnm_get_h... |
C | //
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
/*=============================================================
**
** Source: LockFile.h
**
** Purpose: This header file has a RunHelper method which will be use... |
C | /**
* Multi-Pattern Search
*
* Implement the initialization of the mps engine in the configuration
*/
/******************************************************************************
* API FUNCTIONS
******************************************************************************/
#include "mps.h"
#include "PatternsTr... |
C | #include <stdio.h>
#include "test.h"
#define N 10
// longest_sequence_length - находит длину максимально длинной
// последовательности одинаковых чисел идущих подряд.
// Например, для массива [1, 1, 2, 2, 5, 5, 5, 4, 1, 1] максимально длинная
// последовательность одинаковых чисел идущих подряд это [5,5,5], и ее дли... |
C | #include "mp4.h"
int read_mdia_box(mp4_bits_t *bs, mdia_box_t *mdiabox)
{
box_header_t *boxhead;
fullbox_header_t *fullboxhead;
alloc_struct_box_header(&boxhead);
alloc_struct_fullbox_header(&fullboxhead);
mdiabox->struct_size = mdiabox->boxheader->struct_size;
while (mdiabox->struct_size < mdiabox->boxheader... |
C | /*
* The Python Imaging Library.
* $Id$
*
* encoder for WebP data
*
* history:
* 2011-06-26 fl created
*
* Copyright (c) Fredrik Lundh 2011.
*
* See the README file for information on usage and redistribution.
*/
#include "Imaging.h"
#ifdef HAVE_LIBWEBP
#include "WebP.h"
#include "webp/encode.h"
int
Im... |
C | /*********************
* Author: Adi *
* Reviewer: *
* Status : *
**********************/
#include <string.h> /* strlen */
#include "calculator.h"
typedef enum states
{
WAIT_FOR_NUM,
WAIT_FOR_OPERATOR,
ERROR,
END
} state_t;
typedef struct transition
{
state_t next_state;
calc_errno_t (*action_... |
C | #include<stdio.h>
int josephus(int n, int k)
{
if (n == 1)
return 1;
else
return (josephus(n - 1, k) + k-1) % n + 1;
}
int main()
{
int n,k;
printf("Enter n\n");
scanf("%d",&n);
printf("Enter k\n");
scanf("%d",&k);
printf("The chosen place is %d",josephus(n, k))... |
C | #include <high/ProcessPool.h>
#include <low/Heap.h>
#include <low/Message.h>
#include <low/Process.h>
#include <low/String.h>
struct ProcessPool_ {
// self public object
ProcessPool self;
// constructor data
int size;
tsize item;
// private data
Process** pool;
Message* message;
};
... |
C | #include "fifo.h"
#include "mtask.h"
//ʼFIFO buf
void fifo32_init(struct FIFO32 *fifo, int size, unsigned int *buf, struct TASK *task)
{
fifo->size = size;
fifo->buf = buf;
fifo->free = size;
fifo->flags = 0;
fifo->p = 0;
fifo->q = 0;
fifo->task = task;//Ҫѵtask
return;
}
//fifoб
unsigned int fifo32... |
C | #include "track.h"
#include "trackpoint.h"
#include "location.h"
#include <float.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
//#include <string.h>
//#include "trackpoint.h"
//#include "location.h"
struct track
{
trackpoint ***segarray;
int *seglengths;
int segnumber;
int *segptspace;
int segsp... |
C | #include <stdio.h>
#include <stdlib.h>
#include <glib.h>
#include <string.h>
/*
From https://stackoverflow.com/questions/3463426/in-c-how-should-i-read-a-text-file-and-print-all-strings.
Uses two very unsafe functions.
*/
char* ReadFile(char *filename)
{
char *buffer = NULL;
int string_size, read_size;
FILE ... |
C | #include "src/DnA.h"
// please print what element have 1 every rows
int ar[10][10]={
{1,0,0,0,0,1,0,0,0,0}
{0,0,0,0,1,0,1,0,0,0}
};
int search_value( ){
search_value();
return 0;
}
int main( void ){
return 0;
}
/*
struct _node{
int value;
struct _node *link;
};
typedef struct _node NODE... |
C | #ifndef UTILS_H
#define UTILS_H
#include <stdio.h>
#include <stdint.h>
void ut_mac2s(uint8_t * mac, char *s);
int ut_s2mac(uint8_t * mac, char *s);
int ut_s2n10(const char *s, uint16_t *n);
int ut_s2nl10(const char *s, uint32_t *n);
int ut_s2nll10(const char *s, uint64_t *n);
int ut_s2n16(const char *s, uint16_t *n);... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.