English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Why does C++ have a string class when there is already char * (a pointer to type character)?

2007-01-04 04:20:50 · 3 answers · asked by moonidcs 1 in Computers & Internet Programming & Design

3 answers

the c++ string class is more flexible than just using a char*. I use both depending on how i need to use them.

2007-01-05 01:18:23 · answer #1 · answered by justme 7 · 0 0

Char is a single entity.......'a' , 'a million' etc. yet whilst u have a determination of characters together....."Bombay","desktops"...... it quite is a string. the area occupied is extra 4 strings while character utilises purely one byte. additionally way of use 4 chars and strs are diverse.String dealing with has an quite huge utility.in spite of the incontrovertible fact that ,it would be spoke of that a string is an array of characters. And use is so huge that use of advice may be now and returned tedious for using strings and isn't any longer continuously handy and so we take care of string classification independently regardless of the undeniable fact that pointer would be used too.

2016-10-29 23:48:38 · answer #2 · answered by englin 4 · 0 0

A string class can compare a group of characters (sentence, paragraph) while char looks at them individually one at a time.

2007-01-04 04:33:58 · answer #3 · answered by rod 6 · 0 0

fedest.com, questions and answers