By constructing a bar struct from a bar struct obtained from a tree row, and then passing it's 'a' member by C reference (not C++ reference), modifying it in the foo function would be irrelevant because the constructed bar struct is only temporarily constructed and would disappear after the foo function returns.

You should construct the bar struct outside the invocation of foo() and pass that struct's 'a' member by reference. That would ensure that the change made by foo() is remembered.

This compiles, but when I LATER check "bar(row[columns.bar_struct]).a" it hasn't changed. Is it possible to pass it by reference?

This compiles but segfaults on *bar(row[columns.bar_struct]).a = 0;Why can't I assign a value to data pointed by the pointer? Am I missing something on the dereferencing?

You are experiencing the same problem as above. Really, two bar structs are constructed (one in the first line, another in the second). Dereferencing the 'a' member of the second bar struct is a problem because it is null.