Ask Question
11 July, 16:03

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);

+4
Answers (1)
  1. 11 July, 17:22
    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 you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers