Xref: utzoo comp.lang.c:13168 comp.std.c:415 comp.lang.scheme.c:21 comp.unix.questions:9634 Path: utzoo!attcan!uunet!seismo!sundc!netxcom!hadron!jsdy From: jsdy@hadron.UUCP (Joseph S. D. Yao) Newsgroups: comp.lang.c,comp.std.c,comp.lang.scheme.c,comp.unix.questions Subject: Re: ????? HELP!!! what is wring with this code? ??????? Message-ID: <792@hadron.UUCP> Date: 7 Oct 88 18:08:43 GMT References: <456@mrsvr.UUCP> Reply-To: jsdy@hadron.UUCP (Joseph S. D. Yao) Organization: Hadron, Inc., Fairfax, VA Lines: 30 In article <456@mrsvr.UUCP> ssa@mrsvr.UUCP (6607) writes: >"test.c", line 7: warning: illegal combination of pointer and integer, op = ... > and the funny part is when I run the same program in dbxtool (SUN WS) > IT RUNS FINE !!!!!!!! [L1]>#include [L2]>#define NULL (char *) 0 ... [L7]> while((tokptr=strtok(strptr," \t")) != NULL ){ You do not mention under what machine or C compiler you get the error message. I suspect that, if you look in /usr/include/strings.h on that system, you'll find that strtok() is not declared, while it is on your Sun. Since it is not declared, the C compiler believes that it is a function returning 'int'. (This is an historical bug from before 'void' existed.) Although I like using system include files very much, I tend to try to declare external functions in the body of each new function that uses them. This is good insurance in case - as here - one isn't properly declared, or - as happens - the return value of function xxxfieonyou in your massive project changes, in which case a later 'lint' run will reveal the inconsistency. Joe Yao jsdy@hadron.COM (not yet domainised) hadron!jsdy@{uunet.UU.NET,dtix.ARPA,decuac.DEC.COM} arinc,att,avatar,blkcat,cos,decuac,dtix,\ ecogong,empire,gong,grebyn,inco,insight, \!hadron!jsdy kcwc,lepton,netex,netxcom,phw5,rlgvax, / seismo,sms,smsdpg,sundc,uunet /