In C, what is the difference between using ++i and i++, and which should be used in the incrementation block of a for loop?
++i
i++
for
The Main Difference is i++ Post(After Increment) and ++i Pre (Before Increment) post if i =1 the loop increments like 1,2,3,4,n pre if i =1 the loop increments like 2,3,4,5,n
The Main Difference is
++i Pre (Before Increment)
i =1
1,2,3,4,n
2,3,4,5,n