5 Commits

Author SHA1 Message Date
DeOwl
72eb70edbc TFork commit # 2 2026-09-09 17:10:30 +03:00
DeOwl
127af1b85e Fork commit 1 2026-09-09 17:09:53 +03:00
DeOwl
6b91325623 Move the ask name code into its own function and file 2026-09-09 16:47:55 +03:00
DeOwl
c07b87f2c2 Merge branch 'lastname' into main
# Conflicts:
#    main.c
2026-09-09 16:31:45 +03:00
DeOwl
b9d64d63e9 Use proper grammar. 2026-09-09 16:27:15 +03:00
3 changed files with 16 additions and 7 deletions

10
askname.c Normal file
View 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? */
}

1
askname.h Normal file
View File

@@ -0,0 +1 @@
void askname(char *first, char *last);

12
main.c
View File

@@ -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
}