I have a data structure like this:
struct foo {
int id;
int route;
int backup_route;
int current_route;
}
and a function called update() that is used to request changes in it.
update(42, dont_care, dont_care, new_route);
this is really long and if I add something to the structure I have to add a 'dont_care' to EVERY call to update( ... ).
I am thinking about passing it a struct instead but filling in the struct with 'dont_care' beforehand is even more tedious than just spelling it out in the function call. Can I create the struct somewhere with default values of dont care and just set the fields I care about after I declare it as a local variable?
struct foo bar = { .id = 42, .current_route = new_route };
update(&bar);
What is the most elegant way to pass just the information I wish to express to the update function?
and I want everything else to default to -1 (the secret code for 'dont care')