πŸ“Š C++
Q. Which of the following is the correct way to initialize a string in C++?
  • (A) string str = 'Hello';
  • (B) string str = "Hello";
  • (C) string str = H e l l o;
  • (D) string str = [Hello];
πŸ’¬ Discuss
βœ… Correct Answer: (B) string str = "Hello";

Explanation: In C++, strings are initialized with double quotes. 'string str = "Hello";' is the correct way.

Explanation by: Vikash Gupta
In C++, strings are initialized with double quotes. 'string str = "Hello";' is the correct way.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
88
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Vikash Gupta
Publisher
πŸ“ˆ
94%
Success Rate