Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write program suffix.c that displays the longest suffix two words share, as illustrated in the following example $ ./suffix procrastination destination Common suffix between 'procrastination'
Write program suffix.c that displays the longest suffix two words share, as illustrated in the following example $ ./suffix procrastination destination Common suffix between 'procrastination' and destination' is 'stination $ ./suffix globally internally Common suffix between 'globally' and 'internally isally $ ./suffix qloves dove Common suffix between 'gloves' and 'dove' is'"' Here are a list of requirements, assumptions and hints This program shall contain no global variables . We assume that the maximum number of characters a word can contain is 30 While the two strings that are being filled out by the user are local arrays in the main function, any additional strings created during the execution should be dy namically allocated in the heap Do not forget that dynamically allocated memory should be freed ap . You must implement function char *find suffix(char *sl, char *s2) that returns a propriately dynamically allocated string containing the longest suffix shared by strings sl and s2 o Hint: you should start iterating from the end of the words o Hint: for loops allows multiple initializations and updates within their construct, if they are separated with commas
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