/* strings.c (11th chapter) -- stringing the user along
   GCC's linker complains about gets() being dangerous. Be careful.
 */
#include <stdio.h>
// a symbolic string constant
#define MSG "You must have many talents. Tell me some"
#define LIM 5
// maximum string length + 1
#define LINELEN 81

int main(void)
{
	char name[LINELEN];
	char talents[LINELEN];
	int i;
	
	/* initializing a dimensioned char array */
	const char m1[40] = "Limit yourself to one line's worth.";
	/* letting the compiler compute the array size */
	const char m2[] = "If you can't think of anything, fake it.";
	/* initializing a pointer */
	const char * m3 = "\nEnough about me -- what's your name?";
	/* initializing an array of string pointers
	   array of 5 pointers */
	const char * mytal[LIM] = {
		"Adding numbers swiftly",
		"Multiplying accurately",
		"Stashing data",
		"Following instructions to the letter",
		"Understanding the C language"
	};
	
	printf("Hi! I'm Clyde the Computer. "
	       "I have many talents.\n");
	printf("Let me tell you some of them.\n");
	puts("What were they? Ah, yes, here's a partial list.");
	for (i = 0; i < LIM; i++)
		// print list of computer talents
		puts(mytal[i]);
	puts(m3);
	gets(name);
	printf("Well, %s, %s\n", name, MSG);
	printf("%s\n%s\n", m1, m2);
	gets(talents);
	puts("Let's see if I got that list:");
	puts(talents);
	printf("Thanks fot the information, %s.\n", name);
	
	return 0;
}
