/*int signed 0xFFFFFFFF = = -10xfffffffe = 2 min 0x80000000 = = 21 4748 3648 maximum 0x7fffffff = = 4748 36470x00000001 = 10x0000000 0 = = 0int unsigned max 0xFFFFFFFF = 9496 7295 0x80000000 = 4748 36480x7fffffff = 21 4748 3647 min 0x00000000 = = 0*/
Intmain () {/* first participates in 5 int, 32-bit platform is 4 bytes, and the stack allocates 4 bytes of memory to hold the number of references 5.The%f symbol will feel that this parameter is a double type. The printf function converts the float itself to a double, so the stack reads 8 bytes. So memory access is out of bounds. */printf ("5 =%f\n", 5);/* The 5.01 is a double type, and the storage is 8 bytes.
%d reads only 4 bytes. */printf ("5.01 =%d\n", 5.01);}
/*
[Email protected] test_class]#./a.out
5 = 0.000000
5.01 = 1889785610
[Email protected] test_class]#./a.out
5 = 0.000000
5.01 = 1889785610
[Email protected] test_class]#./a.out
5 = 0.000000
5.01 = 1889785610
*/
Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.
int signed and unsigned type memory--C