Help with pointer & array
I'm confused on how to interpret the following statement:
Is it a pointer to a char array or an array of char pointers? Advanced thanks.
Array of char pointers. This is a pointer to an array of chars:
BTW: The syntax is the same as with functions:
1 2 3 4
|
// Function returning char ptr:
char *foo()
// Pointer to a function returning char:
char (*foo)();
|
Note: The syntax in all cases resemble how you will most likely USE the symbol. E.g.
1 2 3 4
|
// Call the function that foo points to:
(*foo)();
// Get an element from the array that ptr points to:
(*ptr)[i];
|
Topic archived. No new replies allowed.