c-project/C Project/C Project/main.c
void prompt_user(char *buf, int n, const char *format, ...) {

	/* print the prompt */
	va_list args;
	va_start(args, format);
	printf("%s: ", chatbot_botname());
	vprintf(format, args);
	printf(" ");
	va_end(args);
	printf("\n%s: ", chatbot_username());

	/* get the response from the user */
	fgets(buf, n, stdin);
	char *nl = strchr(buf, '\n');
	if (nl != NULL)
		*nl = '\0';
}
/*
 * Prompt the user.
 *
 * Input:
 *   buf    - a buffer into which to store the answer
 *   n      - the maximum number of characters to write to the buffer
 *   format - format string, as printf
 *   ...    - as printf
 */
Prompt the user.

buf    - a buffer into which to store the answer
n      - the maximum number of characters to write to the buffer
format - format string, as printf
- as printf
Prompt the user . buf - a buffer into which to store the answer n - the maximum number of characters to write to the buffer format - format string as printf - as printf
void prompt_user(char *buf, int n, const char *format, ...) {
	va_list args;
	va_start(args, format);
	printf("%s: ", chatbot_botname());
	vprintf(format, args);
	printf(" ");
	va_end(args);
	printf("\n%s: ", chatbot_username());
	fgets(buf, n, stdin);
	char *nl = strchr(buf, '\n');
	if (nl != NULL)
		*nl = '\0';
}
void prompt_user ( char * buf , int n , const char * format , ... ) { va_list args ; va_start ( args , format ) ; printf ( " " , chatbot_botname ( ) ) ; vprintf ( format , args ) ; printf ( " " ) ; va_end ( args ) ; printf ( " \n " , chatbot_username ( ) ) ; fgets ( buf , n , stdin ) ; char * nl = strchr ( buf , ' \n ' ) ; if ( nl != NULL ) * nl = ' \0 ' ; }
Prompt the user.
Prompt the user .
/* print the prompt */ /* get the response from the user */