diff --git a/Palindrome string c b/Palindrome string c new file mode 100644 index 0000000..ec57779 --- /dev/null +++ b/Palindrome string c @@ -0,0 +1,19 @@ +#include +#include +// A function to check if a string str is palindrome +void isPalindrome(char str[]) +{ //Hacktoberfest + // Start from leftmost and rightmost corners of str + int l = 0; + int h = strlen(str) - 1; + // Keep comparing characters while they are same + while (h > l) + { + if (str[l++] != str[h--]) + { + printf("%s is Not Palindrome", str); + return; + } + } + printf("%s is palindrome", str); +}