I know that null character have ascii value of 0 and space as 32.My question is what a NULL character will do.How to define it?
Whether NULL character is same as space char? If not then what exactly a NULL ll do
Collapse
X
-
Tags: None
-
Both are completely different. The space char is used for displaying space between characters that you see. This is used mostly for visual purpose.
While the NULL is mostly used to find out the end of the string or end of some data. The NULL has many other uses in programming.
-RajX
_______________ _______________ _______________ ________
C++ Internals: http://www.avabodh.com/cxxin/cxx.html -
The NULL can be defined as
Code:#ifndef NULL #ifdef __cplusplus #define NULL 0 #else #define NULL ((void *)0) #endif #endif
-RajX
_______________ _______________ _______________ _____
C++ Internals: http://www.avabodh.com/cxxin/cxx.htmlComment
-
NULL is a macro.
You would need to look in your C header file to find out what it is. I expect it's an int 0 though it could be a char 0. Look for a #define NULL in your C header.
NULL us used in C but not C++ to avoid having hard-coded values in the code. When you see NULL in C++ you know it's a C programmer trying to use a C++ compiler.Comment
-
Null is the character '\0'. One of its uses is to terminate strings.
NULL is a pointer value.
There is no relationship between the null character and the NULL pointer other than the unfortunate coincidence that their names are only distinguishable by how they are capitalized.Comment
-
Comment