Wondering if anyone can help explain why, in the following code, passing a unary operator on a variable changes the initialized val of variable in main(), but passing arithmetic operator does not?
Code:
#include <stdio.h>
void displayParam(int a)
{
printf("\nInt variable a: %d\n", a);
}
int main(void)
{
int a = 0;
displayParam(a+1);
printf("val of a in main (unchanged from initialization) is %d\n",a); //a still = 0:
displayParam(a++);
printf("val of a in main (now changed from initialization val) is %d\n",a); //a now = 1
return 0;
}