Answer:
int retrieveAt(int location, array){
// Function to retrieve the element from the list at the position
// specified by the location
if (location <= array.size() - 1){
return array[location];
} else{
cout<<"Location out of range";
assert(); // Assuming the assert function is defined in the program.
}
}
Explanation:
The void retrieveAt function is converted to a return function that returns the integer item of the array given the location and the array variable as arguments. The assert function is used to terminate the program.