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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:26:09+00:00 2026-05-13T07:26:09+00:00

I realized that I had some confusion regarding the value of a dereferenced pointer,

  • 0

I realized that I had some confusion regarding the value of a dereferenced pointer, as I was reading a C text with the following code snippet:

int main() 
{ 
    int matrix[3][10];                 // line 3: matrix is tentatively defined
    int (* arrPtr)[10] = matrix;       // line 4: arrPtr is defined and initialize
    (*arrPtr)[0] = 5;                  // line 5: what is the value of (*arrPtr) ?

My confusion is in regards to the value of *arrPtr in the last line. This is my understanding upto that point.

Line 3, matrix is declard (tentatively defined) to be an array of 3 elements of type array of 10 elements of type int.

Line 4, arrPtr is defined as a pointer to an array of 10 elements of type int. It is also initialized as a ptr to an array of 10 elements (i.e. the first row of matrix)

Now Line 5, arrPtr is dereferenced, yielding the actual array, so it’s type is array of 10 ints.

MY question: Why is the value of the array, just the address of the array and not in someway related to it’s elements?

  • 1 1 Answer
  • 1 View
  • 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-13T07:26:09+00:00Added an answer on May 13, 2026 at 7:26 am

    The value of the array variable matrix is the array, however it (easily) “degrades” into a pointer to its first item, which you then assign to arrPtr.

    To see this, use &matrix (has type int (*)[3][10]) or sizeof matrix (equals sizeof(int) * 3 * 10).

    Additionally, there’s nothing tentative about that definition.

    Edit: I missed the question hiding in the code comments: *arrPtr is an object of type int[10], so when you use [0] on it, you get the first item, to which you then assign 5.

    Pointers and arrays are purposefully defined to behave similiarly, and this is sometimes confusing (before you learn the various quirks), but also extremely versatile and useful.

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

Sidebar

Related Questions

Lately I realized that I had lost some files in one of my projects
I'm doing some tests about drawing text in .Net and I had the following
I had the sample facebook login implementation, and just realized that it stopped working:
I just realized that this piece of code works well in Firefox but not
After doing some changes to my plugin amtyThumb , I realized that there is
I have some code that 100% works for the use case I have. I'm
While inspecting a non-functioning bit of code, I realized that I'd left the case
Yesterday I had problems with some jQuery script. I did some research and realized
Some days ago I realized that in Silverlight, in order to always update the
I recently realized that some countries display floating point numbers with different comma/period notation.

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.