home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sams Teach Yourself C in 21 Days (6th Edition)
/
STYC216E.ISO
/
mac
/
Examples
/
Day21
/
args.c
next >
Wrap
C/C++ Source or Header
|
2002-08-11
|
392b
|
21 lines
/* Accessing command-line arguments. */
#include <stdio.h>
int main(int argc, char *argv[])
{
int count;
printf("Program name: %s\n", argv[0]);
if (argc > 1)
{
for (count = 1; count < argc; count++)
printf("Argument %d: %s\n", count, argv[count]);
}
else
puts("No command line arguments entered.");
return 0;
}