top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is a NULL Macro? What is the difference between a NULL Pointer and a NULL Macro?

0 votes
914 views

What is a NULL Macro? What is the difference between a NULL Pointer and a NULL Macro?

posted May 12, 2016 by Hasan Raza

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

3 Answers

0 votes
 
Best answer

NULL macro is same as any other macros which will be replaced by its macro body during preprocessor stage of compilation.
Following may be the declaration for NULL Macro depending on the compiler

#define NULL ((char *)0)

or

#define NULL 0L

or

#define NULL 0

NULL Pointer is pointer pointing to NULL location,

int *p=NULL;
answer May 13, 2016 by Chirag Gangdev
+2 votes
answer May 13, 2016 by Bhaskar Kalaria
–1 vote

For me these are as following:

define NULL 0 /* Null macro */

define NULLP (void*)0 /* Null pointer */

answer May 12, 2016 by Harshita
...