If I may expand slightly on Sylvar's excellent writeup:

I dunno about this factorial thing; it looks scary to me. But in C, C++, JavaScript, Java, awk, and a thousand thousand other slimy languages, ! is the boolean negation operator:

    ! TRUE == FALSE
    ! FALSE == TRUE

Other unary operators in all or most of those languages include (but might not be limited to, depending on how porous that lump of useless gray fat rolling around between my ears has become):

~ (tilde): Bitwise complement: ~ 0x0f == 0xfffffff0. Each of the bits is flipped. It's very handy for making bit masks.

Unary -: Makes its operand negative.

Unary +: Makes a negative operand negative, or a positive operand positive. In other words, it does nothing. It was introduced to C by the ANSI standard committee, purely for the sake of symmetry with the unary - operator. I am not making this up.

--: Decrement.


In C, C++, awk, and a few of the others, the increment and decrement operators can appear either before or after the operand. If they appear after, the expression returns the value of the operand before incrementing (or decrementing); if they appear before, the expression returns the value of the operand after it was changed. These are called "post-increment"/"post-decrement" and "pre-increment"/pre-decrement", respectively.

Hence:

    int i = 4;
    int j;

    j = i++;    //  i == 5, j == 4: assignment before increment of i
    j = ++i;    //  i == 6, j == 6: assignment after increment of i