What I would like to do with this code: Assign the char value of the first letter of the first array element of devices to the first char value of friendly_device1. Shouldn't it work the way I coded it?
I get the error "invalid conversion from char* to char".
Thanks for any help!
edit: actually, I just wanted to do the following, which didn't work either...:
char* devices[5]; // an array of 5 pointers to strings
char friendly_device1[18];
friendly_device1[0] = devices[0][0];
This assigns the first element in the first string in the devices array to the first element in friendly_devices. Note that you must assign the actual strings to the devices array for this to make any sense.
Edit: The compiler will allocate memory if the strings are initialized at compile time, but pointers to strings can be tricky if you assign the strings at runtime. If you are not sure about how to assign the string values to the devices array, perhaps post a little more of your code showing how you would like to set the values for the devices array.
thank you for your fast reply, this is exactly what I wanted to do.
unfortunately, this method of calling an array element is not
mentioned on the arduino reference page...
yves, the reference page is not, and probably never will be, a complete accounting of the entire C and C++ programming languages. For that, see Google, Amazon or your local library.
I didn't even know I was programming in C, I always thought Arduino/Processing/Wiring was more of an java script environment? My bad .
I still suggest that this method of calling an 2dimensional array should be mentioned at least on the string page (because there, 2 darrays are mentioned).
I think that is the intent of the Arduino design - to enable interesting projects to be designed and built with the minimum of distraction from the technical underpinnings.
But I do agree that some examples of two dimensional arrays would be welcome.