c - 使用struct pass作为参数编译c代码时遇到问题

标签 c

<分区>

我从下面的代码块中收到了两个警告和错误:

test.c:12:26: warning: 'struct PrioirtyQueue' declared inside parameter list [enabled by default] test.c:12:26: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default] test.c: In function 'set_mask_bit': test.c:13:3: error: dereferencing pointer to incomplete type

 struct PriorityQueue {

        unsigned queue_mask;
        int is_empty;
        int task_guid;

};

void set_mask_bit(struct PrioirtyQueue *q, unsigned x) {
    q->queue_mask = x; 
}

int main() {

    return 0;

}

请告诉我我需要修复什么。

最佳答案

struct PrioirtyQueue 应该是 struct PriorityQueue(打字错误)。

struct PrioirtyQueue;
           ||
struct PriorityQueue;

关于c - 使用struct pass作为参数编译c代码时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14545621/

相关文章:

c - 在菜单中制作菜单

c - 使用顺序 bbp 计算 pi 时丢失精度(使用 GMP)

c - C中的BST-仅写入根目录

c - 我如何计算 str 类型数组的大小?

c - 将 char 指针作为参数传递给函数

c - strcpy() 不写入新字符串

用于tcp校验和的c库函数

c - C语言子串比较

c - 如何有效地合并 Ruby C API 中的两个散列?

c - 在 Linux 上从 #include 生成 GCC 选项