Hi, I'm building a iphone app and using c++ and am having trouble checking if a pointer is null.
IMyInterface* myInterface;
if ( !myInterface ){ //doesn't work
myInterfacee->doSometing();
}
if ( myInterface != 0 ) { //doesn't work
myInterfacee->doSometing();
}
if ( myInterface != NULL ){ //doesn't work
myInterfacee->doSometing();
}
if ( myInterface != ( myInterface* )0 ) { //doesn't work
myInterfacee->doSometing();
}
If myInterface is or isn't set it still enters each statement and gives me
Program received signal: “EXC_BAD_ACCESS”.
How do i go about checking if myInterface is null