You are on page 1of 1

NAME: MUSHAL MANZOOR

REG NO. FA19-BSE-082

ASSIGNMENT # 03

Why we use User defined Function in C++?

1. A user-defined function groups code to perform a specific task and


that group of code is given a name(identifier).
2. By creating functions in C++, you can call it many times. So we don't
need to write the same code again and again.
3. It makes the code optimized, we don't need to write much code.
4. User-defined functions are subroutines made of one or more
Transact-SQL statements that can be used to encapsulate code for
reuse. It takes zero or more arguments and evaluates a return value.
5. Functions make code modular.

What is the Importance of Functions in C++?

1. A program may need to repeat the same piece of code at various


places.
2. It may be required to perform certain task repeatedly.
3. The program may become very large if functions are not used.
4. The real reason for using function is to divide program into different
parts.
5. Once a function is defined, it can be used over and over and over
again. You can invoke the same function many times in your
program, which saves you work.

You might also like