关于下述代码,说法错误的是( )。

yh577499 单选题 共 个子题
int multiply(int x, int y);

int main() {
int a = 4;
int b = 5;
int result = multiply(a, b);
std::cout << "The result is: " << result << std::endl;
return 0;
}

int multiply(int x, int y) {
return x * y;
}
A

$O(n^2)$ 函数multiply的定义应该放到函数main之前。

B

$O(n \times 2^n)$ 函数声明int multiply(int x, int y);中明确指定了函数multiply()的返回值为整数类型。

C

$O(1)$ 在main函数中,函数multiply通过multiply(a, b)被调用,其中a和b是定义在main函数中的变 量,它们作为实参传递给了multiply函数的形参x和y。

D

$O(n^3)$ 运行上述代码,将输出The result is: 20。

正在加载题目数据…
已答 /
子题
该题型需在试卷/作业中作答,单题练习暂不支持
答案解析
讨论
发布
登录后参与讨论 立即登录
发布讨论需先绑定并验证手机号 去绑定手机号
加载中…
我
我
回复 @
回复 @
发送
还没有人讨论,来发表第一条吧