vimwiki

C literals

A literal is a constant value that can be assign to a variable :

int num = 42; // 42 is a literal, num a variable
char letter = 'c'; // c is a literal
Literal Type Example Description
Integer Literal 42 Whole numbers without fractional part.
Character Literal ‘c’ Individual characters, enclosed in single quotes.
Unsigned Long Long 43ULL Unsigned long long integer literal.
Floating-point Literal 3.14 Numbers with a decimal point or in exponential notation.
String Literal “Hello” Sequences of characters, enclosed in double quotes.
Boolean Literal true or false Represents true or false values (C99 and later versions).
Hexadecimal Literal 0x1A Integer literal in hexadecimal notation.
Octal Literal 034 Integer literal in octal notation.
binary Literal 0b101 Integer literal in octal notation.