This is the code. Why am I facing this error and what source of information should I refer so as to rectify such errors so that I get to know 'If I do this that way, I will get 'x' error'
#include<stdio.h>
void main()
{
   int i,avg,sum;
   int marks[30]; // Array declaration
   for(i=0;i<31;i++)
   {
      printf("Enter Marks:");
      scanf("%d",&marks[i]); // Stores data in Array
   }
   for(i=0;i<31;i++)
      sum=sum+marks[i];
   avg=sum/30;
   printf("Average marks of student \t %d",avg);
}
 
     
     
    