#include<stdio.h> int main() { int a; a=100000000; printf("%d",a); return(0); }
//why value of gets printed if larger range of int?
because range of int type in c -32767 32767
you have false assumptions there.
the range of type int
not fixed. int not 16 bits.
the c standard doesn't define fixed range int
. requires conforming implementation supports at least range -32767 32767 int
. implementation can support higher ranges. on systems, int
32 bits wide.
so there's nothing unexpected in output. if want know exact limits can use macros int_min
, int_max
<limits.h>
.
relevant c-faq: how should decide integer type use?
Comments
Post a Comment