C++ Function is a group a statement that performs a specific task. A function is the block of organized, reusable code that can be used to perform the single, related action. The good thing about the functions is that they are famous with many names.

What is Function in Programming Language

Different programming languages name them differently, for example, functions, methods, subroutines, procedures, etc. If you come across any such terminology, then imagine the same concept.

Functions provide better modularity for our application and a high degree of code reusability. You have already seen various functions like printf() and main().

Why do we need functions?

Suppose in a program there is a task which is performed at several places. So, with different values, we are delivering the same task. This makes our code look lengthy and naïve.

Functions come to the rescue where we can define the task to be performed at one place and pass parameters as required and get a similar result. Functions make our code modular and more professional.

#c++ #c++ functions #programming

C++ Functions Example | What is Function in C++
5.45 GEEK