Hi All,
Is that true that size of a byte not necessarily 8-bit? What the std. says? If that true, then what will the size of an int, i mean what sizeof(int) should return?
On my machine sizeof(char) == sizeof(int). TMS320C5402 DSP (with 16-bit word size). both returns one. So, it holds true.
But my interpretation is : Size of int,float etc is specified in terms of bytes, not bits...which is a standard i.e int -> 2 bytes, char -> 1 byte etc... now, actual size of these depends up on no. of bits in a byte... which is implementation defined. So, if we say on a machine its defined 1 byte = 8 bits then size(char) = 1byte =
8 bits size(int) = 2 bytes = 16 bits... but on other machine 1 byte = 16 bits the size(char) = 1byte = 16 bits and Size(Int) =2 bytes= 32 bits. In no case, it can be same for both char & int.Please help me where I am missing.
-Neo