Hi All,
I want to know that how does the string differ from char* and why was the string class needed in C++ while char * was already there?
Can anyone help me please?
Hi All,
I want to know that how does the string differ from char* and why was the string class needed in C++ while char * was already there?
Can anyone help me please?
The string class comes with many functions that make its use easier than char pointers
OS: Windows 7, XUbuntu 11.10, Arch Linux
IDE: CodeBlocks
Compiler: GCC
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
The usage of the string container is far more intuitive in comparison to dealing with character arrays/pointers making text processing much more robust and far less error prone.
Blah... blah... blah...
"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens
cross posted -- see Salem's' link