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
How do I round numbers?
What is string length in c?
What are the output(s) for the following ? #include char *f() {char *s=malloc(8); strcpy(s,"goodbye")} main() { char *f(); printf("%c",*f()='A'); }
Is javascript written in c?
What is return in c programming?
How can you return multiple values from a function?
What is line in c preprocessor?
What is strcmp in c?
What is sizeof return in c?
Explain what does it mean when a pointer is used in an if statement?
#include
Differentiate abs() function from fabs() function.
stripos — Find position of first occurrence of a case- insensitive string int stripos ( char* haystack, char* needle, int offset ) Returns the numeric position of the first occurrence of needle in the haystack string. Note that the needle may be a string of one or more characters. If needle is not found, stripos() will return -1. The function should not make use of any C library function calls.
What does s c mean in text?
What is the difference between printf and scanf in c?