Question: Can someone help me please? Implement three C-String functions char * getPointerToTerminator (char w[]); // return a pointer to the null terminator of w. bool

Can someone help me please?

Implement three C-String functions

char * getPointerToTerminator (char w[]); // return a pointer to the null terminator of w.

bool isPalindrome(char w[]); // return true iff w is a palindrome (e.g. "", "d", "xx", "abba" , "racecar" etc.).

void reverse(char w[]); // reverse the characters in w, not including the null terminator, e.g. "abc" --> "cba".

The isPalindrome and reverse functions should be coded this way: Use two pointers p and q of type char *. p will be initialized to w, and q will be initialized to the address of the last character of w (meaning the character preceding the null terminator). To initialize q you should be calling getPointerTerminator. Next, use a loop that increments p and decrements q, as long as one pointer is less than the other. In the case of isPalindrome, you'll be comparing values at addresses p and q to see if they are equal. In the case of reverse, you'll be swapping values as addresses p and q. One more thing: To practice using pointer notation, don't use any square brackets in your code other than in the function header.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!