Wednesday, January 4, 2012

Where are blank spaces permitted in C code?

C code consists of a number of tokens. A C token is the smallest element that the C compiler does not break down into smaller parts. A token can be a function name, such as main, or a C reserved word. All C words should be written continuously. For example, the expression

void ma in(void)

is not legal because no blank characters are allowed between the characters a and i in the word main.

Between tokens, white-space characters (such as blank, tab, or the carriage return) can be inserted, but this is optional. For example, the line

void main(void)

is equivalent to

void main ( void )

or

void main ( void)

In general, it is acceptable to add blanks between tokens but not acceptable to add blanks within tokens.

1 comment:

  1. Thanks! It really helps for my understanding and exams! :)

    ReplyDelete