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
Why is not a pointer null after calling free? How unsafe is it to use (assign, compare) a pointer value after it is been freed?
What is difference between Structure and Unions?
Can we replace the struct function in tree syntax with a union?
List some of the static data structures in C?
Is main is a keyword in c?
What is methods in c?
WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?
What do you mean by dynamic memory allocation in c? What functions are used?
Is c easy to learn?
Is fortran faster than c?
What is hash table in c?
What are the different types of pointers used in c language?
You are to write your own versions of strcpy() and strlen (). Call them mystrcpy() and mystrlen(). Write them first as code within main(), not as functions, then, convert them to functions. You will pass two arrays to the function in the case of mystrcpy(), the source and target array.
Difference between MAC vs. IP Addressing
What is null pointer in c?