摘要:
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 ... 阅读全文
摘要:
1: /* 2: 计算字符串长度。 3: */ 4: 5: #include <stdlib.h> 6: 7: size_t strlen(char *string) 8: { 9: int length = 0; 10: 11: while (*string... 阅读全文