0

C++ で次の 3 つの宣言の違いを解決しようとしています。私は私の推測を追加しました:

  • const float *x[4]- 定数 float の配列上のポインターの 4 要素配列
  • const float (*x)[4]-ここで混乱しています...上記と同じですか?
  • const float *(*x)[4]- 上記と同じですが、「定数浮動小数点数の配列の配列」

ヘルプ/説明をいただければ幸いです。

4

3 に答える 3

4

cdecl宣言を知るために使用し、

  1. const float *x[4]- const float へのポインターの配列 4 として x を宣言します。
  2. const float (*x)[4]- xを const float の配列 4 へのポインターとして宣言する
  3. const float *(*x)[4]- const float へのポインターの配列 4 へのポインターとして x を宣言します。

ソース: cdecl.org

于 2013-06-14T18:28:56.520 に答える
2
const float *x[4] - 4-element array of pointers on arrays of constant floats

定数浮動小数点数へのポインターの 4 要素配列。

const float (*x)[4] - I'm confused here... is it the same as above?

定数浮動小数点数の 4 要素配列へのポインター。

const float *(*x)[4] - the same as above but "on arrays of arrays of constant floats"

定数浮動小数点数へのポインターの 4 要素配列へのポインター。

于 2013-06-14T18:28:23.403 に答える
1
const float *x[4]    -  An array of pointers to constant floats
const float (*x)[4]  -  A pointer to an constant float array with 4 elements
const float *(*x)[4] -  A pointer to an array of pointers to constant float 
于 2013-06-14T18:32:12.623 に答える