/*Program to print all the numbers between a lower bound and a upper bound values*/
#include<stdio.h>
#include<stdlib.h>
void recur(int a, int b);
int main(void)
{
int x,y;
printf("Enter the lower and upper bound values: \n");
scanf("%d %d",&x,&y);
void recur(x,y);
return 0;
}
void recur(int a,int b)
{
if(a<b)
{
printf("%d /n",a);
a++;
void recur(a,b);
}
}
我得到的输出是:ç递归函数调用的概念
Enter the lower and upper bound values:
10
50
process returned 0.
这有什么错的语法或返回类型..? 我刚开始学习c.Need帮助
'void recur(x,y);' - >'recur(x,y);','void recur(a,b);'同上。还有'/ n' - >'\ n' – BLUEPIXY
你也想把“/ n”改成“\ n”来产生换行符,我相信。 – Yuval
该程序在哪里返回0消息输出?我没有看到任何printf消息。顺便说一下,在主代码中'void recur(x,y);'只声明你有一个外部函数,它接受一个未定义的参数列表并返回'void',而不是调用它。不知何故,您必须使用一些C11编译器或至少C98,因为它允许您在可执行代码之后声明函数原型。 –