C 根据指令操作问题

问题描述 投票:0回答:1

对于这个问题,输出应该是这样的: “这是第一个 ” “这是第二个。 ” 但我无法解决,它应该通过指令运算来解决。您只能修改study2函数中下面提到的部分。此外,不允许使用跳转或调用功能。要么你不能调用study()。

#include <stdio.h>

void study()
{
    printf("this is the second.\n");
}

void study2()
{
    int bold[4];
    // can only modify this section BEGIN
    // cant call study(), maybe use study(pointer to function)


    // can only modify this section END
    printf("this is the first\n");
}

int main(int argc, char *argv[])
{
    study2();
    return 0;
}

我期待使用上面的方法来解决这个问题。

c buffer-overflow
1个回答
0
投票

这是我的看法:

void study2()
{
    int bold[4];
    // can only modify this section BEGIN
    // cant call study(), maybe use study(pointer to function)   

    // This macro definition makes no calls:
    #define printf(x) printf(x); study()

    // can only modify this section END
    printf("this is the first\n");
}
© www.soinside.com 2019 - 2024. All rights reserved.