In C99 the available basic integer types (the ones without _t) were deemed insufficient, because their actual sizes may vary across different systems.  The C99 standard includes definitions of several new integer types to enhance the portability of programs. The new types are especially useful in embedded environments.  All of the new types are suffixed with a _t and are guaranteed to be defined uniformly across all systems.

Integer Data Types
C type stdint.h type Bits Sign Range
char uint8_t 8 Unsigned 0 .. 255
signed char int8_t 8 Signed -128 .. 127
unsigned short or unsigned int uint16_t 16 Unsigned 0 .. 65,535
short or int int16_t 16 Signed -32,768 .. 32,767
unsigned int uint32_t 32 Unsigned 0 .. 4,294,967,295
int int32_t 32 Signed -2,147,483,648 .. 2,147,483,647
unsigned long long uint64_t 64 Unsigned 0 .. 18,446,744,073,709,551,615
long long int64_t 64 Signed -9,223,372,036,854,775,808 .. 9,223,372,036,854,775,807

(int can be 16 bits or 32 bits depending on the platform)

Floating Point Data Types
C type IEE754 Name Bits Range
float Single Precision 32 -3.4E38 .. 3.4E38
double Double Precision 64 -1.7E308 .. 1.7E308

Typedef's To Include For C99 stdint.h Types


//----- STDINT.H TYPE DEFINITIONS -----
//(Valid for XC16 & XC32 microchip PIC compilers)
#ifndef uint8_t
typedef unsigned char uint8_t;
#endif

#ifndef int8_t
typedef signed char int8_t;
#endif

#ifndef uint16_t
typedef unsigned short uint16_t;
#endif

#ifndef int16_t
typedef signed short int16_t;
#endif

#ifndef uint32_t
typedef unsigned long uint32_t;
#endif

#ifndef int32_t
typedef signed long int32_t;
#endif

#ifndef uint64_t
typedef unsigned long long uint64_t;
#endif

#ifndef int64_t
typedef signed long long int64_t;
#endif

//----- STDINT.H TYPE DEFINITIONS -----
//(Valid for XC8 microchip PIC compiler)
#ifndef uint8_t
typedef unsigned char uint8_t;
#endif

#ifndef int8_t
typedef signed char int8_t;
#endif

#ifndef uint16_t
typedef unsigned short uint16_t;
#endif

#ifndef int16_t
typedef signed short int16_t;
#endif

#ifndef uint32_t
typedef unsigned long uint32_t;
#endif

#ifndef int32_t
typedef signed long int32_t;
#endif

 

UK Electronic Designer
USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.