This is a follow-up question from question, where I have a struct like
struct {
int a;
//other fields
string s1;
string s2;
} strMyStruct;
How would I initialize all members if the object is malloc() by someone else and passed it to me for quick processing (in a function myFunc
that I am in charge of). How do I make sure in function myFunc
that numerical members are initialized to be 0, string members are initialized to be empty string?
strMyStruct *p = (strMyStruct *)malloc(sizeof(x1));
myFunc(p);
UPDATE 1
Since the members of the struct may change frequently, I don't want my code to refer to any individual members.