Reputation: 1778
If i have a structure say "apple", so is there a way to check whether a particular element say "color" exist inside the structure?
struct apple A{
char color;
int pack;
}
The function which uses this may be knowing the internals of this structure other than its name.....
Upvotes: 3
Views: 3298
Reputation: 7705
C does not support what you are after - and in requiring it it sounds like something is wrong with your design. If you are interpretting a stream then there should be and identifier early on in the stream that indicateds the structure in the stream that follows.
Upvotes: 1
Reputation:
The only way to do this in C is to use the particular field you are interested in. If the program compiles then it exists. If not, than it either does not or you have other errors.
Upvotes: 4