uintptr_t --Pointer type size unsigned integer type

uintptr_t is an unsigned integer type with a pointer type size. For example, if the pointer type is a processing system expressed in 32 bits, it is defined as a 32-bit unsigned integer type, and if the pointer type is a processing system expressed in 64 bits, it is defined as a 64-bit unsigned integer type. uintptr_t was introduced in C99.

Mutual type conversion with general-purpose pointer types

The uintptr_t type is guaranteed to be interchanged with the general-purpose pointer type "void *". Bit representation does not change due to mutual conversion.

This is a sample program that converts uintptr_t and void * to each other.

#include <stdint.h>

int main (void) {
  void * ptr;
  
  uintptr_t iptr = (uintptr_t) ptr;
  
  void * ptr_again = (void *) iptr;
}

The same use is for the pointer type size signed integer type " uintptr_t".

Associated Information