CE Home
Navigation
Go Back   CrazyEngineers Forum > CE : Technical Discussions > Computer Science & IT Engineering
Notices


Advertisements
Reply
 
LinkBack Thread Tools Display Modes

  #1 (permalink)
Old 1st December 2008, 09:53 PM
CE - Newbie
 
Preethi Raman's Avatar
 
Join Date: 14th November 2008
Location: Coimbatore
I'm a Crazy Electronics Engineer
Posts: 5
Default How to stop recursion function?

Can you plzz say me how to stop the recursion function
__________________
Preethi
Preethi Raman is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #2 (permalink)
Old 2nd December 2008, 06:47 PM
CE - Newbie
 
Join Date: 23rd July 2008
I'm a Crazy Information Technology Engineer
Posts: 2
Default Re: How to stop recursion function?

Quote:
Originally Posted by Preethi Raman View Post
Can you plzz say me how to stop the recursion function
Generally the recursion function will quit based on the condition stated in the function or using a break statement or a return function
krishna_540 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)
Old 2nd December 2008, 06:49 PM
CE - Newbie
 
Join Date: 23rd July 2008
I'm a Crazy Information Technology Engineer
Posts: 2
Default Re: How to stop recursion function?

Quote:
Originally Posted by Preethi Raman View Post
Can you plzz say me how to stop the recursion function
can u pls tell me the exact problem wher u want to break the function so that i can be more clear
krishna_540 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)
Old 2nd December 2008, 08:12 PM
CE - Regular Member
 
Ashutosh_shukla's Avatar
 
Join Date: 16th November 2008
Location: India
I'm a Crazy Computer Science & Engineering Engineer
Posts: 54
Send a message via Yahoo to Ashutosh_shukla
Default Re: How to stop recursion function?

Recursive functions always contain 2 parts.First that indicates action to be done by this call and second is the one that recursively calls the function again.We may specify condition that is to be satisfied for calling recursively or may also specify the condition of terminating the recursion process.
For eg: In factorial we continously call until the argument passed is 1 and when argument is 1 we simply return 1 so stop the recursion
Ashutosh_shukla is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)
Old 2nd December 2008, 09:49 PM
CE - Newbie
 
Preethi Raman's Avatar
 
Join Date: 14th November 2008
Location: Coimbatore
I'm a Crazy Electronics Engineer
Posts: 5
Red face Re: How to stop recursion function?

Thanks a lot for your answer..and also does the recursion function forms
an infinite loop???
Its clear that we can terminate the recursive function either by a break,goto,and return functions..
__________________
Preethi
Preethi Raman is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)
Old 3rd December 2008, 06:58 PM
CE - Regular Member
 
komputergeek's Avatar
 
Join Date: 21st October 2008
Location: India
I'm a Crazy IT Engineer
Posts: 55
Send a message via Yahoo to komputergeek
Default Re: How to stop recursion function?

break and goto are used to terminate loop.
__________________
IF YOU CAN'T Convince THEM ...

CONFUSE THEM ...
komputergeek is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)
Old 3rd December 2008, 06:59 PM
CE - Regular Member
 
komputergeek's Avatar
 
Join Date: 21st October 2008
Location: India
I'm a Crazy IT Engineer
Posts: 55
Send a message via Yahoo to komputergeek
Default Re: How to stop recursion function?

Quote:
Originally Posted by Preethi Raman View Post
does the recursion function forms
an infinite loop???
If you don't specify any statement to terminate,it will form infinite loop.

e.g
Code:
void func()
{
       func();
}
__________________
IF YOU CAN'T Convince THEM ...

CONFUSE THEM ...

Last edited by komputergeek; 3rd December 2008 at 07:03 PM.
komputergeek is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)
Old 18th December 2008, 02:47 PM
CE - Newbie
 
Join Date: 14th December 2008
I'm a Crazy enginnering Engineer
Posts: 1
Default Re: How to stop recursion function?

Quote:
Originally Posted by Preethi Raman View Post
Can you plzz say me how to stop the recursion function
i think u r not knowing correct concept of recursion
Given here in pseudocode:
function factorial(n)
{
if (n<=1)
return 1;
else
return n * factorial(n-1);
}
rscrbv is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)
Old 19th December 2008, 08:52 PM
CE - Apprentice
 
moksh's Avatar
 
Join Date: 5th July 2008
Location: Lucknow , India
I'm a Crazy I.T Engineer
Posts: 18
Send a message via Yahoo to moksh
Default Re: How to stop recursion function?

recursion function have a base condition ....

every time the function is called ... the value moves closer to he base condition....
moksh is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
recursive functions, recursive functions in c

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Function in vb nishcom Computer Science & IT Engineering 3 17th November 2008 03:12 PM
What is the function of trap flag in 8086 microprocessor? swati verma Computer Science & IT Engineering 1 2nd November 2008 10:37 AM
What is the function of encoder in servomotor? mujju433 Electrical & Electronics Engineering 0 2nd October 2008 12:19 AM
Stop Electronicmetre sajithhp Electrical & Electronics Engineering 0 23rd August 2008 07:23 PM
How to stop shutdown of computer? devesh Computer Science & IT Engineering 8 8th February 2007 06:46 PM


All times are GMT +5.5. The time now is 11:15 AM.
Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
Member comments are owned by the poster. Copyright © 2005-2008 CrazyEngineers.com. All rights reserved.

Advertisements