I have a data structure like this:
struct foo {
int id;
int route;
int backup_route;
int current_route;
}
and a
I'm rusty with structs, so I'm probably missing a few keywords here. But why not start with a global structure with the defaults initialized, copy it to your local variable, then modify it?
An initializer like:
void init_struct( structType * s )
{
memcopy(s,&defaultValues,sizeof(structType));
}
Then when you want to use it:
structType foo;
init_struct( &foo ); // get defaults
foo.fieldICareAbout = 1; // modify fields
update( &foo ); // pass to function