Thread: problem printing string

  1. #1
    Registered User
    Join Date
    Feb 2008

    problem printing string

    hello to all,

    I am having problems printing a string in reverse using the reverse function.

    here is my code:

    char topSequence[] = reverse(rowAlign) ;
    char bottomSequence[] = reverse(colAlign) ;
    I am receiving the following error:

    error: invalid initializer

    I do not believe the problem is with the rowAlign and colAlign variables. Everything is compiling fine until this point.

    Any suggestions on how to fix?

  2. #2
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Katy, Texas
    Carnac the Magnificent could not figure this out with what little code you have posted.
    Mac and Windows cross platform programmer. Ruby lover.

    Quote of the Day
    12/20: Mario F.:I never was, am not, and never will be, one to shut up in the face of something I think is fundamentally wrong.

    Amen brother!

  3. #3
    Registered User
    Join Date
    Feb 2008
    These are the lines of code that are being singled out by the compiler. There are no other errors being reported by the compiler.

  4. #4
    Join Date
    Dec 2007
    I don't think you can initialize an array like that.

    Try using char *s

  5. #5
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Rishon LeZion, Israel
    array initializers should be constant strings as far as I remember...
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    David J. Wheeler

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. char Handling, probably typical newbie stuff
    By Neolyth in forum C Programming
    Replies: 16
    Last Post: 06-21-2009, 04:05 AM
  2. string problem
    By INeedSleep in forum C++ Programming
    Replies: 24
    Last Post: 11-08-2007, 11:52 PM
  3. convert double to string problem
    By gandalf_bar in forum C++ Programming
    Replies: 6
    Last Post: 03-15-2004, 05:14 AM
  4. Linked List Help
    By CJ7Mudrover in forum C Programming
    Replies: 9
    Last Post: 03-10-2004, 10:33 PM