answersLogoWhite

0

When will lvalue error occur in c?

Updated: 8/11/2023
User Avatar

Wiki User

15y ago

Best Answer

When there is no addressable value in program, then compiler will give lvalue error.

Lvalue or location value is an address that is stored into while rvalue is the "read" value, ie., value of a constant or the value stored at a location. In the assignment a = 31; we have the lvalue of a used on the left hand side and the integer contant value 31 assigned to this location. In the assignment b = a; we have the rvalue of a (31) used to assign to the lvalue of b . So depending on which side of an assignment, we use the variable a , we get two different behaviors

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

15y ago

I believe an lvalue error means you are attempting to assign a value to an object that does not support this. For example:

int x;

x = 8; // This is ok

8 = x; // This is NOT ok object_a.setHeight(8); // This is ok object_a.height = 8; // This is probably ok if height is a public member variable

object_a.setHeight() = 8; // This is NOT ok, since setHeight is a function

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: When will lvalue error occur in c?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the lvalue error?

Most likely it is 'lvalue required' error, examples: 10= x; ++3;


Viva questions of c language?

lvalue


What is L value error in C?

When there is no addressable value in program, then compiler will give lvalue error. Lvalue or location value is an address that is stored into while rvalue is the "read" value, ie., value of a constant or the value stored at a location. In the assignment a = 31; we have the lvalue of a used on the left hand side and the integer contant value 31 assigned to this location. In the assignment b = a; we have the rvalue of a (31) used to assign to the lvalue of b . So depending on which side of an assignment, we use the variable a , we get two different behaviors


What is the syntax of increment operator?

Pick one: ++ lvalue lvalue ++ lvalue += value


What represents the left hand side of a binary operator in c plus plus?

The left hand operand of a binary operator must represent a modifiable lvalue: void f (const int x, int y) { x = y; // error -- x is constant lvalue y = x; // ok }


What is lvalue?

A variable has two associated value with it rvalue and lvalue. 'lvalue' is its location value, that is memory address.


What is Lvalue in c?

An lvalue is an object that can be assigned a value, i.e. it can be on the left side of an equals sign, hence the term lvalue.If the compiler is complaining, you are probably trying to assign a new value to an rvalue, such as an array name or constant.


What is the difference between lvalue and rvalue?

A variable is a named storage that can hold any value and has 2 values associated with it namely rvalue and lvalue. 'rvalue' is its data value that is its content and "lvalue" is its location value, that is memory address.


What is lvalue explain with example?

left-value: an expression that can be target of assignement. eg: array[x+1]->field = 100; # okay 100 = 200; # NOT okay: not lvalue intvar = 100; # okay (char *)intvar = "STR"; # NOT okay: not lvalue *(char **)&intvar = "STR"; okay


Would you say How this error occurred or how did this error occur?

The question would be the latter "How did this error occur?" The former is the objective form, e.g. "I am trying to discover how this error occurred."


Define percentage error?

an error is the difference between a predicted value and the actual value. % errors tell you how close or how far you came to the actual answer is the form of a percentage. Mathematically: [(accepted value-measured value) / accepted lValue] * 100% note: if your answer is negative it means you were, for example, 15% short of the actual answer


How do outliers occur?

Human error