delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/31/03:01:28

Message-ID: <35C169D4.28FC7F86@mailexcite.com>
Date: Fri, 31 Jul 1998 02:53:09 -0400
From: Doug Gale <dgale AT mailexcite DOT com>
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: A DOUBT LOOK THIS
References: <35BFFED0 DOT 459E AT hotmail DOT com> <35C0098B DOT 6835A285 AT mailexcite DOT com> <35C075A7 DOT 5CCA AT cam DOT org>
NNTP-Posting-Host: oshawappp34.idirect.com
Organization: "Usenet User"
Lines: 25
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Vic wrote:

> Doug Gale wrote:
> > if  (strcmp(argv[1], "the") == 0)
> >     printf("OK");
> > else
> >     printf("Wrong");
>
> shouldn't this be
>
>  if  (!strcmp(argv[1], "the") == 0)
>      ^^^
>      printf("OK");
>  else
>      printf("Wrong");
>
> ?
>
> AFAIK strcmp returns 0 if there is a match.

You are right. The original program said "if first parameter is 'the'",
print OK. That is what I did. if strcmp(argv[1], "the") == 0, they
match, so print "OK".


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019