Printf 64 bits data-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);

Use PRIx64 to print in hexadecimal

Refer: http://en.cppreference.com/w/cpp/types/integer

Refer: https://stackoverflow.com/questions/9225567/how-to-print-a-int64-t-type-in-c#:~:text=for%20uint64_t%20type%3A,PRIx64%20to%20print%20in%20hexadecimal.

Sizeof

char c; printf("%zu,%zu\n", sizeof c, sizeof (int));

Leave a comment