The book C for Dummies 2nd Edition is has been pretty good for me for the first three chapters, but now I got to a point where I would swear that the book has it wrong, hence me posting this.
The book is written in 2004, which is pretty new in C terms. It also recommends using GCC, which is no problem whatsoever since I'm a GNU/Linux user, so I would guess the code explained, including the examples, would be correct.
Still I can't see what I would have mistyped in this simple example:
As far as I can see I copied it character for character, still when I try to compile it through the "gcc who.c -o who" command in GCC 4.4.1 I get this error message:PHP Code:
#include <stdio.h>
int main()
{
char me[20];
printf("What is your name?");
scanf("%s",&me);
printf("Darn glad to meet you, %s!\n",me);
return(0);
}
Is this the book giving me wrong code, or did I really miss something there?who.c: In function ‘main’:
who.c:8: warning: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘char (*)[20]’