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
What is a block in c++?
Distinguish between new and malloc and delete and free().
Describe private, protected and public – the differences and give examples.
What are the methods of exporting a function from a dll?
What is a hashmap c++?
Why do we use using namespace std in c++?
Which is best c++ or java?
Write about an iterator class?
Can there be at least some solution to determine the number of arguments passed to a variable argument list function?
What is exception handling? Does c++ support exception handling?
What is the difference between an external iterator and an internal iterator? Describe an advantage of the external iterator.
How do you clear a map in c++?
Reads in the size of a square from the screen; 2. Prints a hollow square of that size out of “-“, “|” and blanks on screen; 3. Prints the same hollow square onto a text file. Your program should work for squares of all side sizes between 1 and 20. --- │ │ │ │ │ │ ---
What are friend classes? What are advantages of using friend classes?
Why do we use string in c++?