20
Feb
Palindrome Checker
Related Blog ItemsNo Related Blog Items Found
Palindrome checker takes input from a file or keyboard, and lists out all palindrome words. This checker identifies even multiple words which are palindrome. This is a console based program, without arguments to the program, will act as a console shell, which takes input from keyboard and processes the words.
Recursive string reversal function is used to reverse the strings while checking for palindrome. Here is the function which identify whether a string is palindrome or not.
boolean checking_str_palindrome(const char *str) { int pal_flag = FALSE; char *dest_str = (char *) malloc(sizeof(char) * (strlen(str) + 1)); if (dest_str == NULL) { /*we are out of memory*/ return FALSE; } memset(dest_str, 0x00, strlen(str)); string_reverse(str, dest_str); dest_str[strlen(str)] ='\0'; if(!strcmp(str, dest_str)) { pal_flag = TRUE; } free(dest_str); return pal_flag; }
Here is the entire [program]….
Popularity: 12%
You need to log on to convert this article into PDF
Related Blog ItemsNo Related Blog Items Found
Related Blog ItemsNo Related Blog Items Found
No Comments
No comments yet.