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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:13:08+00:00 2026-05-25T10:13:08+00:00

In a multidimensional array, is it possible to use the length variable to measure

  • 0

In a multidimensional array, is it possible to use the length variable to
measure different dimensions other than the first?

  • 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-25T10:13:09+00:00Added an answer on May 25, 2026 at 10:13 am

    Yes. Length dimensions vary from row to row. You can do matrix[i].length to get the length of row i. If you know the matrix is square, all the row lengths will equals matrix[0].length anyways, so it doesn’t matter.

    If you’re trying to iterate through all elements:

    for(int i = 0; i < matrix.length; i++){
        for(int j < 0; j < matrix[i].length; j++){
            count += matrix[i][j];
        }
    }
    

    The same principle can be applied for any number of dimensions. For loops, you need 1 nested loop per dimension. For lengths, each bracketed part is actually a new element, so 3d array ar will yield a 2d array with ar[i], 1d with ar[i][j], and 0d (single element of the array type) with ar[i][j][k]

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

Sidebar

Related Questions

We can use array_unique() for remove duplicate entry from a single multidimensional array in
I don't understand this array accessing syntax: $target[$segs[count($segs)]] Is it really possible to use
Is it possible to turn a column of a multidimensional array to row using
Is it possible to create a multidimensional, associative array in VBScript? I'm trying to
Possible Duplicate: Use templates to get an array's size and end address Can someone
Is it possible to create a multidimensional array of gtkwidgets? Specifically something like this:
I basically want to use str_replace() all values of a multidimensional array. I can't
Possible Duplicate: PHP Sort a multidimensional array by element containing date I have some
I have a multidimensional array. I need to search it for a specific range
In C can I pass a multidimensional array to a function as a single

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.