Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Function calling itself?!!! 1

Status
Not open for further replies.

Forri

Programmer
Joined
Oct 29, 2003
Messages
479
Location
MT
Hi

can a function call itself?

thanks
nick
 
Absolutely!! And it is called a recursive function.

The well known example, a function for calculating factorial.

--------------------------------------------------------------------------
I never set a goal because u never know whats going to happen tommorow.
 
But remember you need to get back to where you started sometime. Look to see if you can state your problem in normal interation terms. And if you recurse a lot you might run out of stack
 

It would have been about 100 times faster to try writing a recursive function and testing it than posting here.
 
I think you'll find that this was done and dusted in about 10 minutes this morning.

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top