On Sun, Mar 1, 2009 at 3:59 PM, ruhatadiyaman
<[email protected]> wrote:
> as i said i started C from Deitel and i wrote some examples from book.
> there was a example about function scanf.
> i write it as scanf("%d", var);  and then compiled. but it runs
> windows gives error, and stop the program.
> then i look in web so i see &.
> when i write the code as scanf("%d", &var);
> and it works
> my question; why it needs &

scanf() requires the address of the variable in which to place the
number, not the value of that variable. & returns the address.

> and why is there not & in the book?

Typo most likely.

-- 
PJH

http://shabbleland.myminicity.com/tra
http://www.chavgangs.com/register.php?referer=9375

Reply via email to