nul!null.txt
来自「国外网站上的一些精典的C程序」· 文本 代码 · 共 22 行
TXT
22 行
Q: My compiler gives me a warning whenever I try to assign or compare the value of NULL to an integral type (char, short, int, long). What's the matter?A: According to the standard, NULL is a macro defined as a null pointer constant so you should expect warnings (at least!) when trying to assign a pointer to an integral type without a (highly questionable) cast! This is a fairly common error since people hear other programmers talking all the time about "a null character". As it turns out, ASCII shorthand notation for '\0' happens to be NUL, hence the confusion. In SNIPPETS, I explicitly work around this common error (in SNIPTYPE.H) with the line... #define NUL '\0' The moral of this story is to know the difference between ASCII NUL and C NULL, and use whichever is correct for your application. In many cases, the correct "null" may be NUL, not NULL. Is this confusing enough? ;-)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?