Compiler gives "excess element in array initializer" warning in objective C with 2D C-array -


i'm learning objective c , writing program aid people in learning play guitar. wanted create 2d array containing (almost) notes on guitar neck. since there 6 strings on guitar , twelve notes in octave, created 6 x 12 array. edit: solution @ bottom

the intention here array read as (string),(fret number).

int strings[6][12] = {     { {0, 8},{0, 9},{0, 10},{0, 11} ,{0, 12} ,{0, 1}, {0, 2},{0, 3},{0, 4},{0, 5},{0, 6},{0, 7} },     { {1, 3},{1, 4},{1, 5},{1, 6},{1, 7},{1, 8,},{1, 9},{1, 10},{1, 11} ,{1, 12},{1, 1},{1, 2} },     { {2, 12},{2, 1},{2, 2},{2, 3},{2, 4},{2, 5},{2, 6},{2, 7},{2, 8},{2, 9},{2, 10},{2, 11} },     { {3, 6}, {3, 7} , {3, 8} , {3, 9} ,{3, 10} ,{3, 11} ,{3, 12} ,{3, 1} ,{3, 2} ,{3, 3} ,{3, 4} ,{3, 5} },     { {4, 1} ,{4, 2} ,{4, 3} ,{4, 4} ,{4, 5} ,{4, 6} ,{4, 7} ,{4, 8} ,{4, 9} , {4, 10} ,{4, 11} ,{4, 12} },     { {5, 9},{5, 10},{5, 11} , {5, 12} ,{5, 1},{5, 2},{5, 3},{5, 4},{5, 5},{5, 6},{5, 7},{5, 8} } }; 

the problem is, xcode throws warning: "excess elements in array initializer." doing wrong? i've counted elements numerous times , still left scratching head.

moved question actual answer post:

thanks cool people, figured out problem. in event else has problem, here solution. came realize problem had 2 integers assigned in each array slot, making array 3d array. since first number in each pair string number, went ahead , got rid of it. no more warnings!**

int strings[6][12] =    {8, 9, 10, 11, 12, 1 ,2 ,3, 4, 5, 6, 7, // high e                         3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, // b                         12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, //g                         6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, // d                         1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, //                         8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7 }; // e 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -