清霜一梦

SaveAboutZero

0
阅读(1117)

// date :2013 4 2
//designer :pengxiaoen
//function: check about the number 0 how it is saved in computer

#include "stdio.h"
int main ()
{
int check_number;
char number_temp[32];

check_number = -0;
printf ("%%d check_number = %d\n",check_number);
printf ("%%b check_number = %s\n", itoa(check_number, number_temp, 2));
printf ("%%x check_number = %x\n\n",check_number);


check_number = +0;
printf ("%%d check_number = %d\n",check_number);
printf ("%%b check_number = %s\n", itoa(check_number, number_temp, 2));
printf ("%%x check_number = %x\n\n",check_number);


system ("pause");
}

结果:

也就是说+0 和-0 在computer中存储的方式都是以0000 0000 (对于32位机以32个0)的方式存储。

如有疑问,可以看这个结果:


Baidu
map