zoukankan      html  css  js  c++  java
  • NULL、NUL、‘’、0以及EOF

    0 is an integer constant,

    '' is a character constant,

    nul is the name of the character constant.

    NULL is 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 as ((void *)0), this would 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.

    '' should 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 ''

    EOF :通常定义为-1, 文件结束符标志,一般是ctrl+z.

    关于EOF的详细介绍可以参考http://www.ruanyifeng.com/blog/2011/11/eof.html

  • 相关阅读:
    开发day7
    开发day6
    开发day5
    开发day4
    开发day3
    开发day2
    开发day1
    假期学习2/8
    什么是栈帧
    JDK、JRE和JVM到底是什么
  • 原文地址:https://www.cnblogs.com/nufangrensheng/p/3570053.html
Copyright © 2011-2022 走看看