post  question about argv

Chronophile (1)   Link to this post
Hello, I have a question about the char **argv array in then main function of a any C/C++ program.

I know that char* is a pointer to a string, but how does ** make it an array?

Could this syntax be used for other array types like "int *my_array" or is specific to char?



Also if I have a const vector<int>, do I need a special iterator like

const_vector<int>::iterator

or can I use a normal vector<int>::iterator ?



thanks.
Last edited on
helios (4790)   Link to this post
A char * is a pointer to an array of chars.
A char ** is a pointer to an array of pointers to arrays of chars.

Yes, the syntax can be used for anything else.
mahlerfive (119)   Link to this post
For the second question, you need to use a const_iterator.

So, vector<int>::const_iterator

This topic is archived - New replies not allowed.