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?
2. How about something like this:
struct bar
{
int *a;
int *b;
};
bar(row[columns.bar_struct]).a = new int;
*bar(row[columns.bar_struct]).a = 0;
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.