C Programming - Pointers - Discussion
Discussion Forum : Pointers - General Questions (Q.No. 3)
3.
In which header file is the NULL macro defined?
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.
Rathika.b said:
1 decade ago
What is the purpose of using null pointer?
Then why stdio.h & stddef.h assigned these null pointers.
Then why stdio.h & stddef.h assigned these null pointers.
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?
In that case a, b, c, d are vallid option becz in that header NULL.
Macro also included. Then hows it c?
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.
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.
Sanu said:
1 decade ago
Macro is single line abbreviation for group of statement.
Pokar sanjay said:
1 decade ago
I can not understand about stddef.h can anyone explain?
Dhrumil said:
1 decade ago
stdio.h and stddef.h is what ?
Meenu said:
1 decade ago
What is the function of null macro ?
Sasikumar said:
1 decade ago
Thanks bijan.
Jhansi said:
1 decade ago
What Mr. Ganesh said is true. using NULL pointer is very Dangerous
Hadeer said:
1 decade ago
As pointer can point to anywhere in memory& maybe enter to code area &anywhere that I don't want so we use null. Null like intialize value to pointer.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers