Expression help
-
void main() { int x=8; x-=--x - x--; //explain me from RIGHT TO LEFT //when can operation perform on left side means x- printf("%d",x); getch(); }
Thanks in advance!!"Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India
-
void main() { int x=8; x-=--x - x--; //explain me from RIGHT TO LEFT //when can operation perform on left side means x- printf("%d",x); getch(); }
Thanks in advance!!"Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India
Hi amit, It will follow the below steps 1) x-= (--x**)** - x--; // Decrement x by one. 2) x-= ((--x) - x**)--;// subtract x fom x. 3) (x-=--x - x)--;// Subract reult of above opertaion from X in the left side of =. 4) (x-=--x - x)--**; // Now decrement the x by one. so the results becomes 6.
nave [OpenedFileFinder]
-
Hi amit, It will follow the below steps 1) x-= (--x**)** - x--; // Decrement x by one. 2) x-= ((--x) - x**)--;// subtract x fom x. 3) (x-=--x - x)--;// Subract reult of above opertaion from X in the left side of =. 4) (x-=--x - x)--**; // Now decrement the x by one. so the results becomes 6.
nave [OpenedFileFinder]
HI nave , you are absolutely right dear the answer is 6.But can you kindly explain with value . because suppose
Naveen.R wrote:
- x-= (--x) - x--;
The value of x is 7. here now the value is 7 for all x is it? means ,
Naveen.R wrote:
- x-=
((--x) - x)
--;// subtract x fom x.
how can I follow the step 2 (7-7)-- will it zero or what ??? :doh: then will x will zero or the value 7 will still exist. means, 7-=(7-7)-- //my question is here whether the value of x will zero here.then what is the value of x on LEFT SIDE. because right side I got zero right. now (7-=0)-- as go with logic.... now as x=x-0 means (7=7-0)-- then after it will decrement and the result 6. I understand this way .but I thought about the x value ???? is zero or 7 at step 2. thanks nave amit - bedcollege petlad
"Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India
-
HI nave , you are absolutely right dear the answer is 6.But can you kindly explain with value . because suppose
Naveen.R wrote:
- x-= (--x) - x--;
The value of x is 7. here now the value is 7 for all x is it? means ,
Naveen.R wrote:
- x-=
((--x) - x)
--;// subtract x fom x.
how can I follow the step 2 (7-7)-- will it zero or what ??? :doh: then will x will zero or the value 7 will still exist. means, 7-=(7-7)-- //my question is here whether the value of x will zero here.then what is the value of x on LEFT SIDE. because right side I got zero right. now (7-=0)-- as go with logic.... now as x=x-0 means (7=7-0)-- then after it will decrement and the result 6. I understand this way .but I thought about the x value ???? is zero or 7 at step 2. thanks nave amit - bedcollege petlad
"Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India
amitmistry_petlad wrote:
here now the value is 7 for all x is it?
Yes.
amitmistry_petlad wrote:
will it zero or what ???
yes it will be zero. But the value of X is still the same(7); that line can be broken into the following to lines. x-= 7 - 7; x--;
nave [OpenedFileFinder]
-
amitmistry_petlad wrote:
here now the value is 7 for all x is it?
Yes.
amitmistry_petlad wrote:
will it zero or what ???
yes it will be zero. But the value of X is still the same(7); that line can be broken into the following to lines. x-= 7 - 7; x--;
nave [OpenedFileFinder]
Hi nave ! I need your help for API . where can i find the API help and explanation??
"Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India
-
Hi nave ! I need your help for API . where can i find the API help and explanation??
"Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India