A good compiler won't let you compile code* like in ziplux's writeup - the general concept behind compiler warnings is to stop catastrophic logic errors like that. It's valid syntax, but...

* - MS Visual C++ gave an error, GCC gave a warning

Anyway.

Depending on the logic of your program, using null pointers can be perfectly feasible - one of the first things you'll learn in a data structures course is the structure behind a linked list, which almost always ends in a null pointer.

Especially by using the arrow operator and some basic logic controls, you can make nice use of null pointers, like so:


struct listNode
{
  int data;
  * listNode next;
};

void main()
{
  * listNode myNode; // Assume that myNode points to the front of a linked list

   while (myNode->next)
   {
     myNode = myNode->next;
     Your ultra-interesting code dealing with linked lists here
   } 
}

A rather juvenile example of what null pointers can be used for, but you'll see code like this a lot during your introductory programming courses. This code segment would theoretically work based on the idea that null pointers are inherently interpreted as false, thus making it very simple to execute full traversals.