Can someone please help me out if you can.
I am trying to understand the difference between preincrement and postincrement. I am trying to figure out the value of total when exiting each of the following while repetition structures (looking to enter the answer after each while repetition structure):
int x = 1, total = 0;
while ( ++x <= 5 ) {
total += x;
}
int x = 1, total = 0;
while ( x++ <= 5 ) {
total += x;
}
Thanks