I'm new to c++ programming and use it to program a microcontroller. Since memory is limitted (only 12 kb), I'm looking for a way to reduce memory usage when using some large arrays with floats that are constants. Is it possible to somehow write these arrays to ROM without them having to be transferred to memory before usage?

I did try something like:

static const float myArray[100] = {1.23, 4.56, .... }

, but this does not seem to be working.

It's not C++ language question. It's a question about YOUR compiler and linker. Read the compiler reference guide carefully, look at module map, try and see what happens - and so on...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.