Dyslexicbloke:
Can a pointer be set null...
Yes.
MyPtr = NULL;
...and then tested for?
Yes.
if ( MyPtr == NULL )
{
// Do your thing.
}
The other possibility is to use "pass by reference"...
boolean GetThePointer( int* & MyPtr )
{
if ( NameIsFound )
{
MyPtr = PointerToStruct;
return( true );
}
else
{
MyPtr = NULL;
return( false );
}
}
void loop( void )
{
int* MyPtr;
if ( GetThePointer( MyPtr ) )
{
// Do your thing.
}
}