【发布时间】:2021-12-05 00:39:29
【问题描述】:
#include <stdio.h>
#include <conio.h>
int sum();
//find the sum of two numbers entered by the user.
int main(){
int n, m;
printf("Enter two numbers: \n");
scanf("%d", &m);
scanf("%d", &n);
int result = sum(m, n);
printf(result);
getch();
return 0;
}
int sum(m, n){
int c;
c = m+n;
return c;
}
我只是在写一个简单的函数程序,但我不知道为什么它没有运行它告诉我调试有人可以告诉我它有什么问题
【问题讨论】:
-
将
int sum()和int sum(m, n)更改为int sum(int m, int n)。然后把printf(result);改成printf("%d", result); -
谢谢!!!完成
-
Ans 是什么问题?我认为任何最新的 C 编译器都会在该代码中发出 很多 警告,这应该可以帮助您找到before 此处询问的问题。你没有收到任何编译器警告吗?