
- C Programming Tutorial
- C - Home
- C - Overview
- C - Environment Setup
- C - Program Structure
- C - Basic Syntax
- C - Data Types
- C - Variables
- C - Constants
- C - Storage Classes
- C - Operators
- C - Decision Making
- C - Loops
- C - Functions
- C - Scope Rules
- C - Arrays
- C - Pointers
- C - Strings
- C - Structures
- C - Unions
- C - Bit Fields
- C - Typedef
- C - Input & Output
- C - File I/O
- C - Preprocessors
- C - Header Files
- C - Type Casting
- C - Error Handling
- C - Recursion
- C - Variable Arguments
- C - Memory Management
- C - Command Line Arguments
- C Programming useful Resources
- C - Questions & Answers
- C - Quick Guide
- C - Useful Resources
- C - Discussion
Integer literal in C/C++ (Prefixes and Suffixes)
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
- Related Articles
- Literal number suffixes in C#
- Hexadecimal integer literal in Java
- How can we remove all the prefixes or suffixes from a given string in MySQL?
- Lowercase suffixes in C#
- Electrical Units and Metric Prefixes
- Prefixes with more a than b in C++
- Raw string literal in C++
- Raw string literal in C++ program
- What is 0 (zero) - A decimal literal or An octal literal in C++
- What is the difference between literal and constant in C++?
- What is the difference between literal and constant in C#?
- What is a string literal in C++?
- String Literal Vs String Object in C#
- Trie of all Suffixes
- How to write a short literal in C++?

Advertisements