Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8933359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:31:10+00:00 2026-06-15T09:31:10+00:00

the question is A palindrome is a string that is read the same in

  • 0

the question is

A palindrome is a string that is read the same in both directions, for example, racecar, eye, etc. Write a program in
that prompts the user to enter a string and uses a recursive function to determine if the given input is a palindrome

i have done this so far but its not working guys :

#include<stdio.h>
#include<conio.h>
#include<string.h>// to save string

int isPalindrome(char*str);

int main (void)
{
    int result;
    char str[50];

    printf("\n pls enter string; \n");
    gets(str);
    result = isPalindrome(str);

    if(result ==1) 
    {
        printf("\n input string in a palindrome string ");
    }
    else
    {
        printf(" not a palindrome");
    }

    getch();

    return 1;
}

int isPalindrome(char*str)
{
    static int length = strlen(str);

    if(length<1)
    {
        return 1;
    }

   if(str[0]=str[lenght - 1])
   {
       length-=2;
   }

   return isPalindrome(str + 1)
}


{
     return 0;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:31:11+00:00Added an answer on June 15, 2026 at 9:31 am

    Since you tagged your question as C++, this approach would work:

    #include <string>
    #include <algorithm>
    #include <iostream>
    
    bool isPalindrome(const std::string& str)
    {
        // comparison based on 2 string iterators - a "normal" one
        // and a reversed one
        return std::equal(str.rbegin(), str.rend(), str.begin());
    }
    
    int main()
    {
        std::cout << isPalindrome("racecar") << std::endl; // prints 1
        std::cout << isPalindrome("truck") << std::endl; // prints 0
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a program that determines if a string is a palindrome recursively. I've
Question: I have written a console program that uses the SQL server 2005 web
Question Is it possible to stop a Message Driven Bean (programmatically), so that it
Question context: let say that there is some really important row in config/locales/en.yml that
This is a question about syntax more than anything. I am pretty sure that
Question: Can I override default functions in Javascript? Background: After figuring out that I
Question Is it possible to create a second Preference Dialog that can take some
Question: input an int number ex: ABCD, verify that is ABCD = AB*CD or
I recently wrote a program that takes inputted char data, tests if it is
Question: I need to read a CSV file. I use the FileHelpers library to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.