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 7024567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:51:26+00:00 2026-05-27T23:51:26+00:00

Does int **p and int *p[1] mean the same thing? as both can be

  • 0

Does

int **p 

and

int *p[1]

mean the same thing? as both can be passed to functions allowing the change the pointer object, also both can be accessed via p[0], *p ?

Update, thanks for your help, tough Memory management seems different. does the access mechanism remain the same

*eg: p[0] becomes *(p+0) & *p (both pointing to something)

Thanks

  • 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-27T23:51:27+00:00Added an answer on May 27, 2026 at 11:51 pm

    Not quite.

    int **p;
    

    declares a pointer p, which will be used to point at objects of type int *, ie, pointers to int. It doesn’t allocate any storage, or point p at anything in particular yet.

    int *p[1];
    

    declares an array p of one pointer to int: p‘s type can decay to int ** when it’s passed around, but unlike the first statement, p here has an initial value and some storage is set aside.


    Re. the edited question on access syntax: yes, *p == p[0] == *(p+0) for all pointers and arrays.


    Re. the comment asking about sizeof: it deals properly with arrays where it can see the declaration, so it gives the total storage size.

    void foo()
    {
        int **ptr;
        int *array[10];
    
        sizeof(ptr);   // just the size of the pointer
        sizeof(array); // 10 * sizeof(int *)
    
        // popular idiom for getting count of elements in array:
        sizeof(array)/sizeof(array[0]);
    }
    
    // this would always discard the array size,
    // because the argument always decays to a pointer
    size_t my_sizeof(int *p) { return sizeof(p); }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In a C++ function like this: int& getNumber(); what does the & mean? Is
What does this error mean? I can't seem to find ANY information on it.
What does a statement such as this mean ? int x = ( {
If I use int oneByte = dis.read(byteArray, 0, 1) does this mean I am
For example: sizeof(char*) returns 4. As does int* , long long* , everything that
Does setWidth(int pixels) use device independent pixel or physical pixel as unit? For example,
I am having an error: Error 2 'int[]' does not contain a definition for
Why does this code int (*g)(int); int (*h)(char); h = g; In C, give
Why does the statement (int)84 throw an exception and Convert.ToInt32(84) does not throw an
The following code does not compile: //int a = ... int? b = (int?)

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.