Pass by reference in C

后端 未结 7 1576
夕颜
夕颜 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 03:47

    C has no reference variables but you can consider reference as const pointer to data so ,

    Make const pointer to data like this so that pointer cant point to other data but data being pointed by it can be changed.

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

提交回复
热议问题