【发布时间】:2012-01-30 01:47:33
【问题描述】:
struct node{
char a[100];
struct node* next;
};
typedef struct node* nodeptr;
main()
{
char b[100];
nodeptr p;
int n;
printf("enter the string\n");
scanf("%s",b);
n=strlen(b);
p=getnode();
p->a=b;
p->next=null;
printf("%s \n",(q->a));
return 0;
}
如何使用结构指针访问结构内的数组?这是正确的方法吗?我在编译过程中收到以下错误:
incompatible types when assigning to type ‘char[100]’ from type ‘char *’ "
【问题讨论】: