Friday, July 29, 2016

C Basics - White Space Characters in C

Space, tab, linefeed, carriage-return, formfeed, vertical-tab, newline and comments are called white-space characters because they serve the same purpose as the spaces between words and lines on a printed page - they make reading easier. When parsing code, the C compiler ignores white-space characters unless you use them as separators or as components of character constants or string literals. Use white-space characters to make a program more readable.

A blank line or a line containing comment is ignored by C compiler. Whitespace separates one element in a statement from another. In the following statement –

int age;

there must be at least one whitespace character (usually a space) between int and age for the compiler to be able to distinguish them. In the following statement –

x = y + z;

no whitespace characters are necessary between x and =, or between = and y. But a space between them increases readability.

Related topics:
Tokens in C   |   Character Set in C   |   Trigraph Characters in C   |   Extended Characters in C   |   Escape Sequence in C   |   Comments in C   |   Keywords in C   |   Identifiers in C   |   Declaration in C

List of topics: C Programming

No comments:

Post a Comment