Give a personalized hello

This commit is contained in:
DeOwl committed 2026-09-09 16:20:50 +03:00
1 parent e9a41100a0
commit ec2323c0c3
1 file changed
+6 -1
+6 -1
View File
@@ -1,6 +1,11 @@
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv)
{
printf("Hello world!\n");
char name[255];
printf("Enter your name: ");
fgets(name, 255, stdin);
name[strlen(name)-1] = '\0'; /* remove the newline at the end */
printf("Hello %s!\n", name);
return 0;
}