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

Answer Posted / nithin devang

There is no DataType called String in C++.
String can be created using character array and delimited by
null character i.e. '/0'.
like char name[]={'n','i','t','h','i','n','
','d','e','v','a','n','g','0'}
or
char name={"nithin devang"}//it will automaticall append
null char.
Null character is having value (ASCII) Zero. (0 character
dont have ascii value 0)
--
If you still wish to use the keyword string you may declare
a macro
#define String char[];

my answer surety %=98%
-------------------
Read Expert C programming, The deep C secrets by Peter Van
Der Linden

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Search for: what is pair in c++?

587


What is the two main roles of operating system?

510


What is the full name of logo?

582


Define pointers?

608


Is the declaration of a class its interface or its implementation?

702






How will you call C functions from C ++ and vice-versa?

656


Will a catch statement catch a derived exception if it is looking for the base class?

556


If a round rectangle has straight edges and rounded corners, your roundrect class inherits both from rectangle and from circle, and they in turn both inherit from shape, how many shapes are created when you create a roundrect?

667


What are register variables?

643


How do you add an element to a set in c++?

549


What is dynamic and static typing?

669


Explain polymorphism?

582


What is the difference between a type-specific template friend class and a general template friend class?

553


what is COPY CONSTRUCTOR and what is it used for?

617


What is meaning of in c++?

670