Electrical and Computer Engineering
11 of 22
UAH
CPE 112
Function Declarations
and Definitions
•In C++, you must declare every identifier before it can be used. A function’s declaration must physically precede any function call.
•Example from welcome program
• #include <iostream>
• using namespace std;
• void Print2Lines();
• void Print4Lines();
•A function declaration announces to the compiler the name of the function, the data type of the function’s return value, and the data type of the parameters it uses.