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

  • A+

What is the difference in following c++ codes -

const int x = 5000; const int x = 50'00; 


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.


:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: