Why in Turbo C the compiler sizeof (int) is 2 bytes, while in gcc Linux the compiler is 4 bytes?
The MSDOS instructions contain the codes 16 bit | 2 Bytes
16 bit | 2 Bytes
.
So the maximum integer values will be 16bit
whole numbers.
What I have analyzed so far:
The keyword
int
differs from compiler to compiler. Turbo C is a16 bit
compiler, so it compiles code to16 bit
machine code for the processor!As we all know, the compiler converts code to machine code in order to work.
The same is true for GCC .
The computers we use today are 32/64
bits.
The compiler must support the architecture for any application to work.
- GCC is a
32/64 bit
compiler. So itsizeof(int)
is4 Bytes
. - Turbo C is a
16bit
compiler. So itsizeof(int)
is2 Bytes
.
source to share