Looking for an Alternative to "malloc" and Dynamic Memory


forgive me if dumb question. created array containing numeric values loop. had declare array locally, before loop, because size of array determined user input part of code. if knew array size have be, have declared array other global variables. ultimately, need compare sensor's value (in part of code) against values in array. i'm getting error code "'array' not declared in scope". realize why i'm getting error: array declared locally, , can't seen in part of code. there work around this? can store list of array values in memory, , access them later, in part of code, how? can declare array of unknown variable size globally?  i've been looking @ using dynamic memory malloc, there not many tutorials on using arduino. moreover, of stuff i've read on malloc , dynamic memory has stressed should avoided if @ possible arduino. i'm trying assume simple , required in programs, i'm novice , may wrong. know of simple work around having use dynamic memory?

as long dimension array once, don't see problems malloc.

when array becomes big, consider use eeprom table (caution: slower ram).


Arduino Forum > Using Arduino > Project Guidance > Looking for an Alternative to "malloc" and Dynamic Memory


arduino

Comments