Code · 1 file

Sample C Header File

C header files declare the types and functions that .c files implement. The C header sample is a small program — a customer record, a VIP check and a formatted total — that is the same in every language we offer, so you can compare them side by side.

C header · 353 B

Sample C header file

An idiomatic C header example: a customer record type, a VIP check, a total and a formatted loop — the same program in every language we offer.

CC0 · free for any use · Verified by an independent tool · Report a problem

customer.h — first linesC
/* Sample C header — samplefiles.com */
#ifndef SAMPLE_CUSTOMER_H
#define SAMPLE_CUSTOMER_H

#include <stddef.h>

#define VIP_THRESHOLD 10000.0

typedef struct {
    int id;
    const char *name;
    double balance;
} Customer;

int is_vip(const Customer *c);
double total_balance(const Customer *customers, size_t n);

#endif /* SAMPLE_CUSTOMER_H */

File details

Size
353 B (353 bytes)
MIME type
text/x-c
SHA-256
0e6339095958eb7321dff9d461dbfaa457329cb3ce386e5ba741c5cbf7f70dd9
MD5
b18b04bc4f900c439c380cd272ed3b0c

Download from the command line

curl -L -o customer.h https://files.samplefiles.com/code/h/customer.h

Or check the download in your browser with the checksum calculator.