By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,261 Members | 1,325 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,261 IT Pros & Developers. It's quick & easy.

extremely simple question

P: n/a
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

Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Mike Lundell <workingmike_no@spam_hotmail.com> wrote:
what's wrong with this, and .. can you not declare "char" variables?

#include <iostream>

int main()
{
int a = "* * * * * * * *\n";
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 std::cout << a;
return EXIT_SUCCESS;
}

thx

--
Tim Slattery
Sl********@bls.gov
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.