小编Eri*_*rki的帖子

我们可以使用 C 中的 return 语句返回多个值吗?如果不能,为什么下面的代码编译成功?

程序为什么以及如何给出输出?

#include <stdio.h>
int sum(int a ,int b , int c ){
    return a , b ,c;
}
int main() {
    int a=10, b=100 , c=1000 ;
    int x = sum(a , b ,c);
    printf("%d %d %d" ,x);
    
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

输出:1000 1000 100

c return-type return-value

1
推荐指数
1
解决办法
2085
查看次数

标签 统计

c ×1

return-type ×1

return-value ×1