For the following code snippets why would I use one assignment vs another? thx
void addOne(int &x)
{
x +=1;
}
void (*inc)(int &x) = addOne;
The purpose of one over the other is C compatibility. C said that functions will decay to pointers-to-functions automatically. To be compatible, C++ had to do the same.
Note that when C++ introduced a new function pointer type (member function pointers), they do not decay automatically. So if the C++ committee had their way, odds are good you'd need that &
there.