用指针的方法,将字符串
"ABCD1234efgh"
前后对调显示。(C试题)void reverseString(char *str) { char temp, *pl = str, *pr = str; while (*(pr + 1) != '\0') pr++; while (pl < pr) { temp = *pl; *pl = *pr; *pr = temp; pl++; pr--; } }
"ABCD1234efgh"
前后对调显示。(C试题)void reverseString(char *str) { char temp, *pl = str, *pr = str; while (*(pr + 1) != '\0') pr++; while (pl < pr) { temp = *pl; *pl = *pr; *pr = temp; pl++; pr--; } }