Check if a string is a palindrome program in c

Palindrome are the sequence which is the opposite of the same sequence. For example, consider a sequence of word non, tot, mam; and sequence of numbers such as 121, 222, 989, 590095, 405504 etc. So to check if a string is a palindrome or not, here is a simple program in C++. You can also write this program in C, logic will be the same.

Palindrome are the sequence which is the opposite of the same sequence. For example, consider a sequence of word non, tot, mam; and sequence of numbers such as 121, 222, 989, 590095, 405504 etc. So to check if a string is a palindrome or not, here is a simple program in C++.  You can also write this program in C, logic will be the same.

These words are same from both side if you see them right to left or from left to right, they are same such sequences are called palindrome. so to implement in the program of C++ see the logic details after the program.

```//coding by Himanshu singh(Mindxmaster.com)
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
main()
{
char a[100], b[100];
cout<<"Enter the string to check if it is a palindromen";
gets(a);
strcpy(b,a);
strrev(b);
if( strcmp(a,b) == 0 )
cout<<"Entered string is a palindrome.n";
else
cout<<"Entered string is not a palindrome.n";
return 0;
}```
(Note : I am using Dev C++ to implement this logic I also recommend you the same for you this is the best software for C++.)

## Check if a string is a palindrome: Logic

The logic is very simple, first we include header files iostream, stdio and string. Using namespace std is for standard use of standard input output stream like cout. We use two arrays a & b of char type to implement this logic having 100 letters memory. Now we ask for the array 'a'.

As soon as the user types the string in a strcpy command copies all the things from 'a' to array 'b'. strrev is the command for string reverse, which will place the string in reverse order for array 'b'. and that's all now we just compare the string of array a and b by strcmp command, and if else command will show the result.

This is the simple logic for Palindrome sequence detection. Hope you like this tutorial. Please like and share it if you find it useful. Any suggestions and request can be dropped into comment box below.

Name

ltr
item
MindxMaster: Check if a string is a palindrome program in c
Check if a string is a palindrome program in c
Palindrome are the sequence which is the opposite of the same sequence. For example, consider a sequence of word non, tot, mam; and sequence of numbers such as 121, 222, 989, 590095, 405504 etc. So to check if a string is a palindrome or not, here is a simple program in C++. You can also write this program in C, logic will be the same.
https://3.bp.blogspot.com/-TzUrY3LtJCI/VX0OMwh_HsI/AAAAAAAAAJE/xeYYY9_9mX4/s1600/palindrome%2Boutput.png
https://3.bp.blogspot.com/-TzUrY3LtJCI/VX0OMwh_HsI/AAAAAAAAAJE/xeYYY9_9mX4/s72-c/palindrome%2Boutput.png
MindxMaster
https://www.mindxmaster.com/2015/06/best-logic-to-check-palindrome-sequence.html
https://www.mindxmaster.com/
https://www.mindxmaster.com/
https://www.mindxmaster.com/2015/06/best-logic-to-check-palindrome-sequence.html
true
5332415103371288268
UTF-8