incompatible types when assigning to type 'CHANGE' from type 'struct CHANGE *'typedef struct change{char str1[21];char str2[21];}CHANGE;CHANGE *p=NULL;p=(CHANGE*)calloc(3,sizeof(CHANGE*)); /*申请指针数组*/p[0]=(CHANGE*)calloc(M,sizeof(CHANGE));

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/03 00:45:26
incompatible types when assigning to type 'CHANGE' from type 'struct CHANGE *'typedef struct change{char str1[21];char str2[21];}CHANGE;CHANGE *p=NULL;p=(CHANGE*)calloc(3,sizeof(CHANGE*)); /*申请指针数组*/p[0]=(CHANGE*)calloc(M,sizeof(CHANGE));

incompatible types when assigning to type 'CHANGE' from type 'struct CHANGE *'typedef struct change{char str1[21];char str2[21];}CHANGE;CHANGE *p=NULL;p=(CHANGE*)calloc(3,sizeof(CHANGE*)); /*申请指针数组*/p[0]=(CHANGE*)calloc(M,sizeof(CHANGE));
incompatible types when assigning to type 'CHANGE' from type 'struct CHANGE *'
typedef struct change
{
char str1[21];
char str2[21];
}CHANGE;
CHANGE *p=NULL;
p=(CHANGE*)calloc(3,sizeof(CHANGE*)); /*申请指针数组*/
p[0]=(CHANGE*)calloc(M,sizeof(CHANGE)); /把申请的地址存到指针数组里*/
大概就是这些...为什么会出错呢?

incompatible types when assigning to type 'CHANGE' from type 'struct CHANGE *'typedef struct change{char str1[21];char str2[21];}CHANGE;CHANGE *p=NULL;p=(CHANGE*)calloc(3,sizeof(CHANGE*)); /*申请指针数组*/p[0]=(CHANGE*)calloc(M,sizeof(CHANGE));
前两句改一下:
CHANGE **p=NULL;
p=(CHANGE**)calloc(3,sizeof(CHANGE*)); /*申请指针数组*/