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>
|
#include <stdio.h>
|
||||||
|
|
||||||
int main(void) {
|
int main(int argc, char **argv) {
|
||||||
printf("Hello, world!\n");
|
const char *s = "world";
|
||||||
|
|
||||||
|
if (argc > 1) {
|
||||||
|
s = (const char*) argv[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Hello, %s!\n", s);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user