std::calloc
提供:cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
| Defined in header <cstdlib>
|
||
| void* calloc( std::size_t num, std::size_t size ); |
||
割り当てサイズ
numのsizeオブジェクトの配列のためのメモリおよびゼロ初期化し、それを. Original:
Allocates memory for an array of
num objects of size size and zero-initializes it. The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
割り当てが成功した場合、適当に任意のオブジェクト型に整列された割り当てられたメモリブロックの最下位(最初の)バイトへのポインタを返す.
Original:
If allocation succeeds, returns a pointer to the lowest (first) byte in the allocated memory block that is suitably aligned for any object type.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
sizeがゼロの場合、動作は実装定義(nullポインタが返されることがあります、または一部の非NULLポインタがストレージにアクセスするために使用されない場合があり、その戻される場合があります)Original:
If
size is zero, the behavior is implementation defined (null pointer may be returned, or some non-null pointer may be returned that may not be used to access storage)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
目次 |
[編集] パラメータ
| num | - | オブジェクトの数
Original: number of objects The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| size | - | 各オブジェクトのサイズ
Original: size of each object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[編集] 値を返します
エラーが発生した場合、新たに割り当てられたメモリやNULLの先頭を指すポインタ。ポインタは
free()を使って解放する必要があります.Original:
Pointer to the beginning of newly allocated memory or NULL if error has occurred. The pointer must be deallocated with
free().The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[編集] ノート
アラインメントの要件のために、割り当てられたバイト数が
num*sizeとは必ずしも一致しないです.Original:
Due to the alignment requirements, the number of allocated bytes is not necessarily equal to
num*size.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[編集] 例
| This section is incomplete Reason: no example |
[編集] も参照してください
| C documentation for calloc
|