Posts

Showing posts with the label Recursive Functions in C Langauge

Recursion

Image
A function is generally call another function to accomplish the task but sometimes a function can call itself to complete the task. This type of function is known as a recursive function and this feature is known as recursion. Let's take a short example of the recursive function.main(){ printf("Hello"); main(); }In the above program snippet main() function calls itself so main() is known as recursive function but the output of the above program snippet is "hello" prints indefinitely. The following program snippet improve the above logic and try to make it finite. main() { int i=1; if(i<=10) { printf("Hello"); i++; main(); } } If you thought that above logic print "Hello" 10 times then you are wrong because when program start i becomes one and of course the condition gets true and "Hello" gets printed then i becomes 2 by increment and then the main() function is again called. As the main()…

Popular posts from this blog

Overview of Go lang

Arrays in C Language

Data Types in Go language

Creating your first html page

Say Hello world in Go lang

Installing go lang

Arrays in Go lang

String in golang

Decision Making in Go lang

Decision Making Statements