I have an assignment to do a simple array program that lets the user enter in 10 grades and then the program will average them and output the average. I need to have two functions and main and I am having trouble understanding how to pass my array values from one function to another. I keep getting a "segmentation fault"
Thanks for the help. Just so I understand what I did wrong, when I initialized int i = 1 in my for loop I skipped the array [0] in grades[10] and when i equaled 10 it was writing outside the array [0] to [9]. So if my array had been int grades[11] it still would have worked when i equaled 10, right?
Yup :) Though not very common in C++ a for each loop is awesome for going through each element of an array and not having to worry about problems like going out of the bounds of an array.