Hi all, I'm a beginner in C and was trying my hands at some coding with arrays. I had the array initialized with a size of ten, but later found that I could assign values to array elements that is beyond the 9th element. Why isn't there any exceptions thrown? Is this normal in C? If this is the case then why should we specify the array size in the first place?
Here's a snippet of my code:
Thanks in advance!Code:#define MAX 10 int a[MAX]; int i; for ( i=0; i<MAX; i++) { a[i] = /*some random number*/; printf("%d\n", a[i]); } a[20] = 2020; printf("%d", a[20]); // prints 2020, no exceptions!