Right now I need help adding numbers into an array. The function I have is not in the main function and the array parameters are passed by reference. Using something like

int add ( int grades[], int number_grades )

I need to have it so it will allow someone to input grades into the array, and using a sentinel value to stop it. The max size of the array should be 20 and use a sentinel value to stop. Finally it will count how many grades are now in the array.

You can add grades normally, and you can check array after adding if a[n] == sentinel you have n-1 grades.

I am still confused on how the code would be written out.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.