Which statement best explains why arguments to functions such as swap must be passed by reference rather than by value?
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Which statement best explains why arguments to functions such as swap must be passed by reference rather than by value?
Which statement best explains why arguments to functions such as swap must be passed by reference rather than by value? Select one: Changes made to value parameters affect only a copy of the arguments. Passing references allows the function to change the original variables. Functions like swap can be written without using references, so arguments may be passed by value. Passing variables by value only works for non-primitive types. Passing references allows any type to be used. Declaring the parameters as references allows the function to be used with arbitrary expressions in addition to variables. ооо
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!