Path: utzoo!attcan!uunet!ginosko!aplcen!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: Probably an easy or dumb question Message-ID: <10697@smoke.BRL.MIL> Date: 10 Aug 89 15:16:18 GMT References: <1949@leah.Albany.Edu> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 17 In article <1949@leah.Albany.Edu> rds95@leah.Albany.Edu (Robert Seals) writes: >int d[4]; >scanf("%d %d %d %d", d); Since the array name "d" is converted to "pointer to element d[0]" before being passed to scanf(), the question answers itself. d[0] is a single int. scanf() can't tell the difference between ways of producing pointers-to-int that it is fed as arguments; they all look the same to it. >I guess the question is whether "scanf" uses the format string or >the number of arguments to determine how many thingies to convert. The format string and the input data determine how many items scanf() actually converts. Correct usage requires that you provide one pointer argument for each potentially converted item, i.e. the remaining arguments must exactly correspond to the format string.