so i have two pieces of code,both perform the same task "which is to calculate the factorial of a specific number",but the first one does this using a recursive function,while the other one does this using a "for" loop.
which method should i use in order not to exhaust the memory?.
neither.
use a lookup table of about 25-30 values, unless you are pulling in an extension that can handle the larger values. This can just be a global const array, and your function call looks like