这段代码定义了一个计算整数幂的函数 `power`,但代码中存在语法错误,无法编译运行。 - 在 `for` 循环的初始化部分,`int i=;` 缺少了初始值,应该给 `i` 赋一个初始值,比如 `0`。 - 循环体内的 `result n*;` 写法不正确,C 语言中乘法需要写成 `result = result * n;` 或使用复合赋值运算符 `result *= n;`。
Copy this url:
QR-code: