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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:19:43+00:00 2026-06-09T16:19:43+00:00

Ok, say I do this. NSMutableArray *array1=[NSMutableArray arrayWithObjects:@poop, @on, @your, @face, nil]; NSMutableArray *array2=array1;

  • 0

Ok, say I do this.

NSMutableArray *array1=[NSMutableArray arrayWithObjects:@"poop", @"on", @"your", @"face", nil];

NSMutableArray *array2=array1;


[array2 removeAllObjects];

now does array1 have objects in it?

  • 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-09T16:19:45+00:00Added an answer on June 9, 2026 at 4:19 pm
    NSMutableArray *array1 = [NSMutableArray arrayWithObjects:@"one", @"two", nil];
    

    Creates a mutable array object in memory with strings @”one and @”two” ..and make an array object pointer array1 point to that object in memory.

    enter image description here

    NSMutableArray *array2 = array1;
    

    Create another pointer array2 of type NSMutableArray, and make it point to the same object in memory that array1 is pointing to.

    enter image description here

    [array2 removeAllObjects];
    

    Remove all strings from the mutable Array object that is pointed to by array2

    enter image description here

    Now since array1 and array2 points to the same object in memory, both array1 and array2 will now point to a mutable array object in memory that has no objects in it.

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

Sidebar

Related Questions

Say I have NSMutableArray *array1 with 10 objects. I want to create an *array2
I have three array..say array1,array2,array3. All these arrays contains dictionary.Now, I want to copy
I'm having a hard time getting the hang of this. Say I have: NSMutableArray
For example say I have: NSMutableArray *array = [[NSMutableArray alloc] init]; NSMutableArray *array2 =
I have an NSArray which contains Person objects. This person object contains the following;
Ok, so I'm using Objective-C. Now, say I have: TopClass : NSObject - (int)
How do you compare 2 NSMutableArray ? Different people might say this is a
I have this: NSMutableArray *myMArray and I have 2 IBaction , (insert) & (remove)
Say I wanna create an array of images and i used this: NSMutableArray *images
Say I have a class Car that has 2 properties: NSMutableArray *parts and BOOL

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.