Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Is there a datatype string in c++?How is the memory allocation?

Answer Posted / ganesh chincholkar

Yes true string is not a datatype in C++ but it is implemented through Standard Template Library. And the string class has dynamic memory allocation.
eg:-
string str;
cin>>str;

string str gets dynamically allocated storage and that storage size is not permanent and can be modifies later.

after:
what happens behind screen is actualy:
string str = new char[strlen(str) + 1];
when you take input of the string str its size is calculated and you get the desired meomry.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you remove an element from a set in c++?

1039


What are advantages of using friend classes?

1017


Can I run c program in turbo c++?

980


Arrange Doubly linked list in the ascending order of its integral value and replace integer 5 with 7?

4076


What is the basic structure of c++ program?

1043


Explain the difference between c & c++?

1027


Which is the best c++ compiler for beginners?

1030


What are manipulators used for?

1048


If there are two catch statements, one for base and one for derived, which should come first?

995


What is null and void pointer?

1008


What's the order in which the local objects are destructed?

1213


Is c or c++ more useful?

1001


what is Member Functions in Classes?

1128


What is a set in c++?

922


Write a program which uses Command Line Arguments

1121