home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!munnari.oz.au!bruce.cs.monash.edu.au!monu6!escargot!goanna!ok
- From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe)
- Newsgroups: comp.std.c
- Subject: Re: reg
- Message-ID: <15873@goanna.cs.rmit.oz.au>
- Date: 10 Nov 92 04:14:21 GMT
- References: <1992Nov5.104151.1038@dct.ac.uk>
- Organization: Comp Sci, RMIT, Melbourne, Australia
- Lines: 27
-
- In article <1992Nov5.104151.1038@dct.ac.uk>, mcsbc2gw@dct.ac.uk writes:
- > Does anyone know how to pass the address of an array of structs, to a scanf
- > statement without it returning a NULL pointer assignment.
-
- I guess "a scanf statement" means "an expression which is a call to scanf()".
- I don't know what it means "to return a NULL pointer assignment".
- But most of alll, I don't understand why anyone would _try_ to pass the
- address of an array of structs to scanf(). There is nothing that scanf()
- could possibly do with it. What kinds of arguments does scanf() want?
- Apart from the format control string, which is const char *,
- there are two kinds of arguments:
- pointers to (arrays of) characters for %c, %s, and %[
- pointers to SINGLE NUMBERS for the other formats.
- Plauger&Brodie 1989 has a nice table on p115, "Scan Format Specifiers".
-
- If you have
- struct foo {int i; float f;} arr[10];
- it might make sense to pass
- &arr[k].i
- or &arr[k].f
- but never (arr) on its own.
-
- > Please can anyone help me? I am no novice to C
- With the utmost possible respect, the wording of the question makes me doubt
- this assertion. Why not post a larger fragment of the code, and post it to
- comp.lang.c?
-
-