Fundamental Data Types in C
C builds everything from a tiny set: int for whole numbers, double for decimals, char for single characters (really a small integer), and void for nothing. Sizes are platform-dependent by design — int is at least 16 bits but 32 nearly everywhere — so portable code uses <stdint.h> fixed-width types (int32_t, uint64_t) when exact size matters.
Choose by range and intent: double is the default floating type (float halves precision for little gain on modern hardware), char stores character codes as small integers, and _Bool/bool (via stdbool.h) makes conditions self-documenting.
int: the workhorse
Whole numbers, typically 32 bits (~±2 billion). Default choice for counts, indexes, and IDs.
double: the default decimal
64-bit floating point with ~15 reliable digits. Prefer over float unless memory profiling says otherwise.
char: a tiny integer
Usually 8 bits holding a character code — 'A' is 65 in char-sized storage, and char arithmetic is legal integer math.
void and fixed widths
void means no value (function returns); int32_t/uint64_t from stdint.h guarantee exact sizes across platforms.
#include <stdio.h> int main(void) { int n = 1000000; double pi = 3.14159; char grade = 'A'; printf("%d, %.5f, %c\n", n, pi, grade); return 0;}Recommended resourcesAffiliate links · may earn us a commission
Recommended for learners
Practice what you learned
Re-implement each visualized algorithm in C yourself — building beats watching.