Skip to main content
Robmar
Senior II
February 7, 2023
Question

Array addressing failing using 3 dim array of ints. Any idea why this would fail? It just doesn't enter the value. I can manually enter it in debug, but programatically it fails.

  • February 7, 2023
  • 7 replies
  • 1265 views
#define VBLOCKENTRIES 22
int16_t indexVDial = 0, ixVBFree = 0;
 
int16_t blocksSet[2][VBLOCKENTRIES][4];
 
blocksSet[indexVDial][ixVBFree][1] = 0x1000; / Fails to write to array

This topic has been closed for replies.

7 replies

KnarfB
Super User
February 7, 2023

May depend on the index values which are not shown in your code sample.

Anyway, 123123 is not an int16_t

hth

KnarfB

Robmar
RobmarAuthor
Senior II
February 7, 2023

Index values given, it isn't addressing the memory correctly, so I was wondering if there is an issue with 3 dimensional arrays?

Tesla DeLorean
Guru
February 7, 2023

Hard to know dimensions / size here, or index values. Could get quite large, probably would avoid as a local/auto variable.

Provide more context.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Robmar
RobmarAuthor
Senior II
February 7, 2023

True, it's reasonably small though int16_t[2][22][4], around 350 bytes.

It just doesn't write or read the values, I could manually set them in debug, but it was as if it just ignored the C code. Looking at the asm it looked too short to index correctly, just wondered if there was a known limitation with arrays with over 2 dimensions.

KnarfB
Super User
February 7, 2023

Never heard of such a limitation. Is the result used in the code? Could the assigment be optimized away?