I've seen some other posts similar but I can't seem to figure it out. This function has this function definition:
struct number {
int one;
int two;
int three;
int four;
};
void foo(int move, struct number *f) {
//....
}
bool tester(void (*fp)(int, struct number *)) {
//...
}
Now, in the function 'foo', my function is taking a structure (as seen), but it is changes the values in the structure (that's the purpose of this function 'foo')
Now, inside the function 'tester', I want to be able to access the new structure that 'foo' gives me when I call to it.
For example, if I had this:
struct number x1 = {1, 2, 3, 4}
I was thinking of writing something like this is 'tester':
foo(1, &x1)
But I have no idea how to access the new structure as a result from foo(1, &x1).
I want the function to change the values in of the struct 'x1' and then access them, inside of 'tester'.
You can simply access the changed values by accessing (the now changed) x1
, e. g. x1.one
.