I made the following program to input the credentials of a student and then print them. But when I'm done with inputting the records of two students (the maximum number of records inputs allowed), it is not printing them. Here's the program. Can anybody point out the mistake? Thank you.
#include<stdio.h>
#include<string.h>
struct student
{
char name[20];
char mobile_no[10];
char class[5];
};
int main()
{
static struct student s[2];
int m=0,n=0,i;
char c;
printf("Enter the name , mobile_no and class of the students\n");
while((scanf("%c",&s[m].name[n]))!= EOF)
{
for(n=0; n<=19; n++)
scanf("%c",&s[m].name[n]);
for(n=0; n<=9; n++)
scanf("%c",&s[m].mobile_no[n]);
for(n=0; n<=4; n++)
scanf("%c",&s[m].class[n]);
scanf("%c",&c); //scans for the newline character \n
n = 0;
m++;
}
for(i=0 ; i<m ; i++)
{
printf("%s%3s%3s\n",s[i].name,s[i].mobile_no,s[i].class); //prints the structure
}
}