Question: lab5C.c: #include #include #define SIZE 40 int isPalindrome (char *); void printReverse (char *); int main () { int result; char c; int i; int


lab5C.c: #include#include #define SIZE 40 int isPalindrome (char *); void printReverse (char *); int main () { int result; char c; int i; int count=0; char arr[SIZE]; fgets(arr,SIZE,stdin); while ( ) { arr[strlen(arr)-1] = '\0'; // remove the trailing // print backward printReverse(arr); result = isPalindrome (arr); if (result==1) printf (" Is a case-insensitive palindrome. "); else printf (" Not a case-insensitive palindrome. "); fgets(arr,SIZE,stdin); } return 0; } int isPalindrome (char * str) { } // assume the was removed manually void printReverse(char * str){ int i = strlen(str) -1; while ( i >=0 ){ printf("%c", *(str+i) ); // or putchar(*(str+i)); i--; } }
Implementation Download file 1ab5C.c to start with. . Assume that each line of input contains at most 30 characters but it may contain blanks. . Use fgets to read line by line o note that the line that is read in using fgets will contain a new line charactern', right before'. Then you either need to exclude it when processing the array, or, remove the trailing new line character before processing the array. One common approach for the latter is replacing the 'In' with o' (implemented for you) . Define a function void printReverse (char *) which prints the argument array reversely (implemented for you) Define a function int isPalindrome (char *) which determines whether the argument array (string) is a case-insensitive palindrome. "Dad" is a case-insensitive palindrome, like "dad". Do not use array indexing I throughout your implementation. Instead, use pointers and pointer arithmetic to manipulate the array . Do not create extra arrays. Manipulate the original array only. Do not use global variales. Sample Inputs/Outputs red 339 % a-out hello olleh Not a case-insensitive palindrome lisaxxaSIL LSaxxasl Is a case-insensitive palindrome that is a SI taht that IS a si taht Is a case-insensitive palindrome quit red 340 % .out
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
