IT Community - Software Programming, Web Development and Technical Support

NULL Pointer and a NULL Macro

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 ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C and C++ Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 08-14-2007, 12:03 AM
vigneshgets vigneshgets is offline
D-Web Genius
 
Join Date: Mar 2007
Posts: 904
vigneshgets is on a distinguished road
Smile NULL Pointer and a NULL Macro

Hui Buddies can anyone tell me what is a NULL Macro? What is the difference between a NULL Pointer and a NULL Macro?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 09-06-2007, 07:58 AM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 1,061
S.Vinothkumar is on a distinguished road
Wink Re: NULL Pointer and a NULL Macro

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!
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-08-2007, 03:17 AM
Mramesh Mramesh is offline
D-Web Sr.Programmer
 
Join Date: Sep 2007
Location: Chennai
Posts: 106
Mramesh is on a distinguished road
Send a message via MSN to Mramesh
Smile Re: NULL Pointer and a NULL Macro

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
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 09-08-2007, 03:24 AM
amansundar amansundar is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 324
amansundar is on a distinguished road
Smile Re: NULL Pointer and a NULL Macro

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
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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


All times are GMT -7. The time now is 11:23 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0