X
xian_hong2046
Hello,
Could someone please tell me what's the correct way of representing a
pointer pointing to an array?
If I have an array of int, then I have:
int a[3];
I understand I can create a pointer pointing to "a" by:
int* b = a;
However, according to the book Thinking in C++, one can read pointer
types using a right->left->right approach. An example is:
int (*(*f4())[10]) ()
and "f4" is a function that returns a pointer, pointing to an array of
10 elements, where each element is a function that returns an int.
Following this, a pointer to an array of ints should be:
int (*c)[]
However, this is wrong: the compiler complains about it. The two
methods of declaring pointer types seem inconsistent, or, am I missing
something?
Thanks a lot!
xian
Could someone please tell me what's the correct way of representing a
pointer pointing to an array?
If I have an array of int, then I have:
int a[3];
I understand I can create a pointer pointing to "a" by:
int* b = a;
However, according to the book Thinking in C++, one can read pointer
types using a right->left->right approach. An example is:
int (*(*f4())[10]) ()
and "f4" is a function that returns a pointer, pointing to an array of
10 elements, where each element is a function that returns an int.
Following this, a pointer to an array of ints should be:
int (*c)[]
However, this is wrong: the compiler complains about it. The two
methods of declaring pointer types seem inconsistent, or, am I missing
something?
Thanks a lot!
xian