make hello take an optional argument

This commit is contained in:
2025-06-27 03:07:07 -04:00
parent 8aac5dc8b4
commit cc37fafcd0

View File

@@ -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;
}