function arguments reversed

Hello, insteresting stuff happened today :

byte n;
byte get(){
    n++;
    return n;
}
void p(byte a,byte b){
    Serial.println(a);
    Serial.println(b);
}
void setup(){
    Serial.begin(9600);
    p(get(),get());
}
void loop(){}

Code prints 1 2 on computer, but 2 1 on arduino. Spend some funny time with this xD

Cheers JirkaJ

Not unexpected. It’s a well-known “undefined” order-of-evaluation of function arguments.

Hmm .. new thing to me. Thank you for this info.

More details: https://en.cppreference.com/w/c/language/eval_order