Deitel books are infamous for cramming lots
and lots of info in their books. A typo here and there is certainly not out
of the question.
Most information technology books that have been published recently have an
associated web site where you can check for and report such typos in the
text. But overall Deitel books are pretty good.
Scanf reads a variable input from the user and
places it in the address of the variable that your program has declared for
that purpose. So, scanf needs the address of operator (&).
In a message dated 3/1/2009 11:01:04 A.M. Eastern Standard Time,
[email protected] writes:
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 & and why is there not & in the book?
best regards
**************You're invited to Hollywood's biggest party: Get Oscars
updates, red carpet pics and more at Moviefone.
(http://movies.aol.com/oscars-academy-awards?ncid=emlcntusmovi00000001)
[Non-text portions of this message have been removed]