Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Keith Thompson <kst-u@mib.org> |
| Newsgroups | comp.lang.c |
| Subject | Re: scanf design |
| Date | Mon, 12 Dec 2016 11:37:08 -0800 |
| Organization | None to speak of |
| Lines | 26 |
| Message-ID | <lnh969q6qj.fsf@kst-u.example.com> (permalink) |
| References | <o2kh5p$e5q$1@dont-email.me> <96650663-827e-4f89-b78f-7b42a2516ef3@googlegroups.com> <o2mpi6$4tb$1@dont-email.me> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Injection-Info | mx02.eternal-september.org; posting-host="5ae493c5c0eddd0692ad00c7942bf15f"; logging-data="16089"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19g71AOeGqoZewV+E9w/z9l" |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
| Cancel-Lock | sha1:Qi1p15lbnm2zUy+Aw0EyEFReCLA= sha1:S2i2KKQaphNpi7y/o4ap4yBjVnA= |
| Xref | csiph.com comp.lang.c:99118 |
Show key headers only | View raw
"Bill Cunningham" <nospam@nspam.invalid> writes:
> "Malcolm McLean" <malcolm.mclean5@btinternet.com> wrote in message
> news:96650663-827e-4f89-b78f-7b42a2516ef3@googlegroups.com...
[...]
>> 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.
Most scanf format specifies require a corresponding argument of some
specific pointer type. Let's say it's FOO* (where FOO could be char,
int, double, or whatever). One way to obtain the required value of type
FOO* is to apply the unary & operator to the name of an object of type
FOO. There are other ways that don't require the use of unary &.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Back to comp.lang.c | Previous | Next — Previous in thread | Find similar | Unroll 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