to find the output

i had problem to find the output..can someone of you help me

what is the value of each variable after each statement is executed?

#include<math.h>
int main() {
int base1, base2, n;
base1 =base2 = 3;
n = 2;
base1 = powerOfNValue(base1, n++);
powerOfNRef(base2, n);
base1 = powerOfNValue(base1, n);
return 0;
}

int powerOfNValue(int b, int n) {
b = pow(b, n);
return b;
}

void powerOfNRef(int &b, int n) {
b = pow(b, n);
}

Last edited on
base1 = powerOfNValue(base1, n++);

Remember that the post-fix increment operator first returns the original value of n, then increments it. So, in that case, you're passing 2, not 3.
just uninstall. No need to try, besides, this forum wont help you.
@reality: please don't spam...
(this is exactly the same you posted somewhere else, and just as non-topic-related..)
Last edited on
Topic archived. No new replies allowed.