小编use*_*321的帖子

C-取消引用不完整类型的指针

我已经阅读了有关同一错误的5个不同问题,但是我仍然找不到我的代码有什么问题。

main.c

int main(int argc, char** argv) {
    //graph_t * g = graph_create(128); //I commented this line out to make sure graph_create was not causing this.
    graph_t * g;
    g->cap; //This line gives that error.
    return 1;
}
Run Code Online (Sandbox Code Playgroud)

。C

struct graph {
    int cap;
    int size;
};
Run Code Online (Sandbox Code Playgroud)

。H

typedef struct graph graph_t;
Run Code Online (Sandbox Code Playgroud)

谢谢!

c compiler-errors

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

c ×1

compiler-errors ×1