what is the difference between NULL('\0') and 0?
Answer Posted / salim
I am going to speak in cotext to c language.
NULL is a macro defined in header files such as
stdio.h,stdlib.h,alloc.h,stddef.h,mem.h.The c pre processor
substitutes NULL by the value 0.Its declaration appears to
be like #define NULL 0 in the standard libraries.It is
used to initialise pointers to 0 and helps in portability.
It is a null pointer constant a convention for programmers
to initialise pointers.It is used mainly with pointer.
0 is simply an integer constant.
/0 is a backslash character contant used to indicate end of
string or a string terminator.
Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
In C language, a variable name cannot contain?
In C language, the variables NAME, name, and Name are all the same. TRUE or FALSE?
What are the advantages of the functions?
What are pointers? Why are they used?
When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?
Do you know the purpose of 'register' keyword?
What are variables c?
What is the significance of c program algorithms?
What does stand for?
Is c a great language, or what?
What is the use of gets and puts?
Is c call by value?
Can you subtract pointers from each other? Why would you?
Can you pass an entire structure to functions?
Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal. [ I gave the obvious solution of taking % 10 and / 10, which gives us the decimal value in reverse order. This requires an array since we need to print it out in the correct order. The interviewer wasn't too pleased and asked me to give a solution which didn't need the array ].