DongDong wrote: > > Why could author assume the base address equal to zero? As most C > programmer know, memory should be allocated by system. The pointer > shouldn't be assigned an absolute address, even address 0x0000. > > Is the address zero under Palm OS free to use? I'm confused. > Welcome to advice.
In C, assigning 0 to a pointer type has a special meaning--it assigns that pointer to the corresponding null pointer. The preprocessor macro NULL is #define'd to be 0 (or sometimes to ((void*) 0).) So really, it doesn't matter whether you assign a pointer to 0 or to NULL; it's only a style issue. Note that this does /not/ mean that the null pointer is all-bits-zero (although for most platforms it is). This is all explained in more detail in the comp.lang.c FAQ: <http://www.eskimo.com/~scs/C-faq/s5.html> __________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
