A function can be declared by writing its return type, the name of the function, and the arguments inside brackets. It informs the compiler that this particular function is present. In C++, if you want to define the function after the main function, then you have to declare that function first.