Related Articles

Related Articles

C++ | const keyword | Question 5
  • Difficulty Level : Easy
  • Last Updated : 06 Jul, 2020

Output of C++ program?

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


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

Attention reader! Don’t stop learning now. Get hold of all the important C++ Foundation and STL concepts with the C++ Foundation and STL courses at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :