# Learn The Useful Integer Literals In Modern C++

A programming language consists of a lot of expressions in our source code. One of elements of expressions in C++ are literals. A more specific type of literal is Integer Literals. Integer literals are primary expressions that allow values of integer types (i.e., decimal, octal, hexadecimal) to be used in expressions directly. They are further improved by the `boolean` literals (binary digits) in C++14. In this post, we will explain and list the types of integer literals available to us in modern C++.

## What is integer literal in modern C++?

Integer Literals in C++ are primary expressions that are used to indicate the base or the type of an integer value. They allow values of integer types to be used in expressions directly. They are further improved by the addition of `boolean` literals in C++ 14.

We can categorize integer literals into two groups: Prefixes and Suffixes.

## What is the prefix integer literal in modern C++?

Prefix Integer Literals are used to indicate the numeric base of the literal. For example, the prefix `0x` indicates a hexadecimal base (i.e. value `0x10` indicates the value of 16).

Here are the prefixes for integer literals (integer-prefix).

Here are simple examples to prefix integer literals:

## What is the suffix integer literal in modern C++?

Suffix Integer Literals are used to indicate the type. For example, the suffix `LL` indicates the value is for the `long long integer` (i.e. value 98765432109876LL indicates it is a `long long integer`).

When we use suffix, that means this type of the integer literal is the first type in which the value can fit, and there are other decimal types from the list of types that depends on which numeric base and suffix.

Here are the suffixes for integer literals (integer-suffix),

Here are simple examples of how to suffix integer literals in C++.

The C++23 feature can be tested with this `__cpp_size_t_suffix` if definition as we show below.

## Is there a full example about integer literals in modern C++?

Here is a full example of how to use integer literals that uses prefixes and suffixes in modern C++.

If you are looking more details about literals, there are many documents in https://www.open-std.org/

C++ Builder is the easiest and fastest C and C++ IDE for building simple or professional applications on the Windows, MacOS, iOS & Android operating systems. It is also easy for beginners to learn with its wide range of samples, tutorials, help files, and LSP support for code. RAD Studio’s C++ Builder version comes with the award-winning VCL framework for high-performance native Windows apps and the powerful FireMonkey (FMX) framework for cross-platform UIs.

There is a free C++ Builder Community Edition for students, beginners, and startups; it can be downloaded from here. For professional developers, there are Professional, Architect, or Enterprise version.

## Oh hi there 👋It’s nice to meet you.

### Yilmaz Yoru

Dr. Yilmaz Yoru has 35+ years of coding with more than 30+ programming languages, mostly C++ on Windows, Android, Mac-OS, iOS, Linux, and some other operating systems. He graduated and received his MSc and PhD degrees from the Department of Mechanical Engineering of Eskisehir Osmangazi University. He is the founder and CEO of ESENJA LLC Company. His interests are Programming, Thermodynamics, Fluid Mechanics, Artificial Intelligence, 2D & 3D Designs, and high-end innovations.