#include <stdio.h>
void main()
{
int arr[3][2]={2,3,4,5,6,7};
printf("%d\n",arr);
printf("%d\n",arr[1]);
printf("%d",arr[1][2]);
}
The above code when compiled in Borland Turbo C++ gives the output
8682
8686
6
I don't understand how this program works. I understand that while printing arr
it returns the base address as 8682 and arr[1]
returns next address location 8686 (integer is 4 bytes) but why is arr[1][2]
not flashing an error as arr[1][2]
is out of bounds?