made to greet you, when you input your name or use the arguments
This commit is contained in:
parent
1d2252278a
commit
eb68031c14
4 changed files with 17 additions and 3 deletions
BIN
hello_world
BIN
hello_world
Binary file not shown.
|
|
@ -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
BIN
hello_world_scanf
Normal file
Binary file not shown.
10
hello_world_scanf.c
Normal file
10
hello_world_scanf.c
Normal 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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue