adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include <iostream>
    #include <algorithm>
    using namespace std;
    int main ()
    {
        int myints[] = { 10, 20, 30, 30, 20, 10, 10, 20 };
        int* pbegin = myints;
        int* pend = myints + sizeof(myints) / sizeof(int);
        pend = remove (pbegin, pend, 20);
        for (int* p = pbegin; p != pend; ++p)
            cout << ' ' << *p;
        return 0;
    }

a.

10 20 30

b.

10 30 30 10 10

c.

10 20 30 30

d.

None of the mentioned

Answer: (b).10 30 30 10 10

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?