stdint.h ヘッダーは、整数型、指定幅整数型の限界、その他の整数型の限界、および整数定数式用のマクロを定義します。
整数型の限界を表すオブジェクト類似マクロ: stdint.h ヘッダーによって提供される追加のオブジェクト類似マクロについて説明します。
整数定数を表す関数類似マクロ: stdint.h ヘッダーによって提供される追加の関数類似マクロについて説明します。
#define _ISOC99_SOURCE
#include <inttypes.h>
#include <stdio.h>
int main(void)
{
uint32_t a = UINT32_C(1234);
printf("%u¥n",a );
}
出力:
1234
| uint32_t a = UINT32_C(1234);
+ uint32_t a = 1234U;
例:
/* long long required */
#define _ISOC99_SOURCE
#include <inttypes.h>
#include <stdio.h>
int main(void)
{
intmax_t a = INTMAX_C(45268724);
printf("%jd¥n",a );
}
出力:
45268724
| intmax_t a = INTMAX_C(45268724);
+ intmax_t a = 45268724L;
| intmax_t a = INTMAX_C(45268724);
+ intmax_t a = 45268724LL;