forked from BMSTU_MAGISTRATE_FIRST_SEMESTER/TRPO_2_lab
Move the ask name code into its own function and file
This commit is contained in:
10
askname.c
Normal file
10
askname.c
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
void askname(char *first, char *last)
|
||||
{
|
||||
printf("Enter your first name: ");
|
||||
fgets(first, 255, stdin);
|
||||
first[strlen(first)-1] = '\0'; /* remove the newline at the end */
|
||||
printf("Now enter your last name: ");
|
||||
gets(last); /* buffer overflow? what's that? */
|
||||
}
|
||||
Reference in New Issue
Block a user