language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
#include <math.h>
int main(){
double a=0, b=0, c=0, D=0;
printf("Enter a, b, c: ");
scanf("%lf%lf%lf", &a, &b, &c);
if (a==0 && b==0 && c==0) printf ("There is an infinite set of solutions");
else if (a==0 && b==0) printf ("No solution");
else if (a==0) printf("x=%lf", -c/b);
else{
... |
C | #include "stm32f10x.h"
#include "hardware_conf.h"
#include "sccb.h"
// #include "define.h"
void DelaySCCB(unsigned int i)
{
while( i--)
{
}
}
/*****************************************************
SCCB_GPIO_Config
ܣSCCB߶˿
룺
ֵ
*****************************************************/
vo... |
C | // C program to demonstrate that size_t or
// any unsigned int type should be used
// carefully when used in a loop.
#include<stdio.h>
#define N 10
int main()
{
int a[N],size_t,n;
// This is fine.
for (n = 0; n < N; ++n) {
a[n] = n;
}
// But reverse cycles are tricky for unsigne... |
C | // gcc hdlc.c hdlc_test.c && ./a.out
#include "hdlc.h"
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
uint8_t bufxmit[800];
uint8_t bufrecv[801]; // need 1 extra for closing flag
for (int i = 0; i < 800; ++i) {
bufxmit[i] = lrand48();
}
bufrecv[0] = 0;
uint8_t *txp = bufxmit;
u... |
C | #include <stdio.h>
int main()
{
int i,j,k,n,f=0;
int a[100];
printf("How many values: ");
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
for(i=0;i<n;i++){
for(j=0;j<n;j++){
if(a[j]>a[j+1]){
k=a[j];
a[j]=a[j+1];
... |
C | #include <stdio.h>
#define NAME_LEN 64
typedef struct {
char name[NAME_LEN];
int height;
float weight;
long int scholarship;
} student;
int main(void){
student p1;
printf("enter the data\n");
printf("enter the name\t");
scanf("%s",p1.name);
printf("enter the height\t");
scanf("%d",&p1.height);... |
C | /* C Program to Calculate Square root of a Number */
#include<stdio.h>
#include<math.h>
int main()
{
int number, result;
printf(" \n Please Enter any Number to find Square root : ");
scanf("%d", &number);
result = pow(number, 0.5);
printf("\n Square Root a given number %d = %d", ... |
C |
#ifndef STANDARD_H
#define STANDARD_H
/* include files **************************************************************/
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/* MACRO Definition ***********************************************************/
#define BYTE_SIZE (8) /*!< One byte composite w/ 8 bi... |
C | /****************************
* 2011.1 Miao Yu Implement Vis hypervisor on x86 and x86_64(not finished).
Create this file
*
*****************************/
#include <stdarg.h>
#include <vis/spinlock.h>
#include <vis/print_infos.h>
#define snprintf _snprintf
PVOID g_debugWind... |
C | // example to illustrate C structure and typedef
#include <stdio.h>
typedef struct customer {
char name[10];
int age;
int intern_id;
} customer_t;
main()
{
customer_t joe;
joe.name[0] = 'j';
joe.name[1] = 'o';
joe.name[2] = 'e';
joe.name[3] = '\0';
joe.age = 19;
joe.intern_id = 1200;
printf("%s... |
C | #include <stdlib.h>
#include <unistd.h>
void ft_putint(int i);
void ft_putchar(char a);
void ft_putstr(char *str);
void ft_print_board(int r1, int r2, int r3, int r4);
int ft_strlen(char *str);
int is_begin_possible(int *results, int begin);
int is_end_possible(int *results, int end);
int is_poss(int soll[4], int ... |
C | //
// Created by diego on 15/11/2019.
//
#include <stdio.h>
#include "Funciones.h"
int main()
{
char n[] = {"7364678393525325392035295"};
char n2[] = {"1674033096929473859689548"};
int x,x2,i;
x = (int)sizeof(n) - 1;x2 = (int)sizeof(n2) - 1;
char n3[x];
char *nn1,*nn2,*nn3;
nn1 = n;nn2 = n... |
C | #ifndef SPI_H
#define SPI_H
#include <xs1.h>
#ifdef __spi_conf_h_exists__
#include "spi_conf.h"
#endif
#ifndef SPI_CLK_MHZ
#define SPI_CLK_MHZ 25
#endif
#ifdef __XC__
/** Struct containing ports and clocks used to access a flash device. */
typedef struct fl_spi_ports {
buffered in port:8 spiMISO; ... |
C | #include <stdio.h>
#include <conio.h>
long c(int n) /* khai bao c la tong giai thua */
{
if (n == 0)
return 1;
else
return(n * c(n - 1));
}
int main() /* a la 1 so bat ky */
/* b la giai thua */
{
int a;
long b;
printf("Enter number : ");
scanf("%d", &a);
b = c(a);
printf("Giai thua cua %d la: %ld", a... |
C | #include"chat.h"
pthread_t thread;
void *sendmessage(void *arg);
char data[MAXMSG];
int main()
{
int cfd;
int recbytes;
int sin_size;
char buffer[MAXMSG];
struct sockaddr_in s_add;
unsigned short portnum=0x8888;
cfd = socket(AF_INET, SOCK_STREAM, 0);
if(-1 == cfd)
{
printf("socket fail ! \r\n");
... |
C | #include<stdio.h>
void main()
{
int n,i=1,m;
printf("\nEnter a number :");
scanf("%d",&n);
printf("\nMultiplication table of %d :",n);
do{
m=n*i;
printf("\n%d",m);
i++;
}while(i<=10);
}
|
C | //http://www.geeksforgeeks.org/inorder-predecessor-successor-given-key-bst/
/*
*
Inorder Successor
=================
There are two cases for the node.
1) if the node has right child. Then the successor would be the leftmost node (or mininum) of its right subtree.
2) if the node has no right child. Then the s... |
C | #include<stdio.h>
int main()
{
int num,sum=0,rem,temp;
printf("\nEnter a number: ");
scanf("%d",&num);
temp = num;
while (num != 0)
{
rem = num % 10;
sum = sum + (rem*rem*rem);
num = num / 10;
}
if(temp == sum)
printf("%d is an Armstrong Number",temp);
else
pr... |
C | /********************************************************************************
* Copyright (c) 2020 AVL List GmbH and others
*
* This program and the accompanying materials are made available under the
* terms of the Apache Software License 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.... |
C | /*
* I - PushTo Telescope
* ICPC 2012 Greater NY Regional
* Solution by Fred Pickel
* Problem by Fred Pickel
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#include <string.h>
#undef TEST
#define EPS .01
#define MAX_STARS 100
#define MAX_SUBPROBS 10
#define PI (3.... |
C | #include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
int main(int argc, char *argv[])
{
if (argc != 2) {
printf("usage: %s file\n", argv[0]);
return 0;
}
if (access(argv[1], R_OK) == -1)
perror("access R_OK test failed");
else
printf("access R_OK test passed\n");
... |
C | /* Header for Thermometer module
Computerarchitektur 3
Hochschule Esslingen
Author: M.Brandel, J.Ruess, 04.01.2018
Modified: -
*/
#include "ad.h"
extern int ad_value;
static int temp_value;
static char sign = ' ';
static int upperLimit = 70;
static int lowerLimit = -30;
static int maxResolution =... |
C | /*
* mmap( MAP_SHARED ) test program
*
* Copyright (C) 2014 KO Myung-Hun <komh@chollian.net>
*
* This program is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What The Fuck You Want
* To Public Lice... |
C | // SPDX-License-Identifier: GPL-2.0+
#ifndef __LINUX_BITMAP_H
#define __LINUX_BITMAP_H
#include <asm/types.h>
#include <linux/types.h>
#include <linux/bitops.h>
#define small_const_nbits(nbits) \
(__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG)
static inline void bitmap_zero(unsigned long *dst, int nbits)
... |
C |
#include "commandthread.h"
#include "utils.h"
#include <unistd.h>
#include <stdlib.h>
command_thread_desc_struct *cmDesc = NULL;
void *command_thread_func(void *arg) {
cmDesc->s_socket_desc = socket(AF_INET , SOCK_STREAM , 0);
if (cmDesc->s_socket_desc == -1) {
cmDesc->thread_state = TERMINATED;... |
C | #include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
int A, B;
printf("\n what is your salary? " );
scanf("%d", &A);
printf("\n how old are you? " );
scanf("%d", &B);
printf("\n i earn %d", ... |
C | #include<stdio.h>
int main(){
char c1='A',c2='B',c3='c';
char *p1,*p2,*p3;
p3=&c3;
p2=&c2;
p1=&c1;
printf("%c , %c , %c \n ",*p1,*p2,*p3);
}
|
C | #include "TextureManager.h"
#include <string.h>
TextureManager * newTextureManager()
{
TextureManager *t = malloc(sizeof(TextureManager));
t->key = NULL;
t->left = NULL;
t->right = NULL;
t->texture = NULL;
return t;
}
SDL_Texture * getTexture(TextureManager *tm, char * name)
{
int r = 0;
if (tm == NULL)
r... |
C | /***********************************************************
* Author: Eric Magers
* Lab Number: CST 211 Lab 2
* Filename: Insertion.cpp
* Date Created: 4/15/2014
* Modifications:
*
************************************************************/
#include "Insertion.h"
void InsertionSort(int m_array[], int m_leng... |
C | #include <stdio.h>
#include <poll.h>
#include <time.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
int main(int argc,char *argv[]){
int numpipes,numwrites,i,nwrite,ret;
int (*pipefdp)[2];
struct pollfd *fds;
if(argc < 2 || strcmp(argv[1],"--help") == 0){
fprintf(stderr,"%s num-pipes [num-writes... |
C | #include <stdio.h>
#include <tcp_client.h>
#include <error.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#define MAXLINE 1024
int main(int argc, char *argv[])
{
if (argc != 3)
error(1,0,"usage:tcpclient<IPaddress> <Port>");
int port = atoi(argv[2]);
int socket_... |
C | /* $Id: test_sm_contains.c 1871 2009-06-12 13:58:18Z lsc $ */
/*
* Copyright (c) 2009 STFC Rutherford Appleton Laboratory
* Author: Lee-Shawn Chin
* Date : June 2009
*
*/
#include "header_string_map.h"
void test_sm_contains(void) {
int i, rc;
MBIt_stringmap *sm;
const char *str[10] = { "value 1"... |
C | #pragma once
#include <stdint.h>
#include <stddef.h>
/* A coloured pixel. */
typedef struct {
uint8_t red;
uint8_t green;
uint8_t blue;
} pixel_t;
/* A picture. */
typedef struct {
pixel_t *pixels;
size_t width;
size_t height;
} bitmap_t;
/* Given "bitmap", this returns the pixel of... |
C | /**
* URL - https://www.urionlinejudge.com.br/judge/pt/problems/view/1180
*
* Enunciado - Faça um programa que leia um valor N. Este N será o
* tamanho de um vetor X[N]. A seguir, leia cada um dos
* valores de X, encontre o menor elemento deste vetor
* e a sua posição dent... |
C | /*
아래에서 보이는 main 함수에서 물음표 ???을 대신할 수 있는 포인터 변수를 선언해보자.
int main(void)
{
int * arr1[5];
int * arr2[3][5];
??? = arr1;
??? = arr2;
}
*/ |
C | #include <stm32f4xx.h>
#include "Spi.h"
#define NULL 0
static volatile uint8_t spi_running = 0;
static volatile uint8_t spi_txe = 1;
static volatile uint8_t spi_last_byte = 0;
static uint8_t* spi_transmit_buffer = NULL;
static uint8_t* spi_receive_buffer = NULL;
static uint16_t spi_data_buffersize = 0;
static vola... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <semaphore.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/shm.h>
#include "common.h"
sem_t *sem_send;
sem_t *sem_recive;
int main()
{
// init
char msg[512];
char msgBuf[512];
strcpy(msg,"");
int shmid = shm... |
C | #include "csf.h"
#include "csfimpl.h"
/* read attribute control block (LIBRARY_INTERNAL)
*/
void CsfReadAttrBlock(
MAP *m, /* map handle */
CSF_FADDR32 pos, /* file position of block to be read */
ATTR_CNTRL_BLOCK *b) /* write-only. attribute control block read */
{
int i;
if (csf_fseek(m-... |
C |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int modo = 0;
//FUNCION QUE CUENTA EL NUMERO DE ENTRADAS DE LA TABLA DE SINDROMES
int cuentaentradas(char *nombrearch) {
char actual;
int leialgo = 0;
int lineas = 0;
FILE* entrada;
entrada = fopen(nombrearch,"r");
if ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <limits.h>
struct Node
{
struct Node *left;
struct Node *right;
struct Node *parent;
int d;
int f;
char c;
char code;
};
int suma3;
int ile(struct Node *huff[])
{
int i;
int p=0;
for(i = 0; i < 100; i++)
{
if(huff[i]->f >... |
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 | /**
* Test that bit-sliced signature implementation works as expected.
*
* Calls all functions in bit-sliced signature API
*
* Author: Gati Aher
*/
#include "test_bitslicedsig_main.h"
extern int errno;
extern char *optarg;
extern int opterr, optind;
int main(int argc, char *argv[])
{
int opt;
char *d... |
C | //
// Created by Axel LE BOT on 11/12/17.
//
#include "harmonique.h"
double harmonique(int n) {
int i;
int result = 1;
for (i = 1; i <= n; i++) {
result = result + (1 / i);
}
return result;
}
double harmoniqueRecursif(int n) {
int result;
if (n == 1) result = 1;
else result = ... |
C | /**********************************************************/
//公司名称:
//创建时间:2012-10-16
//作者:ke
//文件名:datafifo.c
//功能描述:该文件提供一个先进先出的缓冲区
/**********************************************************/
#include "main.h"
#include "datafifo.h"
#include <stdio.h>
#ifdef SUPDYMEM
#include "malloc.h"
/************************... |
C | // Reveni (c) 2020 Baltasar MIT License <baltasarq@gmail.com>
#include "ctrl.h"
#include "player.h"
#include "locs.h"
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
void draw_presentation()
{
byte pic_data[] = {
DCMD_Circle, 50, 10, 10,
DCMD_Fill, 50, 10,
... |
C | //#include "quantum.h"
void qubit(int param, int num);
void X(int q);
void Z(int q);
void Y(int q);
void H(int q);
void Rk(int param, int q);
void CNOT(int q1, int q2);
void CRk(int param, int q1, int q2);
void Measure(int q);
void GetQuantumMeasurementReg(int a);
void Toffoli(int q0, int q1, int q2);
void negI(int q... |
C | #include "triangle.h"
/*
* высчитываем периметр триугольникa
*/
Dtype triangle_perimeter(triangle t) {
segment a = {t.b, t.c};
segment b = {t.a, t.c};
segment c = {t.a, t.b};
Dtype a_length = segment_length(a);
Dtype b_length = segment_length(b);
Dtype c_length = segment_length(c);
retur... |
C | /* 4. Insert a value X (Take input X from user) in the array at Kth (take input K from user) index and shift all other value to right.
Name: Sanower Hossain Rabbi
ID: 1915002510
*/
#include<stdio.h>
int main()
{
int a[100] = {36,19,3,15,5,6,18,8,10,20}, max_size = 100, size = 10, i, X,K;
printf("Ente... |
C | /*
** EPITECH PROJECT, 2020
** concat param
** File description:
** cat param like ch star star to ch star
*/
#include <stdio.h>
#include "my.h"
#include <stdlib.h>
char *concat_params(int ac, char **av)
{
int len = 0;
char *param;
for (int i = 0; i < ac; i++)
len = len + my_strlen(av[i]);
pa... |
C | #include <stdlib.h>
#include <stdio.h>
#include "hashtable.h"
void hashtable_init()
{
inode_table = NULL;
attributes = NULL;
}
void hashtable_add_entry(char *link, int inode_value)
{
hashable *new_item = (hashable *)malloc(sizeof(hashable));
strcpy(new_item->key, link);
new_item->inode_value = i... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define STACKSIZE 5
#define STACKINCREMENT 10
#define OK 1
#define ERROR 0
#define OPSETSIZE 7
struct IntStack{
int *base;
int *top;
int stacksize;
};//ջûõ
int IntInitStack(IntStack &S){
S.base=(int *)malloc(STACKSIZE*sizeof(int));
if(!S.base) exit(1);
S.top=... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_numbers.c :+: :+: :+: ... |
C | #pragma once
#include "vector.h"
/* Works only for C strings, uses vector.
* Strings must be allocated in heap or seg fault will occur.
*/
typedef struct {
vector storage;
} simple_map;
void simple_map_new(simple_map* m);
void simple_map_put(simple_map* m, char* key, char* value);
char* simple_map_get(simple_... |
C | #include <stdio.h>
#include <stdlib.h>
/*
ϵ
> >= < <= != ==
ж==жϲ!=
*/
/*
&&
||
int main()
{
int a=0;
int b=5;
int c=a&&b;
int d=a||b;
printf("%d\n",c);
printf("%d\n",d);
int i=0;int x=1;int y=2;int z=3;
i=x++ && ++y && z++; //Ϊ߾... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>
//ʹָӡ
//void Print_arr(int *str,int sz)
//{
// int *start = str;
// while (start<=(str+sz-1))
// {
// printf("%d ", *start);
// start++;
// }
//}
//int main()
//{
// int arr[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };
// int sz = sizeof(arr) / sizeof(... |
C | #include <assert.h>
#include <SDL/SDL.h>
#include <esic/elcd/lcd.h>
#include "emulator_system.h"
#include <Winbase.h>
extern int assign_drives(void);
static const vtable_Object s_object_vtable = {
EmulatorSystem_destructor,
NULL,
NULL,
NULL
};
static const vtable_AbstractSystem s_abstract_system... |
C | /**
* @file filev6.c
* @brief Implement some methods to work with filev6
*
* @author Théo Nikles & Sacha Kozma
* @date 22 mars 2017
*
*/
#include <stdio.h>
#include <inttypes.h>
#include "inode.h"
#include "sector.h"
#include "filev6.h"
#include "error.h"
#include "bmblock.h"
#include "string.h"
int filev6_writ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_stack.c :+: :+: :+: ... |
C |
#include "string.h"
extern void serial_putc(unsigned char c);
extern unsigned char serial_getc(void);
extern void serial_puts(char *s);
char * get_string(char *s)
{
char ch;
char *buf = s;
while( (ch = serial_getc()) != '\r' ) {
if(ch == '\b') {
if(buf > s) { // the num of backspaces should not be excee... |
C | #include <stdio.h>
#include <stdlib.h>
typedef int Data;
typedef struct node
{
struct node *left;
struct node *right;
Data data;
}node;
node *create_node(Data key)
{
node *temp=(node *)malloc(sizeof(node));
temp->data=key;
temp->left=NULL;
temp->right=NULL;
... |
C | /* math.h -- Definitions for the math floating point package. */
#ifndef _MATH_H_
#define _MATH_H_
#define HUGE_VAL (float)3.40282346638528860e+38
/*
* set X_TLOSS = pi*2**52
*/
#define X_TLOSS 1.41484755040568800000e+16
struct complex
{
float x;
float y;
};
#define cabsf(z) (hy... |
C | #include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
void main(){
// char * fifo1 = "/mnt/z/DAM2/Inicio/FIFO";
mkfifo("/mnt/z/DAM2/Inicio/FIFO", 0666);
int fp;
char buffer[100];
char cadena[100];
while(1){
fp = open("FIFO1", O_RDON... |
C | //display leaf nodes in a level
#include<stdio.h>
#include<stdlib.h>
typedef struct Node
{
struct Node* left;
int info;
struct Node *right;
}node;
node* insert(node*,int);
void Display(node*);
void DisplayKthlevelLeaf(node*,int,int);
int Height(node *root);
void Level(node *,int );
void main()
{
printf("Enter ... |
C | #include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "../src/chip8.h"
static uint16_t get_instruction_at(chip8_t* ch8, uint16_t addr) {
return (ch8->mem[addr] << 8) | ch8->mem[addr + 1];
}
static void set_instruction_at(chip8_t* ch8, uint16_t addr, uint16_t instr) {
ch8->mem[ad... |
C | #include <math.h>
#include <SDL2/SDL.h>
#include "../entities/entity.h"
#include "../blit/blit.h"
#define PI 3.14159265358979323846
// Move this much pixels every frame a move is detected:
#define PLAYER_MAX_SPEED 6.0f
// AFTER a movement-key is released, reduce the movement speed for
// every consecutive fram... |
C | #include "network.h"
/********************************* TCP socket function ***************************************************/
int createTCP_server(char *addrstr, char *port)
{
int sockfd, len; // listen on sock_fd, new connection on new_fd
struct addrinfo hints, *servinfo, *p;
struct sockaddr_in local;
voi... |
C | #include <stdio.h>
#include "counter.h"
#include "defaults.h"
#include "llist.h"
typedef struct __myargs_t {
int loops;
counter_t *counter;
int mytid;
llist_t *list;
int key;
} myargs_t;
void *build_list(void *arg) {
myargs_t *a = (myargs_t *) arg;
// do some work
int i, key;
for (... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* int_convertion.c :+: :+: :+: ... |
C | #include <stdio.h>
// Estruturas de Repetição for, while, do while;
int main(){
int x = 0, soma = 0;
printf("\n");
for(int i = 0;i<=10; i++){ //mais usado quando se sabe o numero de repeticoes Ex: Vetores e Matrizes
printf("Digite o %d numero\n", i);
scanf("%d", &x);
soma += x;
... |
C | #include <bicpl.h>
int main(
int argc,
char *argv[] )
{
FILE *file;
STRING filename1, filename2, output_filename;
int i, n, n_objects1, n_objects2, n_normals1, n_normals2;
Vector *normals1, *normals2;
Point p1, p2;
Real dist;... |
C | #include <stdio.h>
/* month_name: return name of n-th month */
char *month_name(int n)
{
static char *name[] =
{
"Illegal month",
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
};
return (n < 1 || n > 12) ? name[0] : name[n];
/* The ... |
C | // Various utility functions for finding the shortest path.
// Copyright 2009-2010 David Lawrence Miller
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include "utils.h"
#include "wood.h"
extern double eps;
int do_int(double p1[2], double p2[2], double p3[2], double p4[2], double ip[2]){
double s,t, s1... |
C | /* https://leetcode.com/problems/insert-into-a-binary-search-tree/ */
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* struct TreeNode *left;
* struct TreeNode *right;
* };
*/
struct TreeNode* Newnode(int key)
{
struct TreeNode* newnode = (struct TreeNode*)malloc(sizeof... |
C | /* 2014, Copyright Intel & Jose Bollo <jose.bollo@open.eurogiciel.org>, license MIT */
/*
* A smack_coda is a smack code of access and it is an integer data.
*/
typedef int smack_coda;
/*
* Constants used for smack_coda
*/
enum {
smack_coda_lock = 1, /* lock permission bit */
smack_coda_transmute = 2, /* tra... |
C | #include<stdio.h>
main ()
{
int a[]={1,1,2,2,4};
int i=0;
a[i++]=a[++i]+i;
printf("%d %d %d %d %d\n",a[0],a[1],a[2],a[3],a[4]);
}
|
C | #include<stdio.h>
int main(){
int soma=0;
int n;
do{
printf("Digite um numero (menor que 0 para parar):");
scanf("%d",&n);
if(n>0)soma=soma+n;
}while(n>0);
printf("Total: %d", soma);
return 0;
} |
C | /* Min Su Kim, mskim3494 */
/* CMSC 152, Winter 2015 */
/* HOMEWORK 5 */
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include "ss.h"
#include "htbl.h"
#include "sll.h"
#include "matrix.h"
void evidence_ss()
{
printf(" === testing squeezed strings ===\n");
char test_s[]="hello... |
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>
main()
{
int a;
printf("enter a number");
scanf("%d",&a);
if(a>0)
printf("it is positive");
else if(a==0)
printf("it is zero ");
else
printf("it is negative n.0");
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
int n = 1;
double potega(double x, int n) {
int i;
double wynik = 1;
for (i = 0; i < n; i++)
{
wynik = (double)wynik * x;
}
return wynik;
}
double sumowanie_od_przodu(int koniec, double x) {
double suma = 0;
for (n; n <= koniec; n++) {
suma = s... |
C | #include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>
static void func_init()
{
puts("SIGINT");
}
int main(void)
{
struct sigaction act;
sigset_t set, oldset;
sigemptyset(&set);
sigaddset(&set, SIGINT);
if (sigprocmask(SIG_BLOCK, &set, &oldset) < 0) {
perr... |
C | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <modbus.h>
modbus_t *initModbus_RTU(char *pdevpath, uint32_t sec, uint32_t usec)
{
modbus_t *mb = NULL;
//1-打开端口
if(NULL == (mb=modbus_new_rtu(pdevpath, 9600,'N',8, 1)))
{
printf("modbus-RTU serial open fa... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* cd.c :+: :+: :+: ... |
C | /* ************************************************************************** */
/* */
/* :::::::: */
/* draw_frame.c :+: :+: ... |
C | /*
* Copyright (c) 2011 Ignasi Barrera
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publ... |
C | #include <stdio.h>
int main()
{
int n, ld = 1;
int a, b, c, d, e, f, g, h, i, j;
a = b = c = d = e = f = g = h = i = j = 0;
scanf("%d", &n);
while (ld > 0)
{
ld = n % 10;
n /= 10;
switch (ld)
{
case 1:
a++;
break;
case... |
C | /*
** EPITECH PROJECT, 2018
** minishell1_2017
** File description:
** minishell1_2017 made by Sanchez Lucas
*/
#include "42sh.h"
void exec_cd_minus(env_t *env, int *ret_value, char *old_pwd, char *cur_dir)
{
if (old_pwd == NULL || chdir(old_pwd) == -1) {
old_pwd != NULL ? my_putstr(old_pwd) : 0;
my_printf(": No... |
C | /* Exercise 1-1. Create the "hello, world" program */
#include <stdio.h>
main()
{
printf("hello, ");
printf("world");
printf("\n");
}
|
C | // TODO: Include the correct file so you can use the methods you wrote in the puppies file
#include "puppies.c"
int main() {
Puppy puppy1 = create_new_puppy("Sparkie", 2);
printf("Welcome our new puppy, %s, who is %d years old!\n", puppy1.name, puppy1.age);
Puppy puppy2 = create_new_puppy("Bailey", 3);
printf(... |
C | #include <stdio.h>
#include <stdlib.h>
#include "listaCirc.h"
void troca_conteudo(Node **Origem, Node **Destino);
int main(){
int Input, i, Deslocamentos;
Node *Anel, *Aux;
Anel = cria_node();
scanf("%d", &Input);
for(i=1; Input != -1; i++ , scanf("%d", &Input)){
if(i==1)
insere_inicio(Input, &Anel);
el... |
C | #pragma once
typedef unsigned long CRC32_t;
void CRC32_Init( CRC32_t* pulCRC );
void CRC32_ProcessBuffer( CRC32_t* pulCRC, const void* p, int len );
void CRC32_Final( CRC32_t* pulCRC );
CRC32_t CRC32_GetTableEntry( unsigned int slot );
inline CRC32_t CRC32_ProcessSingleBuffer( const void* p, int len )
{
CRC32_t ... |
C | #include "holberton.h"
/**
* print_line - a function that draws a staight line in the terminal
* @n: takes an integer value that determines # of times '_' is printed
* Return: a straight line of length n followed by a new
* line or just a new line
*/
void print_line(int n)
{
int i;
if (n > 0)
{
for (i =... |
C | #include <stdio.h>
#include <string.h>
int main(void) {
char texto[50];
printf("\nInforme seu nome completo: ");
fgets(texto, 50, stdin);
int cont = strlen(texto);
printf("\nO tamanho da string: %i\n", cont);
for (int i = 0; i < cont; i++) printf("%d ", texto[i]);
texto[cont - 1] = '\0';
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <pthread.h>
#define N 100
#define RANDOM_RANGE 100000
#define NTHREAD 10
#define VECTOR_LENGTH_PER_THREAD (N/NTHREAD)
static int matrice_a[N][N];
static int matrice_b[N][N];
static int matrice_c[N][N];
static pthread_mutex_t mutex_matrice_mul;
stati... |
C | /* vim: set et ts=4 sts=4 sw=4 : */
/********************************************************************\
* 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 *
* ... |
C | extern int _subtract_bignums(bignum*, bignum*);
extern int _add_bignums(bignum*, bignum*);
extern int _multiply_bignums(bignum*, bignum*, bignum*);
void resize_numbers(bignum* bn1, bignum* bn2);
void add_wrapper();
void add_carry(bignum* bn);
void sub_borrow(bignum* bn);
int compare_bignum(bignum* bn1, bignum*... |
C | // -*- tab-width:4 ; indent-tabs-mode:nil -*-
#include <hre/config.h>
#include <stdlib.h>
#include <string.h>
#include <zlib.h>
#include <hre-io/stream_object.h>
#include <hre-io/user.h>
struct stream_s {
struct stream_obj procs;
stream_t s;
int bufsize;
int compress;
z_stream wr;
void *wr_bu... |
C | /*!
@file spi.c
@brief This is the source file for the Serial Protocol Interface driver for Kinetis K64.
i.e.,this is the application programming interface(API).
@authors: César Villarreal Hernández, ie707560
José Luis Rodríguez Gutierrez,ie705694
@date 24/03/2019
@TODO: Implement the functions d... |
C | #include <stddef.h>
void * memset(void *s, int c, size_t size) {
char * p = s;
while (size--)
*p++ = c;
return s;
}
|
C | /* Copyright 2011; All Rights Reserved
* Please see http://www.coactionos.com/license.html for
* licensing information.
*/
/*! \addtogroup MEM Memory (RAM/Flash)
* @{
*
* \ingroup PERIPHIO
*
* \details The flash memory software module allows the user code to read memory
* in the flash program space. Reading ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.