首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

这个主函数如何写啊

2012-03-05 
这个主函数怎么写啊?我有两个构造体:typedefstructmng{  intnodecnt   /* 链表的长度*/  LTBL*top  /* 

这个主函数怎么写啊?
我有两个构造体:
typedef   struct   mng   {
  int           nodecnt;   /* 链表的长度*/
  LTBL     *top;        /* 指向链表头的指针 */
}   MNG;

typedef   struct   ltbl   {
  struct   ltbl         *fp;    /* 指向链表中前一个元素的指针*/
  struct   ltbl         *np;         /* 指向链表中后一个元素的指针*/
  int                         key;    /* KEYWORD */
  unsigned   char       dummy[32];    /* 备用*/
}   LTBL;


还有几个函数:int   TBLcreate   (MNG*mng,int   n){...}
                            void   print(MNG   *mng){...}
我的主函数:void   main()
{
struct   mng   *p1;
printf( "input   record!\n ");
p1   =   TBLcreate(p1,10);
print(p1);

}
但是出现了警告:   warning   C4047:   '= '   :   'struct   mng   * '   differs   in   levels   of   indirection   from   'int   '

和   warning   C4700:   local   variable   'p1 '   used   without   having   been   initialized
小弟是菜鸟,
该怎么改阿?!!!




[解决办法]
void main()
{
struct mng *p1=(struct mng *)malloc(sizeof(struct mng)); //初始化
printf( "input record!\n ");
TBLcreate(p1,10); //不要返回值了 ....
print(p1);

}

热点排行