Results 1 to 4 of 4

Thread: Pointer ** <- What is this?

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2000
    Location
    Allen Park, MI, Wayne
    Posts
    39

    Pointer ** <- What is this?

    I was just looking across some code and came across this:


    const char *p1;
    char **p2;

    What the heck is p2? p1 is a pointer to a constant. Is p2 some type of pointer?

    Thx,
    Tim

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    p1 is a pointer to a character that you may not modify. This character might be the first in a string of characters.

    p2 is a pointer to a pointer to a character that you may modify.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2000
    Location
    Allen Park, MI, Wayne
    Posts
    39
    A pointer to a pointer. Lovely!

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    It's usually only used for function parameters. Let me think, there's some CRT function that uses it...

    strtol I think. Expects the address of a const char* to be passed which is then set to point to the first character that couldn't be parsed anymore.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width