Re: const char * const *argv ??

Discussion in 'C++' started by Peter van Merkerk, Aug 30, 2003.

  1. > bool __stdcall preproc(const char *user, int type, const char * const
    *argv,
    > int argc)
    >
    > the bit im interested in is the
    >
    > const char * const *argv


    That is a pointer pointing to constant-pointer pointing to const-char. Are
    you still there?

    It means that:
    1. the argv pointer cannot change the value of the pointer it is pointing
    to; *argv = 0 is not allowed.
    2. the characters cannot be changed via this pointer to a pointer; **argv =
    'a' is not allowed.

    > iv never seen somthing decleared like this before and wonder if some one
    > could explain it to me plz ?? i have a bit more info on it as follows.
    > It looks like its an array because argv[0] contains a string and argv[1]
    > also contains a string.


    You are correct.

    > if this is the case how was it made an array and is
    > there a way i could find out the size of it.


    Unfortunately there if no standard way to derive that information from argv
    itself. Maybe that size of the array can be derived from other parameters or
    maybe argv[last] == 0. You will have to ask the one who wrote that code I'm
    affraid.

    Note that in C++ this problem of passing a variable number of strings can be
    solved much more elegantly with the help of the std::vector and the
    std::string class.
    --
    Peter van Merkerk
    peter.van.merkerk(at)dse.nl
    Peter van Merkerk, Aug 30, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bret

    char **argv vs. char* argv[]

    Bret, Aug 31, 2003, in forum: C Programming
    Replies:
    21
    Views:
    4,575
    Richard Heathfield
    Sep 3, 2003
  2. David
    Replies:
    10
    Views:
    5,944
    Richard Heathfield
    Sep 15, 2003
  3. Hal Styli
    Replies:
    14
    Views:
    1,626
    Old Wolf
    Jan 20, 2004
  4. jab3

    char **argv & char *argv[]

    jab3, Dec 4, 2004, in forum: C Programming
    Replies:
    5
    Views:
    663
    Chris Torek
    Dec 8, 2004
  5. oogie
    Replies:
    9
    Views:
    655
    Default User
    Nov 18, 2007
Loading...

Share This Page