(GLOBAL DECLARATION OF CHAR ARRAY)
#include<stdio.h>
char name[10]; /* though allocated memory is 10 bytes still it accepts more then 10 chars*/
void main()
{
printf("\n ENter name :\t");
scanf("%s",name);
}
Second case:(LOCAL DECLARATION OF CHAR array)
#include<stdio.h>
void main()
{
char name[10];/* Now it will only accepts 10 chars NOT MORE */
printf("\n ENter name :\t");
scanf("%s",name);
}
why there is difference in acceptance of the chars in 1st case it accepts more than 10 but in 2nd exactly 10 but not more.I dont know why,but it happens???