That's just the thing - it doesn't. The compiler doesn't care. It's more of a style thing. Bjarne had a question about that so I will link it: http://www.research.att.com/~bs/bs_faq2.html#whitespace
In C++, there is a heavy emphasis on types, which is why I always put them next to the type.
You're right, you do not. I always like to prefix them, though.Quote:
2. Why do I need to say std::, I thought saying 'using namespace std' allowed me to not type that?
c_str() returns a constant C-style string of the contents inside the string class.Quote:
3. I saw .c_str() used in my book but it was unclear whats it purpose is. I also saw .data() and I am currently using that. What is the difference between the two and what is the purpose of the () at the end of them?
The () at the end is because it's a function, and not a member variable. Function calls always needs the ().
Did you not read the link I linked to? I think it explains very well why it's usually a bad idea to strip them.Quote:
4. It is not required but a good idea? Sort of like a comment in the code?

