Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
尝试执行此操作时出现分段错误。如果我使用 valgrind 跟踪错误,我会收到消息错误权限映射区域。这意味着什么 ?
int *p; p = (int *) f // f is a function *p = 0x1234;
所有代码都在标记为只读(和执行)的内存段中。
(我假设你的意思是*p = 0x1234;而不是*ptr)。您不能更改函数的地址,因为它位于只读存储器中。
*p = 0x1234;
*ptr