+ 1

What is the correct example of string data types?

the example of string data type is wrong it is saying no output

1st Mar 2017, 11:48 AM
Manan Aggarwal
Manan Aggarwal - avatar
1 Answer
0
Since you tagged C++ in your question, you need to know that String is not a data type in C++, but a class. This class is found inside the C++ Standard Library (std). C++ does have a C way of representing a string as an array that is marked at the end with '\0'(null character). So you either have : char hello[6] = {'h', 'e', 'l', 'l', 'o', '\0'} or you have string str = "hello" Hope that clarifies things.
1st Mar 2017, 7:49 PM
Tomer