0

Output Tracing of C++ program.

How the parameter value is passing in function argument I cann't understand?

#include <bits/stdc++.h>

void call(int,int,int,int);
int main(){
  int a=10;
  call(a,a++,++a,a);
  return 0;
}
void call(int x,int y,int z,int p){
  printf("%d %d %d %d",x,y,z,p);
}

Output:12 11 12 12 But cann't understand the logic behind this.

ashik
  • 99
  • 1
  • 7

1 Answers1

0

++val will increase the value before doing the comparison.
val++ will increase the value after the comparison succeeds.
Code

Arg1 = a
Arg2 = a
a += 1
a += 1
Arg3 = a
Arg4 = a
Pickle Rick
  • 808
  • 3
  • 6