hello
i want to know that if check the size of int in turbo c++ then its show 2 bytes and if check the size of int in code block then it show the 4 bytes
and how the size of int depend on the system if i have a 64 bit system ?
Good question... I've always just assumed that it stood for "integer, long, pointer". But now that I look at it that doesn't necessarily make sense. I will get back to you on that one.
I suspect it does refer to integer, long and pointer. Apparently, only the largest values are listed, so LP32 means long and pointer are 32 bits, but integer is shorter. The one that might throw someone off is the LLP64. In this case, I guess that the long long type and the pointer are 64 bits, but integer and long are shorter.
- sizeof(char) is always 1 byte, whichever platform you use.
- I have never seen sizeof(float) being different from 4 bytes because floating point numbers are stored in IEEE 754 32-bit floating point format. I would however not count on it though that some platforms/compilers might behave differently.
ALL types BUT char have a possibly variable size.
Use uint32_t, uint16_t, int32_t, int16_t, ... (They must be included from a file, I do not remember which one it was).
you are saying that all type takes diff bytes in diff system but i read from many book they told that changing in bytes happen only with int not for float and char
I repeat: ONLY char has a guaranteed size.
Change your book, change your compiler (Turbo C++? In 2014?)
Size of integers is not related to 32/64bits, anyways.
Once again: ONLY chars do not change.
Any other type may have any other size.
This is what you can rely on:
char <= short <= int <= long
char <= float <= double