相关疑难解决方法(0)

未使用的函数返回值会发生什么?

如果我有一个程序:

#include <iostream>

using namespace std;

int TestIntReturn(int &x, int &y)
{
    x = 1000;
    y = 1000;
    return x+y;
}

int main()
{
    int a = 1;
    int b = 2;
    cout << a << " " << b << endl;
    TestIntReturn(a,b);
    cout << a << " " << b << endl;
}
Run Code Online (Sandbox Code Playgroud)

TestInReturn(a,b)由于它未被使用,返回值会发生什么变化?

c++ windows return function

7
推荐指数
2
解决办法
2597
查看次数

标签 统计

c++ ×1

function ×1

return ×1

windows ×1