Write a function that determines whether a string is a palindrome. ?? Same lette
ID: 3617750 • Letter: W
Question
Write a function that determines whether a string is a palindrome. ?? Same letters backward as forward. ?? Ignore characters that are not letters.Use pointers to compare characters. ?? One pointer works from beginning toward end. ?? One pointer works from end toward beginning. ?? Each skips over characters that are not letters. ?? If characters in corresponding positions do not match, return 0 (false). ?? If the pointers meet, return 1 (true).
?? You will need ?? isalpha() ?? tolower() or toupper()
#include <stdio.h>
int main(void) { char input[1000] = ""; printf ("Enter a message:");
fgets(input, 1000, stdin);
input[999] = 0;
if (is_palindrome(input)) { printf("Palindrome "); } else { printf ("Not apalindrome "); }
return 0; }
can someone show me and let me know how to write this programwithout changing much of what i got and and the same format ?
#include <stdio.h>
int main(void) { char input[1000] = ""; printf ("Enter a message:");
fgets(input, 1000, stdin);
input[999] = 0;
if (is_palindrome(input)) { printf("Palindrome "); } else { printf ("Not apalindrome "); }
return 0; }
can someone show me and let me know how to write this programwithout changing much of what i got and and the same format ?
Explanation / Answer
please rate - thanks #include #include #include // This function determines if a string is a palindrome. int is_palindrome(char* message) { char *p,*q; p=q=message; while(*q!='') q++; // q represents the null character. q-=2;//q represents the last character ofstring. while(!isalpha(*p)) p++; while(!isalpha(*q)) q--; while(tolower(*p)==tolower(*q)&&pRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.