Hi,
I have a problem with returning a struct that I don't understand.
This is just a part of my code. I get an "Incompatible types ..." error when I compile the code. I have been playing around with this code now for a while trying different things, setting '*' and '&' just everywhere. Now I'm stuck. So Please, what am I doing wrong?
Code:
#include <stdio.h>
typedef struct {
int x;
int y;
} Coordinate;
Coordinate c;
Coordinate CallF(Coordinate *c) {
return c;
}
int main() {
Coordinate *c_ptr;
c_ptr = &c;
c_ptr->x = 8;
c_ptr->y = 5;
c = CallF(&c);
return 0;
}