View Single Post
Old 12-09-2004, 02:14 AM   #6 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,736
redhead is on a distinguished road
Quote:
Originally Posted by Rotkiv
redhead, I'm not questioning your knowledge but rather wanting to tap it:
what's the advantage of using string rather than char?
In his example he's only allocating room for one single char, not a name consisting of several chars.. Strange things might happen with a program like that, unless the std::cin(char) operator has been modified to dynamicaly allocate whatever is needed. Which i doubt, but I havn't seen the current deffinition of the standard function.
By using string, theres anough room, since string class will dynamicaly allocate space, and there are several usefull features hidden in there aswell.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote