c语言问题,我菜鸟,麻烦给解答下,

#include<stdio.h>structgood{inta;charb,c;chard[6];struct*link;};structgood*f,*g,*head... #include<stdio.h>
struct good{int a;char b,c;char d[6];struct*link;};
struct good*f,*g,*head;
void main()
{head=(struct good*)molloc(sizeof(struct good));
head->link=NULL;
tail=head;
node=(struct good*)molloc(sizeof(struct good));
node->a=10;
node->b=r;
node->c=h;
node->d="china";
node->link=NULL;
tail->link=node;
tail=node;
};

: error C2065: 'molloc' : undeclared identifier
: error C2065: 'tail' : undeclared identifier
: error C2440: '=' : cannot convert from 'struct good *' to 'int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
: error C2065: 'node' : undeclared identifier
: error C2440: '=' : cannot convert from 'struct good *' to 'int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
C : error C2227: left of '->a' must point to class/struct/union
C) : error C2227: left of '->b' must point to class/struct/union
C: : error C2065: 'r' : undeclared identifier
C : error C2227: left of '->c' must point to class/struct/union
C error C2065: 'h' : undeclared identifier
C: : error C2227: left of '->d' must point to class/struct/union
error C2227: left of '->link' must point to class/struct/union
C:\P: error C2227: left of '->link' must point to class/struct/union
这是哪错啦,,,,,
展开
 我来答
那丫头哥疼
2012-04-16 · 超过10用户采纳过TA的回答
知道答主
回答量:48
采纳率:0%
帮助的人:33.4万
展开全部
#include<stdio.h>
//缺少头文件
//#include<stdlib.h>(malloc函数)
//#include<string.h>(结构体)
struct good{int a;char b,c;char d[6];struct*link;};
struct good*f,*g,*head;//缺少定义*tail,*node
void main()
{head=(struct good*)molloc(sizeof(struct good));//malloc
head->link=NULL;
tail=head;
node=(struct good*)molloc(sizeof(struct good));
node->a=10;
node->b=r;//字符单引号
node->c=h;//同上
node->d="china";//字符串不能直接用等于
node->link=NULL;
tail->link=node;
tail=node;
};
还有你的程序写的格式太不够标准了。。楼上的格式你就可以学习~!
滴冰的水
2012-04-16 · TA获得超过1040个赞
知道小有建树答主
回答量:250
采纳率:0%
帮助的人:351万
展开全部
#include<stdio.h>
#include "malloc.h"
#include "string.h"

struct good
{
int a;
char b,c;
char d[6];
struct good *link;
};

struct good*f,*g,*head;

void main()
{
struct good *tail = NULL;
struct good *node = NULL;

head=(struct good*)malloc(sizeof(struct good));
head->link=NULL;
tail=head;
node=(struct good*)malloc(sizeof(struct good));
node->a=10;
node->b='r';
node->c='h';
strcpy(node->d, "china");
node->link=NULL;
tail->link=node;
tail=node;

};
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
myfairytail
2012-04-16 · TA获得超过277个赞
知道小有建树答主
回答量:445
采纳率:0%
帮助的人:254万
展开全部
缺少必要的头文件,指针类型错误。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
1065037709
2012-04-16
知道答主
回答量:8
采纳率:0%
帮助的人:1.4万
展开全部
菜鸟?
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
收起 更多回答(2)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式