Is there a way to make passing by reference, and passing by value explicit in the function call?

前端 未结 7 1515
北荒
北荒 2021-02-18 13:43

If you were to look at this code,

int x = 0;
function(x);
std::cout << x << \'\\n\';

you would not be able to verify through any me

7条回答
  •  暖寄归人
    2021-02-18 14:25

    That is the whole point of pass-by-reference -- that syntactically don't need to do anything different from passing by value.

提交回复
热议问题