gpt4 book ai didi

C 访谈输出

转载 作者:行者123 更新时间:2023-11-30 18:16:53 26 4
gpt4 key购买 nike

void fun()
{
// What goes here?
}
void main()
{
int x = 20;
fun();
x = 10;
printf("%d",x); // Should print 20.
}

这是我的测试问题之一。我想知道是否应该使用static int。你能帮我吗?

最佳答案

我不容忍这种做法,这是一个可怕的想法。但从技术上讲,这在某种程度上符合问题的标准。

void fun()
{
// Essentially this is a function with an empty body
// And I don't care about () in a macro
// Because this is evil, regardless
#define printf(a, b) (printf)(a, b*2)
}

void main() // I know this is not a valid main() signature
{
int x = 20;
fun();
x = 10;
printf("%d", x);
}

关于C 访谈输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38156503/

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