Question: In C++ write a function named recCStrCmp that must be recursive and will have two parameters. The first parameter is a cstring that will be
In C++
write a function named recCStrCmp that must be recursive and will have two parameters. The first parameter is a cstring that will be compared to the second argument which is also a cstring. This function will use pointer arithmetic to evaluate the positions rather than an index. You can move the pointer down one character by adding 1 to the pointer. Example cstr1 = cstr1 + 1; You will have to dereference the pointer to get to the character. The first string will be compared to the second string and will return the same values as the strcmp function. This function should not change the contents of the cstrings.
Cstring1 == cstring2 the function should return a 0. This includes ignoring the case on alphabetic characters only. Cstring1 < cstring2 the function should return a number less than 0. This includes ignoring the case on alphabetic characters only.
Example. hello < HelP l < P ignoring case. Cstring1 > cstring2 the function should return a number greater than 0. This includes ignoring the case on alphabetic characters only.
Example: WINDOW > widow N > d
Strings answer subtraction using tolower
HELLO and hello answer is 0 \0 \0 = 0
Hello and helP answer is <0 l p 108 112 = 4
helP and hello answer is >0 P l 112 108 == 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
