Get reliable answers to your questions at Westonci.ca, where our knowledgeable community is always ready to help. Discover in-depth answers to your questions from a wide network of professionals on our user-friendly Q&A platform. Get quick and reliable solutions to your questions from a community of experienced experts on our platform.

Rewrite the following function so that it returns the same result, but does

not increment the variable ptr. Your new program must not use anysquare brackets, but must use an integer variable to visit each double in the array. You may eliminate any unneeded variable.

double computeAverage(const double* scores, int nScores)

{
const double* ptr = scores;
double tot = 0;
while (ptr != scores + nScores)

{
tot += *ptr; } ptr++;

}
return tot/nScores;