Reference to a Pointer?

J

Jeremy Cowles

What exactly does this mean?

CString*&

Is it a reference to a pointer to a CString?

Thanks,
Jeremy
 
D

David White

Jeremy Cowles said:
What exactly does this mean?

CString*&

Is it a reference to a pointer to a CString?

Yes. To decipher these things you start at the identifier, or where the
identifier would be. In this case that's after the '&'. You then form the
type by taking the operators one at a time from that position in order of
operator precedence. Parentheses can be used to force the precedence if
necessary. The first operator is '&' (reference), then '*' (pointer; we have
reference to a pointer so far), then finally CString (reference to a pointer
to a CString).

Other examples:
int *p[2]; // array of two pointers to ints
int (*p)[2]; // pointer to an array of two ints
int (*p)(); // pointer to a function returning int

DW
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,159
Messages
2,570,879
Members
47,417
Latest member
DarrenGaun

Latest Threads

Top