I have problem in indexing


i have copied the code from the above video .
my doubt is that when i am callculating starting point , then there maybe a case when start<m then arr[start-m ] it is negatively indexed but still not giving error.
example m=99
and prime no 2
startt=(m/x)*x
=98
arr[98-99]


this is actually working without any error.
first time saw something like this happen.

-1 can be accessed but not a good practice

so it means when i will use arr[-1] = 10 then memory just before the start of the array will assigned 10 ?


actually nothing is fixed because we are logically trying to access memory out of range

1 Like