Can i typecast a pointer to a structure to a signed value to return a different types of errors. Does the C standard allow this or is an undefined behaviour.
typedef enum lError
{
  l_OK = 0,
  l_ERROR = -1,
  l_ABORT = -2,
  l_HALT = -3
}L_STATUS;
typedef struct dataCards
{
  int card1;
  int card2;
  char flag;
}DATACARD;
DATACARD dataCardG;
DATACARD *getCard(int i)
{
  if(i == 1)
    return &dataCardG;
  else if (i == 2)
    return (DATACARD *)l_ERROR;
  else if (i==3)
    return (DATACARD *)l_ABORT;
  else
   return (DATACARD *)l_HALT;
}
int main ()
{
  DATACARD *ptr = NULL;
  ptr = getCard(3);
  if(ptr < (DATACARD *) 1)   /* Is this allowed or undefined behaviour */
    printf("Card failed\n");
}
How can i make this condition work?
 
     
     
    