Igorzovisk Igorzovisk - 2 months ago 15
C Question

How to separate digits in numeric constants (i.e. 10,000) in C or C++ code

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?

Answer

You may write in C++ 14

int a = 1'000'000;

In C such a feature is absent.