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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:08:57+00:00 2026-05-28T15:08:57+00:00

In C, two dimensional arrays are stored in the way just like linear arrays,

  • 0

In C, two dimensional arrays are stored in the way just like linear arrays, but they are indexed using a double pointer. That is, if we define

int a[3][3] = {{1,2,3},{4,5,6},{7,8,9}}.

a first points to something like

{p1 = 0x7fff5fbffb58 , p2 = 0x7fff5fbffb70, p3 = 0x7fff5fbffb88}

then p1 points to 1, p2 points to 4 and p3 points to 7.

So why don’t compilers allow for a conversion from the two dimensional array to the double pointer which is theoretically possible? Although 2-D arrays are stored one by one, but the index information can always be passed to an arbitrary double pointer.

  • 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-28T15:08:58+00:00Added an answer on May 28, 2026 at 3:08 pm

    It’s not theoretically possible. 2d arrays are not indexed using a double pointer – the compiler convert it to one index. For example, if you have int a[3][5], and you access a[i][j], the compiler convert it to ((int[])a)[5*i+j]. (Your explanation is completely wrong)

    Because of all of that, if you want to convert int[][] to int**, you need to allocate memory to save the addresses of all the sub-arrays, and get the address of it. Just (int**)a will not work.

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

Sidebar

Related Questions

What is the most efficient way to copy a two dimensional arrays of primitive
Is there a way to create two dimensional NSArray without nesting arrays in the
I'm working with two-dimensional array-values that should be inserted into a ArrayList. But this
I just wanna ask what best way to work around a Two-Dimensional Array (2
I have an algorithm where I create two bi-dimensional arrays like this: TYPE TPtrMatrixLine
Can anybody suggest which is the best way for using NSArray as two-dimensional array
I am working with two-dimensional arrays of 16-bit integers defined as int16_t e[MAX_SIZE*MAX_NODE][MAX_SIZE]; int16_t
Why when working with two dimensional arrays only second dimension is important for a
I'm getting bamboozled by for each loops and two dimensional arrays, and I'm a
I have the following three arrays and need to create a new two-dimensional array

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.