Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!decwrl!shelby!portia.stanford.edu!jessica.stanford.edu!kocks From: kocks@jessica.stanford.edu (Peter Kocks) Newsgroups: comp.sys.mac.programmer Subject: NULL pointer problem in THINK_C? Keywords: THINK_C,bug Message-ID: <1990Aug14.164700.146@portia.Stanford.EDU> Date: 14 Aug 90 16:47:00 GMT Sender: news@portia.Stanford.EDU (USENET News System) Organization: Academic Information Resources Lines: 32 I ran into a strange problem the other day using THINK_C. Consider the following two codes.... a) while(mypointer != NULL){ .... } b) while(((int)(mypointer)) != 0){ ... } I found that a) does not work. I.e. when mypointer == NULL (as shown by the debugger), the "while" statement continues to execute. On the other hand (b) (which should be functionaly equilavent) does work. I am using think_c 4.0, with the scanf patch, but no others. Please respond also be e-mail. -- Peter Kocks kocks@jessica.stanford.edu P.S Debugger Notes: Variable : Value ------------------------- mypointer : 0x000... NULL : 0x000... mypointer != NULL : 1 mypointer == NULL : 0