Reputation:
I get segmentation fault when I try to do this. If I use valgrind to track the errors I get the message bad permission for mapped region. What does that mean ?
int *p;
p = (int *) f // f is a function
*p = 0x1234;
Upvotes: 0
Views: 1896
Reputation: 409364
All code is in memory segments marked read (and execute) only.
Upvotes: 2
Reputation: 8053
(I assume you mean *p = 0x1234;
instead of *ptr
). You cannot change the address of a function because it's in read-only memory.
Upvotes: 1