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/09/09 03:05:28
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*)); /*申请指针数组*/