Header Names in C Programming

0
Header names in C programming are an integral part of the language's syntax and semantics. They are used to include external source files or headers in a C program.

The syntax for a header name in C is as follows:

header-name:
< h-char-sequence >
" q-char-sequence "

h-char-sequence:
h-char
h-char-sequence h-char

h-char:
any member of the source character set except
the new-line character and >

q-char-sequence:
q-char
q-char-sequence q-char

q-char:
any member of the source character set except
the new-line character and "

The sequences in both forms of header names are mapped in an implementation-defined manner to headers or external source file names. If the characters `, \, ", //, or /*` occur in the sequence between the `< and >` delimiters, the behavior is undefined. Similarly, if the characters `, \, //, or /*` occur in the sequence between the `"` delimiters, the behavior is undefined. Header name preprocessing tokens are recognized only within `#include` preprocessing directives and in implementation-defined locations within `#pragma` directives.

Consider the following sequence of characters:

0x3<1/a.h>1e2
#include <1/a.h>
#define const.member@$

This forms the following sequence of preprocessing tokens (with each individual preprocessing token delimited by a `{` on the left and a `}` on the right):

{0x3}{<}{1}{/}{a}{.}{h}{>}{1e2}
{#}{include} {<1/a.h>}
{#}{define} {const}{.}{member}{@}{$}
Tags

Post a Comment

0Comments
Post a Comment (0)