prefix and postfix operators in C

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • annavalliara
    New Member
    • Aug 2013
    • 1

    prefix and postfix operators in C

    Code:
    int a=5,b;
    b=++a * a++;
    printf("a is %d" ,a);
    printf("b is %d" , b);
    what is the output here?
    what is the value of 'a' in the first and second place in
    b = ++a * a++; ?
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    No one can tell what the output is.

    The rules allow the compiler to obtain the values of variables in any order within a statement. You may think they should go left to right but that's just you.

    Do not change the value of a variable more than once in statement.

    Comment

    Working...