Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #99101

Re: scanf design

From "Bill Cunningham" <nospam@nspam.invalid>
Newsgroups comp.lang.c
Subject Re: scanf design
Date 2016-12-12 13:18 -0500
Organization A noiseless patient Spider
Message-ID <o2mpi6$4tb$1@dont-email.me> (permalink)
References <o2kh5p$e5q$1@dont-email.me> <96650663-827e-4f89-b78f-7b42a2516ef3@googlegroups.com>

Show all headers | View raw


"Malcolm McLean" <malcolm.mclean5@btinternet.com> wrote in message 
news:96650663-827e-4f89-b78f-7b42a2516ef3@googlegroups.com...
> On Sunday, December 11, 2016 at 9:42:45 PM UTC, Bill Cuningham wrote:
>> I have notice over time, and the last few days I have been thinking
>> about this in particular. scanf's design. It wants the value of the
>> address a pointer points to. Hum now I notice many functions want
>> a pointer's address. But not so many an address pointed at.
>>
> No, it's rare. Normally we pass in values, either directly or via
> arrays, and get the results back either in the function's return
> type or in a buffer.
> So normally pointers are named variables that point to buffers
> of several values.
>
>
> But scanf is a bit unusual in that it returns a flexible number of
> values of flexible type. So you see the & operator used heavily.
> It's relatively rare to see the & operator used in most code.

In the manual it speaks of "pointer arguments". Now a dumb ass like me isn't 
going to be too sure of what that means. And it takes scanf(const char 
*format,...) and the ellipsis. Variable arguments.

    I know I am responding to you Malcom but this is for anyone to answer. 
Is '&' not always used? it's all I've seen used. Very useful function.

Bill

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

scanf design "Bill Cuningham" <nospam@nspam.invalid> - 2016-12-11 16:42 -0500
  Re: scanf design Noob <root@127.0.0.1> - 2016-12-11 22:55 +0100
    Re: scanf design "Bill Cuningham" <nospam@nspam.invalid> - 2016-12-11 17:03 -0500
  Re: scanf design Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-11 22:05 +0000
  Re: scanf design Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-11 14:43 -0800
    Re: scanf design "Bill Cunningham" <nospam@nspam.invalid> - 2016-12-12 12:25 -0500
      Re: scanf design Keith Thompson <kst-u@mib.org> - 2016-12-12 11:15 -0800
        Re: scanf design Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-12 13:17 -0800
          Re: scanf design Keith Thompson <kst-u@mib.org> - 2016-12-12 14:02 -0800
            Re: scanf design Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-12 15:06 -0800
              Re: scanf design fir <profesor.fir@gmail.com> - 2016-12-12 15:58 -0800
                Re: scanf design fir <profesor.fir@gmail.com> - 2016-12-12 16:10 -0800
                Re: scanf design fir <profesor.fir@gmail.com> - 2016-12-12 16:10 -0800
                Re: scanf design fir <profesor.fir@gmail.com> - 2016-12-12 16:22 -0800
                Re: scanf design fir <profesor.fir@gmail.com> - 2016-12-15 07:30 -0800
                Re: scanf design fir <profesor.fir@gmail.com> - 2016-12-15 07:56 -0800
                Re: scanf design fir <profesor.fir@gmail.com> - 2016-12-15 08:21 -0800
    Re: scanf design "Bill Cunningham" <nospam@nspam.invalid> - 2016-12-12 13:18 -0500
      Re: scanf design Keith Thompson <kst-u@mib.org> - 2016-12-12 11:37 -0800

csiph-web