Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何将多个字符组合成一个字符串,以便以后可以反转该字符串?我从标准输入用 getchar() 读取字符。我在这样的循环中打印它:
do { character = getchar(); printf("%c", character); } while(character != EOF)
但我必须把它反过来打印。我怎样才能做到这一点?
您需要将字符存储在缓冲区中(char buffer[255]例如)。
char buffer[255]