Chapter 6: The Standard C IO Functions


The while loop has the general form:

while(condition) {      statement block }

If a single statement is the object of the while, then the braces may be omitted. The while loop iterates as long as condition is true.

The while tests the condition at the top of the loop. Therefore, if the condition is false to begin with, the loop will not execute even once. The condition may be any expression.

The following is an example of a while loop. It will read 100 characters and store them into a character array.

char s[256]; t = 0; while(t<100) {   s[t] = stream.get();   t++; }

C(s)C++ Programmer's Reference
C Programming on the IBM PC (C Programmers Reference Guide Series)
ISBN: 0673462897
EAN: 2147483647
Year: 2002
Pages: 539 © 2008-2017.
If you may any questions please contact us: