Timeline for 2d array in Arduino with different row size
Current License: CC BY-SA 3.0
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 1, 2017 at 10:33 | comment | added | Klaus | What kind of access you have to your data? Copy constants from flash to ram via runtime representation is very bad style on microcontrollers at all. | |
| Jul 1, 2017 at 10:28 | answer | added | Scheff's Cat | timeline score: 0 | |
| Jul 1, 2017 at 2:28 | comment | added | eyllanesc | This is a bad style to program microcontrollers, if you know the elements of your matrix it is better to create an array of static and constant elements. | |
| Jul 1, 2017 at 2:19 | comment | added | M.M |
@AgnesLeung they'll contain null characters. I would recommend a design change: instead of strings use an enum, make the arrays be arrays of 1-byte elements containing the enum values, and then when you want to get a string, have a lookup table where the enum value translates to a string
|
|
| Jul 1, 2017 at 2:09 | comment | added | hrmck | @M.M so what if I define the size of the last dimension as, for example, 10, if one row has only 5 items, what is the value of the remaining slots in the row? | |
| Jul 1, 2017 at 2:00 | comment | added | M.M | @Grifplex no, the last dimension must be specified | |
| Jul 1, 2017 at 1:45 | comment | added | Grifplex |
Each row of an array must be the same size. You may declare the entire array by surrounding all of your small arrays in braces, i.e. String notes[][] = { {..}, {..}, {..} }.
|
|
| Jul 1, 2017 at 1:40 | history | edited | hrmck |
the language should be c++
|
|
| Jul 1, 2017 at 1:30 | history | asked | hrmck | CC BY-SA 3.0 |