What happens to a parameter passed by value that is modified locally?

后端 未结 5 376
粉色の甜心
粉色の甜心 2021-01-24 19:53

I am well aware that modifying a function\'s argument that is passed by value is ineffective outside of the C/C++ function, but compilers allow it - but what happens? Is a loca

5条回答
  •  有刺的猬
    2021-01-24 20:25

    The formal parameter x is a separate object in memory from the actual parameter a, so any changes to x are not reflected in a.

提交回复
热议问题