Hi,

I have a very simple C program which will run in UNIX. When i am passing * as 
the command line argument, i am gettig the below output.

Program:
#include <stdio.h>
#include "mylibrary.h"

int **environ;

int main(int argc,char *argv[])
{
        int i;
        printf("\nHello World");
        printf("\nNumber of arguments: %d\n",argc);

        for(i=0;i<argc;i++)
        {
                printf("\nArgument # %d is: %s\n",i,argv[i]);
        }

        return 1;
}

Compile:
cc hello.c -o hello

Run:
../hello *

Output:
Hello World
Number of arguments: 5

Argument # 0 is: ./hello

Argument # 1 is: hello

Argument # 2 is: hello.c

Argument # 3 is: mylibrary.h

Can somebody please explain me what is the exact reason of this output.

Thanks
Sudipta.



      

[Non-text portions of this message have been removed]

Reply via email to