problem printing string

This is a discussion on problem printing string within the C Programming forums, part of the General Programming Boards category; hello to all, I am having problems printing a string in reverse using the reverse function. here is my code: ...

  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    77

    problem printing string

    hello to all,

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

    here is my code:

    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
    Location
    Katy, Texas
    Posts
    2,309
    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
    Posts
    77
    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
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,650
    I don't think you can initialize an array like that.

    Try using char *s

  5. #5
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    array initializers should be constant strings as far as I remember...
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

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, 10:52 PM
  3. convert double to string problem
    By gandalf_bar in forum C++ Programming
    Replies: 6
    Last Post: 03-15-2004, 04:14 AM
  4. Linked List Help
    By CJ7Mudrover in forum C Programming
    Replies: 9
    Last Post: 03-10-2004, 09:33 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21