how to reverse a string by using array method.?

Discussion in 'C' started by gahhon, Aug 28, 2010.

  1. gahhon

    gahhon New Member

    Joined:
    Aug 28, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    how to reverse it?
    i had tried
    Code:
    void main()
    {
            int i = 30;
            int x;
            char reverse[31];
            char title[31] = "programming concepts and design";
    
            for(x = 0; x >= 0; x++)
            {
                    reverse[x] = title[i];
                    i--;
            }
    
            printf("The reverse order is %s\n", reverse[x]);
    }
    the result show me is the system error and end of the program immediately.
    so what's wrong with the codes, so far i can't detect where im wrong.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice