Mail Archives: djgpp/1997/07/20/01:40:18
Robert Herrick wrote:
> ... the gets(), scanf("%c", &character) and
> scanf("%s", &string) get missed. ...
I don't know why the first two wouldn't work (unless you aren't pressing
enter after typing the string for the first one or the character for the
second), but the second form should not work in either UNIX or DOS. You
don't put an & before a string passed to scanf(). This is because, as a
string is a char array, the value of the string arrary name itself
contains the location of the string array because it is actually a
pointer. Putting an & before the array name returns a pointer to the
location of a pointer to the string. To scanf() a string, you would use
scanf("%s", string);
>
>
> Thanks,
> Robert Herrick
-- Adam Chlipala
chilip AT ptd DOT net
ICQ UIN: 489166
Aanigo Software Productions
http://www.dragonfire.net/~psi/aanigo/
- Raw text -