Question: Write a C program with the following specification: a. Declares and reads a string named str (the maximum str size is 64) from the keyboard.

Write a C program with the following specification: a. Declares and reads a string named str (the maximum str size is 64) from the keyboard. b. Declares and reads two integers named start and length from the keyboard C. Finds and prints the substring of str starting from the character indexed by start and ending at the character indexed by (start + length - 1). d. The program should make sure that length is greater than 0, if not it should exit with an error message. e. The program should handle the case when the (start + length - 1) is larger than the length of str (in this case it should return the substring starting from start till the end of str) Example: If: str="My major is CS", start=3 and length=5 Then: the program should print "major" to the screen
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
