Hi guys....i have a problem and I hope you can explain me where am I wrong...
I am doing some kind of Breadth First Search (BFS) ("some kind of" because this is my first program to use this algorithm)
I have an array of size 4^9 (262144 for those of you who dont have nerves to calculate or dont want to) and i have a pointer to access that array...
Problem occurs when i get close to the end of the array...something happens and then Segmentation Fault pops out...
i am not quite sure what is the problem. it could be indexing problem but i dont use array in standard manner like: array[index]
anywhere in code but i use pointer to write data to it, and pointer is constantly being moved towards the end of the array....
I thought it could be stepping over the edge of the array but when i use debug output, i see that last position of that pointer is 261886 which is far from the end...(well....far enough)
Pointer is declared as struct situations *read;
array: struct situations sits[262144];
and then: read = sits;
(could be read = &sits[0];
but didnt want to complicate)
what could be reason for Segmentation Fault if it isn't:
1. dereferencing NULL pointer
2. dereferencing uninitialized pointer
3. accessing memory out of bounds or array indexing out of bounds