Objective-C static inline NSString array

init, inline, objective-c, static-array

Solution

Try this:

static NSString *polygonNames[] = { @"Radical Isotope", @"Point", @"Line", /* etc */ };

Problem

Hi :) I am trying to create a static C-Array of NSStrings. This is what I tried: ``` static NSString** polygonNames = {@"Radical Isotope", @"Point", @"Line", @"Triangle", @"Square", @"Pentagon", @"Hextagon", @"Heptagon", @"Octagon", @"Nonagon", @"Decagon", @"Hendecagon", @"Dodecagon", @"Tridecagon", @"Tetradecagon", @"Pentadecagon", @"Hexadecagon", @"Heptadecagon", @"Octadecagon", @"Enneadecagon"}; ``` No compiler errors, but I am getting 41 warnings, all of which are one of the three following: ``` "warning: initialization from incompatible pointer type" "warning: excess elements in scalar initializer" "warning: (near initialization for 'polygonNames')" ``` Which leads me to believe when I use this class, I am going to be presented with plenty of sigbarts or some other memory access error... What is the proper way to initialize a static array of NSStrings (preferably inline, and I would like to use C-arrays, not NSArrays)?

Original source