为什么主函数调用reverse函数而没有执行操作啊?
#include<stdio.h>
#define MAX 100
int getline(char s[],int li
m);
void reverse(char [],int lim);
main()
{
int len = 0;
char line[MAX];
while((len=getline(line,MAX))>0)
printf("该行包含的字符数为:%d",len);
reverse(line,len);
}
int getline(char s[],int lim)
{
int i,c;
for(i = 0;i<MAX-1 && (c = getchar()) != EOF && c != '\n';++i)
s[i] = c;
if(c == '\n'){
++i;
s[i] = '\0';
}
printf("getline\n");
return i;
}
void reverse(char from[],int lim)
{
char rev[MAX];
int i =0 ;
int j = lim;
while(j>0)
rev[i] = from[j];
++i;
--j;
printf("%s",rev);
}