Using a struct in a header file “unknown type” error

后端 未结 3 1027
夕颜
夕颜 2021-02-05 12:20

I am using Kdevelop in Kubuntu. I have declared a structure in my datasetup.h file:

#ifndef A_H
#define A_H

struct georeg_val {

    int p;
    double h;
    do         


        
3条回答
  •  北荒
    北荒 (楼主)
    2021-02-05 13:12

    Defining a struct type (on this example, a binary search tree struct):

    struct tree { 
      int info;
      struct tree *left;
      struct tree *right;
    } 
    
    typedef struct tree treeNode;
    

    Declaring a function eg.:

    treeNode *insertElement(treeNode *treeA, int number);
    

提交回复
热议问题