0
Guys i run that about code i got sizeof(integer) output as 4 but the sizeof integer is 2.
Which one is right 2 or 4 please give suggestion
4 Answers
+ 2
sizeof(integer) is highly dependent on System, as it can be 64 bit or 32 bit and on vary restricted system 16 or 8 bit
8 bit = 1 byte
16 bit = 2 byte
32 bit = 4 byte (32 bit OS, x86)
64 bit = 8 byte (64 bit OS)
So depending on your system / compiler settings both can be correct.
+ 2
No it is not universal, it is system dependent,
boolean, char, short, long, float, double are almost universal but only int is system dependent, on most present day computer / mobile devices it is 4 bytes but still not constant.
0
But it isn't universal value or what
0
Or it it dependent on type of complier