Iteration vs Recursion
Most problems that can be solved with iteration (
for
,
while
,
do
loops) can also be solved with recursion. Pros and cons are:
Iteration code will be faster and will use less resources.
Recursion normaly looks more like the original formula.
Anyway up, as an example of both technics here is some code to give the factorial of a number.
Iteration
------
Recursion
Top
Master Index
C Keywords
Functions
Martin Leslie
elected'>master
nds-private-remove
packet-loop-back
packet-rx-pump-back
net-next plumbings
Tobias Klauser
summary
refs
log
tree
commit
diff
log msg
author
committer
range
path:
root
/
sound
/
soc
/
codecs
/
ssm2518.c
diff options
context:
1
2
3
4
5
6
7
8
9
10
15
20
25
30
35
40
space:
include
ignore
mode:
unified
ssdiff
stat only
Diffstat
(limited to 'sound/soc/codecs/ssm2518.c')