how has C bitten you?

Andrew Koenig ark at alice.UUCP
Mon Aug 19 01:07:03 AEST 1985


> int dial(telno)
> char *telno;
> {
>	if(telno){		/*  should be if(*telno)  */
>		dial it;
>	}
>	else{
>		hang up;
>	}
> }

Bob Pierce says that this program failed because it should have been
checking *telno instead of telno.

If telno is NULL, you had better not look at *telno; it's illegal.
If the address of a legal character item is NULL, your compiler is
not implementing the language properly.



More information about the Comp.lang.c mailing list