Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72eb70edbc | ||
|
|
127af1b85e | ||
|
|
6b91325623 | ||
|
|
c07b87f2c2 | ||
|
|
b9d64d63e9 |
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? */
|
||||
}
|
||||
12
main.c
12
main.c
@@ -1,13 +1,11 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "askname.h"
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char first[255], last[255];
|
||||
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? */
|
||||
printf("Hello %s %s!\n", first, last);
|
||||
askname(first, last);
|
||||
printf("Hello, %s %s!\n", first, last);
|
||||
return 0;
|
||||
// Test Commit # 1
|
||||
// Test commit # 2
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user