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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:08:39+00:00 2026-06-09T03:08:39+00:00

I created a two dimensional array using one nsmutablearray, and there is a method:

  • 0

I created a two dimensional array using one nsmutablearray, and there is a method:

- (void)enumerateObjectsUsingBlock:(void (^)(id obj, NSUInteger row, NSUInteger column, BOOL *stop))block
{
    [self.internalArray enumerateObjectsUsingBlock:^(id obj, NSUInteger rowIdx, BOOL *stopRow){
        NSMutableArray *rowArray = obj;
        [rowArray enumerateObjectsUsingBlock:^(id obj, NSUInteger columnIdx, BOOL *stopColumn){
            block(obj, rowIdx, columnIdx, stopColumn);
        }];
    }];
}

I noticed that if the ‘block’ sets stopColumn to YES, then I need a way to notify the outer block that stopRow should be YES as well, I’m not sure if I can:

  1. use just one BOOL *stop instead of stopRow and stopColumn (as I am using ARC), or
  2. add a BOOL isStop inside outer block and inner block can set it to stopColumn?
  • 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-09T03:08:40+00:00Added an answer on June 9, 2026 at 3:08 am

    This should work:

    - (void)enumerateObjectsUsingBlock:(void (^)(id obj, NSUInteger row, NSUInteger column, BOOL *stop))block
    {
        [self.internalArray enumerateObjectsUsingBlock:^(id obj, NSUInteger rowIdx, BOOL *stopRow){
            NSMutableArray *rowArray = obj;
            [rowArray enumerateObjectsUsingBlock:^(id obj, NSUInteger columnIdx, BOOL *stopColumn) {
                block(obj, rowIdx, columnIdx, stopColumn);
                // Add this line:
                *stopRow = *stopColumn;
            }];
        }];
    }
    

    A block should capture all variables that its body uses, including the stopRow pointer. Since you are not modifying the pointer itself, only the data to which it points, you do not need to do anything else (if you needed to modify the pointer itself, you’d need an additional temporary variable declared as __block).

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

Sidebar

Related Questions

i ve created two dimensional array inside a function, i want to return that
I want to create a two-dimensional array in which I want to store records
I'm trying to create a two dimensional array like this... @transactions = {} @expenses.each
I have the following three arrays and need to create a new two-dimensional array
I can create and use dynamic two dimensional array in Fortran (in 77 standard).
I would like to create a multi-dimensional array with two variables but don't know
Is there a way to create two dimensional NSArray without nesting arrays in the
I want to create two and three dimensional vectors using a constructor in a
I created two classes in netbeans;One of them is a JPanel form and another
I have a two dimensional array like this $FrstArr = Array( [0]= array( [0]=>101,

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.