I was just looking across some code and came across this:
const char *p1;
char **p2;
What the heck is p2? p1 is a pointer to a constant. Is p2 some type of pointer?
Thx,
Tim
Printable View
I was just looking across some code and came across this:
const char *p1;
char **p2;
What the heck is p2? p1 is a pointer to a constant. Is p2 some type of pointer?
Thx,
Tim
p1 is a pointer to a character that you may not modify. This character might be the first in a string of characters.
p2 is a pointer to a pointer to a character that you may modify.
A pointer to a pointer. Lovely!
It's usually only used for function parameters. Let me think, there's some CRT function that uses it...
strtol I think. Expects the address of a const char* to be passed which is then set to point to the first character that couldn't be parsed anymore.