On this page
  1. uintptr_t
  2. Include
  3. Signature & Overview
  4. Notes & Pitfalls
  5. Example

uintptr_t

Prev: uint64_t | Up: stdint.h | Next: PRIu64
Rel: stdint.h, stdint, stdbool & limits Guide
Ref: cppreference — uintptr_t
Tags: #public #prog #c #stdlib #stdint #tier/standard


Include

#include <stdint.h>

Signature & Overview

typedef /* unsigned ptr-width */ uintptr_t;

Unsigned integer guaranteed wide enough to hold a void * pointer round-trip.

Notes & Pitfalls

Example

#include <assert.h>
#include <stdint.h>

int main(void) {
    int x = 1;
    uintptr_t addr = (uintptr_t)&x;
    assert((int *)addr == &x);
}

Linked from

Related notes