consider this definition:
if I set any of the char strings to chnull...Code:#define chnull (char *)0 typedef struct { int month,day,year; }DATE; typedef struct Key KEY; typedef struct Key* KEYS; struct Key { char *sender; char *addressee; char *regarding; DATE date; int id; char *fname; KEYS next; };
I cannot successfully test for a null value by doingCode:...inside some function... //declare stuff KEY temp; temp.fname=(char*)malloc(sizeof(20)); temp.fname=chnull;
but I can test for a good valueCode:if( ! temp.fname ) nor by if( temp.fname==chnull )
So in this case, what is the proper way to test thatCode:if( temp.fname )
temp.fname = chnull so that the test will evaluate to true?
Thanks in advance,
Mike



LinkBack URL
About LinkBacks




thanks