can't understand what's going on in while
if possible visualize, please.
int main() { char text[] = "hello"; int nchars = sizeof(text)-1; char *pstart = text; char *pend = text + nchars - 1; //can't understand part while (pstart < pend) { char tmp = *pstart; *pstart = *pend; *pend = tmp; pstart++; pend--; } cout << text << endl; return 0; }
Comments
Post a Comment