0

What am i doing here?

... void func(int &x){ x+=1; } int *CheckCondition(void(*tem)(int&)){ int *a = new int; *a = 3; tem(*a); ... CheckCondition(func); ... Can you please tell me what am i passing here: tem(*a) Is it a value to a reference?🤔

11th Oct 2018, 6:21 PM
Oleg Storm
Oleg Storm - avatar
1 Resposta
+ 1
You end up passing the heap address that contains the 3 so it can be changed to 4.
11th Oct 2018, 10:10 PM
John Wells
John Wells - avatar