Keil Logo


Perhaps the most useful aspect of the C preprocessor is the ability to create and use macros. Macros enable you to assign short names to source code blocks. When you use the macro name in your source file, the preprocessor replaces it with the source code block specified in the macro definition.

A macro definition includes the name of the macro, the macro body, and may include macro arguments.

  • Simple Macros require no arguments and are the simplest macros to define.
  • Complex Macros accept one or more arguments and may be used like functions.
  • Macro Operators lists special macro operators that may be used in macro definitions.
  • Predefined Macros lists macros that are defined by the compiler at compile-time.

There are a few caveats of macros that deserve further scrutiny.

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.