void main()
{
int i=5;
printf("%d",i+++++i);
}
Answer Posted / sheetal
gives error
"error C2105: '++' needs l-value"
because it parses above expression in "((i++)++)+i), so in
2nd unary operator it searches for l-value.
If we modify above pgm into following way:-
void main()
{
int i=5;
printf("%d",((i++)+(++i)));
}
it will give answer 12.
because once last pre-unary increment operator is operated,
i is incremented to 6 and 6+6 = 12.
if we put one more print for i's value, it will give i =7.
because first post-increment operator is operated after
first printf statement as follows.
void main()
{
int i=5;
printf("%d",((i++)+(++i)));
printf("%d\n",i); // ===> i =7
}
| Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
What is masking?
Why is not a pointer null after calling free? How unsafe is it to use (assign, compare) a pointer value after it is been freed?
Q.1 write a program to create binary tree 1 to 16 numbers? Q.2 write a program to creat a binary search tree for the member that is given by user?
What is zero based addressing?
please explain every phase in the "SDLC" in the dotnet.
An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above
What are the differences between Structures and Arrays?
What is console in c language?
why wipro wase
What is a stream in c programming?
Why isn't any of this standardized in c? Any real program has to do some of these things.
How does free() know explain how much memory to release?
what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;
What is the importance of c in your views?
Where is c used?