Re: Dynamic NSString Array Help?
Re: Dynamic NSString Array Help?
- Subject: Re: Dynamic NSString Array Help?
- From: Julien Jalon <email@hidden>
- Date: Sat, 19 Apr 2003 23:47:05 +0200
On Saturday, Apr 19, 2003, at 23:31 Europe/Paris, Quentin Whitmyer
wrote:
Hello,
I am trying to find a way to create a Dynamic Array of NSStrings. I
know I could use the NSArray object. But i am trying to do it another
way.
I know that I can create a static array of NSStrings
int i;
NSString *theArray[100];
for(i =0; i < 100; i++)
{
theArray[i] = [[NSString alloc] initWithString: @"this is a test"];
NSLog(@"%@", values[1]);
}
This seems to work.
However when I try
int i;
NSString *theArray;
NSString **theArray;
theArray = (NSString *) malloc(sizeof(NSString) * 100);
theArray = (NSString **) malloc(sizeof(NSString *) * 100);
for(i =0; i < 100; i++)
{
theArray[i] = [[NSString alloc] initWithString: @"this is a test"];
NSLog(@"%@", values[1]);
}
This Fails. I get this error when I try to compile it:
incompatible types in assignment
I have tried this many different ways. The only way I have gotten it
to work is to change "theArray" to an "int". I know that changing the
type of "theArray" is not the proper way to achieve the results I am
looking for.
Thanks for your help in advance.
-Q-
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
--
Julien Jalon
http://www.julien-jalon.org/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.