if i am using negative index it should throw error i have mentioned my doubt in cooment in the code please check
Assigmment of backtracking
Hello @shampblocks,
There is no such error defined in the specification/documentation of C++ for out of range/bound access of the array.
While, you would get an error in Java for it.
What will happen here:
Suppose the memory location assigned to arr[0] i.e. the first index of array is 0a736f8
So, for arr[-1] it will print the values stored at 0a736f4 (if the array is of int type).
Hope, this would help.
Give a like if you are satisfied.
So we can access negative index on c++ when we are checking conditions??
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.