Assuming T is the name of a type, explain the difference between a function declared as void f(T) and void f(T&)
belongs to book: C++ Primer|Stanley B.Lippman, Josee Lajoie, Barbara E.Moo|5th Edition| Chapter number:6| Question number:13
All Answers
total answers (1)
`void f(T)`
will pass the argument by value, which means in the function`f`
, a copy of`T`
will be made.`void f(T&)`
will pass the argument by reference, which means in the function `f`, the same variable defined in the caller is used.