Ask Question
11 November, 08:00

omplete the following function prototype to distinguish pass-by-value and pass-by-reference. The first parameter is the number of people in a team (of type int) and the second parameter is the scaling factor (of type double). void scale (size, factor); Below are sample function calls and their expected effect. Function call Expected effect scale (my_team, 1.1) Increase the value of my_team by 10% and to the nearest whole number. For example, if my_team is 12 before the function call, it would be 13 after the call. scale (their_team, 0.9) Reduce the value of my_team by 10% and to the nearest whole number. For example, if their_team is 23 before the function call, it would be 21 after the call. The following function is intentionally designed with non-descriptive identifier names to test your understanding of how the compiler deals with pass-by-value versus pass-by-reference parameters. Hope it motivates you to use more descriptive names in your own program. void foo (int a, int

+3
Answers (1)
  1. 11 November, 09:08
    0
    See explaination

    Explanation:

    The function definition is:

    void scale (int size, double factor)

    The parameter size maps to variable my_team which is integer and parameter factor maps to the double value 1.1 or 0.9 which are passed while function calling. Therefore the datatype of size is int (integer) and datatype of factor is double.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “omplete the following function prototype to distinguish pass-by-value and pass-by-reference. The first parameter is the number of people in ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers