I'm new in c programming. I'm quite confused with the difference between:
int main (int argc, char **argv)
and
int main (int argc, char *argv[])
are they the same in C programming?
I'm new in c programming. I'm quite confused with the difference between:
int main (int argc, char **argv)
and
int main (int argc, char *argv[])
are they the same in C programming?
Yes they are the same, when part of a function parameter list.
The specifics are that char* argv[]
actually declares an array of unknown size, where each item in the array is a pointer. But whenever an array declaration appears as part of a function parameter list, it gets silently replaced by a pointer to the first element.
The first element of an arrar of char*
is of course of type char*
, so therefore a pointer to the first element would be type char**
.