NULL, NUL, '\ 0', 0, and EOF

Source: Internet
Author: User

0Is an integer constant,

'\ 0'Is a character constant,

NulIs the name of the character constant.

NULLIs a macro defined in several standard headers,

All of these are ** not * interchangeable:

NULL is to be used for pointers only since it may be defined(Void *) 0), This wocould cause problems with anything but pointers.

0 can be used anywhere, it is the generic symbol for each type's zero value and the compiler will sort things out.

'\ 0' shoshould be used only in a character context.

Nul is not defined in C or C ++, it shouldn't be used unless you define it yourself in a suitable manner, like:

# Define nul '\ 0'

EOF: It is usually defined as-1, and the end mark of the file, usually ctrl + z.

For more information about EOF, see http://www.ruanyifeng.com/blog/2011/11/eof.html.

Related Article

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.