The full form of this is:
char* argv[];
Where argv is a pointer to a null-terminated array of null-terminated strings.
We use this type of argument to pass command line switches to the main function:
int main (char * argv[], int argc);
The names of these arguments, argv and argc, are conventional. The argc argument tells us how many elements are in the argv argument, such that argv[0] is the full-qualified name of the executable and argv[argc] is the null-terminator of the array. Any and all other elements (argv[n], such that 0<n<argc) represent programmer-defined command-line switches.
pick one: int main (void); int main (int argc, char **argv); int main (int argc, char **argv, char **envp);
'argc' and 'argv' in this line: int main (int argc, char **argv)
For a 'C' program, the main routine must be on of these:int main (void)int main (int argc, char ** argv)int main (int argc, char ** argv, char **envp) /* on some platforms */
Because we usually don't call it from the program, but if we do, you should have a prototype: int main (int argc, char **argv); int foobar (const char *progname) { char *param[2]; ... param[0]= progname; param[1]= "help"; main (2, param); ... } int main (int argc, char **argv) { ... foobar (argv[0]); ... }
This 'question' is not a question, but here you are. int main (int argc, char **argv) { printf ("argc=%d argv=%p\n", argc, argv); return 0; }
If you mean pointers referring pointers then here you are: int main (int argc, char **argv) { printf ("argv (pointer) is %p\n", argv); printf ("*argv (pointer) is %p "%s"\n", *argv, *argv); printf ("**argv (char) is %c\n", **argv); return 0; }
pick one: int main (void); int main (int argc, char **argv); int main (int argc, char **argv, char **envp);
'argc' and 'argv' in this line: int main (int argc, char **argv)
argv, which is the second parameter of function mainint main (int argc, char *argv[])
The full form of this is: char* argv[]; Where argv is a pointer to a null-terminated array of null-terminated strings. We use this type of argument to pass command line switches to the main function: int main (char * argv[], int argc); The names of these arguments, argv and argc, are conventional. The argc argument tells us how many elements are in the argv argument, such that argv[0] is the full-qualified name of the executable and argv[argc] is the null-terminator of the array. Any and all other elements (argv[n], such that 0<n<argc) represent programmer-defined command-line switches.
minimalist: int main (void); standard: int main (int argc, char **argv); unix-only: int main (int argc, char **argv, char **envp);
int main (int argc, char **argv) { printf ("argv pointer is %p, argv[0] pointer is %p\n", argv, argv[0]); return 0; }
For a 'C' program, the main routine must be on of these:int main (void)int main (int argc, char ** argv)int main (int argc, char ** argv, char **envp) /* on some platforms */
Because we usually don't call it from the program, but if we do, you should have a prototype: int main (int argc, char **argv); int foobar (const char *progname) { char *param[2]; ... param[0]= progname; param[1]= "help"; main (2, param); ... } int main (int argc, char **argv) { ... foobar (argv[0]); ... }
This 'question' is not a question, but here you are. int main (int argc, char **argv) { printf ("argc=%d argv=%p\n", argc, argv); return 0; }
#include <stdio.h> int main (int argc, char **argv) { puts (argv[0]); return 0; }
I guess it is an 'array of pointers'. Example:int main (int argc, char *argv[])