I'm facing an error while assigning the reverse of a string to another string.
[Error] incompatible types in assignment of 'char*' to char[20]
This is my code
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
char str[20],str2[20];
int length;
cout<<"Enter the string\n";
cin>>str;
length=strlen(str);
str2=strrev(str);
if(str==str2)
{
cout<<"Palindrome";
}
else{
cout<<"Not a palindrome";
}
return 1;
}
Any explanation on what i've done wrong would be really helpful. Cheers