K
karthikbalaguru
Hi,
struct sky {
int stars;
struct ocean *oceanptr;
};
struct ocean {
int waves;
struct sky *skyptr;
};
Will the compiler accept the field declaration struct ocean
*oceanptr within struct sky ?
Actually, the compiler has not yet heard of struct ocean till that
instant of time . ( struct ocean is ``incomplete'' at that point.) .
It has been stated that Just a empty declaration of the struct like
below will fix the issue -
struct sky;
struct ocean;
But, How is this possible ? What is happening here internally ? Is it
really like that ?
Thx in advans,
Karthik Balaguru
struct sky {
int stars;
struct ocean *oceanptr;
};
struct ocean {
int waves;
struct sky *skyptr;
};
Will the compiler accept the field declaration struct ocean
*oceanptr within struct sky ?
Actually, the compiler has not yet heard of struct ocean till that
instant of time . ( struct ocean is ``incomplete'' at that point.) .
It has been stated that Just a empty declaration of the struct like
below will fix the issue -
struct sky;
struct ocean;
But, How is this possible ? What is happening here internally ? Is it
really like that ?
Thx in advans,
Karthik Balaguru