vs

[*] The original intention in C++98 was that you should use <cstdint> in C++, to avoid polluting the global namespace (well, not <cstdint> in particular, that’s only added in C++11, but the <c*> headers in general). However, implementations persisted in putting the symbols into the global namespace anyway, and C++11 ratified this practice[*]. So, you … Read more

How to portably print a int64_t type in C

For int64_t type: #include <inttypes.h> int64_t t; printf(“%” PRId64 “\n”, t); for uint64_t type: #include <inttypes.h> uint64_t t; printf(“%” PRIu64 “\n”, t); you can also use PRIx64 to print in hexadecimal. cppreference.com has a full listing of available macros for all types including intptr_t (PRIxPTR). There are separate macros for scanf, like SCNd64. A typical … Read more

How to print a int64_t type in C

For int64_t type: #include <inttypes.h> int64_t t; printf(“%” PRId64 “\n”, t); for uint64_t type: #include <inttypes.h> uint64_t t; printf(“%” PRIu64 “\n”, t); you can also use PRIx64 to print in hexadecimal. cppreference.com has a full listing of available macros for all types including intptr_t (PRIxPTR). There are separate macros for scanf, like SCNd64. A typical … Read more