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 = "\""

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.

http://www.gillius.org/ctut/app_a.htm

you only need escape characters for a few specific characters because these characters are also key characters for the compiler

an underscore would just be mystring = "_"

http://www.gillius.org/ctut/app_a.htm

you only need escape characters for a few specific characters because these characters are also key characters for the compiler

an underscore would just be mystring = "_"

Thanks,

The link was very handy.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.