I\'m trying to use pass by reference in C so that the function can modify the values of the parameters passed to it. This is the function signature:
int loc
C does not have references. You need to pass a pointer to the variable you wish to modify:
int locate(char *name, int *s, int *i) { /* ... */ *s = 123; *i = 456; } int s = 0; int i = 0; locate("GMan", &s, &i); /* s & i have been modified */