Solution for Exercise 15-1
ex1501
#include <stdio.h>
int main(int argc, char *argv[])
{
if(argc>1)
printf("Greetings, %s!\n",argv[1]);
return(0);
}
Output
Greetings, Jonah!
Notes
* The sample output (above) assumes that Jonah was typed after the program name at the command prompt.
* I wrote a program similar to this when I first learned to code. Its name was greet. I would place the command greet Dan into the computer's startup file. Each time I started my day, the screen said, "Greetings, Dan!"
Copyright © 1997-2025 by QPBC.
All rights reserved
