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

#include<stdio.h>

int main()
{ void dg(char a[],int x);
	char a[5];
    gets(a);
	dg(a,5);
	printf("\n");
	return 0;
}
void dg(char a[5],int x)
{ 
  printf("%c",a[x-1]);
  x--;
  if(x>0) dg(a,x)	;
}

猜你喜欢

转载自blog.csdn.net/weixin_43742177/article/details/84851660