Click here to Skip to main content
15,867,594 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am getting a error lvalue error on this code:


C++
gotoxy(36,12);
for(int i=0;i<8;++i)            =here is where the problem comes
{
p[i]=getch();
if(p[i]==’b’)
  {
    printf("b b");
i=i-2;
  }
  else
   cout<<"*";
}
p[i]=’’;
getch();




thank you for help

What I have tried:

i didnt know what to do
so i left it
Posted
Updated 17-Aug-18 8:11am
v3
Comments
Jochen Arndt 17-Aug-18 12:53pm    
Compiler messages contain the file name and the line number where the error occured. Locate the line in your editor. Your posted code would not issue such an error provided that p is an int array or a pointer to int (or char but that should raise a conversion warning).

Note also that there is no such thing as an empty character (p[i]='').

1 solution

Look at your code: you edited it using a word processor, not an editor - so your quotes aren't quotes, your double quotes aren't double quotes, and (as has been mentioned by Jochen) '' isn't a character anyway.

Use a "proper" editor - Notepad if you are really desperate, but most C++ systems come with an IDE which includes a editor, compiler and debugger all in one. If yours doesn't then it's seriously old, and you ought to consider a newer one ... Visual Studio includes C++ and it's free ...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900