Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!hellgate.utah.edu!caen!sdd.hp.com!spool.mu.edu!uunet!cbmvax!higgin From: higgin@cbmvax.commodore.com (Paul Higginbottom - CATS) Newsgroups: comp.sys.amiga.misc Subject: Re: Compairing C values Message-ID: <18595@cbmvax.commodore.com> Date: 5 Feb 91 20:26:32 GMT References: Reply-To: higgin@cbmvax.commodore.com (Paul Higginbottom - CATS) Organization: Commodore, West Chester, PA Lines: 32 In article rat@hotcity.UUCP (P W) writes: $ I have + as an input arguement via *argv[] and whenever I try to $compare its value it comes out as a 0. For instance... If I compile a $program like this: $ $#include $#include $ $void main(int argc, char *argv[]) ${ $ And I type "test +" (I would name the file test) it would just print a $equals 0. Any help would be appereciated... $char a = argv[1]; $if (a = '+') printf("a equals +"); $if (a = '0') printf("a equals '0'"); $if (a = 0) printf("a equals 0"); $} Nice to catch an easier one to answer once in a while... The problem is that argv[1] is in fact a POINTER to the argument string of characters, and not a character itself. char a = argv[1][0]; /* might work */ Otherwise: char *cp = argv[1]; char a = *cp; Good luck. Paul.