Here is source code of the C Program to Print the Program Name and All its Arguments. The C program is successfully compiled and run on a Linux system. The program output is also shown below.
* C Program to Print the Program Name and All its Arguments
void main(int argc, char *argv) /* command line Arguments */
for (i = 0;i < argc;i++)
printf("%s ", argv[i]); /* Printing the string */
$ cc arg9.c $ a.out this is c class by sanfoundry a.out this is c class by sanfoundry
Sanfoundry Global Education & Learning Series – 1000 C Programs.