在内存/编译中会发生什么?

1 c memory stack printf

代码:

#include <stdio.h>

int main(int argc, char *argv[])
{
    //what happens?
    10*10;

    //what happens?
    printf("%d", 10*10);   

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

在这两行中的内存/编译中会发生什么.它存储了吗?(10*10)

Gre*_*ill 5

该声明

10*10;
Run Code Online (Sandbox Code Playgroud)

没有效果.编译器可以选择不为此语句生成任何代码.另一方面,

printf("%d", 10*10);
Run Code Online (Sandbox Code Playgroud)

将结果传递10*10printf函数,该函数将result(100)打印到标准输出.