Disadvantages Of C Programming Function

2627 Words11 Pages
A function is a segment that sets a code for performing a specific task. In C programming language, there should be at least one main () function. Without main function, there is technically no c program. In C programming language, there are two types of functions • Library Function • User Defined Function • Library Function: These functions are built in functions which are combined together and placed in a common place called as library. Each library function performs specific operation. These library functions are created by the persons who designed and created C compilers. • User Defined Function: A user defined function is defined by the user at the time of writing the program. The main benefits of using a function is to provide the modularity…show more content…
Recursive is a programming method which allows the programmer to express operation. A function that calls itself is known as recursive function. A recursive function is easy for expressing an ideas in which the result of recursive call is necessary to complete the task. This module will help you to learn about the function parameters and command line arguments. You will also able to know the concept of recursion with their advantages and disadvantages. In C Programming language, many ways of passing parameters. The function is a good programming concept which can be written using the reusable code and that code can be called if it is required. Whenever the function is called the sequence of executable statements will get executed. In this scenario, we have an opportunity is to pass few information to the function for processing is known as Argument. There are three different methods of passing the arguments to Function in C Language: • Call by Reference • Call by…show more content…
• Recursion will takes a lot of stack space and it is usually not considerable when the program is small and running on a PC. • Recursion will use more processor time. • It is not efficient in execution of speed and time. Tower of Hanoi: The Tower of Hanoi problem is a C Program which uses recursive function in order to express the problem programmatically. Tower of Hanoi is a kind of mathematical puzzle. The problem consists of three rods, and a group of disks of different sizes which will slide onto any rod. The puzzle will start with the group of disks in a neat stack in the ascending order of size of one rod and the smallest will be placed at the top rod. Also, maintain the same stack on the third rod. The main objective of the puzzle is to move the entire stock to another rod, let us consider the following rules: • Only one disk can be moved at a time. • Each move consists of taking the upper disk from one rod and sliding into another rod, the rod is already present on the top of other disks. • No disk is placed on the top of a smaller
Open Document