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

  • SEARCH
  • Home
  • 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 8615093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:17:19+00:00 2026-06-12T05:17:19+00:00

I know that an array decays to a pointer, such that if one declared

  • 0

I know that an array decays to a pointer, such that if one declared

char things[8];

and then later on used things somewhere else, things is a pointer to the first element in the array.

Also, from my understanding, if one declares

char moreThings[8][8];

then moreThings is not of type pointer to char but of type “array of pointers to char,” because the decay only occurs once.

When moreThings is passed to a function (say with prototype void doThings(char thingsGoHere[8][8]) what is actually going on with the stack?

If moreThings is not of pointer type, then is this really still a pass-by-reference? I guess I always thought that moreThings still represented the base address of the multidimensional array. What if doThings took input thingsGoHere and itself passed it to another function?

Is the rule pretty much that unless one specifies an array input as const then the array will always be modifiable?

I know that the type checking stuff only happens at compile time, but I’m still confused about what technically counts as a pass by reference (i.e. is it only when arguments of type pointer are passed, or would array of pointers be a pass-by-reference as well?)

Sorry to be a little all over the place with this question, but because of my difficulty in understanding this it is hard to articulate a precise inquiry.

  • 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-06-12T05:17:20+00:00Added an answer on June 12, 2026 at 5:17 am

    You got it slightly wrong: moreThings also decays to a pointer to the first element, but since it is an array of an array of chars, the first element is an “array of 8 chars”. So the decayed pointer is of this type:

    char (*p)[8] = moreThings;
    

    The value of the pointer is of course the same as the value of &moreThings[0][0], i.e. of the first element of the first element, and also the same of &a, but the type is a different one in each case.

    Here’s an example if char a[N][3]:

    +===========================+===========================+====
    |+--------+--------+-------+|+--------+--------+-------+|
    || a[0,0] | a[0,1] | a[0,2]||| a[1,0] | a[1,1] | a[1,2]|| ...
    |+--------+--------+-------+++--------+--------+-------++ ...
    |            a[0]           |            a[1]           |
    +===========================+===========================+====
                                        a
    ^^^
    ||+-- &a[0,0]
    |+-----&a[0]
    +-------&a
    
    • &a: address of the entire array of arrays of chars, which is a char[N][3]

    • &a[0], same as a: address of the first element, which is itself a char[3]

    • &a[0][0]: address of the first element of the first element, which is a char

    This demonstrates that different objects may have the same address, but if two objects have the same address and the same type, then they are the same object.

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

Sidebar

Related Questions

I know that we can initialise an array in one of two ways: Loop
1-)For sorted array I have used Binary Search. We know that the worst case
I know that an array in JavaScript is nothing else than an object. When
I know that array operators have the precedence. Then the binary arthimetic operators *
So we all know that when iterating through a PHP array using foreach, the
I'm trying to sort a multidimensional array in objective-c i know that i can
For an array [1, 2, 3, 4], how do I know that I am
How in C++ get array length with pointers only ? I know that tab
What's the best way to know when my array controller that is bound to
I have an array with a size that I dont know(mostly a size of

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.