Preprocessing command, preprocessing

Source: Internet
Author: User

Preprocessing command, preprocessing
1. All preprocessing commands start with #. There are three types of preprocessing commands: 1> macro definition: # define COUNT 4 // There is no symbol behind it # undef COUNT ends macro definition 2> Conditional compilation # define A 5 # if (A = 5) printf ("A is 5 "); # elifprintf ("A is 10"); # elseprintf ("A is another"); # endifreturn 0; # if defined () // if A is A macro definition 3> File Inclusion # include "lisi. h "in order to reduce the compilation efficiency caused by multiple file introductions, we recommend that you add # ifndef LISI_H // macro variable defined by file name # define LISI_H 123int sum (int a, int B) to each introduced file ); # endif3.1 <> indicates the file that comes with the system. "" indicates that custom file 3.2 cannot be contained cyclically, for example,. h contains B. h, while B. h also contains. h3: the pre-processing command is executed 4 before the code is translated into and 1. The pre-processing command is written at random. The pre-processing command ranges from the line where the command is written, until the end of the file is 6. macro names generally start with uppercase or k. Variable names generally have higher efficiency than macro definitions with parameters in lower case: # define sum (v1, v2) (v1) + (v2) # define pingfang (v1, v2) (v1) * (v2 ))

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.