Start from scratch-06. preprocessing directives in C language

Source: Internet
Author: User

preprocessing directives
    • Macro definition with no parameters:

Format: #define Macro Name Value

Function: Improve the readability of code

The value after the macro name is replaced by all occurrences where the macro name is marked before the program is compiled

    • macro definition with Parameters

Format #define Macro name (parameter list) parameter expression

Function: Before compiling, replace all occurrences of the macro name (x) with the parameter representation

When I write a macro definition with parameters, I need to use () to amplify each parameter and result.

    • Conditional compilation:

Format: #if #elif #else #endif

Function: A statement that compiles a condition when it is satisfied

Note point: Conditional compilation must end with #endif

    • file contains

#include: Copy the contents of the file behind the include to # include

#include "" To include your own writing file

#include <> to include system-supplied header files

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.