Ich versuche den Unterschied zwischen drei folgenden Deklarationen in c ++ zu lösen. Ich habe meine Vermutungen angehängt:
const float *x[4]
- 4-Element-Array von Zeigern auf Arrays mit konstanten Floatsconst float (*x)[4]
- Ich bin hier verwirrt ... ist es dasselbe wie oben?const float *(*x)[4]
- das gleiche wie oben, aber "auf Arrays von Arrays konstanter Schwimmer"
Jede Hilfe / Erklärung wird geschätzt.
Antworten:
4 für die Antwort № 1Benutzen cdecl
Erklärungen kennen,
const float *x[4]
- Erkläre x als Array 4 des Zeigers zu schwebenconst float (*x)[4]
- Erkläre x als Zeiger zu Array 4 von const floatconst float *(*x)[4]
- Erkläre x als Zeiger auf Array 4 des Zeigers auf const float
Quelle : cdecl.org
2 für die Antwort № 2
const float *x[4] - 4-element array of pointers on arrays of constant floats
4-Element-Array von Zeigern auf konstante Floats.
const float (*x)[4] - I"m confused here... is it the same as above?
Zeiger auf ein 4-Element-Array mit konstanten Floats.
const float *(*x)[4] - the same as above but "on arrays of arrays of constant floats"
Zeiger auf ein 4-Element-Array von Zeigern auf konstante Floats.
1 für die Antwort № 3
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