为了账号安全,请及时绑定邮箱和手机立即绑定

长方形面积调用问题

长方形面积调用问题

C
qq_曦正_0 2015-12-19 22:06:29
#include <stdio.h>int area(int a,int b){    int s=a*b;}int main(){    int a=1;    int b=3;    int s;    int area(a,b);    printf("%d\n",s);            return s;}——————————————————————————在dos控制台运行的结果是如下:32767--------------------------------Process exited after 0.2116 seconds with return value 32767请按任意键继续. . .哪位老师同学能帮我看看到底是哪出错了。
查看完整描述

1 回答

已采纳
?
Ivoth

TA贡献13条经验 获得超3个赞

#include <stdio.h>
int area(int a,int b){
    return (a*b);//返回长宽的乘积
}
int main(){
    int a=1;
    int b=3;
    int s;
    s=area(a,b);//s接收返回值
    printf("%d\n",s);
    
    
    return 0;//这是主函数的返回值
}


查看完整回答
1 反对 回复 2015-12-19
  • 1 回答
  • 0 关注
  • 1233 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信