51 C Program to Print the Program Name and All its Arguments
Posted by Superadmin on December 24 2015 02:20:08
This C Program Prints the Program Name and All its Arguments.
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
*/
#include <stdio.h>
void main(int argc, char *argv[]) /* command line Arguments */
{
int i;
for (i = 0;i < argc;i++)
{
printf("%s ", argv[i]); /* Printing the string */
}
printf("\n");
}
$ cc arg9.c
$ a.out this is c class by sanfoundry
a.out this is c class by sanfoundry