Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

"Lvalue required" error when trying to find palindrome

"Lvalue required" error when trying to find palindrome

"Lvalue required" error when trying to find palindrome

Hi guys, trying to use Borland C++ to create a program to read in a string value to find out if it's a  palindrome. Lots of examples online but none that are too useful. My code is as below but i keep getting the errors (as seen at the bottom of the page).
On the code i have marked out which lines the errors refer to.
I'm a newbie can you help, what am i doing wrong?
int main(int argc, char* argv[])
AnsiString Line;
int Front;
int Back ;
bool Palindrome(char *, int, int);
WriteString("Enter the string to be tested");
Line = ReadStringPr("Enter the string to be tested");
Front = 1;
Back = Length(Line);
Palindrome = true; <---------------ERROR (1)
while ((Front < Back) & (Palindrome = true));  <---------------ERROR (2 & 3)
if (Line[Front] == Line[Back])
Palindrome = false; <---------------ERROR (4)
Front = Front + 1;
Back = Back - 1;
 }  //ifend
}  //loopend
if (Palindrome = true)  <---------------ERROR (5)
WriteString("is a palindrome");
WriteString("is not a palindrome");
return 0;

1. [C++ Error] SCAM1TST.cpp(25): E2277 Lvalue required
2. [C++ Error] SCAM1TST.cpp(26): E2277 Lvalue required
3. [C++ Warning] SCAM1TST.cpp(26): W8019 Code has no effect
4. [C++ Error] SCAM1TST.cpp(30): E2277 Lvalue required
5. [C++ Error] SCAM1TST.cpp(39): E2277 Lvalue required

RE: "Lvalue required" error when trying to find palindrome

Palindrome is the name of a bool function you've declared - you can't reuse the name as a variable.

RE: "Lvalue required" error when trying to find palindrome

Yeah just found out, thanks xwb.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close