I'd give malloc() a shot. It allocates memory on the heap instead of the stack. Look up a C language documentation how to use it.

You would have to use int instead of var then, I presume. Leave a note if you want me to figure out an exact implementation for it.