| delorie.com/archives/browse.cgi | search |
| From: | Endlisnis <s257m AT unb DOT ca> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: gcc 2.7.2.1: Won't compile | or || symbols (really!) |
| Date: | Mon, 07 Sep 1998 19:04:02 -0300 |
| Organization: | NBTel Internet |
| Lines: | 34 |
| Message-ID: | <35F45852.49B75D82@unb.ca> |
| References: | <Pine DOT A32 DOT 3 DOT 91 DOT 980906022606 DOT 27528A-100000 AT broncho DOT ucok DOT edu> <1998090623100300 DOT TAA28060 AT ladder01 DOT news DOT aol DOT com> <o2g1e413ld DOT fsf AT csd DOT abdn DOT ac DOT uk> |
| NNTP-Posting-Host: | fctnts05c61.nbnet.nb.ca |
| Mime-Version: | 1.0 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Darren Johns wrote:
> > int main (int argc, char * argv[])
> > {
> > if (argc == 1)
> > return 1;
> > else if (argc == 2)
> > return 1;
> > else
> > return 0;
> > }
>
> Without trying it this should work as well:
> int main (int argc, char * argv[])
> {
> return (argc == 1);
> return (argc == 2)
> return 0;
> }
1) You missed a ";" on the 2nd return.
2) All this does is evaluate whether (argc==1) and return that value, what you
probably meant to say is:
int main(int argc, char * argv[])
{
return (argc == 1 || argc == 2);
}
--
(\/) Endlisnis (\/)
s257m AT unb DOT ca
Endlisnis AT GeoCities DOT com
Endlis AT nbnet DOT nb DOT ca
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |