// A terabyte represent as a number of bytes using a large integer constant
// (usually long long or size_t)
// A terabyte is:
// 1 TB = 1,099,511,627,776 bytes (binary, 2⁴⁰)
// 1 TB = 1,000,000,000,000 bytes (decimal, SI)
#include <stdio.h>
#include <locale.h> // Required for setlocale and LC_NUMERIC
#define TERABYTE (1ULL << 40) // 1 TB in binary (2^40 bytes)
int main() {
unsigned long long size = TERABYTE;
printf("%llu bytes\n", size);
setlocale(LC_NUMERIC, ""); // enable system locale
printf("%'zu bytes\n", size);
return 0;
}
/*
run:
1099511627776 bytes
1,099,511,627,776 bytes
*/