i was working on c language.I wanted to compile this code
the output i expected was simple my input word, but the output am getting has 1 word less than my input.Code:void main() { char inp[5]; //char out[5]; int i,n; //k=0; printf("Enter no. of characters in the word :"); scanf("%d",&n); printf("Enter the word :"); for(i=0;i<5;i++) scanf("%c",&inp[i]); for(i=0;i<5;i++) printf("%c",inp[i]); }
like
input-apple
output-appl
i have no idea y its happening.. someone please explain it to me..