Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!network!sdcsvax!ucsdhub!hp-sdd!hplabs!hpl-opus!hpnmdla!hpmwtd!jeffa
From: jeffa@hpmwtd.HP.COM (Jeff Aguilera)
Newsgroups: comp.lang.c
Subject: Re: Probably an easy or dumb question
Message-ID: <680006@hpmwjaa.HP.COM>
Date: 10 Aug 89 22:59:58 GMT
References: <1949@leah.Albany.Edu>
Organization: HP Microwave Tech. - Santa Rosa, Ca.
Lines: 16

> Hello frenz, 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);
> 

No.  Use

 scanf("%d %d %d %d", d, d+1, d+2, d+3);

For each valid conversion specification other than %%, at least one pointer 
is consumed from the stack.  You pass one pointer, but ask for four 
conversions.  Expect a hung system or dumped core, depending upon available
memory protection.