make hello take an optional argument
This commit is contained in:
11
src/main.c
11
src/main.c
@@ -1,6 +1,13 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
printf("Hello, world!\n");
|
||||
int main(int argc, char **argv) {
|
||||
const char *s = "world";
|
||||
|
||||
if (argc > 1) {
|
||||
s = (const char*) argv[1];
|
||||
}
|
||||
|
||||
printf("Hello, %s!\n", s);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user