> i=i++

Um, no. Either use i++ on its own or use i=i+1.

Try as a test displaying the values of i and (b-1)-i in the loop instead. What values do you expect? What values do you get? Does that explain why you get EDCDE?