I am new to C Programming ,I don't know what can I change in this code if I compile this code it displays only last name only for n times .. Why it won't display other names please help experts .. Thank you!
#include<stdio.h>
#include<string.h>
#include<malloc.h>
int main()
{
    int a;
    char n[50];
    printf("enter the number of students:\n");
    scanf("%d",&a);
    printf("enter the names of the students\n");
    int i;
    for(i=0;i<a;i++)
    {
        scanf("%s",n);
    }
    for(i=0;i<a;i++)
    {       
        printf("%s\n",n);
    }
return 0;
}
 
     
     
     
     
    