What value will result from the execution of the loop with prefix increment:
int a[4] = {1, 2, 3, 4};
int sum = 0; 
for (int i = 0; i < 4; ++i)
     sum += a[i];
When you use prefix increment in for loop (++i), as well as if you use Postfix increment (i++) the value of the counter i is incremented after the execution of the loop body. View used increment only affects computing performance using ++i is higher.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Sign Up Now
or Subscribe for future quizzes