what is the difference between NULL('\0') and 0?
Answer Posted / 111
What is the difference b/w '\0' and NULL?
The first is the representation for the null character, i.e.,
a character with value zero. It is used as a string
terminator in C.
It is actually an "escape sequence" with an octal zero.
The second is a macro that resolves to a null pointer value.
In C source
code a literal zero is also converted into a null pointer
constant when
it occurs in a pointer context.
The first expression is of type int while the second is of a
pointer
type.
> In which case It is useful?
Use '\0' to terminate strings and NULL to initialise
pointers and set
them to a "safe" value after they have been used.
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
How pointer is different from array?
simple program of graphics and their output display
How can I manipulate individual bits?
Do array subscripts always start with zero?
What is 1f in c?
When should you not use a type cast?
Are c and c++ the same?
how can i write a program that prints out a box such that whenever i press any key8(coordinate number) on the keyboard, the box moves.
What is an arrays?
How to declare a variable?
What is the difference between abs() and fabs() functions?
Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.
I have a varargs function which accepts a float parameter?
What does 2n 4c mean?
What is the use of a conditional inclusion statement in C?