In this tutorial, we will be discussing a program to understand integer literal in C/C++ (Prefixes and suffixes).
Integer literals are literals for integer values directly represented in the source code. Further, they are of two types −
Prefixes − Prefixes denotes the base of the value. For example, 0x10 indicates hexadecimal value with 0x.
Suffixes − Suffixes denotes the type of the value. For example, 8465484156155LL denotes a long long integer.
Example
#include <iostream> using namespace std; int main(){ //prefixes cout << 213 << '\n' << 0213 << '\n' << 0x213A << '\n' << 0b101 << '\n' //suffixes << 1234567890123456789LL << '\n' << 12345678901234567890ull << '\n' << 12345678901234567890u; return 0; }
Output
213 139 8506 5 1234567890123456789 12345678901234567890 12345678901234567890