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 ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between struct and class?

1037


Is swift better than c++?

724


What is an inclusion guard?

844


What is a base class?

803


List down the guideline that should be followed while using friend function.

817


Describe linked list using C++ with an example.

850


Is facebook written in c++?

749


What is a class definition?

802


How do you write a function that can reverse a linked-list?

785


What are all predefined data types in c++?

769


Do you know the problem with overriding functions?

798


What is static class data?

769


Describe the advantages of operator overloading?

768


Please explain the reference variable in c++?

797


What is the use of volatile variable?

814