made to greet you, when you input your name or use the arguments

This commit is contained in:
MarcUs7i 2024-09-26 15:54:21 +02:00
parent 1d2252278a
commit eb68031c14
4 changed files with 17 additions and 3 deletions

Binary file not shown.

View file

@ -1,6 +1,10 @@
#include <stdio.h>
int main() {
printf("Hello, World!\n");
int main(int argc, char* argv[]) {
if (argv[1] == NULL)
{
argv[1] = "World";
}
printf("Hello, %s!\n", argv[1]);
return 0;
}
}

BIN
hello_world_scanf Normal file

Binary file not shown.

10
hello_world_scanf.c Normal file
View file

@ -0,0 +1,10 @@
#include <stdio.h>
#include <string.h>
int main(int argc, char* argv[]) {
char name[64];
printf("Please enter your name: ");
scanf("%s", name);
printf("Hello, %s!\n", name);
return 0;
}