Declaring a Function

In this lesson, we will go through the basic syntax for declaring a function in C++.

Function creation

In C++, function creation consists of the following two steps:

  • Function declaration
  • Function definition

Function declaration

Function declaration informs the compiler about:

  • The return type of function
  • The function name
  • The number of parameters and their data types.

The basic syntax for declaring a function in C++ is:

Get hands-on with 1200+ tech skills courses.