extremely simple question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike Lundell

    extremely simple question

    what's wrong with this, and .. can you not declare "char" variables?

    #include <iostream>

    int main()
    {
    int a = "* * * * * * * *\n";
    std::cout << a;
    return EXIT_SUCCESS;
    }

    thx

  • Tim Slattery

    #2
    Re: extremely simple question

    Mike Lundell <workingmike_no @spam_hotmail.c om> wrote:
    [color=blue]
    >what's wrong with this, and .. can you not declare "char" variables?
    >
    >#include <iostream>
    >
    >int main()
    >{
    > int a = "* * * * * * * *\n";[/color]

    You're trying to assign a character string to an integer variable.
    That's not going to work. You need something like:

    char a[] = "* * * * * * * *\n";

    Also, you might want to investigate the "string" in the STL[color=blue]
    > std::cout << a;
    > return EXIT_SUCCESS;
    >}
    >
    >thx[/color]


    --
    Tim Slattery
    Slattery_T@bls. gov

    Comment

    Working...