Ok I have a question. I am using dynamic memory allocation to create an array thats size is determined by the user. Now, after the user designates the size of the array I want to add all of the values in the and divide by the size of the array. (the program is determinging the averages of grades).
Ok, what I tried is, I tried to create a for loop that said:
'i' is the array variable for the pointer and 'numTests' is the size of the array that the user determines.
The closest I got was I got one term of the array divided by the size of the array determined by the user.
I am new to programming so cut me some slack.
The language should be obvious, if it's not then you wouldn't know the answer.
If you want I can post the entire code.
Ok, what I tried is, I tried to create a for loop that said:
Code:
for (int i = 0; i < numTests; i++)
sum += iPtr[i];
'i' is the array variable for the pointer and 'numTests' is the size of the array that the user determines.
The closest I got was I got one term of the array divided by the size of the array determined by the user.
I am new to programming so cut me some slack.
The language should be obvious, if it's not then you wouldn't know the answer.
If you want I can post the entire code.