What book did you get that from? The code is awful.
Anyway, looks like you're not explicitly adding a \0 to terminate the string -- maybe one can rely on an array to be initialized with zeroes, but that's pretty sloppy. The code in general is unnecessarily complicated for what little it does.
For example, this does the job:
I think the best solution to your problem is to get a better book.
#define LENGTH 15
char *p, string[LENGTH];
printf("Whats your name? ");
fgets (string, LENGTH, stdin);
if ((p = strchr (string, '\n')) != NULL)
*p = '\0';
printf("Darn glad to meet you, %s!\n", string);