Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference - const int x = 5000; and const int x = 50'00; in C++?

What is the difference in following c++ codes -

const int x = 5000;
const int x = 50'00;
like image 957
ashish singh Avatar asked Dec 02 '22 10:12

ashish singh


1 Answers

50'00 uses digit separator that was added in C++14. The number will resolve to 5000, only difference is that it might be easier to read. Usually you would use digit separator to separate thousands, like 1'000'000, but you are allowed to use it at any point in the number.

like image 77
VLL Avatar answered Dec 04 '22 00:12

VLL