Ask your own question, for FREE!
Computer Science 9 Online
OpenStudy (anonymous):

C++ Can anyone tell me why an error occurs when I declare something like string x = 0;?

OpenStudy (anonymous):

Can string type take a value of a number?

OpenStudy (anonymous):

no. it's a string, so it is registered as a "string" of characters.

OpenStudy (anonymous):

Strings in C++ end up as character arrays (from my experience). therefore, unless you are trying to make this a null string (in which case you should use ""; or null;) you generally want to surround your input with quotes as @nphuongsun93 stated previously. (which would make your right hand side be "0";)

OpenStudy (anonymous):

Thank you very much.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!