Below is a block of code from my program. I'm getting error of Segmentation fault (core dumped)
after entering name
and age
in first loop.
#include<stdio.h>
#include <string.h>
struct Cricketer
{
char name[25];
int age;
float avg_run;
};
int main(){
struct Cricketer c[3];
int i,j;
for (i=0 ; i<3;i++){
printf("Enter name: \n");
scanf("%s",c[i].name);
printf("Enter age: \n");
scanf("%d",c[i].age);
printf("Enter average run: \n");
scanf("%f",c[i].avg_run);
}
return 0;
}
And I couldn't find what is causing this program.