Can anyone please elaborate this loop??


and especially 2nd and 3rd clause of loop either increment or assignment will be done first...

str and end are pointers.

while (str is pointing at memory somewhere before what end is pointing at)
  make a temporary copy of whatever str is pointing at
  copy whatever end is pointing at into what str is pointing at
  move the pointer str along one
  copy that temporary value into wehre end is pointing
  move end back one

This looks like a simple string (char array) reversal algorithm. Here is the same thing, done with your fingers and a line of text.

Write out a long string
Point one finger at the first letter and one finger at the last letter
Swap the letters over.
Move your fingers in one letter.
Repeat until your fingers meet.

commented: Great explanation! +15