C: “invalid use of undefined type ‘struct X’ & dereferencing pointer to incomplete type” errors

后端 未结 5 1834
天命终不由人
天命终不由人 2021-01-18 04:18

I\'ve been perusing similar questions to mine for a couple of days but still haven\'t found a solution. Thanks any any help:

I have two files, one containing methods

5条回答
  •  攒了一身酷
    2021-01-18 04:23

    While in there, you may also want to change your definitions.

    Better way so you understand what's going on:

    struct fraction {
       int integer;
       int num;
       int den;
    };
    typedef struct fraction fractionType; // We can now use fractionType and it'll be struct fraction
    
    typedef fractionType * fractionTypePtr; // We can now use fractionTypePtr and it will be a pointer to a fractionType which is a struct fraction
    

提交回复
热议问题