The Null Statement
Objective-C permits you to place a solitary semicolon wherever a normal program statement can appear. The effect of such a statement, known as the null statement, is that nothing is done. This might seem quite useless, but programmers often do this in while, for, and do statements. For example, the purpose of the following statement is to store all the characters read in from standard input (your terminal, by default) in the character array that text points to until a newline character is encountered. This statement uses the library routine getchar, which reads and returns a single character at a time from standard input:
while ( (*text++ = getchar ()) != '' ) ;
All the operations are performed inside the looping conditions ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access