#include <stdio.h>
//指针数组练习
int main1(void)
{
//int a[10];
char* arry[3] = {"hello", "world", "itcast"};
//char arry[3][20] = {"hello", "world", "itcast"};
//char *str = "hello";
int i;
printf("%d
", sizeof(arry));
for (i = 0; i < 3; i++)
printf("%p %s
", arry[i], arry[i]);
return 0;
}
//指针数组易犯错误
int main(void)
{
//int a[10];
char* arry[3]; //arry[0] => 0x0
//char arry[3][20] = {"hello", "world", "itcast"};
//char *str = "hello";
int i;
for (i = 0; i < 3; i++)
scanf("%s", arry[i]); //使用二维数组申请字符串存储空间
for (i = 0; i < 3; i++)
printf("%s", arry[i]);
return 0;
}