How do I check if my structure has a member something
in C99?
#include <stdlib.h>
#include <string.h>
struct some {
char title[50];
char name[50];
};
int main() {
struct some s;
if (*s.something) { // Error: no member named 'something' in 'struct.some'
strcpy(s.something, "Hello");
}
}
UPDATED:
I don't need to know if it exists at compile time, but in a built program. The members and their values will be parsed from a file and then consumed to the struct in a loop but I need to be sure that it will skip all non-existing members.