Create an array with low memory


hi,
i have arduino uno.it has atmega328p chip.it has 2kbytes sram.
in program make 2d array this,

code: [select]
#define keysize 4
#define numberofstaff 256
byte uids[numberofstaff][keysize];



this array 256*4=1024=1kbyte sram.
if can give bounds of array in runtime,i able save sram.
in array implementation,keysize constant..it ok.don't need give in runtime.
numberofstaff may changed.i can sd card in project in runtime.
how can give numberofstaff in runtime?

yes possible set array sizes @ runtime using dynamic allocation ( https://arduino.land/faq/content/4/26/en/how-to-use-dynamic-memory.html ) point when need cater worst case anyway. can change program not need load data sd card memory ?


Arduino Forum > Using Arduino > Programming Questions > Create an array with low memory


arduino

Comments