Understand the difference between declaring and defining a function.
In C++, there is a crucial distinction between a function's declaration and its definition. A function declaration, also known as a function prototype, introduces the function's name, its return type, and the types of its parameters to the compiler. It's essentially a blueprint for the function. The declaration doesn't contain the actual code that the function executes; it simply tells the compiler that a function with this signature exists somewhere in the program. This allows you to call a function before it has been defined, as long as it has been declared. Declarations are often placed in header files (`.h` or `.hpp`). A function definition, on the other hand, provides the actual implementation of the function—the code block that runs when the function is called. A function can be declared multiple times in a program (though it's redundant), but it can only be defined once. This is known as the One Definition Rule (ODR). The basic structure of a definition is: `return_type function_name(parameter_list) { // function body }`. For example, `int add(int a, int b);` is a declaration, while `int add(int a, int b) { return a + b; }` is the corresponding definition. Separating declaration from definition is key to organizing large projects, allowing different parts of the code to know about functions without needing to know how they work internally.