Question: In my code, what ever I enter for n, compiler allows me to input and output only half of it. Why?
#include<stdio.h>
#include<stdlib.h>
int main()
{
int n;
scanf("%d\n",&n);
char *c= (char*)malloc((n+1)*sizeof(char));
c[n]='\0';
for(int i=0;i<n;i++)
{
scanf("%c",&c[i]);
}
for(int i=0;i<n;i++)
{
printf("%c",c[i]);
}
}