the value of 8 bytes for unsigned integers

I'm confused about the actual value of 8 bytes for unsigned integers. The below code suggests the value is 13217906525252912201:

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <stdio.h>
#include <inttypes.h>

typedef uint64_t byte_int_t;

int main(void)
{
    byte_int_t t;
    printf("%" PRIu64 "\n", t);
    return 0;
}
./runprogram
13217906525252912201


However, when I use a calculator, I get a different value:
2^64= 1.8446744e+19

So I was wondering is this really 8 bytes? So I try below test and it produces 8, as expected:

1
2
3
4
5
6
7
8
9
10
11
#include <stdio.h>
#include <inttypes.h>

typedef uint64_t byte_int_t;

int main(void)
{
    byte_int_t t;
    printf("%u\n", sizeof(t));
    return 0;
}


So why does C and my calculator provide two different results?
It looks like you are printing an uninitialized value on line 9; why were you expecting to get a specific value as the initial value of t?
Topic archived. No new replies allowed.