C - Literals
Literals are fixed values written directly in code (numbers, characters, strings).
Numeric Literals
int dec = 42;      // decimal
int oct = 052;     // octal (leading 0)
int hex = 0x2A;    // hexadecimal
long long big = 42LL; // suffixes
Char and String Literals
char c = 'A';
char nl = '\n';
const char *s = "Hello";
Floating Literals
double pi = 3.14159;
float f = 1.23f;   // f suffix for float
Checks for Understanding
- What base is 075interpreted in?
Show answer
Octal (base 8).