will the size of datatypes is fixed like integer will take 4 bytes only …or else the datatype sizes depends on compiler?
Size of datatypes
Yes, it depends on both processors (more specifically, ISA, instruction set architecture, e.g., x86 and x86-64) and compilers including programming model. For example, in 16-bit machines, sizeof (int) was 2 bytes. 32-bit machines have 4 bytes for int
. It has been considered int
was the native size of a processor, i.e., the size of register. However, 32-bit computers were so popular, and huge number of software has been written for 32-bit programming model. So, it would be very confusing if 64-bit computer would have 8 bytes for int
. Both Linux and Windows remain 4 bytes for int
. But, they differ in the size of long
.