Question: [4 points] Consider the following program written in a language similar to C+. Note that cout < < g statement outputs the value of

[4 points] Consider the following program written in a language similar to

[4 points] Consider the following program written in a language similar to C+. Note that cout < < g statement outputs the value of variableg on the standard output in C+. int g = 2 1/ global var int func(int &a) { a = 1; g = 0; } int main() { func(g); cout g; } a) What will it output if the language uses pass-by-reference method? b) What will it output if the language uses pass-by-value-result method?

Step by Step Solution

3.46 Rating (156 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To solve this problem we need to understand how the two different parameter pas... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!