Probably an easy or dumb question
Reinhard Foessmeier
foessmei at lan.informatik.tu-muenchen.dbp.de
Fri Aug 11 17:28:59 AEST 1989
In article <1949 at leah.Albany.Edu> rds95 at leah.Albany.Edu (Robert Seals) writes:
>...is it workable to pass only the base address of an array
>to "?scanf" and have it convert into successive memory locations?
>
>int d[4];
>
>scanf("%d %d %d %d", d);
>
>I guess the question is whether "scanf" uses the format string or
>the number of arguments to determine how many thingies to convert.
"scanf" uzas la formatan vicon; "scanf" uses the format string; it
^gi ne scias la nombron de argumentoj; doesn't know about the # of args; but
tamen via propono ne funkcias. what you propose doesn't work all the
La kawzo estas, ke "scanf" volas same. The reason is that "scanf" wants
propran adreson por ^ciu legata an address of its own for every datum
dateno. ^Car la adreso de unu read. Since the address of a single
elemento de estas distingebla de element is not distinguishable from the
la adreso de vektoro, "scanf" ne address of an array, "scanf" would be
scius kion fari el at a loss with something like
scanf(" %d %d %d", d1, d2);
d1 kaj d2 povus esti deklaritaj kiel d1 and d2 might be declared as
int d1[2], d2[1];
aw or
int d1[1], d2[2];
"scanf" absolute ne scias, kiu el "scanf" has no way of telling which of
la du deklaracio antawiris. these declarations was used.
Reinhard F\"ossmeier, Technische Univ. M\"unchen | Vivu
foessmeier at infovax.informatik.tu-muenchen.dbp.de | la gefiloj
[ { relay.cs.net | unido.uucp } ] | de niaj gepatroj!
More information about the Comp.lang.c
mailing list