This is a discussion on NULL Pointer and a NULL Macro within the C and C++ Programming forums, part of the Software Development category; Hui Buddies can anyone tell me what is a NULL Macro? What is the difference between a NULL Pointer and ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Null macro is defined in stdio.h and stddef.h.It is used to represent a null pointer in your code. its value is zero. Null pointer is same as an uninitialized pointer..It does not point anywhere.
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| A NULL pointer is a pointer that's guarnteed to point to nothing. This may be 0 in a UNIX/Linux system or some other address in another system Using the NULL macro to set/initialize your pointers will make your programs more portable among systems than using something like the 0. Code: #include <stdio.h> char *c = 0; // initialize to NULL--not portable char *p = NULL; // initialize to NULL as defined in stdio is portable |
| |||
| NULL Macro is simply what is defined as 0 in a macro provided by the library Null pointer is a pointer which has 0 or NULL value stored and points to nowwhere still it points to 0x00 i.e. the first memory location of the OS Null pointer != Uninitialized pointer because an uninitialised pointer can point anywhere in the memory location ...but a NULL pointer surely points to no where(but still behind the scene we can say that it only points to 0x00). Never we can retrive a Null pointer location using th"&" operator..neither will malloc/calloc return NULL IF THERE IS SPACE IN THE MEMORY. NULL pointer is unique !!
__________________ cheers Aman |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Why do I get a null or not an object error? | sathian | HTML, CSS and Javascript Coding Techniques | 1 | 12-04-2007 01:15 AM |
| Get the null value row in SQL server | oxygen | Database Support | 1 | 12-03-2007 07:26 AM |
| What is the result of comparing NULL with NULL? | vijayanand | Database Support | 1 | 09-20-2007 07:07 AM |
| Is null an Object? | prasath | Java Programming | 1 | 07-19-2007 04:29 AM |
| Null | nhoj | Java Programming | 2 | 05-08-2007 03:37 AM |