Question
Please Use C Language! Write the implementation for the three functions described below. The functions are called from the provided main function. You may need
Please Use C Language!
Write the implementation for the three functions described below. The functions are called from the provided main function. You may need to define additional helper functions to solve the problem efficiently.
1) Write a print_string function that prints the characters in a string to screen on- by-one.
2) Write a is_identical function that compares if two strings are identical. The functions is required to be case insensitive. Return 0 if the two strings are not identical and 1 if they are identical.
3) Write a is_palindrome function. The function is required to be case insensitive and should only consider the letters and the numbers in the input string, i.e., remove all fillers. Using this definition, the string Madam, Im Adam! is considered a palindrome. The function is required to return 1 if the string is a palindrome and otherwise 0.
void print_string(char str[]);
int is_identical(char str1[],char str2[]);
int is_palindrome(char str[]);
void main(){
char str1[] = "Hello World";
char str2[] = "Madam, I'm Adam!";
char str3[] = "hello world";
print_string(str1);
printf(" ");
print_string(str2);
printf(" ");
(is_identical(str1,str2)) ? printf("Identical! ") : printf("No identical! ");
(is_identical(str1,str3)) ? printf("Identical! ") : printf("No identical! ");
(is_palindrome(str1)) ? printf("Palindrome! ") : printf("No palindrome! ");
(is_palindrome(str2)) ? printf("Palindrome! ") : printf("No palindrome! ");
}
Please Use C Language!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started