摘要:
2013-10-25 最近碰到一道笔试题,是关于字符串翻转的。题目是:将一段英文翻转,但保留单词拼写,如给定字符串str="I am a student",返回为"student a am I"。(为简单代码,设给定字符串由' '和字母组成)。 对于这个题目我的思路是,先不管单词拼写,将str完全翻转得到str="tneduts a ma I",然后再对str中每个单词逐个翻转。代码实现如下 1 #include 2 #include 3 #include 4 char *revstr(char *str)//翻转字符 阅读全文