_Alignof operator

From cppreference.com
< c‎ | language

Queries the alignment requirement of its operand type.

Syntax

_Alignof( type-name ) (since C11)

This operator is typically used through the convenience macro alignof, which is provided in the header stdalign.h

Explanation

Returns the alignment requirement of the type named by type-name. If type-name is an array type, the result is the alignment requirement of the array element type. The type-name cannot be function type or an incomplete type.

The result is an integer constant of type size_t.

The operand is not evaluated (so external identifiers used in the operand do not have to be defined)

Notes

The use of alignof with expressions is allowed by some C compilers as a non-standard extension.

Keywords

_Alignof