小编Rag*_*van的帖子

函数调用顺序错误

这就是我今天编写的内容

#include <iostream>
using namespace std;

int function1()
{
  cout<<"hello from function1()"; return 0;
}

int function2()
{
  cout<<"hello from function2()"; return 0;
}

int main()
{
    int func_diffresult = 0;
    func_diffresult = function1() - function2();
    cout<<func_diffresult; /** prints 0 correctly **/
}
Run Code Online (Sandbox Code Playgroud)

输出是得到的hello from function2()hello from function1().我认为输出应该是hello from function1()hello from function2().我的编译器和我一起玩吗?

c++ evaluation function unspecified

6
推荐指数
2
解决办法
388
查看次数

标签 统计

c++ ×1

evaluation ×1

function ×1

unspecified ×1