Pass by reference in C

后端 未结 7 1572
夕颜
夕颜 2020-12-03 03:34

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         


        
7条回答
  •  日久生厌
    2020-12-03 04:03

    C does not support pass by reference. You'll need C++ to do it the way it is written, or modify into

    int locate(char *name, int *s, int *i)
    

    and pass pointers to the second and third parameter variables.

提交回复
热议问题