In order to deepen my understanding of how memory is allocated and stored, I wrote an application that can scan the address space of a memory, find a value, and write a new value.
I developed an example application with the ultimate goal to be able to programmatically find my array and overwrite it with a new sequence of numbers. In this situation, I created a one-dimensional array with 5 elements, for example
int[] array = new int[] {8,7,6,5,4};
I started the application and looked for a sequence of five numbers above. I searched for any value that fell between 4 and 8, for a total of 5 numbers in a row. Unfortunately, my consecutive numbers in the array corresponded to hundreds of results, since the numbers 4 through 8, not a single specific sequence, were located next to each other in memory in many situations.
Is there a way to distinguish a set of numbers in memory, is an array, and not integers that are next to each other? Is there any way to find out that if I find a specific value, that the corresponding values โโcorrespond to an array?
I would suggest that when I declare an int[] array , it points to the first address of my array, which will provide some kind of metadata to what existed in the array, for example
0x123456789 meta-data, 5 - 32 bit integers 0x123456789 + 32 "8" 0x123456789 + 64 "7" 0x123456789 + 96 "6" 0x123456789 + 128 "5" 0x123456789 + 160 "4"
How do I retreat from the base?