Reputation: 4692
I'm implementing stack in C and I define pop function in C file:
int pop(int &x, int &y);
Xcode shows error (pointing on the first argument): Expected ')' Any ideas why I have that problem? Thanks.
Upvotes: 0
Views: 1043
Reputation: 30332
C doesn't have "pass by reference" like C++. To implement something like this, you need to use pointers:
int pop(int *x, int *y);
...and somewhere else, in a function...
int a, b;
int c = pop(&a, &b);
(It's hard to know exactly what syntax details to give without knowing more about what the arguments are meant to be.)
Upvotes: 4