On 1/18/07, mohaghghy <[EMAIL PROTECTED]> wrote:

--- In [email protected], "malaram kumhar" <[EMAIL PROTECTED]> wrote:
>
> How does this expression could be solve and what is the value of a and
> b?
>  int a=13;
> b=++a + ++a;
>
30
1 ++ & ++ -> a = 15


That's one interpretation allowed by compilers, yes. It's not the only one.
The compller could quite legitimately calculate both ++a's as 14 and come up
with  the result of 28. And it'd still be right. The whole expression is
undefined, and thus any answer is right.

2 +
3 a + a -> 15 + 15
4 b = 30



--
PJH

Some people, when confronted with a problem, think "I know, I'll use regular
expressions." Now they have two problems.
—Jamie Zawinski, in comp.lang.emacs

Reply via email to