@vishwa : that is not correct. Check : http://ideone.com/Kn7hRn
On Wed, Nov 7, 2012 at 9:20 PM, vishwa vishwavam...@gmail.com wrote:
I guess its other way.
According you guys explanation after evaluating the expression first the
if condition turns out to be if(1);
And the program runs
We start with k = 5.
if ++k 5 translates to if 6 5 = which is false.
No need to evaluate k++/5 (short-circuiting)
if ++k = 8 translates to (6+1) 7 = 8 which is true.
So, 7 gets printed.
On Tuesday, November 6, 2012 6:22:13 AM UTC-5, Anil Sharma wrote:
main()
{
int k = 5;
I guess its other way.
According you guys explanation after evaluating the expression first the if
condition turns out to be if(1);
And the program runs infinitely..
first -- ++k = 8 --- turns true and k becomes 6.
second -- k++ / 5 --- skipped. k remains 6
third --