Ask Question
10 August, 11:43

Assume a program contains a void function named calcNewPrice (). The function receives two double variables named oldPrice and newPrice. The function multiplies the contents of the oldPrice variable by 1.1, then stores the result in the newPrice variable. Which of the following can be used to call the calcNewPrice () function? (A) calcNewPrice (double oldPrice, double newPrice); (B) calcNewPrice (&oldPrice, newPrice); (C) calcNewPrice (oldPrice, &newPrice); (D) calcNewPrice (oldPrice, newPrice);

+1
Answers (1)
  1. 10 August, 15:32
    0
    (C) calcNewPrice (oldPrice, &newPrice);

    Explanation:

    It's a void function so there's no return value, however they wanted to change a value. The only way to do that is to pass in an address of the variable into the function, and deference it and store the new data there.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Assume a program contains a void function named calcNewPrice (). The function receives two double variables named oldPrice and newPrice. ...” in 📙 Engineering 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