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

19th Dec 2018, 5:12 PM
Venkatesh
Venkatesh - avatar
4 Antworten
+ 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.
19th Dec 2018, 5:47 PM
🇵🇰 Danish Khan 🇵🇰
🇵🇰 Danish Khan 🇵🇰 - avatar
+ 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.
19th Dec 2018, 6:18 PM
🇵🇰 Danish Khan 🇵🇰
🇵🇰 Danish Khan 🇵🇰 - avatar
0
But it isn't universal value or what
19th Dec 2018, 5:51 PM
Venkatesh
Venkatesh - avatar
0
Or it it dependent on type of complier
19th Dec 2018, 5:51 PM
Venkatesh
Venkatesh - avatar