String Reverse – Algorithm



Algorithm to Reverse String in C :

  1. Start
  2. Take 2 Subscript Variables ‘i’,’j’
  3. ‘j’ is Positioned on Last Character
  4. ‘i’ is positioned on first character
  5. str[i] is interchanged with str[j]
  6. Increment ‘i’
  7. Decrement ‘j’
  8. If ‘i’ > ‘j’ then goto step 3
  9. Stop

Dry Run :