char b[4]={"morning","industry","beautiful","english"};
此句有误,b是容量为4个字符的数组,不能用来存放字符串,若想存放一组字符串,建议你用2维数组
注:C中没有String类型,只有Char类型
#include "stdio.h"
char *b[4]={"morning","industry","beautiful","english"};
void main()
{
int i;
char *x;
for(i=0;i<4;i++)
{
x=b[i];
puts(x);
}
getchar();
}
*b[4]是四个字符串
b[i]已经代表了每一个字符串的首地址
这样就可以输出
morning
industry
beautiful
english