logo
down
shadow

what is the difference between while(1) infinite loop and a recursive function?


what is the difference between while(1) infinite loop and a recursive function?

By : user3851285
Date : October 17 2020, 11:12 AM
fixed the issue. Will look into that further A recursive function will call itself repeatedly. The infinite loop will just keep executing the same code repeatedly. While this may sound very similar, the actual effects are very different. Each time a method is called, variables are pushed onto the stack. Of course, this means that there are inherent limits to the number of times a function can recurse. So while your infinite loop will execute forever, a recursive function in practice will eventually run out of stack space and the application will likely come to a grinding halt.
code :


Share : facebook icon twitter icon
this recursive function(palindrome) become a infinite loop.why?

this recursive function(palindrome) become a infinite loop.why?


By : user2628015
Date : March 29 2020, 07:55 AM
it should still fix some issue /* but if I change the 13th line to "else return palindrome(s, ++f, --l);" then the codes run well. what is the reason for that?*/ , The signature
code :
int palindrome(char* s, int f, int l)    
f = first index, l = last index;`
 int palindrome(char* s, int& f, int& l)
                         // ^       ^ Add a reference, if you're intending to change 
                         // the parameter value
What is difference between an infinite loop and an infinite recursive call?

What is difference between an infinite loop and an infinite recursive call?


By : user3080458
Date : March 29 2020, 07:55 AM
I wish this helpful for you You should note that the C specification doesn't actually mention anything about "the stack". Using the stack is just an implementation detail, and compiler-designers/-programmers are free to use any other method to implement function calls and local variable storage. However, which method is used, it ultimately will use up some resource (like memory) and like everything else the resources on a computer are limited, so using them up will sooner or later cause some kind of overflow situation.
On the other hand, an empty while loop doesn't actually use any extra resources no matter how many iterations it does. In your case it's more complicated than that because you don't know what printf does or what resources it uses or what resources the layers beneath the printf call uses, so there might be a limit there too. For example, what if the terminal window is set to use "infinite" scrollback, then that scrollback will expand until it consumes all available memory.
Infinite loop in recursive Haskell function

Infinite loop in recursive Haskell function


By : user3153575
Date : March 29 2020, 07:55 AM
it should still fix some issue It appears that the main problem is that you define a local version of div:
code :
div x y
  | x `mod` y == 0 = x `div` y
  | otherwise = x
div' x y
  | x `mod` y == 0 = x `div` y
  | otherwise = x
C++ Recursive Function Infinite Loop

C++ Recursive Function Infinite Loop


By : Rafał Zdankiewicz
Date : March 29 2020, 07:55 AM
help you fix your problem The function MainMenuSelection( int x ) requires an int. The function call in the main function thinks it gets this by calling a function which should return an int namely int MainMenu(). But this function does not do what you should expect from a function which has been declared in this way. You should make sure that a function should ALWAYS return the value (except for a void of course).
There are static code analyzers like Cppcheck which can help you to analyse your code and find possible problems like the one you stated above.
Writing a recursive function but getting infinite loop

Writing a recursive function but getting infinite loop


By : Dikgale Dr-Phil Phil
Date : March 29 2020, 07:55 AM
seems to work fine You are calling fractal(Pattern, n) inside fractal(Pattern, n). It will never stop doing that (at least till it runs out of stack).
Related Posts Related Posts :
  • JasperReports: How to pass parameter to subReport
  • Is there built-in web analytics tool in Liferay?
  • 'if' scenario in an equation. How do I implement it?
  • Uncaught [CKEDITOR.editor] The instance "html" already exists
  • Trimming variable in CLLE
  • Slot not being passed from action to layout in Symfony 1.4
  • Are there any disadvantages of using C# 3.0 features?
  • How to download paypal transactions using some API
  • Microsoft CRM could not log you on to the system. Make sure your user record
  • Good acceleration structure for ray sphere tests with spheres that move
  • Draw formatted rich text
  • How can I sum values in column based on the value in another column?
  • JBoss eventually stops responding to request, but no OOME
  • Prevent inline-block from wrapping on white-space: pre?
  • Neural Network Recommendation Engine
  • Getting the return value of an exec process
  • Dynamics CRM: Create users with specific GUIDs
  • Languages used to write programs for satellite-missions?
  • is it possible to use only two semaphores to synchronise three or more threads?
  • Opengl ES - drawing a plane of multiple vertices
  • Make Aptana never use Windows line endings
  • Stub property and save other behaviour
  • What would you call "callback" or "closure" in general?
  • Drag a bezier curve to edit it
  • Archive/Compress Command FTP Through Terminal?
  • how can I use curly braces in a mysql query?
  • or operator in vbscript
  • Using ms: xpath functions inside XPathExpression
  • How to add menu entry to "Run As"?
  • How can I make a single PyQt code to work in Windows and Linux?
  • NSFileSystemFreeSize
  • how we can i use google translator api in my website
  • Looking for a database of n-grams taken from wikipedia
  • how to map network drive for Clearcase View in Windows service?
  • What is the difference between machine independent and machine neutral?
  • DDD Business Model to Relational Model mapping
  • Source code version number policy
  • How to disable Caret Blinking?
  • Writing MS Word 2007 XML
  • Extension method to filter a list of concrete types based on interface?
  • Determining Opcode Cycle Count for a CPU
  • How to specify a fixed height for a SWT widget?
  • Does the iframe have any effect on page load time? Why not?
  • Twitter Streaming API Best Practices(Multiple or Single connection)
  • How to achieve effective democratic governance for an Open Source project?
  • Cross domain cookie reading/setting cross browsers
  • include existing youtube video in my own youtube account
  • Registering and using out-of-proc COM server in an isolated way (SxS)
  • How do i provide site resources in the parent for all children modules to use?
  • I/O in NASM programs in Windows 7
  • How to adapt the Specification pattern to evaluate a combination of objects?
  • JTree component in java swing
  • PostgreSQL: Log query only on error
  • Spec fails when run by mspec.exe, but passes when run by TD.NET
  • Castle Dynamic Proxy in Windsor Container
  • Kanbanish visualization and workflow management for multi-project, multi-team department
  • How to share code with continuous integration
  • Please recommend a complete guide/book on MVVM for silverlight
  • Does Compressed Sensing bring anything new to data Compression?
  • Exceptions with DateTime parsing in RSS feed in C#
  • shadow
    Privacy Policy - Terms - Contact Us © bighow.org