Purchase Solution

A recursive C function to detect palindromes

Not what you're looking for?

Ask Custom Question

A palindrome consists of a word or deblanked, unpunctuated phrase that is spelled exactly the same when the letters are reversed. Write a recursive function that returns a value of 1 if its string argument is a palindrome.
Notice that in palindromes such as level, deed, sees, and Madam I'm Adam(madamimadam), the first letter matches the last, the second matches the next-to-last, and so on.

Purchase this Solution

Solution Summary

This solution shows and explains a C function that can determine if the given string is a palindrome or not. It uses a recursive algorithm.

Solution Preview

The basic idea behind recursion is that a function calls itself. Each time the function calls itself is does some processing and then calls itself with a "smaller" version of the initial data. Then the second call to the function does the same thing: process some data and call itself with smaller data. Eventually all of the data will be processed.

For detecting a palindrome recursively we will follow the ...

Purchase this Solution


Free BrainMass Quizzes
Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

C# variables and classes

This quiz contains questions about C# classes and variables.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

C++ Operators

This quiz tests a student's knowledge about C++ operators.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.