language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | //Name: Garen Porter
//Program name: ftserver
//Program description: Waits on a control socket and accepts incoming clients. Sends either a directory listing or file over a separate data connection.
//Data connection is closed after requested action has been completed and a new client may conn... |
C | #include <config.h>
#include <tableLogic.h>
#include <core.h>
/*Função para limpar o nome do arquivo*/
void clearFileName(t_tableData *tableData)
{
for (int i = 0; i < MAX_FILENAME - 1; i++)
{
tableData->filename[i] = '\0';
}
}
/*Função para reinicializar os dados do jogo*/
void flushData(t_tableD... |
C | #include <stdio.h>
int main()
{
int tam, num = 1, run, tri; scanf("%d", &tam);
for (run = 0; run <= tam; run ++)
{
int soma[run];
for (tri = 0; tri <= run; tri ++)
{
printf("%d\n", num);
soma[tri] =
}
}
return(0);
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include "pds.h"
#include "bst.h"
#include <errno.h>
#include <string.h>
struct PDS_RepoInfo repo_handle;
int pds_open( char *repo_name, int rec_size )
{
char repofilename[30];
strcpy(repofilename, repo_name);
strcat(repofilename, ".dat");
if(repo_handl... |
C | #include <stdio.h>
#include <string.h>
int ft_strlen(char *);
int main()
{
char *c = "hellow!";
char *b = "\0";
char *d = "";
char *a = "a";
printf("%lu, %d\n",strlen(c),ft_strlen(c));
printf("%s\n",c);
printf("%lu, %d\n",strlen(b),ft_strlen(b));
printf("%lu, %d\n",strlen(d),ft_strlen(d));
printf("%lu, %d\n",... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* write_wchar.c :+: :+: :+: ... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
// pointer + 1
//int main()
//{
// //int: 4 bytes. E.g. 0x00 00 00 01 is stored in memory as follows:
// // low address(little endian) high address(big endian)
// // |01|00|00|00|02|00|00|00|03|00|00|00|04|00|00|00|
// //
// //
// // array a starts... |
C | /*
It creates a memory object "/myMemoryObj"
Object can be found: /dev/shm
to be compiled with "-lrt"
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/stat.h> /* For mode constants */
#include <fcntl.h> /* For O_* constants */
#include <unistd.h>
#include <sys/typ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
// ----- Declaracion de Funciones -----
float get_n(char *str);
int get_option(int min, int max, char *str);
int partition(float arr[], int start, int end);
void clear();
void display_stgs(int n, int m, char arr[n][m]);
void get_arr(float arr[], int si... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dlfcn.h>
#define SENO "-s"
#define ARC_SENO "-a"
void displayNumero(char * opcao, double numero);
double calculaResultado(char * opcao, double numero);
int main(int argc, char * argv[]){
if(argc > 2){
double angulo;
angulo = atof(argv[2]... |
C | #include "Array.h"
Vector mul(Vector v1, Vector v2){
if(v1.count != v2.count){
puts("Cannot multiply vectors of differing length.");
return empty_vector();
}
Vector prod = empty_vector();
int index;
for(index = 0; index < v1.count; index++){
insert(&prod, v1.vector[index] * v... |
C | #include <stdio.h>
int main()
{
int n,remainder,sum=0 ;
printf("Enter the number: ");
scanf("%d",&n);
while (n!=0)
{remainder=n%10;
sum+=remainder;
n=n/10;
}
printf("\n\nYour entered digit Sum= %d",sum);
return 0;
}
|
C | #include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#ifndef INT16_MAX
enum { INT16_MAX = (1 << 0) + (1 << 1) + (1 << 2) + (1 << 3) + (1 << 4) + (1 << 5) + (1 << 6) + (1 << 7) +
(1 << 8) + (1 << 9) + (1 << 10) + (1 << 11) + (1 << 12) + ... |
C | #include <stdio.h>
#include <unistd.h>
int
do_something(){
printf("doing someting \n");
return 0;
}
int
main(){
do_something();
/*切换到后台服务模式*/
daemon(NULL, NULL);
while (1) {
do_something();
sleep(1);
}
}
|
C | /*
emain.c
Copyright (C) 2016 Adapteva, Inc.
Contributed by Ola Jeppsson <ola@adapteva.com>
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
(at your... |
C | #include<stdlib.h>
#include<stdio.h>
#include<time.h>
#include<string.h>
int main (void)
{
char name[30];
int x;
srand(time(NULL));
printf("Please enter a string.");
scanf("%s", name);
x=(rand()% (1300-1200))+1200;
printf("%s %d",name,x);
return EXIT_SUCCESS;
}
|
C | #include <stdio.h>
/* Максимален брой върхове в графа */
#define MAXN 200
/* Брой върхове в графа */
const unsigned n = 6;
/* Матрица на съседство на графа */
const char A[MAXN][MAXN] = {
{ 0, 10, 0, 5, 0, 0 },
{ 0, 0, 5, 0, 0, 15 },
{ 0, 0, 0, 10, 5, 0 },
{ 0, 10, 0, 0, 10, 0 },
{ ... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *fptr;
char ch;
if ((fptr = fopen("myfile.txt", "w")) == NULL)
{
printf("Error in opening file :\n");
exit(1);
}
printf("Enter text :\n");
/*Press Ctrl+z/Ctrl+d to stop reading character*/
while ((ch = getchar()) !=... |
C | /*
* Copyright 2021 Regents of the University of Michigan
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by a... |
C | #include <math.h>
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char **argv)
{
int size = atoi(argv[1]);
double *array = (double *) malloc(sizeof(double) * size);
double total = 0;
for ( int i = 1; i < size; i++ )
{
if ( i % 1000001 == 1000000 )
array[0] = 100000;
array[i] = array[... |
C | //(Single Line Comment)
/*
Multiple Line
Comment
*/
// Pre-Processor Directive
#include<stdio.h>
#include<conio.h> // it is optional to mention
/*
# - Pre-Processor
include
Directive: Directory / Folder
<stdio.h>: Standard Input / Output
<conio.h>: Console Input / Output
*/
// main() - Entry p... |
C | #include <stdlib.h>
#include "phonebook_hash_djb2_3.h"
/* TODO: FILL YOUR OWN IMPLEMENTATION HERE! */
unsigned long hash(unsigned char *str)
{
unsigned long hash = 5381;
int c;
while (c = *str++)
hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
return hash;
}
entry *findName(char lastNa... |
C | /*
4. Ÿ DATE ü DATE ü Ű ¥ "2019/1/1" ó ϴ print_date Լ Ͻÿ.
DATE ü print_data Լ ̿ؼ Է¹ ¥ ϴ α ۼϽÿ.
? [ 2019 ]
? [ 1 ]
? [ 1 ]
2019/1/1
*/
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
void print_date_1(DATE);
typedef struct date {
int year;
int month;
int day;
}DATE;
void pa10_04() {
DATE data;
printf... |
C | //
// Created by xing on 2020/7/17.
//
#include <stdio.h>
#include <assert.h>
#include<stdlib.h>
/**
* 字符串复制
* @param sub
* @param arr
* @return
*/
char *Strcpy(char *sub, char *arr) {
if (sub == NULL || arr == NULL)
return NULL;
char *tem = sub;//定义一个指针tem保存字符串首元素地址
while (*arr != '\0')//复制字... |
C | /* No.9498 ٲٴ */
#include <stdio.h>
int main()
{
int num;
scanf("%d", &num);
if (num <= 100 && num >= 90)
printf("A \n");
else if (num >= 80)
printf("B \n");
else if (num >= 70)
printf("C \n");
else if (num >= 60)
printf("D \n");
else
printf("F \n");
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <windows.h>
#include "CeldaMazo.h"
#include "Cartas.h"
nodoJugador *generarBot(){
char bots[30]={"Bots.dat"}; ///Ruta de los bots
FILE *archi = fopen(bots, "rb");
srand(time(NULL));
nodoJugador *aux = NULL;
if(ar... |
C | #include<stdio.h>
#include<stdlib.h>
// Porovn vk dvou student uitm funkce a vlastnch strukturovanch datovch typ, nsledn vype
// Zadn - http://jazykc.inf.upol.cz/strukturovane-datove-typy/index.htm
typedef struct {
char Den, Mesic; short Rok;
} Datum;
typedef struct {
char jmeno[20], prijmeni[20]; Datum narozen;... |
C | #include <stdio.h>
#include <string.h>
int main()
{
char original[] = "Am I the original?";
char duplicate[] = "Overwritten";
printf("Here is the original string: %s\n",original);
strcpy(duplicate,original);
printf("Here is the duplicate: %s\n",duplicate);
return(0);
}
|
C | #include "minitalk.h"
void char2binary(char c, char *dest)
{
int i;
unsigned char d;
i = 0;
while (i < 8)
{
d = 0x1 & c >> i;
if (d == 0)
dest[i] = '0';
else
dest[i] = '1';
i++;
}
}
void int2binary(t_uint n, char *str)
{
unsigned long i;
unsigned char d;
i = 0;
while (i < sizeof(t_uint) *... |
C |
#include "button.h"
#include <string.h>
static int default_on_draw(struct button *button, struct display_buf *buf)
{
dismgr_draw_region(&button->region, COLOR_DEFAULT_BUTTON);
dismgr_draw_text_in_region(button->text, &button->region, COLOR_DEFAULT_TEXT);
dismgr_flush(&button->region, buf);
return 0;
... |
C | #include <stdio.h>
#include <string.h>
/* Reverses a string in C */
void reverseString(char* s) {
//assume null terminated
if (s == NULL) {
return;
}
int length = strlen(s);
if (length <= 1) {
return;
}
char *start = s;
char *end = s + length -1;
while(start < en... |
C | #include <stdio.h>
#include <string.h>
void ForcaBruta(char T[], int n, char P[], int m){
int i, j, k;
for(i=0; i<(n-m+1); i++){ //n-m+1 pra nao dar segFault no fim da string
k = i; //posiçao no texto
j = 0; //posiçao no padrao
while(T[k] == P[j] && j < m){
//percorre o texto e o padrao ao mesmo tempo enqua... |
C | #include "holberton.h"
/**
* set_string - sets a value of char to pointer
* @s: pointer memory area
* @to: pointer for char to fill
*
* Return: (void)
*/
void set_string(char **s, char *to)
{
*s = to;
}
|
C |
/*
** Parses a list of output from evalbites to summarize the
** total results, giving total TP, FP and U, as well as
** the TPR and PPV.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
FILE *fpt;
int tp,fp,u,total_tp,total_fp,total_u;
int total_files;
if (argc... |
C | #include <stdio.h>
int main()
{
int input, i;
while(1){
scanf("%d", &input);
if(input==0){
break;
}
else{
for(i=1; i<input; i++){
printf("%d ", i);
}
printf("%d\n", input);
}
}
return 0;
}
|
C | #include "../binaryTree.c"
// Perform a postorder traversal of the BST where the result is: { 25, 75, 50, 110, 125, 175, 150, 100 }
//
//
// __ 100 __
// / \
// 50 150
// / \ / \
// 25 75 125 175
// /
// ... |
C | #include <stdio.h>
int main(void) {
int T, t, R, C, W;
scanf("%d", &T);
for (t = 1; t <= T; ++t) {
scanf("%d%d%d", &R, &C, &W);
printf("Case #%d: %d\n", t, (C - 1) / W + W);
}
return 0;
}
|
C | #include<stdio.h>
int main(){
float a,b;
printf("Enter the first number :");
scanf("%f",&a);
printf("Enter the second number :");
scanf("%f",&b);
printf("Sum : %f \n", a*b);
return 0;
}
|
C |
#include "../headers/fftc_fixedpt.h"
static const unsigned BitPosition[32] =
{0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,
31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9};
unsigned reverseBits(unsigned number, unsigned N)
{
unsigned reversed = 0;
unsigned lInd = N >>... |
C | //#include <stdio.h>
//#include <stdlib.h>
//#include <string.h>
//#include <Windows.h>
//#include <math.h>
//#include <time.h>
//#include "58.h"
//#define SIZE 128
//int MyStrlen(const char *str);
//int main()
//{
// const char* str = "abcdef12";
// printf("%d",MyStrlen(str));
// return 0;
//}
//int MyStrlen(const ch... |
C | #include <stdio.h>
#include "linked_list.h"
#include <stdlib.h>
int main() {
node_t* head = NULL;
head = malloc(sizeof(node_t));
head->value = 192;
node_t* node1 = malloc(sizeof(node_t));
head->next = node1;
node1->value = 168;
node_t* node2 = malloc(sizeof(node_t));
node1->next = node... |
C | #include<stdio.h>
#include<math.h>
int main(){
int i,i1,i2, centroid1, centroid2, k=2;
int data_set[10];
char product[20], cluster1[10], cluster2[10];
printf("\n");
printf("**************************************************************Welcome to Customer Segmentation Application****************************... |
C | /*
* Copyright (c) 2019 triaxis s.r.o.
* Licensed under the MIT license. See LICENSE.txt file in the repository root
* for full license information.
*
* enums.h
*/
#pragma once
#include <base/base.h>
#ifdef __cplusplus
//! Declares friend operators suitable for an enumeration containing flags
/*! This has to ... |
C | void basicDrive (int leftPower, int rightPower) {
motor[LDrive] = leftPower;
motor{RDrive] = -rightPower;
}
//void basicHorizontalIntake (int power) {
// motor[HIntake] = power;
// }
void basicIntake (int power) {
motor[VIntake] = -power
motor[HIntake] = power;
}
//void basicBothIntakes (int po... |
C | #include"stdio.h"
// #include"gsl_matrix.h"
#include"gsl/gsl_matrix.h"
int print_half_00(gsl_matrix* m)
{
// double half = 1/2;
double half = 1./2;
// int *status = printf( "half m_{00} = %i\n", gsl_matrix_get(&m,0,0)*half );
int status = printf( "half m_{00} = %g\n", gsl_matrix_get(m,0,0)*half);
// gsl_matrix_fr... |
C | #include<stdio.h>
#include<math.h>
int main()
{
double a, b, c,r,th;
int t = 1;
while (scanf("%lf : %lf", &a, &b) == 2)
{
th = atan(b / a);
r = a / 2 * a / 2 + b / 2 * b / 2;
c = 400 / (2 * a + 4 * th * sqrt(r));
printf("Case %d: %.10f %.10f\n", t++, a * c, b * c);
}
return 0;
... |
C | #include "beep.h"
void BEEP_GPIO_Config(void)
{
/*һGPIO_InitTypeDef͵Ľṹ*/
GPIO_InitTypeDef GPIO_InitStructure;
/*ƷGPIOĶ˿ʱ*/
RCC_APB2PeriphClockCmd( BEEP_GPIO_CLK, ENABLE);
/*ѡҪƷGPIO*/
GPIO_InitStructure.GPIO_Pin = BEEP_GPIO_PIN;
/*GPIOģʽΪͨ*/
GPIO_InitStructure.GPIO_Mode = GPIO_M... |
C | // ----------------------------------------------------------------------
// file: card.c
//
// Description: This file implements the CARD module. Its job is to
// create an interface for providing cards from a shuffled deck of
// 52 standing playing cards. Each call to card_get() will return
// the top car... |
C | #include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
#include "queue.h"
struct _args {
queue q;
int value;
} _args;
void * insert (void * insert_arguments) {
struct _args * args = (struct _args *) insert_arguments;
q_insert(args->q,(void*) &args->value);
printf("Inserted --------------... |
C | // Linked List implementation of Stack data structure
#include <stdio.h>
#include <stdlib.h> // For malloc()
int read_element(){
int element;
scanf("%d", &element);
return element;
}
struct Node{
int data;
struct Node* next;
};
// Aliasing struct Node* to MyNode
typedef struct Node* MyNode;
void display(M... |
C | #include<stdio.h>
#include<cs50.h>
int getValue(){
int temp = 0;
printf("Height: ");
temp = GetInt();
while(temp < 0 || temp > 23){
printf("Height: ");
temp = GetInt();
}
return temp;
}
int main(void){
int f = getValue();
int i = 0;
int start = 2;
for(i=0;i<f;i++)... |
C | //2) Faça um Programa que peça dois números e imprima o maior deles.
#include <stdio.h>
#include <stdlib.h>
int main() {
int a, b = 0;
printf("Digite dois numeros:\n");
scanf("%d", &a);
scanf("%d", &b);
if(a>b){
printf("\n%d", a);
}else{
printf("\n%d", b);
}
return 0... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_token.c :+: :+: :+: ... |
C | #include "header.h"
/*****************************************************/
//
/*****************************************************/
void make_ekran_chose_settings_df(void)
{
const unsigned char name_string[MAX_NAMBER_LANGUAGE][MAX_ROW_SETTINGS_DF][MAX_COL_LCD] =
{
{
" ",
" "... |
C | /* Пренапишете Задача 2 от 05.03.2021г за Пощенските такси на дадена
куриерска фирма се определят според тежестта на пратките (с точност до цял грам) и обема,
както е показано в таблицата.
При влизане в някоя функция отваряте файл за писане и при успешно излизане от функцията
записвате във файла function_name() suc... |
C | #ifndef COMP_371_A1_KEYBOARDCONTROLS_H
#define COMP_371_A1_KEYBOARDCONTROLS_H
#endif
#include <glew.h>
#include <GLFW/glfw3.h>
#include "../GLM/glm/matrix.hpp"
#include "../GLM/glm/gtc/matrix_transform.hpp"
/*
* This method defines what occurs when the w key is pressed on the keyboard. For this assignment, it modifi... |
C | #include<stdio.h>
#define OK 0
#define ERR_IO 1
/*
Функция считает число из поредицу фибоначи,
Как параметр задаем номер число из поредицу которое хотим вычеслить
n
*/
int fib(int n)
{
int fib1 = 1, fib2 = 1, fib3;
if (n == 0)
fib2 = 0;
else
{
for (int i = 3; i <= n; i++)
{
... |
C | #include <stdio.h>
void printArray(int *A, int n)
{
int i;
for (int i = 0; i < n; i++)
{
printf("%d ", A[i]);
}
printf("\n");
}
void bubbleSort(int *A, int n)
{
int temp;
for (int i = 0; i < n - 1; i++)
{
for (int j = 0; j < n - 1 - i; j++)
{
if (A[j] > A[j + 1])
{
temp = A[j];
A[j] = A[j + ... |
C | /*
* mm.c
*
* In this approach, a block is allocated using LIFO and an Explicit
* Free List. An occupied block has a header and a footer, while a
* free block also has a pointer to the previous and next free blocks.
* Blocks are coalesced and thus reused. Realloc is currently
* implemented directly using mm_mal... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print.c :+: :+: :+: ... |
C | #include "libft.h"
static int ft_find(char const *set, char c)
{
int i;
i = 0;
while (set[i] != '\0')
{
if (set[i] == c)
return (1);
i++;
}
return (0);
}
char *ft_strtrim(char const *s1, char const *set)
{
char *res;
int i;
int begin;
int end;
i = 0;
if (!s1 || !set)
return (NULL);
while (... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* flagd.c :+: :+: :+: ... |
C | #include<stdio.h>
int main()
{
printf("char size : %d\n", sizeof(char));
printf("short size : %d\n", sizeof(short));
printf("int size : %d\n", sizeof(int));
printf("long size : %d\n", sizeof(long) );
printf("long long size : %d\n", sizeof(long long));
return 0;
}
/*
#include<stdio.h>
int main()... |
C | #include <math.h>
#include <stdio.h>
const int MAX = 3;
// "return" multiple values;
void multiple_values(int n, int* square, double* square_root)
{
*square = n * n;
*square_root = sqrt(n);
}
void run_multiple_values()
{
int n = 100;
int sq;
double square_root;
multiple_values(n, &sq, &square_root);
... |
C | #include <stdio.h>
void safeFlush()
{
char c;
while((c = getchar()) != EOF && c != '\n');
}
int main ()
{
float l1,l2,a;
printf("Digite os dois lados do paralelogramo: ");
scanf("%f %f",&l1,&l2);
safeFlush();
a = l1*l2;
printf("A area do paralelogramo e': %f\n",a);
return 0;
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr_base.c :+: :+: :+: ... |
C | #include <sys/msg.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
enum { N = 10, M = 5 };
typedef struct
{
long author;
char txt[81];
} msg_t;
int main()
{
key_t key = ftok("/usr/bin/shell", '1');
int msg = msgget(key, IPC_CREAT | 0777);
msgctl(msg, IP... |
C | #include<stdio.h>
#include<stdlib.h>
#include<pthread.h>
#include<semaphore.h>
struct thread_argument
{
int thread_num;
void (*function)(void *);
void *function_argument;
};
struct quicksort_argument
{
int T_num;
int left;
int right;
};
struct bubblesort_argument
{
int* data;
int begin;
int end;
};
struct... |
C | /*
* client2.c
*
* Created on: Aug 7, 2013
* Author: rick
*/
#include "common.h"
int management_enter_datas(char *argv[], int argc){
// if (!strcmp(argv[0], "send")){
// argv++; argc--;
// if (!(management_send(argc, argv))){
// return 0;
// }
// }else if (!strcmp(argv[0], "retrieve")){
// argv++;... |
C | #include <stdio.h>
#include <math.h>
int main ()
{
float i=0.0;
while (scanf("%f",&i)!= EOF) {
int a = floor(i);
int b = round(i);
int c = ceil(i);
printf("%d %d %d\n",a,b,c);
}
printf("Done.\n");
}
|
C | //#include<stdio.h>
#define SORT(a,b,t) {if(a>b){t=a;a=b;b=t;}
int main()
{
int arr[10]={3,4,2,6,7,1,8,5,9,10};
int temp,i,j;
printf("enter array element is: ");
for(i=0;i<10;i++)
printf("%d ",arr[i]);
printf("\n");
for(i=0;i<10;i++)
{
for(j=i+1;j<10;j++)
SORT(arr[i],arr[j],temp)
... |
C | /*#########################################################
## CS 3710 (Winter 2010), Assignment #2, Question #2 ##
## Program File Name: itemCount.c ##
## Student Name: Todd Wareham ##
## Login Name: harold ##
## MU... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 5_stacksort.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <netdb.h>
#include <errno.h>
#include <syslog.h>
#include <sys/socket.h>
#define BUFLEN 128
#define QLEN 10
#ifndef HOST_NAME_MAX
#define HOST_NAME_MAX 256
#endif
int initserver(int type, const struct sockaddr *addr, socklen_t alen, int ql... |
C | /******************************************************************************
[HEADER]
This library contains different common utilities used by most of the
other functions.
******************************************************************************/
#include <string.h>
#include <math.h>
#include <time.h>
#incl... |
C | /* 5.9-3 */
#include <stdio.h>
unsigned int reverse_bits( unsigned int value );
int main( void ) {
unsigned int value;
printf( "%s\n", "please enter an unsigned number:" );
scanf( "%d", &value );
printf( "\nthe bitwise-reversed number in decimal:\t%u\n", reverse_bits( value ) );
return 0;
}
unsigned int reverse_... |
C | /*
* Example for Step-up click
*
* Date Apr 2017
* Author Djordje Rosic
*
* Test configuration KINETIS :
* MCU : MK64
* Dev. Board : HEXIWEAR docking station
* SW : mikroC PRO for ARM v5.0.0
*
* Description :
*
* Connect the clic... |
C | #include <stdio.h>
int main()
{ int i;
puts("x x+10 x+20 x*10");
for(i=5;i<=25;i=i+5)
{ printf("%d %d %d %d \n" ,i,i+10,i+20,i*10);
}
return 0;
}
|
C | #include<stdio.h>
int main()
{
int n,i,num,m,count=0,j;
scanf("%d",&n);
char array[10000];
for(i=0;i<10000;i++)
{
array[i]=0;
}
for(i=0;i<n;i++)
{
scanf("%d",&num);
if(array[num]==2)
count--;
array[num]=1;
scanf("%d",&m);
for(j=0;j<m;j++)
{
scanf("%d",&num);
if(array[num]==0)
{
a... |
C | /** @file
Testy inputu/outputu drzewa.
@ingroup dictionary
@author Jan Gajl <jg332124@students.mimuw.edu.pl>
@date 2015-06-06
*/
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <stdlib.h>
#include <cmocka.h>
#include "trie.h"
#include "dictionary.h"
#include "io_utils.h"
#include <string.... |
C | /*
Obtém o valor máximo em um vetor de inteiros gerados aleatoriamente
*/
#include <stdio.h>
#include <mpi.h>
#include <time.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int n, n_nos, rank;
MPI_Status status;
int vetor[100000], i, k;
int max_val_parcial, max_val_total, max_val;
MPI_Init(&argc, &arg... |
C | #include <bits/stdc++.h>
using namespace std;
int n,m;
char grid[1005][1005];
int vis[1005][1005];
int x[4]={1,0,-1,0};
int y[4]={0,1,0,-1};
pair<int,int> src,u,v;
queue< pair<int,int> > Q;
bool is_safe(pair< int,int > curr)
{
if(curr.first>=1 && curr.first<=n && curr.second>=1 && curr.second<=m && vis[curr.first][c... |
C | // Daniel Christiansen
// ECE373
// HW #3
// User-space program to talk to pci driver
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#define LED_ON 0xE
#define LED_OFF 0xF
int main() {
int fd, len, buf;
// Open driver
fd = open("/dev/pci_driver", O_RDWR);... |
C | #include <stdio.h>
void *multiply(int a, int b, int *c);
int main(void)
{
int a, b;
printf("Enter numbers: ");
scanf("%d %d", &a, &b);
int c = 0;
multiply(a, b, &c);
printf("%d\n", c);
}
/* Multiply a with b and stores result in pointer c */
void *multiply(int a, int b, int *c)
{
*c = a * b;
}
|
C | #include "terrain.h"
/**
* destroy_renderer - function called on exiting from program to deallocate
* the SDL2 renderer.
* @status: exit status
* @rend: pointer to renderer
*/
void destroy_renderer(int status, void *rend)
{
(void) status;
if (rend)
SDL_DestroyRenderer(rend);
}
/**
* destroy_window - f... |
C | // Pulled from https://github.com/ob/rules_ios/tree/a86298de81efd92f9719ff8f9ff5f4ef4c1b0878/rules
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/errno.h>
#include "hmap.h"
struct {
char* key;
char* value;
} testdata[10] = {{"foo.h", "bar/baz/foo.h"},
{"bam.h", "ba... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* libft.h :+: :+: :+: ... |
C | #include <stdlib.h> //malloc
#include <stdio.h> //printf
#include "datalink.h"
#include "application.h"
#include "shared.h"
void testOpenNClose()
{
initDatalinkLayer(9600, 256, 1, 10, 0.0);
int fd = llopen(COM1, RECEIVE);
printf("llopen returned fd = %d\n", fd);
printf("Sleeping for 3 secs.\n");
... |
C | #include<stdio.h>
void main()
{
int s,e,i,j,count=0;
scanf("%d%d",&s,&e);
for(i=s;i<=e;i++)
{
for(j=2;j<=(i/2);j++)
{
if((i%j)==0)
{
count++;
}
}
if(count==0)
{
printf("%d ",i);
}
count=0;
}
}
|
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
/**
* @file header.h
* @author ayushi (ayushiag882@gmail.com)
* @brief mini_project
* @version 0.1
* @date 2021-04-15
*
* @copyright Copyright (c) 2021
*
*/
#ifndef __HEADER_H__
#define __HEADER_H__
typedef enum error_t{
ERROR_NULL_PTR = -2,
SU... |
C | /**
* @file semaphores_posix.c
*
* @brief Functions for working with shared semaphores - POSIX Semaphores (wait if zero)
* @date 2020-05-06
* @author F3lda
* @update 2021-04-26
*/
#include "semaphores_posix.h"
int semaphore_create(sem_t **semaphore, char *name, int value)
{
errno = 0;
if ((*se... |
C | /**
* @file
*
* @brief Tests for specload plugin
*
* @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <tests_plugin.h>
#include "testdata.h"
#include <config.c>
#include <unistd.h>
#define BACKUP_STDIN() int stdin... |
C | /* ====================================================
# Copyright (C)2020 All rights reserved.
#
# Author : Pandora
# Email : pandora@github.com
# File Name : c_linked_list.h
# Last Modified : 2020-04-27 19:10
# Describe :
#
# ====================================================*/
... |
C | //
// OS Windows
// 2020.03.16
//
// [Algorithm Problem Solving]
//
// [ùķ̼] <jungol#1319> ڰ
//
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#define SZ 100
int arr[SZ], prev[SZ], N;
void go()
{
register int i, nxt;
for (i = 0; i < N; ++i)
{
nxt = (i + 1) % N;
prev[nxt] = arr[i] / 2;
}
for (i = 0; i < N; ... |
C | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "pokemon.h"
#include "jogador.h"
Nopok *PegaPok(Listapok *l, int i... |
C | #include <stdio.h>
#include <stdlib.h>
float income;
float deduction;
float getInput(float income, float deduction ) {
float uInput = -1;
// use do-while loop to gurantee one execution
while (uInput != 0) {
printf(" Enter the next amount : ");
scanf("%f", &uInput);
if(uInput > 0) ... |
C | #include<stdio.h>
void main ()
{
int x,y;
for(x=5;x>=1;x--){
for(y=1;y<=x;y++){
printf("%d\t",y);
}
printf("\n");
}
}
|
C | #include "HAL9000.h"
#include "dmp_nt.h"
void
DumpNtHeader(
IN PPE_NT_HEADER_INFO NtHeader
)
{
ASSERT( NULL != NtHeader );
LOG("Image Base: 0x%X\n", NtHeader->ImageBase);
LOG("NT base: 0x%X\n", NtHeader->NtBase );
LOG("Image Size: 0x%X\n", NtHeader->Size);
LOG("Image... |
C | /* CMSC 426 Project
* File: klogger.c
* Author: Patrick Carroll <pcarrol1@umbc.edu>
* Date: December 2007
*
* This file is a user-space keylogger written for Linux. It works by reading
* directly from the PS/2 port and interpreting the scancodes it sees into
* characters.
*
* IMPROVEMENTS:
* o Could inter... |
C | #include <stdio.h>
int main(int argc, char const *argv[])
{
int n;
scanf("%d", &n);
for (int i = 0; i < 20; i++)
{
if (n & 1)
{
printf("%d*3+1=%d\n", n, n * 3 + 1);
n = n * 3 + 1;
}
else
{
printf("%d/2=%d\n", n, n / 2);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.