I'm studying for my final exam and I have the following code example:
#include <iostream>
using namespace std;
int* f(int *i) {
(*i)--;
return i;
}
void main() {
int a;
int b = 2019;
a = (*f(&b))--;
printf("%d\n", a);
printf("%d\n", b);
}
When I print the values, a = 2018 and b = 2017. Why is that? Why a get 2018 and after that b gets --?