what does asterisk(*++argv) mean?
void main (int argc, char *argv[])
{
while (--argc)
{
printf ("%s\n", *++argv);
}
}
what does asterisk(*++argv) mean?
void main (int argc, char *argv[])
{
while (--argc)
{
printf ("%s\n", *++argv);
}
}
here argv is a pointer to a pointer of char type
*argv points to the first argument string in the argv array, which is same as argv[0], similarly *(argv + 1) and argv[1] point to second argument string and so on..
argv stands for argument vector and it holds argc + 1(int - argument count and the last one is NULL by default.) number of elements. Like in the char arrays, first element of the argument vector holds the address for the whole argument vector. So, by passing argument vector pointer (*argv[]), program gets the char typed parameters when main function is called.
To see how to get argument vector parameters and use them please check out this answer.