Main () Primary function
Every C program must have a main () function that can be placed somewhere in the program according to your hobby. Some programmers put it first, while others put it on the last side, no matter where it is, the following instructions are appropriate.
1.main () parameter
During the turbo C2.0 boot process, pass the main () function three parameters: ARGC, argv, and Env.
* ARGC: Integer, for the number of command line arguments passed to main ().
* argv: Array of strings.
In the DOS 3.X version, argv[0] is the full path name for the program to run; To DOS 3.0
The following version, Argv[0] is an empty string ("").
ARGV[1] is the first string after the execution of the program name on the DOS command line;
ARGV[2] is the second string after the execution of the program name;
...
ARGV[ARGC] is null.
*env: An Fu string array. Every element of env[] contains characters of envvar=value form
String. Where Envvar is an environment variable such as path or 87. Value is envvar corresponding to C:\DOS, C:
\TURBOC (for path) or Yes (for 87).
Turbo C2.0 always passes these three parameters to the main () function when it is started, and can be used in the user program
Descriptions (or not) of them, and if some (or all) of the parameters are described, they become main () subroutines
The local variable.
Please note that once you have indicated these parameters, you must press ARGC, ARGV, env order, as follows
Examples of:
Main ()
Main (int argc)
Main (int argc, char *argv[])
Main (int argc, char *argv[], char *env[])
The second of these is legal, but not common, because there are very few argc in the program, not
In the case of argv[].