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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:14:37+00:00 2026-05-16T11:14:37+00:00

If I have a NSMutableArray: NSMutableArray *principalTable; and I have a other NSMutableArray: NSMutableArray

  • 0

If I have a NSMutableArray:

NSMutableArray *principalTable;

and I have a other NSMutableArray:

NSMutableArray *secondTable;

and I do this:

[secondTable addObject:@"string"];

[principalTable addObject: secondTable];

[secondTable removeAllObjects];

The principalTable has 1 object, but this object has nothing inside. So my question is:

  • When I add a object in a array, the array point on the object, or copy the object in the array?
  • And is it the same thing when I add in a nsmutabledictionnary?
  • 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-16T11:14:38+00:00Added an answer on May 16, 2026 at 11:14 am
    [secondTable addObject:@"string"];
    
    [principalTable addObject: secondTable];
    
    [secondTable removeAllObjects];
    

    When you do the above, principalTable will contain a reference to the secondTable NSMutableArray instance and will not directly contain the string. Thus, when you removeAllObjects, you are emptying secondTable and principalTable will continue to hold a reference to that now-empty mutable array.

    None of your code copies anything.

    NSMutableDictionary copies keys. Not values.

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

Sidebar

Related Questions

I have an NSMutableArray of custom objects. The custom object (Tag Class) has an
I have an NSMutableArray called george. It has NSInteger values inside: 12, 23, 54,
I have a NSMutableArray that has custom objects in it. Each object does have
I have a NSMutableArray and it has the users high scores saved into it.
I have an NSMutableArray which has five objects in it. I want to insert
I have a NSMutableArray of objects, below is the struct: //object at index i
I have a NSMutableArray that I need to search for a string and return
I have a NSMutableArray that holds a collection of UIViewControllers Amongst other properties and
I have this NSMutableArray which is a collection of objects that are being moved
I have a NSMutableArray which i am initializing from a plist with strings. but

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.