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
Do you know the difference between exit() and _exit() function in c?
C program to find all possible outcomes of a dice?
There is a practice in coding to keep some code blocks in comment symbols than delete it when debugging. How this affect when debugging?
How a string is stored in c?
What is the difference between the expression “++a” and “a++”?
Create a structure to specify data on students as given below: Roll number, Name, Department, Course, and Year of joining. Assume that there are not more than 450 students in the collage. (a) Write a function to print the names of all students who joined in the last 3 years. (b) Write a function to print the data of a student whose roll numbers are divisible by 4.
how to create duplicate link list using C???
the question is that what you have been doing all these periods (one year gap)
Explain how can I convert a number to a string?
i have a written test for microland please give me test pattern
How to write a program for machine which is connected with server for that server automatically wants to catch the time for user of that machine?
Can you please explain the difference between exit() and _exit() function?
Can the “if” function be used in comparing strings?
What does sizeof function do?
What is data types?