Checking for palindrome string in c
问题 I am accepting a string as a command line argument. I want to check whether the inputted string is a palindrome or not and print the result. I have written the following code. But its displaying the result 'not palindrome' for all inputs. #include<stdio.h> #include<string.h> int main(int argc, char argv[20]) { int i; int l = strlen(argv); char str[20]; bzero(str, 20); for(i=0; i<l; i++) { str[i] = argv[i+2]; } int flag; int len = strlen(str); for(i=0; i< len/2; i++) { if(str[i] == str[len -