I am getting confused with an array code.
According to me the program should raise an error but it's working fine. The code :
#include<stdio.h>
#include<conio.h>
void main()
{
int a[1],n,i;
clrscr();
printf("Enter the length");
scanf("%d",&n);
for( i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
printf("%d ",a[i]);
}
getch();
}
Here the array size is 1
but when I enter the length 5
then it works fine : the program show all 5
elements that i have entered.
This is the output screen.