Skip to main content

Loops

  • Chapter
Beginning C
  • 13k Accesses

Abstract

In this chapter, you’ll learn how you can repeat a block of statements until some condition is met. The programming mechanism for this is called a loop. The number of times that a loop is repeated can be controlled simply by a count—repeating the statement block a given number of times—or it can be more complex—repeating a block until some condition is met, such as the user entering “quit”, for instance. The latter would enable you to program the calculator example in the previous chapter to repeat as many times as required without having to use a goto statement.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 49.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2013 Ivor Horton

About this chapter

Cite this chapter

Horton, I. (2013). Loops. In: Beginning C. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4302-4882-8_4

Download citation

Publish with us

Policies and ethics