본문 바로가기

C Programing

main function arguments

[leechul@~/C_Study]leechul cat 013-main-arg.c

int main(int argc, char *argv[])



{

        int i;



        printf("argc = %d\n",argc);



        for(i = 0; i < argc; i++)

        {

                printf("argv[%d] = %s\n", i, argv[i]);

        }



        return 0;

}



[leechul@~/C_Study]leechul ./013-main-arg.o hello world "hello world" test

argc = 5

argv[0] = ./013-main-arg.o

argv[1] = hello

argv[2] = world

argv[3] = hello world

argv[4] = test

'C Programing' 카테고리의 다른 글

multiple-source-files  (0) 2013.12.08
typedef  (0) 2013.12.08
structure  (0) 2013.12.08
function pointer  (0) 2013.12.08
array  (0) 2013.12.08