Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 193919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:33:04+00:00 2026-05-11T16:33:04+00:00

I understand having one asterisk * is a pointer, what does having two **

  • 0

I understand having one asterisk * is a pointer, what does having two ** mean?

I stumble upon this from the documentation:

- (NSAppleEventDescriptor *)executeAndReturnError:(NSDictionary **)errorInfo
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T16:33:04+00:00Added an answer on May 11, 2026 at 4:33 pm

    It’s a pointer to a pointer, just like in C (which, despite its strange square-bracket syntax, Objective-C is based on):

    char c;
    char *pc = &c;
    char **ppc = &pc;
    char ***pppc = &ppc;
    

    and so on, ad infinitum (or until you run out of variable space).

    It’s often used to pass a pointer to a function that must be able to change the pointer itself (such as re-allocating memory for a variable-sized object).

    =====

    Following your request for a sample that shows how to use it, here’s some code I wrote for another post which illustrates it. It’s an appendStr() function which manages its own allocations (you still have to free the final version). Initially you set the string (char *) to NULL and the function itself will allocate space as needed.

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    
    void appendToStr (int *sz, char **str, char *app) {
        char *newstr;
        int reqsz;
    
        /* If no string yet, create it with a bit of space. */
    
        if (*str == NULL) {
            *sz = strlen (app) + 10;
            if ((*str = malloc (*sz)) == NULL) {
                *sz = 0;
                return;
            }
            strcpy (*str, app);
            return;
        }
    

     

        /* If not enough room in string, expand it. We could use realloc
           but I've kept it as malloc/cpy/free to ensure the address
           changes (for the program output). */
    
        reqsz = strlen (*str) + strlen (app) + 1;
        if (reqsz > *sz) {
            *sz = reqsz + 10;
            if ((newstr = malloc (*sz)) == NULL) {
                free (*str);
                *str = NULL;
                *sz = 0;
                return;
            }
            strcpy (newstr, *str);
            free (*str);
            *str = newstr;
        }
    
        /* Append the desired string to the (now) long-enough buffer. */
    
        strcat (*str, app);
    }
    

     

    static void dump(int sz, char *x) {
        if (x == NULL)
            printf ("%8p   [%2d]   %3d   [%s]\n", x, sz, 0, "");
        else
            printf ("%8p   [%2d]   %3d   [%s]\n", x, sz, strlen (x), x);
    }
    
    static char *arr[] = {"Hello.", " My", " name", " is", " Pax",
                          " and"," I", " am", " old."};
    
    int main (void) {
        int i;
        char *x = NULL;
        int sz = 0;
    
        printf (" Pointer   Size   Len   Value\n");
        printf (" -------   ----   ---   -----\n");
        dump (sz, x);
        for (i = 0; i < sizeof (arr) / sizeof (arr[0]); i++) {
            appendToStr (&sz, &x, arr[i]);
            dump (sz, x);
        }
    }
    

    The code outputs the following. You can see how the pointer changes when the currently allocated memory runs out of space for the expanded string (at the comments):

     Pointer   Size   Len   Value
     -------   ----   ---   -----
    # NULL pointer here since we've not yet put anything in.
         0x0   [ 0]     0   []
    
    # The first time we put in something, we allocate space (+10 chars).
    0x6701b8   [16]     6   [Hello.]
    0x6701b8   [16]     9   [Hello. My]
    0x6701b8   [16]    14   [Hello. My name]
    
    # Adding " is" takes length to 17 so we need more space.
    0x6701d0   [28]    17   [Hello. My name is]
    0x6701d0   [28]    21   [Hello. My name is Pax]
    0x6701d0   [28]    25   [Hello. My name is Pax and]
    0x6701d0   [28]    27   [Hello. My name is Pax and I]
    
    # Ditto for adding " am".
    0x6701f0   [41]    30   [Hello. My name is Pax and I am]
    0x6701f0   [41]    35   [Hello. My name is Pax and I am old.]
    

    In that case, you pass in **str since you need to be able to change the *str value.

    =====

    Or the following, which does an unrolled bubble sort (oh, the shame!) on strings that aren’t in an array. It does this by directly exchanging the addresses of the strings.

    #include <stdio.h>
    
    static void sort (char **s1, char **s2, char **s3, char **s4, char **s5) {
        char *t;
    
        if (strcmp (*s1, *s2) > 0) { t = *s1; *s1 = *s2; *s2 = t; }
        if (strcmp (*s2, *s3) > 0) { t = *s2; *s2 = *s3; *s3 = t; }
        if (strcmp (*s3, *s4) > 0) { t = *s3; *s3 = *s4; *s4 = t; }
        if (strcmp (*s4, *s5) > 0) { t = *s4; *s4 = *s5; *s5 = t; }
    
        if (strcmp (*s1, *s2) > 0) { t = *s1; *s1 = *s2; *s2 = t; }
        if (strcmp (*s2, *s3) > 0) { t = *s2; *s2 = *s3; *s3 = t; }
        if (strcmp (*s3, *s4) > 0) { t = *s3; *s3 = *s4; *s4 = t; }
    
        if (strcmp (*s1, *s2) > 0) { t = *s1; *s1 = *s2; *s2 = t; }
        if (strcmp (*s2, *s3) > 0) { t = *s2; *s2 = *s3; *s3 = t; }
    
        if (strcmp (*s1, *s2) > 0) { t = *s1; *s1 = *s2; *s2 = t; }
    }
    
    int main (int argCount, char *argVar[]) {
        char *a = "77";
        char *b = "55";
        char *c = "99";
        char *d = "88";
        char *e = "66";
    
        printf ("Unsorted: [%s] [%s] [%s] [%s] [%s]\n", a, b, c, d, e);
        sort (&a,&b,&c,&d,&e);
        printf ("  Sorted: [%s] [%s] [%s] [%s] [%s]\n", a, b, c, d, e);
        return 0;
    }
    

    which produces:

    Unsorted: [77] [55] [99] [88] [66]
      Sorted: [55] [66] [77] [88] [99]
    

    Never mind the implementation of sort, just notice that the variables are passed as char ** so that they can be swapped easily. Any real sort would probably be acting on a true array of data rather than individual variables but that’s not the point of the example.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 117k
  • Answers 117k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Yes and no. No, the help browser that comes with… May 11, 2026 at 10:46 pm
  • Editorial Team
    Editorial Team added an answer I take it you're absolutely sure you've edited the right… May 11, 2026 at 10:46 pm
  • Editorial Team
    Editorial Team added an answer I figured this out at some point yesterday. Pretty straight… May 11, 2026 at 10:46 pm

Related Questions

I'm working on a java SE 1.5+ swing application, in conjunction with others. I'm
I can understand wanting to avoid having to use a cursor due to the
Im trying to wrap my head around MVVM. I understand a lot of it,
We have a requirement from a client to protect the database our application uses,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.