I
Ike Naar
some_type *ptr = NULL;
/* some_type is a null pointer */
/* some_type is some type; ptr is a null pointer */
int yes_its_equal = some_type == NULL;
int yes_its_equal = ptr == NULL;
some_type *ptr = NULL;
/* some_type is a null pointer */
int yes_its_equal = some_type == NULL;
Ike Naar said:/* some_type is some type; ptr is a null pointer */
int yes_its_equal = ptr == NULL;
Hence, (1) NULL is a macro defined in one of the std lib headers
(2) null pointer is equal to the null pointer constant.
(3) And from C-FAQ 5.1 and 5.9, I see null pointer constant is just a 0
(zero). zero and null pointer are equal (in the case of pointers only).
(4) null character is '\0' which is not equal to the null pointer.
am I right now ?
Sorta.
Now I know NULL, null pointer, null pointer constant and null character.
What is nul (with single l) that you are talking about ?
where above are better than
0 0x00000000
(void*)0 0x00000000
(int*) 0 0x00000000
are for help the compiler?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.