Q. Which of the following is the correct syntax for defining a constant in C++?

  • (A) const int x = 5;
  • (B) constant int x = 5;
  • (C) int const x = 5;
  • (D) int x = const 5;
πŸ’¬ Discuss
βœ… Correct Answer: (A) const int x = 5;
Explanation: In C++, the correct syntax to define a constant is 'const type name = value;'
Explanation by: Ranjeet
In C++, the correct syntax to define a constant is 'const type name = value;'

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
146
Total Visits
πŸ“½οΈ
2 y ago
Published
πŸŽ–οΈ
Ranjeet
Publisher
πŸ“ˆ
96%
Success Rate