cscanfaddressof

Why scanf must take the address of operator


As the title says, I always wonder why scanf must take the address of operator (&).


Solution

  • Because C only has "pass-by-value" parameters, so to pass a 'variable' to put a value into, you have to pass its address (or a pointer to the variable).