问题
我想写一个c语言的逆序输出字符,
输入:qwe
输出:ewq
下面是我写的代码,没有报错,也不逆序输出,我看不懂我这问题出在了哪里,在线求解!
#include <stdio.h>
#include <string.h>
void main(){
char ch,c[100];
int i=0;
while(ch=getchar()!='\n'){
c[i]=ch;
i++;
}
for(int j=i;j>0;j--){
putchar(c[j]);
}
}