A Comparison of while, do-while and for loop in C programming language based on Assembly Code Generation
DOI:
https://doi.org/10.26438/ijcse/v7i6.12041211Keywords:
while, do-while, for, assembly codeAbstract
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.
References
[1]. Mark Burgess, “The GNU C Programming Tutorial”, Ron Hale-Evans, Norway, pp. 61-68, 2002
[2]. E Balagurusamy, “Programming in ANSI C”, Tata McGraw-Hill, India, pp 154-159, 2007
[3]. Joseph Cavanagh, “X86 Assembly Language and C Fundamentals”, CRC Press Taylor & Francis Group, New York, pp 251-266, 2013.
Downloads
Published
How to Cite
Issue
Section
License

This work is licensed under a Creative Commons Attribution 4.0 International License.
Authors contributing to this journal agree to publish their articles under the Creative Commons Attribution 4.0 International License, allowing third parties to share their work (copy, distribute, transmit) and to adapt it, under the condition that the authors are given credit and that in the event of reuse or distribution, the terms of this license are made clear.
