devnotes.

Variables and Basic Data Types

C is statically typed — every variable's type is fixed at compile time and must be declared before use.

int age = 25;             // whole numbers
float price = 19.99f;     // single-precision floating point
double pi = 3.14159265;   // double-precision floating point (default for decimals)
char grade = 'A';         // a single character, stored as a small integer
unsigned int count = 10;  // only non-negative values
long long big = 9000000000LL; // wide enough for very large integers

printf("Size of int: %zu bytes\n", sizeof(int)); // sizeof returns size_t

int, float, double, and char are C's core primitive types. char is really just a small integer internally (typically 1 byte), which is why you can do arithmetic on characters. Adding unsigned restricts a type to non-negative values, doubling its positive range; short, long, and long long adjust the storage size, though exact byte sizes are platform-dependent — that's precisely what sizeof is for, since C guarantees relative ordering (short <= int <= long <= long long) but not exact sizes.

Uninitialized local variables hold indeterminate garbage values, not automatically zero — always initialize variables when you declare them to avoid subtle, hard-to-reproduce bugs.

C Variables and Basic Data Types Explained | DevNotes