摘要:
1 /* 2 Reverse a string. 3 */ 4 5 void rev_str(char *str) 6 { 7 char *end = str; 8 9 while (*end != '\0')10 end++;11 end--; //Rollback to the last character.12 13 while (str < end) {14 char tmp = *str;15 *str++ = *end;16 *end-- = tmp;17 ... 阅读全文
posted @ 2012-04-17 16:56
xiranpa
阅读(581)
评论(6)
推荐(1)
摘要:
1: /* 2: 计算字符串长度。 3: */ 4: 5: #include <stdlib.h> 6: 7: size_t strlen(char *string) 8: { 9: int length = 0; 10: 11: while (*string... 阅读全文
posted @ 2012-04-17 10:59
xiranpa
阅读(269)
评论(0)
推荐(0)

浙公网安备 33010602011771号