I am learning array and just wrote this small program to see how it works. but its crashing with segmentation faul which i understand mean i am writing my variable / function to an memory place not allotted to it. But I cant figure how. Can anyone let me know please? i am calling introArray from my main().
int introArray (void)
{
int total, ctr;
printf("enter how many students \n");
scanf("%d", &total);
int students[total];
ctr = 0;
while ( students[ctr] <= total)
{
printf("enter student %d DOB in mmddyy \n", ctr );
scanf("%d", students[ctr]);
ctr++;
}
return 0;
}