According to syntax postfix increment returns copy of unmodified variable (C++ == C), while prefix increment returns incremented variable (++C == C + 1).

  • Blue_Morpho@lemmy.world
    link
    fedilink
    arrow-up
    5
    ·
    edit-2
    6 hours ago

    ???

    If c = 1, then c++ = 2

    #include <iostream> using namespace std;

    int main() {

    int i = 10;

    cout << i++ << endl;

    cout << i << endl;

    }

    postfix ++ increments the variable.