利用递归实现一个函数输入1,输出11,输入12,输出1122
来源:百度知道 编辑:UC知道 时间:2024/05/15 13:07:44
#include <stdio.h>
#include <string.h>
void func(char *outPut)
{
char *p = outPut;
if(*p != '\0')
{
printf("%c%c", *p, *p);
}
else
{
printf("\nOVER!\n");
return;
}
func(++p);
}
void main(void)
{
char temp[10];
printf("Input:");
scanf("%s", temp);
func(temp);
}