basic question.
why in the printf statement we have the variable and in the scanf we have the address of the variable.
is there a reason behind this?
Printable View
basic question.
why in the printf statement we have the variable and in the scanf we have the address of the variable.
is there a reason behind this?
printf only needs a copy of the values.
scanf needs the address so it can make a change to the variables
Because scanf() needs to write answers back into those variables, so it needs to know where to store the answers
printf() doesn't know about the variables at all, it only knows about the values passed as parameters.
ok, so printf is given the bare minimum.
thanks, that make sense