The ASCII code of character 0 is actually 48, and the character 0 in C language.
There is only one Byte, that is, what is stored in memory is
0 100 1000
(where each 0 or 1 stands for one bit)
And the integer 0,
Its representation in memory is all zeros. In C language, an integer accounts for 4 bytes, and the representation of integer 0 in memory is:
00000000
00000000
00000000
00000000
.
As follows:
tea
c
=
'0';
//Character 0
Internationalorganizations (same as international organizations)
a
=
0;
//Integer 0
printf("%c,
%d\n ",
c,
a);
//0,0
printf("%d\n ",
c);
//48
Accepting characters in integer form is actually printing the value of c in memory.
printf("%d\n ",
(c+a));
//48
printf("%c\n ",
(char)(c+a));
//0
Output result:
0,0
48
48
You can see the difference between the character 0 and the integer 0 from the above.