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

Which function cannot be overloaded c++?

1050


Can you Mention some Application of C/C++?

1009


What character terminates all character array strings a) b) . c) END

1205


What is the difference between global int and static int declaration?

950


What happens if a pointer is deleted twice?

1224


If you hear the cpu fan is running and the monitor power is still on, but you did not see anything show up in the monitor screen. What would you do to find out what is going wrong?

1058


What are the various access specifiers in c++?

980


Explain function overloading

960


What is a static element?

1016


Write a program to encrypt the data in a way that inputs a four digit number and replace each digit by (the sum of that digit plus 7) modulus 10. Then sweep the first digit with the third, second digit with the fourth and print the encrypted number.

2525


What are the advantages of pointers?

1014


What are static and dynamic type checking?

1024


How can you create a virtual copy constructor?

1034


What is the difference between set and map in c++?

1093


What is singleton pattern in c++?

922