CS12, Lab 8
Week of February 25 – March 1
Topics
·
Character
strings
·
Pointers
·
The string.h
library
·
Recursion
In this lab you
will use three different methods to compare two character strings.
To do
Write a program
that will prompt the user for two strings and check if they are equal using
three different methods:
1. Using the strcmp function in string.h
2. Calling a function (that you write) that
loops through the two strings comparing character by character.
3. Calling a recursive function (that you
write) that takes two pointers to char as parameters and does the following:
a. If the pointers point to different
characters, return false
b. If both pointers point to the null
character, return true
c. If both pointers point to the same (non-null) character, advance both pointers and call the recursive function again, returning the result of the recursive call.