Can anyone tell me whats wrong with this program. when i try to run it. After entering the first grade, it gives the error message of The instruction at " " referenced memory at " ". The memory could not be written. What exactly does this mean, and what did I do wrong?
Description: Displays the grade average from four tests
#include <stdio.h>
int main()
{
unsigned int grade1=0,grade2=0,grade3=0,grade4=0,total=0; /*declare grade1, grade2, grade3,grade4 as a int variable*/
float average;
total=grade1 + grade2 + grade3 + grade4;
average=total/4.0; /*divide the total by 4.0*/
printf("Enter student1 first grade:\n");
scanf("%f",grade1);
printf("Enter student1 second grade:\n");
scanf("%f",grade2);
printf("Enter student1 third grade:\n");
scanf("%f",grade3);
printf("Enter student1 fourth grade:\n");
scanf("%f",grade4);
printf ("\n The grade average of student1 is %f",average);
return 0;
}
SOS!