__STDC_ENDIAN_LITTLE__, __STDC_ENDIAN_BIG__, __STDC_ENDIAN_NATIVE__
Header: <stdbit.h>
Indicates the endianness of all scalar types:
# Declarations
#define __STDC_ENDIAN_LITTLE__ /* implementation-defined */
(since C23)
#define __STDC_ENDIAN_BIG__ /* implementation-defined */
(since C23)
#define __STDC_ENDIAN_NATIVE__ /* implementation-defined */
(since C23)
# Example
#include <stdbit.h>
#include <stdio.h>
int main()
{
switch(__STDC_ENDIAN_NATIVE__)
{
case __STDC_ENDIAN_LITTLE__:
printf("__STDC_ENDIAN_LITTLE__\n");
break;
case __STDC_ENDIAN_BIG__:
printf("__STDC_ENDIAN_BIG__\n");
break;
default:
printf("mixed-endian\n");
}
return __STDC_ENDIAN_NATIVE__;
}