-
What is the output of this program?
#include
using namespace std;
int main ()
{
int p, q;
p = 6;
q = ++p * ++p;
cout << p<<" " << q;
p = 6;
q = p++ * ++p;
cout <<" "<< p<<" " << q;
return 0;
}
-
- 8 64
- 8 48
- 64 8 48
- 8 64 8 48
- None of these
Correct Option: D
Because of the precedence the pre-increment and post increment operator, we got the output as 8 64 8 48.