It generally depends on the memory contents directly after the array. If that address isn't mapped, the application will crash.
But it's undefined behavior, so there's no guarantee as to what will happen. The compiler might just as well decide to use a default value like 0 if it sees that it's an out-of-bound access or trigger a runtime error.
... then &a[0] will return a pointer to the memory location of where the array starts.
Increasing the offset (the number between the square brackets) will simply increment the pointer by the size of the array data type (int his case int) by how ever many times you specify. So &a[6] will return a pointer to 6 memory locations past the start of 'a'. In this case, since the array 'a' only contains 3 memory locations, &a[6] will point to a position in memory that has absolutely nothing to do with the array and so the returned result could be anything since this adjacent memory could be being used for anything. Perhaps it is being used to store a string. maybe another array of ints. There is no way for you to know.
When you say...
int n = a[6];
... memory is being read from the memory position &a[6] until an ints worth of data has been read, and it is then being interpreted as a meaningless integer.
thank you for all the replies..got it now .!
btw one more thing if its possible..
is there any way i can specify the compiler which memory addresses to use for the data type.
eg:
let us suppose i want to assign int b[9]; a memory location that starts from a[3], i.e the memory just after the end of a[];
I think the answer is no, you can't, but variables created on the stack are usually created in a consistent order (anyone know if this is mandated in the specification?). Anyway, try: