程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> 關於C語言 >> NULL、NUL、‘\0’、0以及EOF

NULL、NUL、‘\0’、0以及EOF

編輯:關於C語言

0 is an integer constant,

'\0' 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.

'\0' 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 '\0'

EOF :通常定義為-1, 文件結束符標志,一般是ctrl+z.

關於EOF的詳細介紹可以參考http://www.ruanyifeng.com/blog/2011/11/eof.html

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved