how has C bitten you?
Bob Peirce
rbp at investor.UUCP
Fri Aug 16 09:24:51 AEST 1985
Here's one that trapped me this week. It took much head scratching
and debug prints to figure it out.
int dial(telno)
char *telno;
{
if(telno){ /* should be if(*telno) */
dial it;
}
else{
hang up;
}
}
Print statements showed the telno was being handed to the routine,
but the if said nothing was there. Turns out, on my system, the
address of telno is NULL. I needed to check the contents not the
address!
--
Bob Peirce, Pittsburgh, PA
uucp: ...!{allegra, bellcore, cadre, idis}
!pitt!darth!investor!rbp
412-471-5320
NOTE: Mail must be < 30,000 bytes/message
More information about the Comp.lang.c
mailing list