C
← Volver a stddef.h stdint.h Seguir con stdio.h


Este ficheiro de cabeceira permite aos programadores escribir código máis portable fornecendo instrucións typedef que establecen o tamaño fixo dos tipos enteiros, xunto con claves definindo os valores máximos e mínimos de cada tipo. Pode incluírse nun código fonte mediante a seguinte directriz:

#include <stdint.h>

A convención para nomear os tipos enteiros de tamaño fixo é intN_t para os enteiros (negativos e positivos) e uintN_t para os naturais. Por exemplo: int8_t e uint64_t.

Os tipos de tamaño fixo e os seus correspondentes límites so van incluídos no ficheiro de cabeceira se existen para o procesador ou compilador específico.

Tipos editar

O ficheiro de cabeceira inclúe tipos de enteiros de tamaño fixo, que seguen as formas intN_t (enteiros positivos e negativos) e uintN_t (números naturais).

Especificador Equivalente en Unix/Linux Equivalente en Windows Enteiro ou natural? Bits Bytes Valor mínimo Valor máximo
int8_t signed char signed char enteiro 8 1 −128 127
uint8_t unsigned char unsigned char natural 8 1 0 255
int16_t short short enteiro 16 2 −32,768 32,767
uint16_t unsigned short unsigned short natural 16 2 0 65,535
int32_t int int or long enteiro 32 4 −2,147,483,648 2,147,483,647
uint32_t unsigned int unsigned int or unsigned long natural 32 4 0 4,294,967,295
int64_t long long long enteiro 64 8 −9,223,372,036,854,775,808 9,223,372,036,854,775,807
uint64_t unsigned long unsigned long long natural 64 8 0 18,446,744,073,709,551,615


C
← Volver a stddef.h stdint.h Seguir con stdio.h