Re: [algogeeks] Add and subtract with out using mathematical operator.......

2012-11-07 Thread rahul sharma
following using exor http://www.geeksforgeeks.org/archives/18324 following is tricky http://www.geeksforgeeks.org/archives/22080 On Wed, Nov 7, 2012 at 11:36 AM, Rahul Kumar Patle < patlerahulku...@gmail.com> wrote: > you can use bit wise addition.. using xor , and , or and shift op > erations..

Re: [algogeeks] output of the program with explanation

2012-11-07 Thread vishwa
let me keep it simple y is integer pointer pointing to address 20 .. x=20 y+7 will point to the addressy + ( size(int) * 7) i.e 50 here /*y is integer pointer*/ On Tue, Nov 6, 2012 at 11:45 AM, Rahul Kumar Patle < patlerahulku...@gmail.com> wrote: > because difference is of 30 byt

Re: [algogeeks] Re: increment operator...

2012-11-07 Thread vishwa
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 --

[algogeeks] Re: increment operator...

2012-11-07 Thread apsalar
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;

[algogeeks] increment operator...

2012-11-07 Thread Aamir Khan
Let's concentrate on if condition, *if (++k < 5 && k++/5 || ++k <= 8);* is equivalent to (based on operator precedence) *if (((++k < 5) && (k++/5)) || (++k <= 8));* Initially k = 5. Step1 : The first term in if clause i.e, (++k < 5) is false which makes the *((++k < 5) && (k++/5)) *false becau