Why is '#' symbol used in C language's header ? Why not any other symbol ? [closed]

I would guess that the requirements were

  • available in the common character sets of the time (ASCII, EBCDIC, and perhaps others)
  • not otherwise used by the language, so the preprocessor could easily identify its directives
  • easy to type on a standard US keyboard

There aren’t many characters that meet these requirements; # is one. The choice of that, rather than @ or $ for example, was probably arbitrary.

Leave a Comment