Home » C++ Programming » Data Types » Question
  1. What is the output of the following program?
    #include 
    using namespace std;
    int main()
    {
    int p = 10;
    float q;
    cout << sizeof(++p + q);
    cout << " "< return 0;
    }
    1. 10 2
    2. 10 4
    3. 2 10
    4. 10 0
    5. 4 10
Correct Option: E

The a as a integer will be converted to float while calculating the size. The value of any variable doesn’t modify inside sizeof operator. Hence value of variable a will remain 10.



Your comments will be displayed only after manual approval.