This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Pointer to NULL structure

I have a structure defined as

typedef struct example{
int a;
char b;
example c;
}STRUCT_EG;

and I declare a pointer to this structure as

STRUCT_EG *Struct_ptr

To check whether the pointer is pointing to NULL I use the following "if" statement

if (Struct_ptr == (STRUCT_EG*)0)

I was wondering whether this method is acceptable as I could not get it to work correctly (ie the "if" condition doesnt go through eventhough the pointer is null). Are there any other ways which I can use?

Please advise. Thank you.

0