T
tmp123
fidlee said:Thanks for answering this question.That brings up my next question.
What is the significance of argv and argc in main() ?
Hi,
A full declaration of main is:
int main (int argc, char *argv[]);
That means:
1) main returns an integer. How the operating system, the caller shell,
or any caller interprets this result, is specific of the aplication.
2) The second parameter is an array of pointers to chars, or, in usual
language, an array of strings. Each item of the array is one parameter
of the call to the program. The number of used elements in the array is
stored in argc. The first element is typically the program name.
For example, if in a shell console you execute program "foo" typing:
foo 1 hello
means argc=3, argv[0]="foo", argv[1]="1", argv[2]="hello"
Kind regards.