Hewlett Packard Interview Question
Software Engineer / DevelopersBut I really wonder how this code it is returning TRUE for condition (i > j) ?
and this returns TRUE only if I have swap(i,j) call.
Can some one pls explain detailly ?
Its correct ;
Replace that micro . After replacement code will be like this
if(i>j)
temp=a;
a=b;
b=temp;
and if condition is false, therefore only last two statements will be executed.
a(i) will get b(10), b(j) will get temp(0)
finally i=10,j=0;temp=0;
@bhaskar: you are not right the output will be same in any standard compiler of c
- geeks August 19, 2011and that will be 10 0 0
further ur exaplanation is right