main (int ac, char * of[])和 main(int argc,char *argv[]) Of some of my understanding

Observance of the whereabouts of the 100th article,,,Although the content is somewhat illegible

Yesterday, see route on the main (int argc,char *argv[]) The article feels written brief said such a function

Of course first contact functions of this function is not the main (int argc,char *argv[]) But the main (int AC, char * of[])

They use the same。

Every c program must have a main function,As the beginning of program。When a program is executed,Command line parameters (resolved via the shell) provided through two main functions,First int type (argc, or AC) represents the number of command line parameters。Second char pointer of type array parameters (*AV[]Or *argv[]) Is a pointer to a command line argument array。And (*AV[]Or *argv[]) List ends with NULL for the pointer in argv [argc]For NULL

Here a small program to increase your understanding of this

Original article written by LogStudio:R0uter's Blog » main (int ac, char * of[])和 main(int argc,char *argv[]) Of some of my understanding

Reproduced Please keep the source and description link:https://www.logcg.com/archives/502.html

About the Author

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *