size_t
提供: cppreference.com
ヘッダ <stddef.h> で定義
|
||
ヘッダ <stdio.h> で定義
|
||
ヘッダ <stdlib.h> で定義
|
||
ヘッダ <string.h> で定義
|
||
ヘッダ <time.h> で定義
|
||
ヘッダ <uchar.h> で定義
|
(C11以上) |
|
ヘッダ <wchar.h> で定義
|
(C95以上) |
|
typedef /*implementation-defined*/ size_t; |
||
size_t
は sizeof、 _Alignof (C11以上) および offsetof の結果の符号なし整数型で、データモデルに依存します。
|
(C99以上) |
目次 |
[編集] ノート
size_t
はあらゆる型 (配列を含む) の理論上可能なオブジェクトの最大サイズを格納できます。
size_t
は一般的に配列のインデックスやループカウンタのために使用されます。 配列のインデックスに unsigned int などの他の型を使用するプログラムは、例えば64ビットのシステムにおいて、インデックスが UINT_MAX を超えるとき、または32ビットの剰余算術をあてにしている場合、失敗するかもしれません。
[編集] 例
Run this code
出力例:
SIZE_MAX = 18446744073709551615 size = 400
[編集] 参考文献
- C11 standard (ISO/IEC 9899:2011):
- 7.19 Common definitions <stddef.h> (p: 288)
- 7.20.3 Limits of other integer types (p: 293)