Mail Archives: djgpp/2003/08/27/23:00:15
"DJ Delorie" <dj AT delorie DOT com> wrote in message
news:200308280125 DOT h7S1PFP5020856 AT envy DOT delorie DOT com...
>
> > Thanks for the corrections! DJGPP's help gave no reason for the
ampersand.
>
> The very first line in the scanf documentation is:
>
> "This function scans formatted text from `stdin' and stores it in the
> variables pointed to by the arguments."
>
> The "pointed to by the arguments" should have indicated that the
> arguments are pointers, not values.
>
> In addition, the examples show:
>
> scanf("%d %d %s", &x, &y, buf);
>
> But, if you can suggest a more obvious wording, we'll listen.
>
> > From what I can grasp, the asterisk symbol means the same thing.
> > Though I have yet to really grasp the proper place(s) and form(s)
> > for its usage.
>
> Nope, asterisk is the inverse of ampersand. Ampersand takes the
> address of something, converting values into pointers that point to
> those values. Asterisks dereference pointers, turning pointers into
> the values they point to.
I appreciate your clarity on the point.
Sincerely,
Gregory D. MELLOTT
- Raw text -