Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!think.com!linus!agate!shelby!msi.umn.edu!noc.MR.NET!gacvx2.gac.edu!gacvx2.gac.edu!scott From: scott@erick.gac.edu (Scott Hess) Newsgroups: comp.sys.amiga Subject: Re: Compairing C values Message-ID: Date: 6 Feb 91 03:18:22 GMT References: <1991Feb5.173012.20398@nas.nasa.gov> Organization: Gustavus Adolphus College Lines: 23 Nntp-Posting-Host: erick.gac.edu In-reply-to: dueker@xenon.arc.nasa.gov's message of 5 Feb 91 17:24:12 GMTLines: 23 In article <1991Feb5.173012.20398@nas.nasa.gov> dueker@xenon.arc.nasa.gov (Chris Dueker) writes: In article , rat@hotcity.UUCP (P W) writes... >char a = argv[1]; >if (a = '+') printf("a equals +"); >if (a = '0') printf("a equals '0'"); >if (a = 0) printf("a equals 0"); >} Umm, if it's not a typo above, you should use "==" instead of "=" in the if stmts above. The "=" assigns the character to variable a, then if the result is true, the printf stmt is executed. You missed the most important part (among many) : a=argv[ 1]? Note that argv[ 1] is a 'char *', rather than a char. Of course, no one's going to see this anyway! -- scott hess scott@gac.edu Independent NeXT Developer GAC Undergrad "Tried anarchy, once. Found it had too many constraints . . ." "Buy `Sweat 'n wit '2 Live Crew'`, a new weight loss program by Richard Simmons . . ."