Advantages of using user defined functions in your C++ program

There are many different advantages of using user defined functions in a C++ program:


1. Functions makes possible top-down modular programming. In this types of programming, the high level logic of the overall problem is solved first while the details of each lower level functions is addressed later.
2. Functions reduce the complexity of the program by reducing the code.
3. Functions reduce the time to run a program as we say it is directly proportional to complexity.
4. Functions once written, they serve as a black box. All that a programmer would have to know to invoke a function would be to know its name, and the parameters that it accepts.
5. Every C++ program consists of one main() function typically invoking other functions, each having a well-defined functionality.
6. By using functions, it became very easy to find the errors due to blocks made as function definition outside the main function.
7. The length of the source code can be reduced by using functions at appropriate places.
8. Functions becomes uncomplicated to locate and separate a faulty function for further study.
9. Functions may be used later by many other programs this means that a C++ programmer can use function written by others, instead of starting over from scratch.
10. A function can be used to keep away from rewriting the same block of codes which we are going to use two or more locations in a program.



Thanks
Mukesh Rajput
Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments: