Write a program in C language to check that a string entered by the user is Palindrome or not.
Write a program in C language to check that a string entered by the user is Palindrome or not.
Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To check whether a string entered by the user is a palindrome or not in C language, follow these steps:
start
) and the other pointing to the end of the string (let's call itend
).start
andend
positions iteratively untilstart
becomes greater than or equal toend
.start
andend
positions are not equal, the string is not a palindrome. Otherwise, continue comparing characters until the pointers meet.Here's the C code implementing the above logic:
This program prompts the user to enter a string, reads the input string, and then checks whether it is a palindrome or not. It performs case-insensitive comparison by converting the string to lowercase. Finally, it prints the result indicating whether the string is a palindrome or not.