Hey,

This is probably a newb question, but what all can a string type variable hold?

Is it restricted to just letters or can it hold things like "/\|;:'><!@#$%^"...?

An easy way to think of a string is that its an array of characters in C and a vector of characters in C++.

Meaning it can hold any character. If you want something like " ' or \ in it you need to put an escape character before it like
mystring = "\\"
mystring = "\""

Edited 6 Years Ago by sfuo: n/a

Ok,

What if it is reading from a file? Does the escape character still need to be there?

It probably does, I just would like to make sure. Also how to you get an underscore character?

Thanks in advance,
Tmantix.

Edited 6 Years Ago by tmantix: n/a

This question has already been answered. Start a new discussion instead.