Ive tryd to find the answer to this, but cant. What is better to use? A string variable or a char[] variable. (eg. string Name = "jack" or char Name[5] = ("jack") ). I plan on useing it as a class attribute, that will be accesable through accesor functions within the class.
Agreed.
Remember, a std::string is a container class, which maintains a char[] internally.
The advantage is now you can use all the dynamic features of a container class, but you still have access to the char[].
Depending on the STL implementation, the char[] is marginally faster than a std::string, but stick with the string unless your profiler tells you that you absolutely have to trim time spent on essential string operations. (This should be unlikely.)
Hope this helps.
Thanks alot!! You guys answerd my question perfectly!! Great site!