I'm trying to debug a program I've written. According to the debugger a particular void *
holds the value 0x804b008. I'd like to be able to dereference this value (cast it to an int *
and get it's value).
I'm getting a Segmentation Error with this code. (The program with the void *
is still running in the background btw - it's 'paused')
#include <stdio.h>
int main() {
int* pVal = (int *)0x804b008;
printf("%d", *pVal);
}
I can see why being able to deference any point in memory could be dangerous so maybe that's why this isn't working.
Thank you!