C Programming - Pointers - Discussion

Discussion Forum : Pointers - General Questions (Q.No. 3)
3.
In which header file is the NULL macro defined?
stdio.h
stddef.h
stdio.h and stddef.h
math.h
Answer: Option
Explanation:
The macro "NULL" is defined in locale.h, stddef.h, stdio.h, stdlib.h, string.h, time.h, and wchar.h.
Discussion:
48 comments Page 2 of 5.

Pokar sanjay said:   1 decade ago
I can not understand about stddef.h can anyone explain?

Sanu said:   1 decade ago
Macro is single line abbreviation for group of statement.

Nani said:   1 decade ago
I understand that
Both are very different.

NULL macro is
#define NULL 0

It means the macro NULL will be replaced by 0 while pre-processing. But the NULL pointer means it points to nowhere i.e. contains 0. It contains 0 means it may be dangerous to use such pointer without assigning proper address to it otherwise NULL pointer may try to access reset address may cause the program to crash.

Amit said:   1 decade ago
Sir.

In that case a, b, c, d are vallid option becz in that header NULL.

Macro also included. Then hows it c?

Rathika.b said:   1 decade ago
What is the purpose of using null pointer?
Then why stdio.h & stddef.h assigned these null pointers.

Meera said:   1 decade ago
NULL Macro is simply what is defined as 0 in a macro provided by the library.

Prasanna said:   1 decade ago
Macro is available in stdlib.h, stddef.h, locale.h. etc.,

We know that NULL represents nothing. But it should have some value. While using NULL in program we may get garbage value. So to avoid that garbage values. NULL macro defines that NULL is "0". So in program if we got any null value that will be taken as zero.

Vinod said:   1 decade ago
What is the purpose of using null pointer?

Karthika said:   1 decade ago
I need the purpose of using wchar.h in this program.

Varsha said:   1 decade ago
NULL Pointer is a pointer which is pointing to nothing. It points the base address of segment.

In case, if you don't have address to be assigned to pointer then you can simply use NULL Pointer which is initialized with NULL value is considered as NULL pointer.


Post your comments here:

Your comments will be displayed after verification.