If I understand you correctly, you just don't have a problem.
Just check the pointer against NULL
and you are fine.
int test_the_struct(struct my_struct *s)
{
if (s) { // or if (s != NULL) or whatever you want to express it...
return s->val1 + s->val2;
} else {
return 42;
}
}
If you call it with your test_struct
, both values are 0
. There is nothing wrong or special about it.