I'm solid confused with range of data type in C. I have 64 bit computer so int data type can store 64 bit value
64 bits: maximum representable value = 18,446,744,073,709,551,615
https://en.wikipedia.org/wiki/Integer_overflow
When I run program on 64 bit computer. It gives two warning
Result : -1
Program should be print this value = 18446744073709551615 but I don't understand why it print -1.
How maximum value int data type can be hold in memory location ?
64 bits: maximum representable value = 18,446,744,073,709,551,615
https://en.wikipedia.org/wiki/Integer_overflow
C:
#include <stdio.h>
int main (void)
{
int value = 18446744073709551615;
printf ("%d", value);
return 0;
}
Code:
warning: integer constant is so large that it is unsigned
Warning: overflow in implicit constant conversion [-Woverflow]
Program should be print this value = 18446744073709551615 but I don't understand why it print -1.
How maximum value int data type can be hold in memory location ?