# max_align_t

> C++ Atlas: `cppatlas.com/w/c/types/max_align_t` | Source: https://en.cppreference.com/w/c/types/max_align_t | Domain: Type support | Standards: C11

max_align_t is a type whose alignment requirement is at least as strict (as large) as that of every scalar type.

## Official Specification Summary (cppreference)

```cpp
// Defined in header <stddef.h>
typedef /*implementation-defined*/ max_align_t; // (since C11)
```

`max_align_t` is a type whose alignment requirement is at least as strict (as large) as that of every scalar type.

### Notes

Pointers returned by allocation functions such as `malloc` are suitably aligned for any object, which means they are aligned at least as strictly as `max_align_t`.

### Example

```c
#include <inttypes.h>
#include <stdalign.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    size_t a = alignof(max_align_t);
    printf("Alignment of max_align_t is %zu (%#zx)\n", a, a);

    void *p = malloc(123);
    printf("The address obtained from malloc(123) is %#" PRIxPTR"\n",
            (uintptr_t)p);
    free(p);
}
```

Possible output:

```text
Alignment of max_align_t is 16 (0x10)
The address obtained from malloc(123) is 0x1fa67010
```

### References

- C23 standard (ISO/IEC 9899:2024):

  - 7.19 Common definitions \<stddef.h> (p: TBD)

- C17 standard (ISO/IEC 9899:2018):

  - 7.19 Common definitions \<stddef.h> (p: 211)

- C11 standard (ISO/IEC 9899:2011):

  - 7.19 Common definitions \<stddef.h> (p: 288)

### See also

- [C++ documentation for `max_align_t`](https://en.cppreference.com/w/cpp/types/max_align_t)

---
Attribution: content from https://en.cppreference.com/w/c/types/max_align_t (cppreference.com), licensed under CC-BY-SA 3.0 and GFDL. Modified: converted to markdown, study notes added. Offline snapshot of 9 February 2025.