Vidyalelo
C++ Programming · Q40

Arrays and Strings in C++

Programming · C++ Programming · question 40

Q40

What is the correct syntax to declare a string literal in C++?

A.
const char* str = "Hello";
Answer
B.
string str = "Hello";
C.
char* str = "Hello";
D.
char str[] = "Hello";

Answer: Option A

Solution

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