用指针逆序字符串

Tags
C语言
字符串
指针
ID
3
 
用指针的方法,将字符串 "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--; } }