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
on>
packet-rx-pump-back
net-next plumbings
Tobias Klauser
summary
refs
log
tree
commit
diff
log msg
author
committer
range
path:
root
/
include
/
net
/
rawv6.h
Age
Commit message (
Expand
)
Author
Files
Lines