为什么我总是显示 [Warning] assignment from incompatible pointer type
来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/09/25 09:34:32
为什么我总是显示 [Warning] assignment from incompatible pointer type [enabled by default]呢
代码如下:
#include
#include
struct student
{
\x05char name[20];
\x05float score;
\x05struct student *next;
};
struct student *create(int n)
{
\x05int i;
\x05struct student *pnew,*head,*ptail;
\x05pnew=(struct shtdent *)malloc(sizeof(struct student));
\x05\x05\x05scanf("%s%f",&pnew->name,&pnew->score);
\x05head=ptail=pnew;
\x05for(i=1;iname,&pnew->score);
\x05\x05(*ptail).next=pnew;
\x05\x05ptail=pnew;
\x05}
\x05(*pnew).next=NULL;
\x05return head;
}
代码如下:
#include
#include
struct student
{
\x05char name[20];
\x05float score;
\x05struct student *next;
};
struct student *create(int n)
{
\x05int i;
\x05struct student *pnew,*head,*ptail;
\x05pnew=(struct shtdent *)malloc(sizeof(struct student));
\x05\x05\x05scanf("%s%f",&pnew->name,&pnew->score);
\x05head=ptail=pnew;
\x05for(i=1;iname,&pnew->score);
\x05\x05(*ptail).next=pnew;
\x05\x05ptail=pnew;
\x05}
\x05(*pnew).next=NULL;
\x05return head;
}
两个申请空间的都写成(struct shtdent *)了,难道完整程序中还有struct shtdent的结构体定义?
应该都是pnew=(struct student *)malloc(sizeof(struct student));
修改后经试验没有警告,且能创建成功.
另外,(*ptail).next也可写成ptail->next
应该都是pnew=(struct student *)malloc(sizeof(struct student));
修改后经试验没有警告,且能创建成功.
另外,(*ptail).next也可写成ptail->next
incompatible types when assigning to type 'CHANGE' from type
Iryxe是什么程序?显示 Invalid pointer operation
为什么我看电影会出现FBI WARNING?
matlab求导,总是跳出warning,
问一个C语言里面的错误啊,argument of type "float" is incompatible with p
为什么我打英语打单引号时总是显示不出来,
英语翻译1) Type of AssessmentThis assignment will be individual
assignment
我上沪江英语网 想录音 为什么总是显示拒绝麦克风 无法录音啊 我都设置允许了啊
笔记本开机时会显示“warning:the battery cannot be identified…”我要按任意健才能
最近我用ICL7107做了个电压表,检查后电路正常,接通电源数码管的显示数字为什么总是跳(显示不稳定)?
matlab问题:我写了 个M文件,执行后总是显示Empty state-space model.为什么呢