43.6k views
5 votes
Select all that apply. Given the following code fragment, which of the things shown below happen when the statement on line 8 executes?

1 int square(int a)2 {3 return a * a4 }5 int main()6 {7 int x = 0;8 x = square(5);9 cout << x << endl;10 return 0;11 }

User Krono
by
4.4k points

1 Answer

3 votes

Answer:

A call to function square is made with the argument as 5 and then storing the result in the integer x which was defined above in the line 7.So when function square is called with value 5 the square function will return 5*5 that is 25 as an integer so we have to store it in an integer that was done by assigning it to integer x.

User Jmatthias
by
5.2k points