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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:54:14+00:00 2026-05-24T15:54:14+00:00

How can I let a pointer assigned with a two dimensional array? The following

  • 0

How can I let a pointer assigned with a two dimensional array?

The following code won’t work.

float a1[2][2] = { {0,1},{2,3}};
float a2[3][2] = { {0,1},{2,3},{4,5}};
float a3[4][2] = { {0,1},{2,3},{4,5},{6,7}};

float** b = (float**)a1;

//float** b = (float**)a2;
//float** b = (float**)a3;

cout << b[0][0] << b[0][1] <<  b[1][0] <<  b[1][1] << endl;
  • 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-24T15:54:16+00:00Added an answer on May 24, 2026 at 3:54 pm

    a1 is not convertible to float**. So what you’re doing is illegal, and wouldn’t produce the desired result.

    Try this:

    float (*b)[2] = a1;
    cout << b[0][0] << b[0][1] <<  b[1][0] <<  b[1][1] << endl;
    

    This will work because two dimensional array of type float[M][2] can convert to float (*)[2]. They’re compatible for any value of M.

    As a general rule, Type[M][N] can convert to Type (*)[N] for any non-negative integral value of M and N.

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

Sidebar

Related Questions

How can I build a numpy array out of a generator object? Let me
How can one swap pointer addresses within a function with a signature? Let's say:
I need to solve the following question which i can't get to work by
Let's say I have following code: int f() { int foo = 0; int
I came across a line of code that i can't seem to grasp Let
I have a basic pointer question. I have some code like this: Please let
Can someone please let me know how to get the different segments of the
Can anoyne recommend a good library that will let me easily read/write private member
Can PL/SQL procedure in Oracle know it's own name? Let me explain: CREATE OR
Let's look at an example - books. A book can have 1..n authors. An

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.