Ask Question
24 April, 00: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. 24 April, 00:49
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers