Like Tree1Likes
  • 1 Post By qny

To check the String is palindrome or not.?

This is a discussion on To check the String is palindrome or not.? within the C Programming forums, part of the General Programming Boards category; In C programming how can we check that the entered String is palindrome or not..? http://im.cprogramming.com/images/smilies/confused.png...

  1. #1
    Registered User
    Join Date
    Oct 2012
    Posts
    8

    To check the String is palindrome or not.?

    In C programming how can we check that the entered String is palindrome or not..?






  2. #2
    qny
    qny is offline
    Registered User
    Join Date
    Sep 2012
    Posts
    355
    Basically, just check if the 0th (first) letter is equal to the last,
    the 1st (second) equal to the one before last
    ...
    the nth equal to the (last-n)th
    ...
    until you've checked all of them (except maybe a single middle letter for strings with odd length).
    stahta01 likes this.

  3. #3
    Registered User
    Join Date
    Oct 2012
    Posts
    8
    firstly tell me how can i entered string..??

  4. #4
    qny
    qny is offline
    Registered User
    Join Date
    Sep 2012
    Posts
    355
    Quote Originally Posted by sash.arya View Post
    firstly tell me how can i entered string..??
    Wasn't that lesson #2 (lesson #1 being the famous "Hello, World!" program)?
    Did you miss the class, maybe ...

    Check the fgets() function. It is a safe way to get strings.

  5. #5
    Registered User
    Join Date
    May 2009
    Posts
    2,764
    "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the Universe is winning." Rick Cook

  6. #6
    Registered User
    Join Date
    Oct 2012
    Posts
    8
    thnx...

  7. #7
    Registered User
    Join Date
    Oct 2012
    Posts
    8
    tell me the logic please...

  8. #8
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,264
    qny described the logic in post #2.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Function to check for palindrome
    By Kristyy_mariee in forum C++ Programming
    Replies: 2
    Last Post: 03-03-2012, 07:08 PM
  2. Check to check string for a series of characters
    By robi in forum C Programming
    Replies: 1
    Last Post: 02-28-2012, 05:42 PM
  3. Replies: 10
    Last Post: 12-09-2011, 02:52 AM
  4. Recursively Checking a Palindrome string
    By TheUmer in forum C Programming
    Replies: 19
    Last Post: 12-04-2009, 07:38 PM
  5. Error in Recursive String Palindrome Code
    By clegs in forum C Programming
    Replies: 13
    Last Post: 12-21-2008, 12:36 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21