Day#82 C' Coding Challenge

Day#82 C' Coding Challenge

Is NULL pointer and a pointer which is not initialized are the same?

Both are not same.

For a pointer declaration, we follow below statements,

int *ptr;

int *ptr1 = NULL;

The major difference between the ptr and ptr1 is that ptr is not initialized while ptr1 is initialized. The value ptr points to is junk and is not valid one. Whereas for ptr1, it is initialized to NULL. NULL is a predefined constant in C pointing to 0.

Post a Comment

0 Comments