Vidyalelo
C++ Programming · Q18

Arrays and Strings in C++

Programming · C++ Programming · question 18

Q18

Which of the following correctly defines a string variable named name initialized with the value "John" in C++?

A.
string name = "John";
Answer
B.
char name[] = "John";
C.
char* name = "John";
D.
string name("John");

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board