Westonci.ca is the best place to get answers to your questions, provided by a community of experienced and knowledgeable experts. Explore a wealth of knowledge from professionals across various disciplines on our comprehensive Q&A platform. Join our platform to connect with experts ready to provide precise answers to your questions in different areas.

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;