Hi all,
I am not sure why the following code fragement is not doing what it is supposed to do. Returning the numbers 0 to 9 in the second loop would be idea. *scp is a pointer to a memory region allocated to the program.
unsigned char* scp = (unsigned char*)(0x8e000000);
scp_size = 10;
for(i = 0; i < scp_size; i++, scp++) {
*scp = i;
}
}
scp = (unsigned char*)(0x8e000000);
for(i = 0; i < scp_size; i++, scp++) {
printf("Data read[%d]: %d\n", i, *scp);
}
The acual output is however completely different:
[exec] Data read[0]: 3
[exec]
[exec] Data read[1]: 3
[exec]
[exec] Data read[2]: 3
[exec]
[exec] Data read[3]: 3
[exec]
[exec] Data read[4]: 128
[exec]
[exec] Data read[5]: 35
[exec]
[exec] Data read[6]: 32
[exec]
[exec] Data read[7]: 1
[exec]
[exec] Data read[8]: 18
[exec]
[exec] Data read[9]: 146
Anybody an idea if I mixed here something up with the pointer or any other idea what might have gone wrong? Many thanks