retagged by
1,351 views
0 votes
0 votes
#include<stdio.h>
int  main()
{

   int i=10;
    printf("address of i=%d  value of i=%d",&i,i);
    &i=7200;
    printf("address of i=%d  value of i=%d",&i,i);
    
    return 0;
}
retagged by

2 Answers

3 votes
3 votes

#include<stdio.h>
int  main()
{

   int i=10;----------------------------------------------------------------------------- Line 1
    printf("address of i=%d  value of i=%d",&i,i);-------------------------Line 2
    &i=7200;----------------------------------------------------------------------------Line 3
    printf("address of i=%d  value of i=%d",&i,i);-------------------------Line 4
    return 0;
}

In line 3, there will be L value error.

.

L-Value stands for left value

L-Value of Expressions refer to a memory locations

In any assignment statement L-Value of Expression must be a container(i.e. must have ability to hold the data)

Variable is the only container in C programming thus L Value must be any Variable.

0 votes
0 votes

lvalue and lvalue -:

An lvalue refers to an object that persists beyond a single expression. You can think of an lvalue as an object that has a name. All variables, including nonmodifiable (const) variables, are lvalues. An rvalue is a temporary value that does not persist beyond the expression that uses it. (https://msdn.microsoft.com/en-IN/library/f90831hc.aspx)

Here &i gives a particular value temporarily,which is itself a data not some kind of memory that can store data.

Related questions

0 votes
0 votes
1 answer
2
1 votes
1 votes
1 answer
3
. asked Apr 2, 2017
1,594 views
What will be the output of the following C program? If you think it will give a runtime error, you need to mention it. In either case,your answer must include proper just...
0 votes
0 votes
1 answer
4
Desert_Warrior asked May 16, 2016
2,357 views
#include<stdio.h int main() { int a = 5; int b = ++a * a++; printf("%d ",b); return 0; }(a) 25 (b) 30 (c) 36 (d) Undefined Behavior