Search code examples
cintegersizeofturbo-c

Why in Turbo C compiler sizeof(int) is 2 bytes and in gcc Linux compiler is 4 byte?


Why in Turbo C compiler sizeof(int) is 2 bytes and in gcc Linux compiler is of 4 bytes?


Solution

  • sizeof(int) is not a constant across all platforms.

    It varies from system to system.

    PS: Only sizeof object which is constant across all platforms is sizeof(char)