Will anyone explain this programme?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Will anyone explain this programme??

C++ https://code.sololearn.com/cdcXiXLgh6T2/?ref=app

10th Jul 2020, 1:00 PM
Kajal Kumari
2 Answers
+ 4
The function 'x' accepts two by integer parameters by reference, meaning it can directly alter their values. https://www.learncpp.com/cpp-tutorial/73-passing-arguments-by-reference/ It then changes the value of the first parameter 'a' to 3 and the value of the second parameter 'b' to 4, and finally returns the value of 'a', which is now 3. In main(), we pass the variables 'b' and 'a' into the function, so that 'b' becomes 3 (it corresponds to the function parameter 'a', since it is passed first - the naming might be confusing here) and 'a' becomes 4. The variable 'c' is then assigned the return value of the function, which is always 3. As a result, the output is 433.
10th Jul 2020, 1:15 PM
Shadow
Shadow - avatar
0
ooutput is 2 7 3
10th Jul 2020, 1:15 PM
Sebastian Klemens
Sebastian Klemens - avatar