VS Arduino | |
Visual Micro >> Project Guidance >> Having issues with multi-dimensional array
https://www.visualmicro.com/forums/YaBB.pl?num=1501490551 Message started by orbitcoms on Jul 31st, 2017 at 8:42am |
Title: Having issues with multi-dimensional array Post by orbitcoms on Jul 31st, 2017 at 8:42am
This is more a c++ question (or maybe an Arduino print question)?
I have initialized a 2 dimensional array and attempt to access the array produced unexpected results. For the array below, I expect to get the 3 values assigned to row 0 but I get these 3 values instead? 1 , 4 and 7. Is this a problem with the way print is working or some issue with the way I am accessing the array? It looks ok to me but I cannot see what is happening. Its probably something very simple/silly I have overlooked. Note: If I set up a 1-dimensional array and test it, I get correct elements returned. byte freq[10][3] = { {0x69,0x00,0x11}, //420 {0x69,0xc0,0x11}, //423 {0x6a,0x80,0x11}, //426 {0x6b,0x40,0x11}, //429 {0x6c,0x00,0x12}, //432 {0x6c,0xc0,0x12}, //435 {0x6d,0x80,0x12}, //438 {0x6e,0x40,0x12}, //441 {0x6f,0x00,0x12}, //444 {0x6f,0xc0,0x12} //447 }; Serial.print(byte(freq[0,0])); Serial.print(byte(freq[0,1])); Serial.print(byte(freq[0,2])); Thanks |
Title: Re: Having issues with multi-dimensional array Post by Visual Micro on Jul 31st, 2017 at 1:11pm |
Title: Re: Having issues with multi-dimensional array Post by orbitcoms on Jul 31st, 2017 at 9:36pm
I did find that post initially and change the array structure declaration but still had issues. So, I reverted to setting up 3 arrays and getting values from each one.
|
VS Arduino » Powered by YaBB 2.6.12! YaBB Forum Software © 2000-2024. All Rights Reserved. |