language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /* cdok -- Calcudoku solver/generator
* Copyright (C) 2012 Daniel Beer <dlbeer@gmail.com>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* T... |
C | #include <stdio.h>
#include <stm32f4xx_gpio.h>
#include <stm32f4xx_rcc.h>
#define I2C_TIMEOUT_MAX 0xff
#define MEM_DEVICE_READ_ADDR 0xA0
#define MEM_DEVICE_WRITE_ADDR 0xA1
#define M2402 1
#define M24512 2
void Delay(long i) {
while (i--) { asm ( "nop" ); };
}
void init_GPIO(void) {
GPIO_InitTypeDef GPIO_Output;
... |
C | #ifndef _WORK_QUEUE_H_
#define _WORK_QUEUE_H_
/*
*线程池里所有运行和等待的任务都是一个work_t
*由于所有任务都在链表里,所以是一个链表结构
*/
typedef struct work_s
{
/*回调函数,任务运行时会调用此函数,注意也可声明成其它形式*/
void *(*process) (void *arg);
void *arg;/*回调函数的参数*/
struct work_s *next;
} work_t;
/*线程池结构*/
typedef struct work_queue_s
{
... |
C | #include "stdio.h"
#include "unistd.h"
#include "stdlib.h"
#include "pthread.h"
#define N 100
#define x 10000000000
long long int contador = 0;
pthread_mutex_t lock_contador = PTHREAD_MUTEX_INITIALIZER;
void* incrementar(void* arg){
int id = *((int *) arg);
printf("Criou uma pthread com id = %d\n", id);
... |
C | #include <iso646.h> // simplified rewrite of the text editor by dwrr on 2304307.024007
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <time.h>
#include <errno.h>
#include <signal.h>
#include <unistd.h>
#include <termios.h>
#include <sys/time.h>
#includ... |
C | #include<stdio.h>
int main()
{
int a;
a=2;
{
int a;
a=4;
{
int a;
a=7;
printf("Inner Inner a= %d\n",a);
}
printf("Inner a= %d\n",a);
}
printf("Outer a= %d\n",a);
return 0;
} |
C | #define _POSIX_SOURCE
#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <sys/wait.h>
#include <signal.h>
#include <unistd.h>
#include <sys/stat.h>
#include <ctype.h>
#include <time.h>
#define PERM 0644
typedef int pipe_t[2];
typedef struct{
int c1; // pid
int c2; // secondo c... |
C | #include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{
int fd;
char * buf = "This is a test!";
fd = open("./file1", O_RDWR | O_APPEND);
printf("fd = %d\n", fd);
//ssize_t write(int fd, const voi... |
C | #include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
//#include <unistd.h>
pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER;
int msg;
pthread_cond_t has_product = PTHREAD_COND_INITIALIZER;
void * c(void *arg)
{
int counter = 0;
while (1)
{
counter++;
pthread_mutex_lock(&mylock);
// 1. release myl... |
C | #include<stdio.h>
double pi=3.14;
void my_fn()
{
pi=3.1416;
}
int main()
{
printf("%lf\n",pi);
my_fn();
printf("%lf\n",pi);
return 0;
}
|
C | #include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <netinet/in.h>
#include <sys/wait.h>
#include <string.h>
#include "outil.h"
#define couleur(param) printf("\033[%sm",param)
#define NOIR "30"
#define ROUGE "31"
... |
C | #include "libftprintf.h"
int ft_dec_minus(int width, int precision, long d, int dot)
{
int t;
int len;
len = 0;
t = ft_cast_putnbr(d);
if (d == 0 && dot && !precision)
{
len += ftt_putchar(' ', width);
return (len);
}
if (!precision || precision <= t)
{
len += ftt_putnbr(d);
len += ftt_putchar(' ', w... |
C | #include<stdio.h>
#include<conio.h>
#define MAX 5
typedef struct
{
int key;
}element;
int top=-1,item;
element s[MAX];
void push(int,int *);
int pop(int*);
void display(int *);
void main()
{
int ch,f;
clrscr();
do
{
clrscr();
printf("\n\t 1.. Push ");
printf("\n\t 2.. Pop ");
printf("\n\t 3.. Display "... |
C | # include<stdio.h>
# include<conio.h>
void main()
{
int i,j,x[10],no,last,cnt=0,temp,k;
clrscr();
printf("\n\t :===>How Many No can be Entered:----->");
scanf("%d",&no);
for(i=0;i<no;i++)
{
printf("\n\t Enter the No:----->");
scanf("%d",&x[i]);
}
printf("\n");
printf("\n\t :===>Array Before Bubble:---... |
C | #include<stdio.h>
#include<ctype.h>
#pragma warning(disable:4996)
int main()
{
int i = 0;
char str[100];
printf("ȯϰ ڿ ԷϽÿ : ");
gets(str);
for (i = 0; str[i]; i++){
if (islower(str[i]))
str[i] = toupper(str[i]);
else if (isupper(str[i]))
str[i] = tolower(str[i]);
}
puts(str);
} |
C | /// EXERCICIO 2 ///
/*
ALUNO: EDGAR DOS REIS
GRR: 20111758
Contadores:
Modo UP/DOWN
t = 1.5 s
f = 1M hz
div = 8
T' = 8u s
N = 46.875
Modo UP
t = 0.4 s
f = 1M hz
div = 8
T' = 8u s
N = 50.000
Modo UP/DOWN
t = 0.5 s
f = 1M hz
div = 8
T' = 8u s
N = 15.625
*/
#include <msp430g2553.... |
C | #include<stdio.h>
void main()
{
//unsigned short int x = 65536;
//signed short x = 32768;
unsigned short x = -4;
clrscr();
printf("%d\n", x); // signed
printf("%u\n", x); // unsigned
getch();
} |
C | int main()
{
int n;
int i,j;
printf("\n Enter 5 integers in a single line separated by space (1-30):\n");
for(i=1;i<=5;i++)
{
scanf("%d",&n);
printf("\n%2d ",n);
for(j=1;j<=n;j++)
printf("*");
}
}
|
C | /*4. Faa um programa que leia um nmero do tipo float e depois o exiba na tela.*/
#include <stdio.h>
main ()
{
float n1;
printf("Digite um numero:\n");
scanf ("%f",&n1);
printf("%f",n1);
}
|
C | #include "goatee_hashmap.h"
#define TOPBIT (1 << 7)
#define POLYNOMIAL 0x9b
#define HMSIZE 256
static unsigned char table8[256];
static int tinit = 0;
void crc8_init() {
int dividend;
unsigned char bit, remainder;
tinit = 1;
/*
* Compute the remainder of each possible dividend.
*/... |
C | #include "holberton.h"
/**
*add - adds two integers
*@a: it is int parameter
*@b: it is int parameter
*Description: This function adds two functions
*Return: return a + b
*/
int add(int a, int b)
{
return (a + b);
}
|
C | #include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv)
{
float a, b;
a = atoi(argv[1]);
scanf("%f", &b);
printf("%f\n", b * a);
}
|
C | #include <stdio.h>
#include <stdlib.h>
/**
* 伯努利实验,实验n次,出现k次的概率
* 非递归方式实现,采用二维数组存储已经计算过的值
* 时间复杂度: O(n * k) 空间复杂度: O(n * k)
*
* @param n
* @param k
* @param p
* @return
*/
double binomialArray(int n, int k, double p) {
double array[n + 1][k + 1];
// 初始化数组
for (int i = 0; i <= n; i++) {
... |
C | #include <stdio.h>
#include "avi.h"
#include <string.h>
#define PAD_EVEN(x) ( ((x)+1) & ~1 )
#define strncasecmp(x,y,z) _tcsnicmp(x,y,z)
//static size_t avi_read(int fd, char *buf, size_t len)
//{
// size_t n = 0;
// size_t r = 0;
//
// while (r < len) {
// n = read(fd, buf + r, len - r);
//
// if ... |
C | #include <stdio.h>
int main(void) {
float variavel;
variavel = 1000.0;
printf ("%f\n", variavel);
variavel = variavel + 0.00000000000001;
printf ("%f\n", variavel);
}
|
C | #include "stdio.h"
int search1(char s[], char c)
{
int i;
int k = 0;
//printf("%d\n", i );
for (i = 0; s[i] != '\0'; i++)
//printf("%d %c\n", i, s[i]);
if (s[i] == c) k++;
return k;
}
int main()
{
char s[] = "alabalk";
char c = '1';
printf("%d\n", search1(s, c));
return 0;
} |
C | /*
* AD9850.h
*
* Created on: 5-okt.-2015
* Author: Robbe
*/
#ifndef STM32DEV_INCLUDE_GENERAL_AD9850_H_
#define STM32DEV_INCLUDE_GENERAL_AD9850_H_
// PINS FROM IC
/*
PIN NO MNEMONIC DESCRIPTION
4 to 1, 28 to 25 D0 to D7 8-Bit Data Input. This is the 8-bit data port for iteratively loading the 32-bit ... |
C | /*
* Copyright (C) 2009-2011 by Benedict Paten (benedictpaten@gmail.com)
*
* Released under the MIT license, see LICENSE.txt
*/
/*
* reconcilliation.c
*
* Created on: 31-Mar-2010
* Author: benedictpaten
*/
#include <assert.h>
#include "cactus.h"
#include "commonC.h"
Event *labelAndReturnEvent(struct B... |
C | /* it's all too easy to start over-complicating this: for example quotations. Here you woul dneed to check the last 2 characters of everyword, not just the last one, i.e "stop!", that adds new layers. */
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#ifdef DBG
#define CBUF 2
#define WABUF 1
#define LBUF 2
#e... |
C | #pragma once
#include <math.h>
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#ifndef M_PI_2
#define M_PI_2 1.57079632679489661923
#endif
#ifndef M_PI_4
#define M_PI_4 0.785398163397448309616
#endif
//структура синусов углов Эйлера , для совмещения с классом SMat
struct TSinus
{
double Teta, Gam... |
C | /*
* name: Whelpley
* date: 20 Feb 2019
* project: Lab10.6A - PREPROCESSOR DIRECTIVES
*
* Write a C program with preprocessor directives to:
* Combine two string literals
* Wrap those string literals in quotes
* Define a constant buffer size of 64
*
* Define an array:
* Of standard buffer size
* A... |
C | #include "holberton.h"
/**
* print_chessboard - prints the chess board
*
* @a: input pointer
*
* Return: return nothing
*/
void print_chessboard(char (*a)[8])
{
int i, j;
i = 0;
j = 0;
while (i < 64)
{
if (i % 8 == 0 && i != 0)
{
j = i;
_putchar('\n');
}
_putchar(a[i / 8][i - j]);
i++;
}
... |
C | /*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use ... |
C | #include <stdio.h>
#include <string.h>
int main(void){
struct book
{
char name[50];
int pages;
float price;
};
struct book b,*bptr;
printf("Enter Book's name:\t");
scanf("%s",b.name);
printf("Number of Pages: \t");
scanf("%d",&b.pages);
printf("Enter Price: \t");
scanf("%f",&b.price);
bptr=&b;
pri... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <openssl/objects.h>
#include <openssl/comp.h>
COMP_CTX *COMP_CTX_new(COMP_METHOD *meth)
{
COMP_CTX *ret;
if ((ret=(COMP_CTX *)OPENSSL_malloc(sizeof(COMP_CTX))) == NULL)
{
/* ZZZZZZZZZZZZZZZZ */
return(NULL);
}
memset(ret,0,sizeof(COMP_CT... |
C | #include <sys/stat.h>
#include <fcntl.h>
#include "../../lib/tlpi_hdr.h"
#define CMD_SIZE 200
#define BUF_SIZE 1024
int main(int argc, char *argv[])
{
int fd;
int j;
int numBlocks;
char shellCmd[CMD_SIZE];
char buf[BUF_SIZE];
if (argc < 2 || strcmp(argv[1], "--help") == 0) {
usageErr("%s temp-file [num-1kb-... |
C | #include <math.h>
#include "prbs31.h"
#include <stdio.h>
int main () {
// FILE *fp;
// data_t seed;
// seed = 0x02;
int i;
// Generate the expected result
data_t start = SEED;
result_t hw_out=start;
result_t sw_out=start;
for(i = 1;; i++) {
int newbit = (((sw_out >> 30) ^ (sw_out >> 27))... |
C |
#include<stdio.h>
void main(){
int j = 1,num = 2;
for(int i = 1;i<=4;){
if(j<=4){
printf("%d ",num);
num += 2;
j++;
continue;
}
else{
printf("\n");
i++;
j = 1;
num = 2;
}
}
}
/*shital@sarode:~/Desktop/PPA/Assignments/Assignment-21 August 2020$ ./a.out
2 4 6 8
2 4 6 8
2 4 6 8 ... |
C | #include "util.h"
/*
TODO
give exit and return error number some define
to clarify error information
*/
static void report(const char *prefix, const char *err, va_list params)
{
char msg[2014];
vsnprintf(msg,sizeof(msg),err,params);
fprintf(stderr," %s%s\n", prefix, msg);
}
static NORETURN void die_builtin(cons... |
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void)
{
int n, m, a, b;
scanf("%d", &n);
scanf("%d", &m);
a = (n + m) / 2;
b = n - a;
printf("%d\n", a);
printf("%d", b);
} |
C | #include <sqlite3.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <unistd.h>
#include "callback.h"
#include "show_data.h"
#include "user_manager.h"
#include "expense_manager.h"
#include "draw_main.h"
sqlite3 *db;
int main(void) {
int rc = sqlite3_open("ljdata.db", &db);
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include "icy_mem.h"
#include "types.h"
#include "log.h"
#include "mem.h"
#include "array.h"
#include "utils.h"
#i... |
C | #include <setjmp.h>
#include "test.h"
#include "os.h"
enum state_t
{
STATE_ZERO = 0,
STATE_0,
STATE_1,
STATE_2,
STATE_3,
};
enum state_t states[10] = {0};
static int state_num = 0;
static void test_task(void *data)
{
os_task_begin();
states[state_num++] = STATE_1;
os_yield();
st... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/select.h>
#include <time.h>
#define MSG_SIZE 64
#define NB_MSG 20
#define NB_CHANNELS 10
void do_reader(void)
{
int i, v, n;
int ret;
int fd[NB_CHANNELS];
char msg[MSG_SIZE];
char chaname[50]... |
C | #include <stdint.h>
#include <kernel.h>
void ipc_send_packet(uint32_t pid, char* payload, uint32_t len) {
// check for a limit overflow
if (((uint32_t)payload + len) >= (task_table[current_task]->pages * PAGE_SIZE)) {
tty_kputs("\nIPC packet had a bogus length.", 0);
tty_kputs("\nTask terminate... |
C | /***********TESTO ESERCIZIO***************
scrivere un programma che legge da stdin una riga alla volta (la riga si considera terminata dal carattere \n).
la lunghezza della riga è arbitraria, non fare ipotesi sulla massima lunghezza di riga.
[in questo esercizio, non occorre immagazzinare l'intera riga].
calcolare l... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* search_path_t.c :+: :+: :+: ... |
C | #include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <ctype.h>
int p[2];
void
aleatorios (int sig){
int aleatorio;
aleatorio = rand() % 10;
write(p[1], &aleatorio, sizeof(int));
}
int
main (void){
// Variables
pid_t PID;
... |
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 | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* bubblesort.c :+: :+: :+: ... |
C | #ifndef __LINKED_LIST_H__
#define __LINKED_LIST_H__
typedef struct Node Node;
typedef struct List_t List;
List* create_list(void);
void insert_first(List *list, int val);
void insert_last(List *list, int val);
void insert_after(List *list, Node *node, int val);
void insert_before(List *list, Node *node, int val)... |
C | #include "map.h"
#include "tools.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
enum Const
{
Search_mark = 's',
Bad_map = 'B',
};
const scalar Ship_sizes[ Max_ship_size+1] = { 0, 4, 3, 2, 1};
scalar map_set( struct map_t *map, scalar x, scalar y, scalar val);
scalar map_check_ship( struct ma... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
char s[40], crypt[200], vis[200];
typedef struct node {
char c;
struct node *nxt;
} node;
int main() {
char ch;
int len, i, num;
FILE *in = fopen("in.txt", "r"), *out = fopen("in_crpyt.txt", "w");
node *head = (node*) malloc(sizeof(node)), *cur = head, *t... |
C | /**
**************************************************************
* @file mylib/atimer/s4353737_hal_atimer
* @author George Todorovic - 43537370
* @date 30032020
* @brief Atimer driver files
* REFERENCE: csse3010_mylib_hal_atimer.pdf
***************************************************************
* EXTERNAL F... |
C | #include "inheritence_defs.h"
const char* getName(Types type)
{
const char* const names[] = { "Plastic", "Metal", "Wood", "Paper", "Other" };
return names[type];
}
void _ZN11PhysicalBoxC1Eddd(PhysicalBox* const this, double l, double w, double h)
{
_ZN3BoxC1Eddd((Box*)this, l, w, h);
this->material.mat... |
C | /*
** EPITECH PROJECT, 2020
** CPE_matchstick_2019
** File description:
** ia_turn.c
*/
#include <stdlib.h>
#include "include/my.h"
int maj_ia(map_t *map)
{
int i = map->first;
for (; map->buffer[map->line_ia][i] != '|'; i--);
for (int j = 0; j != map->nb_ia_rm; j++, i--)
if (map->buffer[map->li... |
C | #include "stm32f0xx_rcc.h"
#include "stm32f0xx_gpio.h"
#include "led.h"
#define LED_RCC RCC_AHBPeriph_GPIOC
#define LED_PORT GPIOC
#define LED_PIN GPIO_Pin_13
void led_init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_AHBPeriphClockCmd(LED_RCC, ENABLE);
GPIO_InitStructure.GPIO_Pin = LED_PIN;
GPIO_InitSt... |
C | #ifndef _FINDPEAKS_H_
#define _FINDPEAKS_H_
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
/*
* find the peak in an array.
*
* Input
* ------------------------------------------
* data: the data array
* length: the array length
* peaks: the peaks found in the array
* index: the ... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <cs50.h>
#include <ctype.h>
#define ALPHABET_COUNT 26
string encrypt(string text, string key);
bool valid_key(string key);
int main(int argc, char* argv[])
{
if (argc != 2)
{
printf("Include the key as a command-line argument!\n");
... |
C | #include <stdio.h>
#include <math.h>
#include <sys/timeb.h>
#define R 6371.8
#define TO_RAD(val) (val * (M_PI / 180))
void main(void)
{
struct timeb start, stop;
double elapsed;
int i;
ftime(&start);
for(i=0; i < 1000000000; i++)
{
double lat1 = 58.7530;
double lon1 = 17.0115;
double l... |
C | /**
****************************************************************************************
*
* @file airmouse.h
*
* Copyright (C) Shanghai Tropos Microelectronics Co., Ltd. 2018~2020
*
****************************************************************************************
*/
#ifndef AIRMOUSE_H
#define AIRM... |
C | #define F_CPU 16000000UL
#include <inttypes.h>
#include <compat/twi.h>
#include "i2cmaster.h"
/* I2C clock in Hz */
#define SCL_CLOCK 100000L
/*************************************************************************
Initialization of the I2C bus interface. Need to be called only once
****************... |
C | #include <stdio.h>
void main(){
int input_number=0;
int input_number_copy=0;
int sum_number=0;
int total=0;
float average=0;
printf(" Է¹ðڽϱ? ex) 3 : ");
scanf("%d", &input_number);
input_number_copy = input_number;
while(0 < input_number){
printf(" Էϼ: ");
scanf("%d", &sum_number);
total = total + su... |
C | /*
* https://www.geeksforgeeks.org/write-a-program-to-reverse-an-array-or-string/
*
* Write a program to reverse an array or string
*
* Given an array (or string), the task is to reverse the array/string
*
* Input : arr[] = {1, 2, 3}
* Output : arr[] = {3, 2, 1}
*
* Input : arr[] = {4, 5, 1, 2}
* Output... |
C | #include <stdio.h>
#include <string.h>
int x[100], y[100], row[20], column[20];
int main()
{
int count, i, j, dia1, dia2, over, p;
scanf("%d", &count);
while(count--)
{
memset(x, -1, sizeof(x));
memset(y, -1, sizeof(y));
dia1 = dia2 = 1;
for(i=0; i<5; i++)
{
row[i] = column[i] = 0;
for(j=0; j<5; j... |
C | //write a program that displays two dimentional array
#include<stdio.h>
int main()
{
while(1)
{
int i, j;
int A[3][4] = { {3,4,5,6}, {11,12,13,14}, {22,23,24,25} };
for(i=0; i<3; i++)
{
for(j=0; j<4; j++)
{
printf("%d ", A[i][j]);
}
... |
C | ////////////////////////////////////////////////////////////////////////////////
// Main File: division.c
// This File: division.c
// Other Files: sendsig.c, intdate.c
// Semester: CS 354 Fall 2018
//
// Author: Alexandra Yavnilovitch
// Email: yavnilovitch@wisc.edu
// CS... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define RANDINT(a, b) ((rand() % ((b) - (a))) + (a))
/*
*
* + AA, , ׳
* + ǻ, ڵ, ũν
* ͵
* + , ݶ, ġ佺, , ڱ
*/
/*
*
* struct
*
*/
#ifndef _ITEMINFO_STRUCT
#define _ITEMINFO_STRUCT
typedef struct {
int no;
int x;
int y;
... |
C | #include<stdio.h>
int main(){
int mat[10][10],i,j,k=0,m,n,arri[10],arrj[10];
printf("\nEnter order(m x n) :");
scanf("%d %d",&m,&n);
for(i=0;i<m;i++)
for(j=0;j<n;j++){
scanf("%d",&mat[i][j]);
if(mat[i][j]){
arri[k]=i;
arrj[k++]=j;
}
}
for(i=0;i<k;i++){
for(j=0;j<n;j++)
mat[arri[i]][j]=1;
... |
C | /* File: main08.c
Using generic linked list functions in ll.c
to implement a linked list of integers.
*/
#include <stdio.h>
#include <stdlib.h>
#include "ll.h"
typedef struct int_node {
print_ftype print_func ;
struct int_node *next ;
int data ;
} int_node ;
void print_int_node(int_node *ptr) {
... |
C | /***************************************************************
Paul Lewis
File Name: tour.h
Genetic Algorithms and Permutations
Contains struct definitions, libraries, and function prototypes for tour.c
***************************************************************/
#ifndef TOUR_H
#define TOUR_H
#include ... |
C | #include <stdio.h>
int main(){
int result=0, tmp;
while (scanf("%d", &tmp) != EOF){
if(tmp>0) result++;
else continue;
}
printf("%d", result);
}
|
C | /*
* fiwix/fs/fd.c
*
* Copyright 2018-2022, Jordi Sanfeliu. All rights reserved.
* Distributed under the terms of the Fiwix License.
*/
#include <fiwix/errno.h>
#include <fiwix/types.h>
#include <fiwix/fs.h>
#include <fiwix/sleep.h>
#include <fiwix/stdio.h>
#include <fiwix/string.h>
struct fd *fd_table;
static ... |
C | #include "holberton.h"
/**
* set_bit - Set the value of a bit to 1 at a given index
* @n: unsigned long int
* @index: index, starting from 0 of the bit you want to set
*
* Return: 1 if it worked, or -1 if an error occured
*/
int set_bit(unsigned long int *n, unsigned int index)
{
unsigned long int max = sizeof(... |
C | #include <stdio.h>
#define AL 5
#define MAX 5
int main(){
int i, x, smol, poz;
float nums[AL];
printf("Input the 5 members of the array: ");
for (i = 0; i < AL; i++)
{
scanf("%f", &nums[i]);
}
for (i = 0; i < AL; i++)
{
if (nums[i] < MAX)
{
printf("A[... |
C | //-----------------------------------------------------------------------------
// Parsing helper functions
//-----------------------------------------------------------------------------
#include "shared.h"
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include "libparse.h"
#ifndef FALSE
#define FALSE ... |
C | #ifndef I386_SLAB_H
#define I386_SLAB_H
#include <mutex.h>
#include <common/types.h>
/*The AK slab allocator is a very simple design:
*A slab entry contains the address (page) of the first
*buffer node. It contains a link to the next page of
*objects, if there is one (denoted by not being null).
*The first_free i... |
C | /*******************************************************************************
* This file is part of Bombeirb.
* Copyright (C) 2018 by Laurent Réveillère
******************************************************************************/
#include <SDL/SDL_image.h>
#include <assert.h>
#include <player.h>
#include <sp... |
C | /*******************************************************************************
* Name: pun.c
* Purpose: Prints a bad pun
* Author: shiqf*
*******************************************************************************/
/* 包含了... |
C | /*
* Problem-5: Program to multiply 2 matrixes
* Ayush Singh 1910990059 24/07/21
* Assignment_1 -> C Foundation
*/
#include <stdio.h>
#include<stdlib.h>
//function to multiply two matrixes
int **multiply_matrix(int row1, int col1, int matrix1[][col1], int row2, int col2, int matrix2[][col2]){
int i, j, k;
int ... |
C | #include <stdio.h>
#include <math.h>
#include "vecs.h"
#include "display.h"
#include "shader.h"
#include "mesh.h"
#include "texture.h"
#include "camera.h"
int main(void)
{
float counter = 0.0f;
SDL_Init(SDL_INIT_EVERYTHING);
struct display *d = display_new(800, 600, "hello world");
GLenum status = glewInit();
i... |
C | /* spike.c - spiking filter design */
#define MAX 10
#define NMAX 10
#define max(a, b) (((a) >= (b)) ? (a) : (b))
#define min(a, b) (((a) <= (b)) ? (a) : (b))
void lev(), corr();
void spike(N, y, M, R, L, E, P, H, eps)
double y[], R[], L[][MAX+1], E[], P[][NMAX+MAX+1], H[][NMAX+MAX+1], eps;
i... |
C | #include "utilities.h"
#include <stdio.h>
int main(){
printf("This is Fred's testing area:\n");
double total, average;
for (int i=0; i<10; i++) {
double R=arcRand(0.0,2.0);
printf("%lf\n",R);
total = total + R;
}
average = total/10.0;
printf("average = %lf\n",average);
if (abs(average - 1.0)... |
C |
#include<stdio.h>
int main(void){
//questao 1
float n1,n2;
char op;
scanf("%f%f%s",&n1,&n2,&op);
switch (op)
{
case '+':
printf("%0.2f",(n1+n2));
break;
case '-':
printf("%0.2f",(n1-n2));
break;
case '*':
printf("%0.2f",(n1*n2));
bre... |
C | #include <stdio.h>
int main(){
int l,n,range[201][3],i,j,max=0,st,end,sf=0;
scanf("%d %d",&l,&n);
for(i=1;i<=n;i++){
scanf("%d %d",&st,&end);
range[i][0] = st;
range[i][1] = end;
}
for(i = 1; i<=l;i++){
sf = 0;
for(j=1; j<=n;j++){
if(i<range[j][0... |
C | // zhaoyangbu.c
#include <ansi.h>
inherit SKILL;
string *dodge_msg = ({
"$nһݣʹ"YEL"ɽơ"NOR"ܿһС\n",
"$Nһ$nʹ"HIR"ƻơ"NOR"һ$NͷԽ\n",
"$nһãһ"HIC"ƺơ"NOR"ӰӶûˡ\n",
"$nһ㣬һ"HIG"ơ"NOR"ڿն𣬱˿ȥ\n",
"$nʹһ"HIY"ƽơ"NOR"Ʈ˿ȥ\n",
"ֻ$nһɼ磬ڷǡе"HIW"ơ"NOR"\n"
});
int valid_enable(string usage)
{
return (usage=="dodge") || (usage=="m... |
C |
#include "Decoder.h"
void Construct_MsgList()
{
int index=0;
LINK* header = NULL;
LINK* temp = NULL;
for(index=0;index<Msg_No;index++)
{
/* First Node */
if(Msg_List == NULL)
{
temp = (LINK*)malloc(sizeof(LINK));
Msg_List = header = temp;
}
else
{
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
/*
* In this problem, there is a sushi bar with 5 open seats. If a customer
* arrives, then two conditions might happen:
*
* 1. If there is an empty seat, then the customer walks in and take a seat.
*
* 2. If all 5 seats are occupi... |
C | #ifndef ___CGI_H___
#define ___CGI_H___
/**
@file cgi.h
Macros úteis para gerar CGIs
*/
#include <stdio.h>
/**
* Caminho para as imagens
*/
#define IMAGE_PATH "http://localhost/images/"
/**
\brief Macro para começar o html
*/
#define COMECAR_HTML printf("Content-Type: text/html\n\n")
/**
\brief Macro pa... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <string.h>
int main(int argc,char *argv[]) {
int connsfd;
int porta;
struct sockaddr_in strind;
if(argc!=2)
{
printf("\nINS <IP>\n");
exit(1);
}
printf("\nIn... |
C | #include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
/* Numerically Solve throw at an angle*/
const double g = -10.0;
double *make_dynamic_array(size_t slots);
double *init_dynamic_array(double *m, size_t slots);
typedef struct
{
size_t step;
size_t size;
doub... |
C | /*---------------------------------------------------------19910726 RWB-----*/
/* jobser.c -- recv messages passed over the network */
/*--------------------------------------------------------------------------*/
#include <stdio.h>
#include <dos.h>
#include <conio.h>
#include <process.h>
... |
C | #include <stdio.h>
#include <string.h>
int N,M;
char input[50][51];
#define MAX(i,j) ((i)>(j))?(i):(j)
int upper(int size,int y,int x);
int lower(int size,int y,int x);
int upper(int size,int y,int x)
{
int i;
int temp;
if(x<0||y>N-1||x>M-1)
return 0;
for(i=0;i<size;i++)
{
if(input[y][x+i]!='#')
return... |
C | #include <linux/module.h>
#include <linux/kernel.h>
#include <linux/version.h>
#include <linux/fs.h>
#include <linux/cdev.h>
#include <linux/device.h>
#include <linux/errno.h>
#include <asm/uaccess.h>
#include <linux/ioctl.h>
#include<linux/proc_fs.h>
#define SET_VALUE _IOW('q', 1, char *)
#define PROC_SET_VALUE _IOW(... |
C | /*****************************************************
* cbc.c
This is a simple xor chain encryption program that will encrypt a
file, the filename of which must be provided as a command line
argument, using a simple CBC encryption algorithm. Upon
execution of the program, the user is prompted ... |
C | /******************************* COPYRIGHT ********************************/
/*
* Copyright (c) 2017 Gregory N. Leonhardt All rights reserved.
*
****************************************************************************/
/******************************** JAVADOC ***********************************/
/**
* The... |
C | #include<stdio.h>
#include<stdlib.h>
int main() {
float valordia = 30;
float taxair= 0.08;
float taxainss= 0.04;
float valorbruto ;
int dias;
printf(" Digite o numero de dias trab:");
scanf("%d",&dias);
valorbruto = (dias *valordia);
printf("o salario bruto e %.2f:", valorbruto);
prin... |
C | #include"stdio.h"
#include"unistd.h"
#include"fcntl.h"
#include"sys/types.h"
#include"errno.h"
int main()
{
int fd1, fd2, fd3, dup2ret;
char buffer[12];
printf("PID :- %ld\n",(long)getpid());
fd1 = ("read.c",O_RDONLY);
fd2 = ("read.c",O_RDONLY);
fd3 = ("select.c",O_RDONLY);
dup2ret = dup2(fd,19);
if(dup2ret ... |
C | // Annie is the talk of the town, who recently won the prize for being the most beautiful woman of her town. Due to her achievement, she has become Dream girl of the youth.
// So, many people in the town are trying to propose her, but She has her own demands and only if the demands are satisfied, she will accept the p... |
C | // Protótipo para o programa de criação de listas invertidas utilizando MPI
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<mpi.h>
typedef struct chave{
char valor[30];
int ordem;
struct chave *prox;
}Chave;
typedef struct chaveiro{
Chave *c;
struct chaveiro *prox;
}Chaveiro;
vo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.