作业帮 > 综合 > 作业

char* a[5]={"student","worker","cadre","soldier","peasant"};

来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/11/19 21:02:15
char* a[5]={"student","worker","cadre","soldier","peasant"};高手帮我解释一下谢谢
#include "stdio.h"
#include "string.h"
main()
{
int i;
char* a[5]={"student","worker","cadre","soldier","peasant"};
char *p1,*p2;
p1=p2=a[0];
for(i=0;i0) p1=a[i];
if(strcmp(a[i],p2)
char* a[5]={
这一句的意思是:定义一个char类型的指针数组,也就是说,在a[5]这个数组中有5个字符型的指针元素,然后将{"student","worker","cadre","soldier","peasant"}分别赋值给这五个指针.
结果是a[0]="student",a[1]="worker",a[2]="cadre",a[3]="soldier",a[4]="pessant".