利用递归函数调用方式,将所输入的五个字符,以相反顺序打印出来

递归

void palin(int n);
int main()
{
int i=5;


printf("please input 5 numbers:");
palin(i);
printf("\n");

}
void palin(int n)

{
char next;
if(n<=1)
{
next=getchar();
printf("\n");
putchar(next);

}
else
{
next=getchar();
palin(n-1);
putchar(next);
}
}

对于putchar(),getchar()的用法

https://www.jb51.net/article/126855.htm

猜你喜欢

转载自www.cnblogs.com/gs1124/p/9346880.html