How do I modify a pointer that has been passed into a function in C?

前端 未结 5 1619
予麋鹿
予麋鹿 2020-11-21 05:25

So, I have some code, kind of like the following, to add a struct to a list of structs:

void barPush(BarList * list,Bar * bar)
{
    // if there is no move t         


        
5条回答
  •  轮回少年
    2020-11-21 05:59

    Yes, you have to pass in a pointer to the pointer. C passes arguments by value, not by reference.

提交回复
热议问题