delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/08/27/23:00:15

From: "Kenton W. Mellott" <melken AT co DOT tds DOT net>
Newsgroups: comp.os.msdos.djgpp
References: <HfZ2b.3213$cQ1 DOT 755278 AT kent DOT svc DOT tds DOT net> <hO%2b.16285$8i2 DOT 341 AT newsread2 DOT news DOT atl DOT earthlink DOT net> <tHc3b.3480$cQ1 DOT 829301 AT kent DOT svc DOT tds DOT net> <200308280125 DOT h7S1PFP5020856 AT envy DOT delorie DOT com>
Subject: Re: Simple program. Strange results.
Lines: 37
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <F7e3b.3490$cQ1.838461@kent.svc.tds.net>
Date: Thu, 28 Aug 2003 02:52:21 GMT
NNTP-Posting-Host: 69.21.9.124
X-Complaints-To: abuse AT tds DOT net (TDS.NET Help Desk 1-888-815-5992)
X-Trace: kent.svc.tds.net 1062039141 69.21.9.124 (Wed, 27 Aug 2003 21:52:21 CDT)
NNTP-Posting-Date: Wed, 27 Aug 2003 21:52:21 CDT
Organization: TDS.NET Internet Services www.tds.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019