#include <stdio.h> /** * C语言中,数组的名称就是 一连串连续内存的起始地址, * 因此给数组传递给函数,传递的就是数组元素类型的指针 */ void hello_0(char msg[20]); void hello_1(char msg[]); void hello_2(char *msg); int main() { char msg[20] = "hello kitty"; char notice[40] = "this is a notice to kitty."; hello_0(msg); hello_1(msg); hello_2(msg); hello_0(notice); hello_1(notice); hello_2(notice); return 0; } void hello_0(char msg[20]) { printf("0 msg is [%s]\n", msg); } void hello_1(char msg[]) { printf("1 msg is [%s]\n", msg); } void hello_2(char *msg) { printf("2 msg is [%s]\n", msg); }