Skip to content
Related Articles

Related Articles

C++ | const keyword | Question 5

View Discussion
Improve Article
Save Article
  • Difficulty Level : Easy
  • Last Updated : 28 Jun, 2021

Output of C++ program?

#include <iostream>
int const s=9;
int main()
    std::cout << s;
    return 0;

Contributed by Pravasi Meet
(A) 9
(B) Compiler Error

Answer: (A)

Explanation: The above program compiles & runs fine. Const keyword can be put after the variable type or before variable type. But most programmers prefer to put const keyword before the variable type.

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!