Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function with a string argument, that replaces the contents of the string with the string in reverse order. The function prototype is

Write a function with a string argument, that replaces the contents of the string with the string in reverse order. The function prototype is as follows. void reverse (char str[]); Test the function in a simple program. An example run of the program look like this, Enter a string: Go Raptors! The string in reverse order is: !srotpaR OG 5.2 (3 marks) Write a C program that finds the "smallest" and "largest" in a series of words. After the user enters the words, the program will determine which words would come first and last if the words were listed in dictionary order. The program must stop accepting input when the user enters a four-letter word. Assume that no word is more than 20 letters long. An interactive session with the program might look like this: Enter word: dog Enter word: zebra Enter word: rabbit Enter word: catfish Enter word: walrus Enter word: cat Enter word: fish Smallest word: cat Largest word: zebra. Note: The underlined text is the input from the keyboard. Hint: Use two strings named smallest word and largest word to keep track of the "smallest" and "largest" words enetered so far. Each time the user enters a new word, use stremp to compare it with smallest word; if the new word is "smaller", use strcpy to save it in smallest word. Do a similar comparison with largest word. Use strlen to determine when the user has entered a four-letter word.

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_2

Step: 3

blur-text-image_3

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

Auditing An International Approach

Authors: Wally J. Smieliauskas, Kathryn Bewley

6th edition

978-0070968295, 9781259087462, 978-0071051415

More Books

Students also viewed these Programming questions