www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/09/29/05:03:52

Message-ID: <3BB570FD.F7B78997@yahoo.com>
From: CBFalconer <cbfalconer AT yahoo DOT com>
Organization: Ched Research
X-Mailer: Mozilla 4.75 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Please add strrev proposal
References: <lcq8rtk1nqua2hc6rqfhmqisbd587n8t2n AT 4ax DOT com> <Xns912A8823C1399ASINANUNUR AT 132 DOT 236 DOT 56 DOT 8> <3BB50884 DOT 347A4384 AT yahoo DOT com> <Xns912AD5B54F1C7ASINANUNUR AT 132 DOT 236 DOT 56 DOT 8>
Lines: 31
Date: Sat, 29 Sep 2001 07:05:19 GMT
NNTP-Posting-Host: 12.90.168.197
X-Complaints-To: abuse AT worldnet DOT att DOT net
X-Trace: bgtnsc04-news.ops.worldnet.att.net 1001747119 12.90.168.197 (Sat, 29 Sep 2001 07:05:19 GMT)
NNTP-Posting-Date: Sat, 29 Sep 2001 07:05:19 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"A. Sinan Unur" wrote:
> 
> CBFalconer <cbfalconer AT yahoo DOT com> wrote in
> news:3BB50884 DOT 347A4384 AT yahoo DOT com:
> 
> > Thank you.  I knew there was a reason I made my equivalent
> > (revstring) a void function.  I just didn't know what it was :-)
> 
> The usefulness of a strrev function depends very much on what you intend to
> use it for. For example, if your program is looking for palindromes, you
> might want to use something like:
> 
> strcmp(word, strrev(word));
> 
which has precisely the undefined action you illustrated earlier. 
With it returning void you are forced to write something like:

   strcpy(temp, word);
   strrev(word)
   if (strcmp(word, temp)) palindrome();

but you would be better off modifying strrev to do it all in one
scan, and calling it:

   bool ispalindrome(char *word);

-- 
Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT XXXXworldnet DOT att DOT net)
   (Remove "XXXX" from reply address. yahoo works unmodified)
   mailto:uce AT ftc DOT gov  (for spambots to harvest)

- Raw text -


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