错误:间接需要指针操作数

jsm*_*894 5 c pointers

我有以下函数,一个 initializeHeap 函数,它不接受任何参数并输出我定义的 Heap 结构。还有一个 insertNode 函数,它接收一个指向堆结构的指针和要添加到堆中的数字。我在主函数中这样调用它们:

h = initializeHeap();
Heap *p = *h;
insertNode(p,5);
insertNode(p,7);
insertNode(p,3);
insertNode(p,2);
Run Code Online (Sandbox Code Playgroud)

尝试执行此操作时出现此错误:

error: indirection requires pointer operand
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?如果需要,我可以发布更多代码。

struct Heap 和函数 initializeHeap() 如下:

typedef struct node{
    int data;
}Node;

typedef struct heap{
    int size;
    Node *dataArray;
}Heap;

Heap initializeHeap(){
    Heap heap;
    heap.size = 0;
    return heap;
}
Run Code Online (Sandbox Code Playgroud)

oua*_*uah 7

改变:

Heap *p = *h;
Run Code Online (Sandbox Code Playgroud)

Heap *p = &h;
Run Code Online (Sandbox Code Playgroud)

h是一个Heap结构对象,使用&操作符得到一个指向结构对象的指针。