Hey guys , I found a question very similar to this on
cracktheinterview.com . I think it might clear some doubts . Here is
the question with answer : -
Whats wrong with the expression a[i]=i++; ? Whats a sequence point?
Although its surprising that an expression like i=i+1; is completely
valid, s
@priya...ya thats wat i meant by interleaving of operations(non-atomic
operations). you can understand the results if you can trace the register
values.
On Sat, Jan 8, 2011 at 10:18 PM, Priyanka Chatterjee wrote:
> @harshal, sundi: Use some compiler to check, i checked on gcc , it gives
> 13,14,1
@harshal, sundi: Use some compiler to check, i checked on gcc , it gives
13,14,14
On 9 January 2011 11:44, Harshal wrote:
> hey i am also getting the output as 12,13,13,13..
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to
which order of execution will anyways give 22,13,14,14? The only way to
explain is interleaving of each of the operations(i.e operations are not
atomic).
On Sat, Jan 8, 2011 at 10:34 PM, nishaanth wrote:
> output should be 22,13,13,13 right ?
>
>
> On Sat, Jan 8, 2011 at 10:22 PM, priya mehta
output should be 22,13,13,13 right ?
On Sat, Jan 8, 2011 at 10:22 PM, priya mehta wrote:
> http://www.ideone.com/mxvmt
> please see
> please see the link it has the program with output
>
> On Sun, Jan 9, 2011 at 11:44 AM, Harshal wrote:
>
>> hey i am also getting the output as 12,13,13,13..
>>
>
it would be more accurate to call that behaviour (as in order of evaluation
of arguments) unspecified rather than undefined. It is compiler dependent
whether it takes from right to left or the other way round.
--
You received this message because you are subscribed to the Google Groups
"Algorith
When you invoke the ++ operator (either pre- or post-increment) twice in the
same statement, you invoke undefined behavior. How your compiler decides to
resolve that is completely """compiler-dependent""". There is undefined
behaviour because the same variable is modified more than once between
con
http://www.ideone.com/mxvmt
please see
please see the link it has the program with output
On Sun, Jan 9, 2011 at 11:44 AM, Harshal wrote:
> hey i am also getting the output as 12,13,13,13..
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" gr
hey i am also getting the output as 12,13,13,13..
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegrou
http://www.ideone.com/mxvmt
please see
On Sun, Jan 9, 2011 at 11:34 AM, Sundi wrote:
> Evaluation of b=a++ + ++a;
> is also from right to left,
> so
> b = 22;
> but i am getting the o/p as 22,13,13,13
>
> On Jan 9, 10:59 am, Sundi wrote:
> > Evaluation of printf is from right to left !!!,
> >
>
Evaluation of b=a++ + ++a;
is also from right to left,
so
b = 22;
but i am getting the o/p as 22,13,13,13
On Jan 9, 10:59 am, Sundi wrote:
> Evaluation of printf is from right to left !!!,
>
> Regards
> Sundi
>
> On Jan 9, 10:08 am, priya mehta wrote:
>
>
>
>
>
>
>
> > int a=2;
> > printf("%d %
Evaluation of printf is from right to left !!!,
Regards
Sundi
On Jan 9, 10:08 am, priya mehta wrote:
> int a=2;
> printf("%d %d %d",a,a,a++);
> the output is 3 3 2
> can someone tell the logic behind this?
--
You received this message because you are subscribed to the Google Groups
"Algorith
12 matches
Mail list logo