Thread: Reversing a string

  1. #1
    Registered User
    Join Date
    Nov 2004
    Posts
    2

    Smile Reversing a string

    To reverse a string using a recursive function, without swapping or using an extra memory.

  2. #2
    Registered User Kybo_Ren's Avatar
    Join Date
    Sep 2004
    Posts
    136
    No one is going to do work for you.
    Do it yourself, or at least try.

    Post your attempt and what you don't get, etc. and we'll help.

  3. #3
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Well since function calls use memory what you want isn't possible.

  4. #4
    Registered User manofsteel972's Avatar
    Join Date
    Mar 2004
    Posts
    317
    I think he means without declaring another variable or array to store it in.
    "Knowledge is proud that she knows so much; Wisdom is humble that she knows no more."
    -- Cowper

    Operating Systems=Slackware Linux 9.1,Windows 98/Xp
    Compilers=gcc 3.2.3, Visual C++ 6.0, DevC++(Mingw)

    You may teach a person from now until doom's day, but that person will only know what he learns himself.

    Now I know what doesn't work.

    A problem is understood by solving it, not by pondering it.

    For a bit of humor check out xkcd web comic http://xkcd.com/235/

  5. #5
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Well, if you're not going to create another array to store the results in, I don't see how you can reverse a string without swapping elements.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  6. #6
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Quote Originally Posted by manofsteel972
    I think he means without declaring another variable or array to store it in.
    What he meant and what he said are possiblity two very different things. But lets say we forget about the return address, you still have parameters that are variables so you can pass anything into it with creating more variables.

  7. #7
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Why doesn't anyone use the board search function? Reversing a string is posted all the time.

    Quzah.
    Hope is the first step on the road to disappointment.

  8. #8
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660

  9. #9
    Registered User
    Join Date
    Nov 2004
    Posts
    14
    I didnt find reversing a string on the boards using recursion. That seems like a good practise for recursion though. I think i will try it.

  10. #10
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by Cowboy
    I didnt find reversing a string on the boards using recursion.
    Well then you're an idiot.

    Using the following keywords: reverse string recursion

    Quzah.
    Hope is the first step on the road to disappointment.

  11. #11
    Registered User
    Join Date
    Nov 2004
    Posts
    14
    hmmm...yeah the search works a lot better...

    but allow me to show my disapproval of your people skills right there...burn in hell bastard

  12. #12
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    You must have missed the smiley. You're allowed to say anything as long as you smile.

    You also missed the part where I just don't care.

    Quzah.
    Hope is the first step on the road to disappointment.

  13. #13
    Registered User
    Join Date
    Nov 2004
    Posts
    14
    Quote Originally Posted by quzah
    You must have missed the smiley. You're allowed to say anything as long as you smile.
    i didnt agree to those terms

    Quote Originally Posted by quzah
    You also missed the part where I just don't care.
    thats because it wasnt in your post...so why don't you show me that you don't care by not replying to this

  14. #14
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    Don't worry, your not the only one to be on the wrong end of the "Wrath of Quzah". And you are getting off relatively unscathed compared to others.
    Perhaps if you got him a rain coat, he'd be nice.
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  15. #15
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    >>And you are getting off relatively unscathed compared to others.
    Much to the dismay of the audience Too bad, quzah must've been in a good mood today.

    >>Perhaps if you got him a rain coat, he'd be nice.
    A raincoat?...
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. String Class
    By BKurosawa in forum C++ Programming
    Replies: 117
    Last Post: 08-09-2007, 01:02 AM
  2. Program using classes - keeps crashing
    By webren in forum C++ Programming
    Replies: 4
    Last Post: 09-16-2005, 03:58 PM
  3. Calculator + LinkedList
    By maro009 in forum C++ Programming
    Replies: 20
    Last Post: 05-17-2005, 12:56 PM
  4. problems with overloaded '+' again
    By Brain Cell in forum C++ Programming
    Replies: 9
    Last Post: 04-14-2005, 05:13 PM
  5. Reversing a String
    By ToasterPas in forum C++ Programming
    Replies: 10
    Last Post: 08-14-2001, 12:20 PM