A Comparison of while, do-while and for loop in C programming language based on Assembly Code Generation

Authors

  • J Makhijani Department of Computer Science & Engineering, Rustamji Institute of Technology, Tekanpur, Gwalior, India
  • M Niranjan Department of Computer Applications, Rustamji Institute of Technology, Tekanpur, Gwalior, India
  • Y Sharma Department of Computer Science & Engineering, Rustamji Institute of Technology, Tekanpur, Gwalior, India

DOI:

https://doi.org/10.26438/ijcse/v7i6.12041211

Keywords:

while, do-while, for, assembly code

Abstract

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

2019-06-30
CITATION
DOI: 10.26438/ijcse/v7i6.12041211
Published: 2019-06-30

How to Cite

[1]
M. J, N. M, and S. Y, “A Comparison of while, do-while and for loop in C programming language based on Assembly Code Generation”, Int. J. Comp. Sci. Eng., vol. 7, no. 6, pp. 1204–1211, Jun. 2019.

Issue

Section

Research Article