房天下 > 房天下问答 > 业主生活 > 其他
  • C问题,请问在函数foo中有什么错误,怎样修改才可解决错误?前提是不可修改init_bar。

    /* init_bar takes a pointer to a struct bar and initializes its fields */ extern void init_bar(struct bar *b); int foo() { struct bar *fb; init_bar(fb); /* Do some stuff with fb */ ... return fb->field1; }

    提问者:h564335

    发布于2010-12-07

共1个回答
  • 小小生活网 丨Lv 2
    struct bar *fb;这个是声明,不是定义啊。空指针,传到函数里,稍微不注意就出错了。
    +1 2010-12-07 举报
热门人气推荐
免责声明:问答内容均来源于互联网用户,房天下对其内容不负责任,如有版权或其他问题可以联系房天下进行删除。