Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

421
Vistas
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?

over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

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)

over 4 years ago · Santiago Trujillo Denunciar

0

sizeof(int) varies from machine to machine (and sometimes from compiler to compiler).

Usually sizeof(int) represents the "natural" word width of the CPU. But If your compiler runs as x86 program on a x64 machine even this assumption breaks.

over 4 years ago · Santiago Trujillo Denunciar

0

In MSDOS instructions codes are 16 bit | 2 Bytes.
So, the maximum integer values would be 16bit integers.

What I've analysed so far:

The keyword int differs from compiler to compiler. Turbo C is a 16 bit compiler so it compiles the code into a 16 bit machine code for the processor!

As we all know, a compiler will convert the code to a machine code in order to work.
Same applies for GCC.

The computers we use today is either 32/64 bit.


A compiler should support the architecture to make any applications work.

  • GCC is 32/64 bit compiler. So, sizeof(int) is 4 Bytes.
  • Turbo C is 16bit compiler. So, sizeof(int) is 2 Bytes.
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda