Home » C++ Programming » Data Types » Question
  1. What is the output of the following program?
    #include 
    using namespace std;
    int main()
    {
    int n = 0x10 + 030 + 50;
    cout << sizeof(n)<<'\n';
    return 0;
    }
    1. 0x10 + 030 + 50
    2. 030 + 50
    3. 0x10 + 030
    4. Depends on compiler
    5. Garbage
Correct Option: D

The sum of three numbers are belongs to different number systems, so the result is type casted into integer.



Your comments will be displayed only after manual approval.