I believe scanf looks a bit like this:
Code:
int scanf(int* bird) {
// read input stream
// save next int into variable bird
// return number of items read
}
while printf for example looks a bit like this:
Code:
int printf(int bird) {
// print bird variable
// return number of characters
}
A quick note: If you don't understand the return values of these functions, they don't apply to your question, so you can ignore that part.
If a function is called that is to save data into a variable which survives the scope of the function, the address of that variable is required. printf doesn't need an address of a variable because it only needs a value to print.
If the function scanf didn't receive a pointer to a variable and it only received the value, it wouldn't know where to save that value.
In code form, if scanf looked like this:
Code:
int scanf () {
int bird;
// read input stream
// save next int into variable bird
// return number of items read
}
bird could not be used outside of the scanf function.
And if scanf looked like this:
Code:
// read bird from input stream
int scanf (int bird) {
int value;
// save bird into variable value
// return ???
}
well, if you are being relied upon to direct a value of the input stream into the variable bird prior to a scanf call, what is the point of scanf anyway?
I did honestly try to simplify this a bit to get across the answer to your question. I used comments instead of real code and ignored the formatting portion of the functions.