char *name[3];
name[0] = "a2n";
name[1] = "c9s";
name[2] = "ccn";
Known name at 0x1, and its content is:
{0x100, 0x101, 0x102}
Meaning indicates to "a2n", "c9s" and "ccn", respectively.
The array "name" saves the three string's address in its array space, hence, pass the array "name" to other function might via the address, and access the content of array "name" via address again. In the other word, I shall using "Pointer into Pointer" in the parameters field of array "name". :-)
Example:
void show(char **name)
{
for (int i = 0; i < 3; i++) cout << *name[i] << endl;
}
char *name[3];
name[0] = "a2n";
name[1] = "c9s";
name[2] = "ccn";
show(name);
沒有留言:
張貼留言