Hi,
If you want to understand the code just trace the program statement by statement from main() using a pen and paper.
You shall know what is happening.

Syed.