How to work with pointer to pointer to structure in C?
maybe (*foo)->member = 1 (if it's dynamically allocated)
Due to operator precedence, you need to put parentheses around this:
(*foo)->member = 1;
You can use a temp variable to improve readability. For example:
Ttype *temp = *foo;
temp->member = 1;
If you have control of this and allowed to use C++, the better way is to use reference. For example:
void changeMember(Ttype *&foo) {
foo->member = 1;
}
Try
(*foo)->member = 1;
You need to explicitly use the * first. Otherwise it's an attempt to dereference member.