+ Reply to Thread
Results 1 to 2 of 2

Thread: In-place String reversal

  1. #1
    Surfer is offline Senior Member
    Join Date
    Mar 2010
    Posts
    321

    In-place String reversal

    Reverse an array of char in place.

  2. #2
    Surfer is offline Senior Member
    Join Date
    Mar 2010
    Posts
    321
    Code:
    void strRev(char *s)
    {
        for(char *end = s + (strlen(s) - 1); (end > s) ; (*s++) ^= (*end) ^=(*s) ^= (*end--));
    }

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Linked List Reversal
    By TopGun in forum Algorithm/Data Structure Questions
    Replies: 1
    Last Post: 2nd June 2008, 15:53
  2. Linked List Reversal
    By TopGun in forum Linked Lists
    Replies: 0
    Last Post: 17th February 2008, 17:37

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts