该函数未在 clang 中返回
The function is not returning in clang
我正在尝试编写一个程序来计算矩形的面积
但函数 return 没有任何值
这是 cs50 沙箱中的代码
#include <stdio.h>
#include <cs50.h>
int calcrectarea(int len,int wid){
return len*wid;
}
int main(){
printf("enter length here:\n");
int x; scanf("%d",&x);
printf("enter width here:\n");
int y; scanf("%d", &y);
calcrectarea(x,y);
}
其实函数returns一个值。也许你想看,所以打印结果:
#include <stdio.h>
#include <cs50.h>
int calcrectarea(int len,int wid){
return len*wid;
}
int main(){
printf("enter length here:\n");
int x; scanf("%d",&x);
printf("enter width here:\n");
int y; scanf("%d", &y);
printf("area is: %d", calcrectarea(x,y));
}
我正在尝试编写一个程序来计算矩形的面积 但函数 return 没有任何值
这是 cs50 沙箱中的代码
#include <stdio.h>
#include <cs50.h>
int calcrectarea(int len,int wid){
return len*wid;
}
int main(){
printf("enter length here:\n");
int x; scanf("%d",&x);
printf("enter width here:\n");
int y; scanf("%d", &y);
calcrectarea(x,y);
}
其实函数returns一个值。也许你想看,所以打印结果:
#include <stdio.h>
#include <cs50.h>
int calcrectarea(int len,int wid){
return len*wid;
}
int main(){
printf("enter length here:\n");
int x; scanf("%d",&x);
printf("enter width here:\n");
int y; scanf("%d", &y);
printf("area is: %d", calcrectarea(x,y));
}