Computer Science - Object Oriented Programming Using C++ - Discussion

Discussion Forum : Object Oriented Programming Using C++ - Section 1 (Q.No. 36)
36.
Which of the following is(are) invalid string constant(s)?
'7.15 pm'
"i like e"
"7.3el2"
"1234el2"
None of the above
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
7 comments Page 1 of 1.

Kanupriya said:   8 years ago
Strings cannot be enclosed in ' '. It must be enclosed in " ".

Vipul Dabhi said:   9 years ago
String literals:

auto s0 = "hello"; // const char*
auto s1 = u8"hello"; // const char*, encoded as UTF-8
auto s2 = L"hello"; // const wchar_t*
auto s3 = u"hello"; // const char16_t*, encoded as UTF-16
auto s4 = U"hello";

LoveToProgram said:   1 decade ago
String Should be declared in double quotes.

Preeti said:   1 decade ago
Strings cannot be enclosed in (' ').

Abhaysingh N. Rajpurohit said:   1 decade ago
Char type variables are enclosed in ' where as string is in " .

Vijay said:   1 decade ago
Strings cannot be enclosed in single quotes.

Prasu said:   1 decade ago
String should be written in double quotation (" ").

Post your comments here:

Your comments will be displayed after verification.