pointer of a pointer in linked list append

后端 未结 7 1847
Happy的楠姐
Happy的楠姐 2020-11-30 09:49

I normally program in python. To increase performance of my simulations, I am learning C. I have a problem to understand the use of a pointer of a pointer when implementing

7条回答
  •  半阙折子戏
    2020-11-30 10:16

    Hey why you are thinking it in this way,think when someone is passing structure to append function,in that case whole structure struct node{int data; struct node *link; }; in your case will get copied on stack frame of append function,so better to pass address of structure pointer so as to get just 4 bytes copied onto stack.

提交回复
热议问题