void say(char msg[])
{ // using pointer to print out the first char of string
printf("%c\n", *msg);
}
void say(char msg[])
{ // using pointer to print out the memory address of the first char of string
printf("%p\n", msg);
}
void say(char msg[])
{ // using pointer to print out the whole string
printf("%s\n", msg);
}
前两个是有道理的,但我不太明白第三个函数是如何工作的。我所知道的是 msg 指向字符串第一个字符的内存地址。提前致谢。