C++ Pass by Reference Program

前端 未结 3 1167
不思量自难忘°
不思量自难忘° 2020-12-20 09:30

IBM explains C++ pass by reference in the example below (source included).

If I changed void swapnum... to void swapnum(int i, int j), wou

3条回答
  •  有刺的猬
    2020-12-20 09:58

    Yes. The '&' operator specifies that the parameter should point to the memory address of what was passed in.

    By removing this operator, a copy of the object is made and passed to the function.

提交回复
热议问题