Quantcast
Viewing all articles
Browse latest Browse all 22162

A pointer to array of forward declared structures in C

I have a question about forward declarations in C. The problem code is

typedef struct yhash_s t_yhash;          // forward declaration
struct yhash_s {
               size_t  size_h; 
               t_yhash (*yhash)[];       // pointer to array of structures
               };

Once the code is compiled with gcc, it complains:

error: array type has incomplete element type ‘t_yhash’ {aka ‘struct yhash_s’}

I do understand that t_yhash is not know (yet) and size of array can't be computed, but I am asking about pointer to an array of unknown yet size, which should be perfectly resolvable IMHO.

How do I fix that forward declaration and struct itself?


Viewing all articles
Browse latest Browse all 22162

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>