#include<stdio.h>/* Compile: cc -g -ansi -pedantic -Wall -O2 -o command-line command-line.c *//* Run: ./command-line */intmain(intargc, char *argv[])
{
inti;
printf("This program's name is %s.\n", argv[0]);
if (argc > 1)
{
printf("This program was called with %i command-line arguments.\n", argc - 1);
printf("Here are the arguments:\n");
for (i = 1; i < argc; i++)
printf("Argument %i: %s\n", i, argv[i]);
}
else
{
printf("This program was called without any command-line arguments.\n");
}
return 0;
}