gpt4 book ai didi

C - 指针算法使用机器代码测试器框架

转载 作者:太空宇宙 更新时间:2023-11-04 05:48:30 26 4
gpt4 key购买 nike

我在网上发现了一种用 C 语言编写的类似形式的机器代码测试器。

测试人员使用指针运算来运行机器码缓冲区。

#include <stdio.h>
#include <string.h>

unsigned char code[] = \
"machine code to be executed";

void main() {
int (*ret)() = (int(*)())code;
ret();
}

谁能解释一下两者的指针运算背后的逻辑上面显示的行?

最佳答案

Can anyone explain the logic behind the pointer arithmetic of the two lines presented above?

没有指针运算。代码只是声明了一个变量 (ret),其类型是指向不带参数并返回 的函数的指针整数。它将该变量设置为指向 code,其中可能包含机器代码的实际字节,然后使用它进行函数调用。

关于C - 指针算法使用机器代码测试器框架,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52245724/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com