It happens because the
function came to an end without any error being detected: zero is a return code indicating "normal exit".
Why did it exit sooner than you expected? Because NULL is defined as 0. And because "=" is an asignment. And because 0 is "false" as far as C++ is concerned.
So when your code does this:
while ( num = NULL )
It's the equivalent of saying:
while ( false )
I suspect you need to do this:
while ( num == 0 )
cout<<"please enter element "<<i<<" ::: ";
But that won't work for long either, as you haven't allocates any "real" space to your array!