Q:

What happens when a parameter is passed with the -- operator?

i came across following code in Java:
public static void foo (int a, int b) {
    System.out.println("a: " + a);
    System.out.println("b: " + b);
}

public static void main(String[] args) {
    int c = 1;
    foo(c--, c);
    System.out.println("c: " + c);
//The output is:
//a: 1
//b: 0
//c: 0

Could someone please explain, why that is? I would have guessed it the other way round that only the first print-statement would be affected by c--. But if it did permanently change c's value why is the first print line still printed 1?

A:

You can increment by using ++c or c++, similarly, you can decrement by using --c or c--
for ++c and --c, you're effectively telling Java "Change the value, then do something with the new value"
for c++ and c--, you're telling java "Load the value, then change it".
Now, that explains why A is 1, and C is 0.  But why is B also 0?
When you call a function, the arguments are resolved in order.  Usually this is only relevant if you're passing the direct results of a method as an argument.
for example, calling
methodX( methodY(), methodZ())
where the method signatures are
void methodX(int a, int b); int methodY(); and int methodZ();, then method Y will execute before Z, which executes before X.

