Following is the code :
#include<stdio.h>
int main(){
char a[6]; // DECLARATION OF ARRAY OF CHARACTER WITH SIZE 6
printf("Enter ur Name :");
scanf("%s",a); // INITILISATION OF ARRAY
printf("\nName : %s\n",a); //PRITNTING WHAT GETS STORED IN A
for (int i = 0; i < 10; ++i)
{
printf("%c .",a[i]); // PRINTNING A WITHIN BOUND 10.
}
return 0;
}
I am getting following output :
Enter ur Name :DESKTOP
Name : DESKTOP **//Why DESKTOP is being printed ? shouldn't be DESKTO**
D .E .S .K .T .O . . . . .
Why i am getting DESKTOP .. as a size is 6 hence a must have stored DESKTO .