Pointer to console arguments

As a C newbie, it's hard for me to understand the following:

 int main(int argc, char *argv[]) {
     char **inputs = argv + 1;

char ** Inputs is a pointer to char * argv [], which is also a pointer, right? But why should I add a +1 at the end? Will this be extra space for the character '\ 0'?

+4
source share
4 answers

argv [0], or the first argument, is a string containing the name of your program.

+4
source

argv [0] is the program you are currently running
argv [1+] - arguments passed to the program.
Perhaps this is not the best link: https://www.gnu.org/software/gawk/manual/html_node/ARGC- and-ARGV.html

+3
source

, , . , , , main, . . :)

+1

"+1" , . , , argv. argv (char* C), ( ). , argv + 1 &argv[1].

, argv - . , ,

+1

Source: https://habr.com/ru/post/1570062/


All Articles