If arrays in C are fixed in size, then how come this code is working properly? This code works but my teacher said I did it in a wrong way...
int main()
{
int n,element,i;
printf("Enter the size of Array : ");
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++){
printf("Enter %d no element : ",i+1);
scanf("%d",&a[i]);
}
printf("Enter the new element to be inserted at the End: ");
scanf("%d",&element);
n=n+1;
a[n-1]=element;
for(i=0;i<n;i++){
printf("%d\t",a[i]);
}
}