/* CpSc 215 Example: "Hello" program */ /* ** This program is a variation of the standard "hello world" program, ** and it is intended only to illustrate some of the most basic ** characteristics of C programs. ** ** The program prompts for a user's name and then prints a greeting ** using that name. The name cannot contain any blanks. */ #include #include #define MAX_NAME_LENGTH 20 /* maximum number of characters in a name */ int main(void) { char name[MAX_NAME_LENGTH+1]; /* the input name */ /* Prompt for and read the user's name. */ printf("\nEnter your name (no blanks): "); scanf("%s", name); /* Print the greeting and exit. */ printf("\nHello, %s!\n", name); printf("Goodbye!\n\n"); return EXIT_SUCCESS; }