psss by value
Contents
pass by value: pass the copy value of the arguments feture: any change made to the parameter won’t affect the origin value
pass by reference: pass the reference of the arguments feature: any change made to the parameter will affect the orgin value
example:
|
|
|
|
problem: 为什么指针作为参数可以改变指针指向的值,却不是传递引用
- 参数传递的还是指针的拷贝值
- 对指针本身值的改变并不会影响外部指针的值
- 混淆点: 并不是对指针本身的值改变,而是对指针指向值的改变