Final answer:
To complete the change_grade() function, you need to check if gradepointer is null and, if so, assign the value of gradevalue to the variable pointed by gradepointer.
Step-by-step explanation:
To complete the change_grade() function, you need to check if gradepointer is null and, if so, assign the value of gradevalue to the variable pointed by gradepointer. Here's an example:
void change_grade(int *gradepointer, int gradevalue) {
if (gradepointer == nullptr) {
gradepointer = &gradevalue;
}
}
This code checks if gradepointer is null using the nullptr keyword, and if so, assigns the value of gradevalue to gradepointer by using the address-of operator (&). The function should end with a newline character, but since this is a simple function implementation, there is no need to explicitly add it.