Home » C++ Programming » Data Types » Question
  1. What is the output of this program?
    #include 
    using namespace std;
    enum test
    {
    p = 20, q, r
    };
    int main()
    {
    cout << p <<" " << q<< " " << r;
    return 0;
    }
    1. 20 21
    2. 21 22
    3. 20 21 22
    4. 20 22
    5. None of these
Correct Option: C

If we not assigned any value to enum variable means, then the next number to initialized number will be allocated to the variable.



Your comments will be displayed only after manual approval.