Exforsys
+ Reply to Thread
Results 1 to 2 of 2

auto-increment!! help!

This is a discussion on auto-increment!! help! within the C and C++ forums, part of the Programming Talk category; int c=6; b=c++ - --c*c++; printf("%d%d",c++ - --c*c++,b); there is a difference in th output how it that?? can u ...

  1. #1
    chaisen2006 is offline Junior Member Array
    Join Date
    Nov 2006
    Answers
    3

    Unhappy auto-increment!! help!

    int c=6;
    b=c++ - --c*c++;
    printf("%d%d",c++ - --c*c++,b);
    there is a difference in th output how it that?? can u help plzz!!


  2. #2
    zsk_00 is offline Member Array
    Join Date
    May 2006
    Answers
    37
    int c=6;
    b=c++ - --c*c++;
    b= 6 - (7-1) * 6; // now c=7

    in printf function, you are starting with c=7. When you calculated b, you started with c=6


Latest Article

Network Security Risk Assessment and Measurement

Read More...