Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C programming 1. Write a program that reads two strings str1 and str 2 from the keyboard 2. Print both strings 3. Write a

In C programming

1.

Write a program that reads two strings str1 and str 2 from the keyboard

2.

Print both strings

3.

Write a function ,computeLength and call this function in main to compute the length of the string str1 and str2.

4.

if the string str1 is of length 1 the program will terminate

5.

if the string str2 is of length 0 the program will terminate

6.

Write a function, isPrefix (str1, str2), that returns 1 if the string str2 is a prefix of str1 substring of str1 then isPrefix should return a ONE , if not return a ZERO.

7.

Call this function with str1 and str2 in main and output your result

8.

Now write a function, isPalindrome(str), that returns a 1 if str is a palindrome and 0 otherwise. To get full credit use isPrefix in your function

9.

Call your function, isPalindrome(str1)

10.

Output the correct conclusion either

PALINDROME

or

NOT PALINDROME

You are NOT to use any standard library functions except for I/O functions.

You will determine the above and output each in a formatted manner. Here is a potential list of functions you may want to declare

int computeLength(char *str);

int isReversePrefix(char *str1, char *str2);

int isPalindrome(char *str);

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database Design A Practical Approach

Authors: Marilyn Campbell

1st Edition

1587193175, 978-1587193170

More Books

Students also viewed these Databases questions