elibraryportal Logo

What is Function in C++

Function is a block of statements that perform individual tasks which means only runs when it is called when you can pass the data, known as parameters, into a function..

Types of Functions

There are two types of functions that is

  1. Library Functions :- Declared the header files such as ceil(x), cos(x), exp(x), etc.
  2. User-defined functions:- User can create function he/she can use it many times.


Explain that

1) Return Type:- A return_type is the data type name that function returns .

2) Function Name:- function name is by user define name, function name & parameter list together form the function.

3) Parameters:- User pass the value in the parameter. Parameters are optional that is a function may contain no parameters.

4) Function Body:- Function is a collection of statement.



 The result is 8
Next Topic