The first simple compilation is explained in the previous article.ProgramNext, let's have a deeper understanding of the compilation.
3. processing parameters when running the program
Compared with DOS, it is simpler and more intuitive to call the input parameters when running the program. Because after the program starts running, all parameters are saved in oneStack, so you only need to use the pop command to obtain the required parameters. The following is an example (a program with three parameters ):
./Program Foo bar 42
The corresponding stack can be explained in the following figure.
|
Number of parameters. Note that the program name is also treated as a parameter (argc) |
Program name (argv [0]) |
The first parameter (argv [1]) |
Parameter 2 (argv [2]) |
Parameter 3 (argv [3]) (Note: Here is the string "42", not the number 42) |
|
Http://www.cin.ufpe.br /~ If817/arquivos/asmtut/index.html # intro
Thanks to Derick Swanepoel (derick@maple.up.ac.za)
)