Cracking the Coding Interview Q1.2
2014-07-03 09:31
369 查看
Write code to reverse a C-Style String. (C-String means that “abcd” is represented as five characters, including the null character.
View Code
void reverse(char *str) { char * end = str; char tmp; if (str) { while (*end) { ++end; } --end; while (str < end) { tmp = *str; *str++ = *end; *end-- = tmp; } } }
View Code
相关文章推荐
- cracking the coding interview ch1.2
- cracking the coding interview No1.2
- Cracking the coding interview Q1.2
- Cracking The Coding Interview 1.2
- Cracking The Coding Interview 3rd -- 1.2
- Cracking the coding interview--Q11.1~Q11.6
- Cracking the coding interview--Q12.3
- 《Cracking the Coding Interview》——第1章:数组和字符串——题目5
- 《Cracking the Coding Interview》——第3章:栈和队列——题目3
- 《Cracking the Coding Interview》——第4章:树和图——题目4
- 《Cracking the Coding Interview》——第6章:智力题——题目2
- Cracking the coding interview--Q2.4
- 《Cracking the Coding Interview》——第6章:智力题——题目3
- 《Cracking the Coding Interview》——第9章:递归和动态规划——题目6
- Cracking the Coding Interview Q2.3
- Cracking the coding interview--Q15.2
- Cracking the coding interview--Q1.7
- Cracking The Coding Interview2.1 暂存
- Cracking the coding interview--Q19.3
- Cracking the Coding Interview 题目分析笔记—— Array and String