Determine if a character string is palindromic

  • Thread starter lovecreatesbeauty
  • Start date
S

Simon Biber

Richard said:
Simon Biber said:


They are palindromes.

Sure, but the original program did not claim to detect palindromes. It
claimed to detect palindromic strings. :)
And when were you planning on fixing the bug? :)

Apart from the failure to include <ctype.h>, was there a bug in my code?

Simon.
 
R

Richard Heathfield

Simon Biber said:
Apart from the failure to include <ctype.h>, was there a bug in my code?

Yep. Here's a hint. The name of the function gives the intent, but the code
does not meet that intent. You have forgotten something rather important,
as a result of which disaster could well strike. In fact, it's a terminal
error!
 
S

Simon Biber

Richard said:
Simon Biber said:




Yep. Here's a hint. The name of the function gives the intent, but the code
does not meet that intent. You have forgotten something rather important,
as a result of which disaster could well strike. In fact, it's a terminal
error!

Ah, yes. I am getting sloppy!

Insert a line
*destination = 0;
as the last line of the function.

I will admit that I had not tested the function the first time I posted
it. I did test it after your comment about a bug, but unfortunately it
worked fine. There must have been a serendipitous null byte in my array.
 
C

Chris F.A. Johnson

My news reader provides such indentation sufficient unto my needs. I
could probably configure it to provide more if I so desired. This does
not require that you indent your text.


Personally I find shells don't have a problem with white space before
the commands.

It would if the command, intending IFS to contain a single newline,
is:

IFS='
'

I have the same problem if I have my newsreader do the indentation.
 
K

Keith Thompson

Chris F.A. Johnson said:
It would if the command, intending IFS to contain a single newline,
is:

IFS='
'

I have the same problem if I have my newsreader do the indentation.

Since you're the only person I know of who does this, it makes your
posts, and posts that quote them, slightly more difficult to read.
I suggest not indenting your text and finding some other way to mark
code.

It's not a huge deal, and I don't plan to bring it up again. Sorry
for the digression.
 
D

Denis Kasak

Vladimir said:
Apart from the fact that it doesn't work, it looks fairly good.
Did you consider upper/lower case? Try: "Ana voli Milovana".
Or, alternatively, you need to define "palindrome" more precisely.

After seeing this example, I'm curious; where are you from?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top