Some characters in C are used as punctuators, which have their own syntactic and semantic significance. Punctuators are not operators or identifiers. Table 1-4 lists the C punctuators.
| Punctuator | Use | Example |
|---|---|---|
| < > | Header name | #include <limits.h>
|
| [ ] | Array delimiter | char a[7]; |
| { } | Initializer list, function body, or compound statement delimiter | char
x[4] = {'H', 'i', '!', '\0' }; |
| ( ) | Function parameter list delimiter; also used in expression grouping | int f
(x,y) |
| * | Pointer declaration | int *x; |
| , | Argument list separator | char x[4] = { 'H', 'i', '!', '\0'}; |
| : | Statement label | labela: if (x == 0) x += 1; |
| = | Declaration initializer | char x[4] = { "Hi!" }; |
| ; | Statement end | x +=
1; |
| ... | Variable- length argument list | int f ( int y, ...)
|
| # | Preprocessor directive | #include "limits.h"
|
| ' ' | Character constant | char x = 'x'; |
| " " | String literal or header name | char x[] = "Hi!"; |
The following punctuators must be used in pairs:
< >
[ ]
( )
' '
" "
{ }
Some characters can be used either as a punctuator or as an operator, or as part of an operator. The context of the occurrence specifies the meaning. Punctuators usually delineate a specific type of C construct, as shown in Table 1-4.