我在vc++6中编递归求字符串逆序输出在指定文件中

#include<stdio.h>

#include<process.h>
#define SIZE 10
char reverse(char *s)
{
if(*s!='\0')
return(reverse(s));

reverse(s+1);

putchar(*s);

}

void main()
{

char *s;
FILE *fp;

char c[10],i;
if((fp=fopen("input.txt","wt+"))==NULL)
{
printf("error!\n");
exit(1);
}
else
{
printf("输入文件内容:");
for(i=0;i<SIZE&&!feof(fp);i++)
c[i]=fgetc(fp);
c[i]='\0';
puts(c);
fclose(fp);}
if((fp=fopen("ouput.txt","wt+"))==NULL)
{printf("error!\n");
exit(1);
}
else
{
fprintf(fp,"文件内容:%s\n",reverse(s));
fclose(fp);
}

}
Compiling...
Skipping... (no relevant changes detected)
xz.cpp

xz.obj - 0 error(s), 0 warning(s)
这是编译之后的提示

啥问题?
我试了一下内存调用错误!
你能把你的整体思路说一下。能在程序上加一下注释就更好了。
O(∩_∩)O哈哈~来自:求助得到的回答
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答
大家正在搜