RECURSIVE FUNCTION ‘C’ LANGUAGE.

Text Ads Only

Text Ads Only

336 x 280 Block ads
RECURSIVE FUNCTION ‘C’ LANGUAGE.
Recursion in ‘c’ language: in the ‘c’ programming language, a recursive function, is a special function that calls to itself in a program. Like other programming languages ‘C’ language allows you to define recursive functions easily in program. The ‘C’ programming language supports recursion, programmers need to be careful to define an exist condition from the function, otherwise it will go infinite loop.

Image result for c++ pictures
A ‘C’ recursion function allows you to break down a complex problem into identical sub problems recursively until the sub problems are simple enough to solved directly in ‘C’ language. The solutions are then combined to produce the solution to the original problem. This is a famous programming technique called divided and conquers in ‘C’ language. In ‘C’ language, ‘C’ recursive function must have at least one exist condition that must be satisfied a program. Otherwise, the ‘C’ recursive function will call itself indefinitely until a sack overflow error is occurs.
Recursive function is very useful to solve many mathematical problems like, to calculate factorial number, generating Fibonacci series, e.t.c.
ADVANTAGES AND DISADVANTAGES OF RECURSION.
Recursion is more elegant and requires few variables which make program clean. Recursion can be used to replace complex nesting code by dividing the problem into same problem of its sub type.
In other hand, it is hard to think the logic of a recursive function. It is also different to debug the code containing recursion.
Example: Recursive function for factorial.
1. #include<stdio.h>
2. #include<conio.h>
3. Int fact(int);
4. Int main()
5. {
6.   Int num, f;
7.   Print f(“\nEnter     a      positive number:”);
8. Scanf(“%d”, & num);
9. F=fact(num);
10. Printf("\nFactional     of    %  d  is:
%d", num, f);
11. return 0;
12.}
13.int fact (int n)
14.{
15. if(n==1)
16. return 1;
17.else
18. return(n*fact(n-1));
19.}

output:
Enter a positive number: 5
Factorial of 5 is:120.


HEADER FILES LIST AND FUNCTION’S IN ‘C’ LANGUAGE.
Header files contain set of pre-defined standard library functions that we can include in our ‘c’ programs. But, to use these various library functions, we have to include the appropriate header files.
There are many header files in ‘c’ programming language, and there all header files have their own different functionalities.
LIST OF ALL HEADER FILE OF ‘C’ LANGUAGE AS BELOW.
1. Stdio.h Input/ output functions.
2. Conio.h Console input/ output.
3. Assert.h Diagnostics functions.
4. Ctype.h Character handling functions.
5. Cocale.h Localization functions.
6. Math.h Mathematics functions.
7. Setjmp.h Nonlocal jumps functions.
8. Signal.h Signal handling functions.
9. Stdarg.h Variable argument list functions.
10. Stdlib.h General utility functions.
11. String.h String functions.
12. Time.h Date and time functions.

LIST’S OF BOOK’S FOR ‘C’ PROGRAMMING.
‘c’ programming absolute beginner’s guide.
The ‘c’ programming language.
‘c’ programming: a modern approach.
Learn ‘c’ the hard way.

(For c++) great list of books for all level’s.
The definitive c++ book guide and list.
Cplusplus.com- the c++ resources network.

LEARN C++ GAME DEVELOPMENT? (For game creation)
The required Books.
Programming: principles and practice using c++.
The c++ programming language.
For game programming? Beginning c++ through game programming.

If you really found this post/ article helpful, then, why can't you show us your gratitude by; commenting and sharing with your friends, don't keep it alone. As Tech teazer, love to share important article's with you, then, help other's (your friend's) known about this site (blog).

Hope you find the post useful. If yes, don’t forget to share it on the social media. Maybe your friends are also looking for such help. Techteazer.com.
you can even follow us on; Google+.
Text Ads Only
336 x 280 Block ads
Sharing Is Caring.

2 comments:

  1. Very nice, interesting and helpful Teazer, keep it up dear. Love it.

    ReplyDelete
  2. Understood, interesting and helpful.

    ReplyDelete

Powered by Blogger.