What will be the output of the following C++ code?

#include <iostream>
  using namespace std;
  enum test 
  {
      A = 32, B, C
  };
  int main()
  {
      cout << A << B<< C;
      return 0;
  }

a) 323334
b) 323232
c) 323130
d) 323134

1 thought on “What will be the output of the following C++ code?”

  1. a
    Explanation: If we not assigned any value to enum variable means, then the next number to initialized number will be allocated to the variable.
    Output:
    $ g++ enum2.cpp
    $ a.out
    323334

Leave a Comment