How do I store a list of arrays into another set of array? I tried this way but it doesn't work.
float data1[5] = {150.0, 203.0, 165.0, 4.0, 36.0};
float data2[5] = {249.0, 255.0, 253.0, 104.0, 2.0};
float allData[2] = {data1, data2};
cout << allData[1][2] << endl; //this should print 253.0 but it has error
This didn't allow me to compile. I also tried to change it to float *allData[2] = {data1, data2}; and it allowed me to compile but I don't get the result I want.
What have I done wrong in this? Thanks.
float *allData[2] = {data1, data2}actually gives you the correct answer: ideone.com/kE70qfloat *allData[2]is not the same asfloat allData[2].*is a pointer while the one without the asterisk has the exact value, right? I triedfloat *allData[2]but got that error that says "expression needs to have a pointer-to-object type".