---
title: "Adding Strings into NSMutableArray"  
description: "Adding Strings into NSMutableArray"  
author: "Anonymous User"  
published: 2015-11-07  
updated: 2015-11-08  
canonical: https://www.mindstick.com/forum/33578/adding-strings-into-nsmutablearray  
category: "iphone"  
tags: ["iphone", "ios", "objective c"]  
reading_time: 1 minute  

---

# Adding Strings into NSMutableArray

I have created 2 [variables](https://www.mindstick.com/articles/715/php-variables) of NSString and 1 [variable](https://www.mindstick.com/articles/1807/objective-c-data-types-variables-object-creation) of NSMutableArray,\
[Now](https://yourviews.mindstick.com/view/81402/it-s-liberals-vs-progressives-in-us-politics-now) I want to [add](https://www.mindstick.com/forum/12983/add-address-in-textbox-when-page-is-load-and-if-i-search-address-in-textbox-show-in-map-by-javascript) both [string](https://www.mindstick.com/articles/1527/string-split-in-c-sharp) variables into [mutable array](https://www.mindstick.com/forum/33695/sorting-mutable-array-in-ascending-order-in-objective-c).\
\
can any one tell me how to do it?

## Replies

### Reply by Tarun Kumar

If you want to add NSString objects into array,\
then I'll try to show you both Mutable and Immutable array example but I would recommend using an Immutable version:\
**Mutable version:**

```
NSMutableArray *mutableObject = [[NSMutableArray alloc] init];NSString *stringObj1 = @"string1"];[mutableObject addObject:stringObj1];//or[mutableObject addObject:@"string2"];NSLog(@"%@", mutableObject);
```

## Immutable version:

```
NSArray *immutableObject = [NSArray arrayWithObjects:@"string1", @"string2", nil];NSLog(@"%@", immutableArray);
```


---

Original Source: https://www.mindstick.com/forum/33578/adding-strings-into-nsmutablearray

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
