Java allows the digits in a numeric constant to be separated as follows:
int a = 1_000_000;
Does C or C++ have a similar construct?
Java allows the digits in a numeric constant to be separated as follows:
int a = 1_000_000;
Does C or C++ have a similar construct?
The only way to do this is in C++14, is with single quotes, like this. Unfortunately, the only problem with this is that syntax highlighting often gets messed up with the notation below, and you can see that in my example as well:
int i = 1'000'000;
In the integer and floating-point digit sequences, optional separators ' are allowed between any two digits and are ignored (since C++14)
You may write in C++ 14
int a = 1'000'000;
In C such a feature is absent.