J
jaso
Hi,
If have a structure of a database record like this:
struct record {
char id[ID_LENGTH];
char title[TITLE_LENGTH];
...
};
Is there some way to find out how many member variables there is
in the struct and then iterate through them?
I want to have a function that takes the struct as argument and
then prompts the user for input for all the members. And instead
of coding the input for every member variable, I want the function
to automatically update each member. That will make it easier to
update the struct with more members.
The function also needs to know the length of every string in the
struct, so maybe I should add a length variable to each string
in the struct.
Is that feasible? Or can you recommend an other way?
If have a structure of a database record like this:
struct record {
char id[ID_LENGTH];
char title[TITLE_LENGTH];
...
};
Is there some way to find out how many member variables there is
in the struct and then iterate through them?
I want to have a function that takes the struct as argument and
then prompts the user for input for all the members. And instead
of coding the input for every member variable, I want the function
to automatically update each member. That will make it easier to
update the struct with more members.
The function also needs to know the length of every string in the
struct, so maybe I should add a length variable to each string
in the struct.
Is that feasible? Or can you recommend an other way?