What does (node ​​*) mean NULL in C?

I was browsing a book while studying the Linked List and saw these lines

if( *head == NULL){ }else if ( (*head)->next == (node *) NULL ){ } 

What is the difference between NULL and (node *) NULL , can they be used interchangeably?

 typedef struct nodeType{ int info; struct nodeType *next; }node; 
+7
source share
2 answers

When comparing pointers, types are not taken into account, so this is pointless.

Probably, the author simply included it for clarity, if this is an introductory book. If this is not an introductory book, then the author either has an odd coding style, or somehow thinks that it is more significant.

+8
source

They can be used interchangeably. But this is non-standard and unusual for typecast NULL , as your code does.

No cast is required.

+7
source

All Articles