新手求助:这段代码是哪里有问题呢,求大神指点!!!
#include <stdio.h>#include <stdlib.h>
/*
将输入的字符串倒过来输出(如输入'abcd',输出'dcba')
*/
int main(int argc, char *argv[])
{
printf("请输入一串英文");
char *p, ch1, ch2;
p = &ch1;
int i=0;
ch2 = getchar();
while(ch2 != '\n')
{
*(p+i) = ch2;
i++;
ch2 = getchar();
}
i--;
while(i >= 0)
{
printf("%c", *(p+i));
i--;
}
printf("End");/*结束标志*/
return 0;
}