A Comparison of while, do-while and for loop in C programming language based on Assembly Code Generation - J, Makhijani; M, Niranjan; Y, Sharma (International Journal of Computer Sciences and Engineering, 2019)
C is a programming language which is the most powerful and useful language ever for the programmers and developers. Like all the modern programming languages, the C language also has many control statements out of which five are iterative statements, i.e., while, do-while and for. These three statements are meant for use in same conditions, but which one is better. The performance of these three statement does not compared by the novice programmers. So, a basic knowledge of performance of these loops should be there. This comparison will guide novice programmers to use these loops efficiently. The comparison can be done by counting the execution time but that can depend on other factors also like CPU usage by other programs or services etc. But a very efficient way to compare is the comparison of Assembly Instruction generated by a program, so here we are presenting a comparison based on the assembly code generation by each loop which can be seen by the object file created just after the compilation.