Linux -Blue forest free software | Return to home page | Site Map | Search WWW | Contact Us |
Your current position : Homepage > Free Software > Technological exchanges >Application Programming


    

Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006


NULL and '\0' What is the difference between that in the end

I want to determine whether one of the indicators for air,
(Ptr==NULL) and (!ptr) equivalence in the end?
Char * ch;
Ch= NULL; can?
Thank you.

NULL and '\0' What is the difference between that in the end

Can. However formal or something, if Linux is to see /usr/include/linux/stddef.h the definition of a NULL. But that is not defined as NULL, although the definition has become even Moxiandaoguo other.

NULL and '\0' What is the difference between that in the end

Inconsistent with the message of your landlord topic ah, with the NULL '\0' is simply no connection between the two.

NULL and '\0' What is the difference between that in the end

ANSI will stdio.h moved from the definition stddef.h NULL, NULL used when you increase stddef.h either at the beginning, either directly definition of NULL.
#ifndef NULL
# NULL (void *) 0
#endif

'\0' Is a string of ASCII characters in a final, with the NULL or not.
NULL is a big ask estimated floor and 0 (zero), is NULL (void *) 0, but not zero.

Note:NULL can also be re-defined, in your best not to redefine its development process.
If NULL has been redefined, is no longer (void *) 0, you have to replace your best definition of a NULL_PTR had wanted to use the NULL.

1, using (ptr ====== NULL) or (NULL ====== ptr) is correct, after a proposal, because NULL is a constant, if you incorrectly ptr = NULL, the compiler will be incorrect report, it could not be wrong packet.
2, (!ptr) best only Boolean variables, which Mr Lam has the "high-quality C + + Programming" shows.
3, char * ch;
Ch= NULL;
Is correct. Ch is because indicators and void to the random-assignment guidelines can be indicators.



 Privacy Policy  Copyright © 1999-2000 LSLNET.COM. All rights reserved. Blue Forest website owners. E-mail : Webmaster@lslnet.com