C++: Integer Literals


Some programming languages have ways of expressing integer literals in bases other than the normal base ten.

Show how integer literals can be expressed in as many bases as your language allows.

Note: this should not involve the calling of any functions/methods but should be interpreted by the compiler or interpreter as an integer written to a given base.

Also show any other ways of expressing literals, e.g. for different types of integers.

#include <iostream>
int main()
  std::cout << ( (727 == 0x2d7) && 
                 (727 == 01327)     ? "true" : "false")
            << std::endl;
  return 0;


Content is available under GNU Free Documentation License 1.2.