Objective-C: Initializing char with char at index of string.
Posted
by Mr. McPepperNuts
on Stack Overflow
See other posts from Stack Overflow
or by Mr. McPepperNuts
Published on 2010-06-07T14:32:44Z
Indexed on
2010/06/07
15:02 UTC
Read the original article
Hit count: 237
objective-c
unichar myChar = [myString characterAtIndex:0];
[myNSMutableArray addObject:myChar];
I am trying to insert the first char of a string into an array, to create an array of chars. the first line does not give me an error. The second line however, provides the following error: warning: passing argument 1 of 'addObject:' makes pointer from integer without a cast
This also crashes the application with a "bad address" error. I thought this error was due to a problem with memory allocation. Can someone shed some light on this.
© Stack Overflow or respective owner