ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
"lvalue is required", this message is shown when you don't have a variable on the lift side of assignment. means we have a value but don;t have a space to store it.
try ++x++, it will display because after post increment, pre will be applied on incremented value of x. that will cause your message.
You will encounter these when you especially work with pointers.
For e.g.
Code:
main()
{
int a[10];
//now if I try to change the address of the array a
a++;
//I will get that lvalue required because you are changing the base address of the array.
}
Or you could do this -
Code:
main()
{
int a[10];
int *b;
b=a; //assign the address of a to b;
for(int i=0;i<a;i++)
printf("%d ",*b++); //and use b to access elements
}
In my previous post, a++ actually is a=a+1.
lvalue required is that you cannot assign a new value to a on LHS.
You have to take another variable, i.e. a pointer to 'a'
Code:
int *b;
b=a;
//a=a+1 //lvalue required
b++; //will work
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.