Description
Do not forget to read the warnings at the end of the document before coding and submission.
In this assignment you are going to write a program that takes a string, and two capital letters as an input. Your program will check the elements of the string, and if they are letters that are in between given capital letters, it will move them to the end of the string.
For example, If the input capital letters are A and D, the program is going to move the characters “a A b B c C d D” to the end of the string.
Input string: “This is a ABc test” Ouput string: “This is testaABc”
You are not going to use any libraries other than <stdio.h>.
● Function 1: (30 pts)
○ Name of the function: isInBetween
○ Return type of the function: int
○ 1. Parameter: character 1
○ 2. Parameter: character 2
○ 2. Parameter: a char pointer to the string
○ You are going to use this function to check if the characters in the string are in
between given letters or not. Assume the input characters are always capital
letters.
● Function 2: (50 pts)
○ Name of the function: moveToEnd
○ Return type of the function: void
○ 1. Parameter: a char pointer to the string
○ 2. Parameter: an integer to represent left element
○ 3. Parameter: an integer to represent right element
○ 4. Parameter: First char (ch1)
○ 5. Parameter: Second char (ch2)
○ In this function you will check the elements of the string and move the letters that
are in between ch1 and ch2 to the end of the string. You are going to use first
function to check if the elements of the strings are in between or not.
○ You are expected to use pointer notation to change the input string. You are not
allowed to use a second string (If you use a second string, your homework will be
evaluated out of 60 points).
○ Do not use any loop structures.
● Main function: (20 pts)
○ Enter a string for testing you code.
○ Call the moveToEnd function to print the final output.
WARNING:
● Submit only the source file in the format assignment4_name_surname.c
● Be sure the extension of your file is .c. If you do not know how to check the extension
please look at the file (“How to run your code?”) on the COADSYS.
● Do not use any library other than stdio. That means, you are not allowed to use string
library functions (such as strlen, strcmp) in this assignment.