Given a string, write a c function to check if it is palindrome or not.
A string is said to be palindrome if reverse of the string is same as string. For example, “abba” is palindrome, but “abbc” is not palindrome.
1) Find length of str. Let length be n.
2) Initialize low and high indexes as 0 and n-1 respectively.
3) Do following while low index ‘l’ is smaller than high index ‘h’.
…..a) If str[l] is not same as str[h], then return false.
…..b) Increment l and decrement h, i.e., do l++ and h–.
4) If we reach here, it means we didn’t find a mis
Following is C implementation to check if a given string is palindrome or not.
abba is palindrome abbccbba is palindrome geeks is Not Palindrome
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Python program to check if given string is vowel Palindrome
- TCP Client-Server Program to Check if a Given String is Palindrome
- Python program to check if a string is palindrome or not
- Java program to check whether a string is a Palindrome
- Sentence Palindrome (Palindrome after removing spaces, dots, .. etc)
- Count all palindrome which is square of a palindrome
- Check if a given string is a rotation of a palindrome
- Check if characters of a given string can be rearranged to form a palindrome
- Given two strings check which string makes a palindrome first
- Check if it is possible to create a palindrome string from given N
- Check whether the given string is Palindrome using Stack
- Check if string remains palindrome after removing given number of characters
- Check given string is oddly palindrome or not
- Check if a given string is Even-Odd Palindrome or not
- Check given string is oddly palindrome or not | Set 2
- Java program to check palindrome (using library methods)
- Bash program to check if the Number is a Palindrome
- Recursive program to check if number is palindrome or not
- Program to check if an array is palindrome or not using Recursion
- Program to check the number is Palindrome or not
Improved By : AbhijeetPrakash